<!-- Hide from chessy browsers

DaysInMonth = new Array('31', '28', '31', '30', '31', '30', '31', '31', '30', '31', '30', '31');
    
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth();
var day = now.getDay();
var date = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();

//calculate the difference in local time and gmt
var hourOffset = parseInt(now.getTimezoneOffset()/60);
var minuteOffset = now.getTimezoneOffset()%60;   

var minuteGMT = minute + minuteOffset;
var hourGMT = hour + hourOffset + 1; // add one hour as table below is for BST
var dayGMT = 0;
var dateGMT = 0;
var monthGMT = 0;
var yearGMT = 0;
  
// sorts out the minutes and hours and days and date for GMT (or BST) relative to local time 
if (minuteGMT < 0)
{
  minuteGMT += 60;
  hourGMT -= 1;
}
if (minuteGMT >= 60)
{
  minuteGMT -= 60;
  hourGMT += 1;
}

// GMT and local on a different day   
if (hourGMT >=24 || hourGMT < 0)
{ 
  // GMT behind local
  if (hourGMT < 0)  // correct the hour and go back one day
  {
    hourGMT += 24;
    if (day == 0)
      dayGMT = 6;
    else
      dayGMT = day - 1;
    // then correct the date
    if (date == 1)  // case first day of month
    {
      if (month == 0)  // case first month of year
      {
        monthGMT = 11;
        dateGMT = DaysInMonth[monthGMT];
        yearGMT = year - 1;
      }
      else  // case other months
      {
        monthGMT = month - 1;
        dateGMT = DaysInMonth[monthGMT];
        yearGMT = year;
      }
    }
    else  // case other days of month
    {
      dateGMT = date - 1;
      monthGMT = month;
      yearGMT = year;
    }
  }
  // GMT ahead of local   
  else if (hourGMT >= 24)  // correct the hour and go forward one day
  {
    hourGMT -= 24;
    if (day == 6)
      dayGMT = 0;
    else
      dayGMT = day + 1;
    // then correct the date
    if(date == DaysInMonth[month])    // case last day of month
    {
      if(month == 11)  // case last month of year
      {
        monthGMT = 0;
        dateGMT = 1;
        yearGMT = year + 1;
      }
      else   //  case other months
      {
        dateGMT = 1;
        monthGMT = month + 1;
        yearGMT = year;
      }
    }
    else  // case other days
    {
      dateGMT = date + 1;
      monthGMT = month;
      yearGMT = year;
    }     
  }
}
else // GMT and local on the same day
{
  dayGMT = day;
  dateGMT = date;
  monthGMT = month;
  yearGMT = year;
}
  
/* now set hours, day, date, month and year to GMT (or BST) 
for the comments table below as this is in local UK time */
hour = hourGMT;
day = dayGMT;
date = dateGMT;
month = monthGMT;
year = yearGMT;

/* define weeks 1 to 4 for easier programming of the list */
var week1 = new Boolean(false);
var week2 = new Boolean(false);
var week3 = new Boolean(false);
var week4 = new Boolean(false);
var broadcasting = new Boolean(false); // broadcast period = weeks 1, 2, 3, and 4)

/*** IMPORTANT - enter broadcast dates including year if we are 'go' this year ***/
if (((date == 30) && (month == 3)) || ((date >=1 && date <=6) && (month == 4)) && (year == 2011)) { week1 = true; }
if (( date >=7 && date <=13) && (month == 4) && (year == 2011)) { week2 = true; }
if (( date >=14 && date <=20) && (month == 4) && (year == 2011)) { week3 = true; }
if (( date >=21 && date <=27) && (month == 4) && (year == 2011)) { week4 = true; }
if ((week1 == true) || ( week2 == true) || (week3 == true) || (week4 == true)) { broadcasting = true; }

//debug
//document.write("<span class=onair>"+month+broadcasting+"<br></span>");
//document.write("<span class=onair>"+week1+week2+week3+week4+"<br></span>");

if ( broadcasting == true ) // we are on air so sort through and display programme info
{
   // change the hourly comments here, starts at midnight
   var comment;

   switch (day)
   {
   	case 0:	//sunday
         if (hour>=0 && hour<6) comment="00:00 - 06:00<br>Overnight Requests";
			if (hour>=6 && hour<9) comment="06:00 - 09:00<br>Johnny Diamond";
			if (hour>=9 && hour<12) comment="09:00 - 12:00<br>Andrew Raeburn";
			if (hour>=12 && hour<15) comment="12:00 - 15:00<br>Nick Thomas";
			if (hour>=15 && hour<18) comment="15:00 - 18:00<br>Angie Loveless";
			if (hour>=18 && hour<20) comment="18:00 - 20:00<br>Andy Gunton<br><i>Local Music</i>";
			if (hour>=20 && hour<22) comment="20:00 - 22:00<br>Tony Bell";
			if (hour>=22 && hour<=23) comment="22:00 - 00:00<br>Alan Mills<br><i>Rock of Ages</i>";
			break;
		case 1:	//monday
			if (hour>=0 && hour<6) comment="00:00 - 06:00<br>Overnight Requests";
			if (hour>=6 && hour<9) {
            if (week1 == true) comment="06:00 - 09:00<br>Johnny Diamond";
            if (week2 == true) comment="06:00 - 09:00<br>Clive";
            if (week3 == true) comment="06:00 - 09:00<br>Steve Wilson";
            if (week4 == true) comment="06:00 - 09:00<br>Clive";
            }			
         if (hour>=9 && hour <12) {
            if (week1 == true) comment="09:00 - 12:00<br>Andy Gunton";
            if (week2 == true) comment="09:00 - 12:00<br>Simon Halsey";
            if (week3 == true) comment="09:00 - 12:00<br>John Hinkley";
            if (week4 == true) comment="09:00 - 12:00<br>Nick Thomas";
         }
			if (hour>=12 && hour<16) {
            if (week1 == true) comment="12:00 - 16:00<br>Steve Dack";
            if (week2 == true) comment="12:00 - 16:00<br>Johnny Diamond";
            if (week3 == true) comment="12:00 - 16:00<br>Angie Loveless";
            if (week4 == true) comment="12:00 - 16:00<br>Andy Gunton";
         }
         if (hour>=16 && hour<19) comment="16:00 - 19:00<br>Ralph Winser";	
			if (hour>=19 && hour<21) {
            if (week1 == true) comment="19:00 - 21:00<br>Clive<br><i>Requests</i>";
            if (week2 == true) comment="19:00 - 21:00<br>Clive<br><i>Requests</i>";
            if (week3 == true) comment="19:00 - 21:00<br>Johnny Diamond<br><i>Requests</i>";
            if (week4 == true) comment="19:00 - 21:00<br>Johnny Diamond<br><i>Requests</i>";
         }
			if (hour>=21 && hour<23) comment="21:00 - 23:00<br>Richard Studholme<br><i>Blues</i>";
			if (hour>=23 && hour<=23)  comment="23:00 - 00:00<br>Rick<br><i>Featured Album</i>";	
			break;
		case 2:	//tuesday
			if (hour>=0 && hour<6) comment="00:00 - 06:00<br>Overnight Requests";
			if (hour>=6 && hour<9) {
            if (week1 == true) comment="07:00 - 09:00<br>Steve Dack";
            if (week2 == true) comment="06:00 - 09:00<br>Clive";
            if (week3 == true) comment="06:00 - 09:00<br>Steve Wilson";
            if (week4 == true) comment="06:00 - 09:00<br>Clive";
            }
         if (hour>=9 && hour <12) {
            if (week1 == true) comment="09:00 - 12:00<br>Andy Gunton";
            if (week2 == true) comment="09:00 - 12:00<br>Dominic";
            if (week3 == true) comment="09:00 - 12:00<br>John Hinkley";
            if (week4 == true) comment="09:00 - 12:00<br>Nick Thomas";
         }     
			if (hour>=12 && hour<16) {
            if (week1 == true) comment="12:00 - 16:00<br>Steve Dack";
            if (week2 == true) comment="12:00 - 16:00<br>Johnny Diamond";
            if (week3 == true) comment="12:00 - 16:00<br>Angie Loveless";
            if (week4 == true) comment="12:00 - 16:00<br>Andy Gunton";
         }
         if (hour>=16 && hour<19) comment="16:00 - 19:00<br>Ralph Winser";	
   		if (hour>=19 && hour<21) {
             if (week1 == true) comment="19:00 - 21:00<br>Johnny Diamond";
             if (week2 == true) comment="19:00 - 21:00<br>Clive";
             if (week3 == true) comment="19:00 - 21:00<br>Clive";
             if (week4 == true) comment="19:00 - 21:00<br>Johnny Diamond";
         }
         if (hour>=21 && hour<23) comment="21:00 - 23:00<br>Tony Bell<br><i>Progressive</i>";
			if (hour>=23 && hour<=23)  comment="23:00 - 00:00<br>Dominic<br><i>Featured Album</i>";
			break;
		case 3:	//wednesday
		   if (hour>=0 && hour<6) comment="00:00 - 06:00<br>Overnight Requests";
			if (hour>=6 && hour<9) {
            if (week1 == true) comment="06:00 - 09:00<br>Steve Wilson";
            if (week2 == true) comment="06:00 - 09:00<br>Clive";
            if (week3 == true) comment="06:00 - 09:00<br>Steve Wilson";
            if (week4 == true) comment="06:00 - 09:00<br>Clive";
            }
         if (hour>=9 && hour <12) {
            if (week1 == true) comment="09:00 - 12:00<br>Andy Gunton";
            if (week2 == true) comment="09:00 - 12:00<br>Dominic";
            if (week3 == true) comment="09:00 - 12:00<br>John Hinkley";
            if (week4 == true) comment="09:00 - 12:00<br>Nick Thomas"
         }     
		   if (hour>=12 && hour<16) {
            if (week1 == true) comment="12:00 - 16:00<br>Steve Dack";
            if (week2 == true) comment="12:00 - 16:00<br>Johnny Diamond";
            if (week3 == true) comment="12:00 - 16:00<br>Angie Loveless";
            if (week4 == true) comment="12:00 - 16:00<br>Andy Gunton";
         }
         if (hour>=16 && hour<19) comment="16:00 - 19:00<br>Ralph Winser";	         if (hour>=19 && hour<21) {
            if (week1 == true) comment="19:00 - 21:00<br>Clive<br><i>Requests</i>";
            if (week2 == true) comment="19:00 - 21:00<br>Clive<br><i>Requests</i>";
            if (week3 == true) comment="19:00 - 21:00<br>Johnny Diamond<br><i>Requests</i>";
            if (week4 == true) comment="19:00 - 21:00<br>Johnny Diamond<br><i>Requests</i>";
         }
		   if (hour>=21 && hour<23) comment="21:00 - 23:00<br>Nigel Ford<br><i>Heavy Rock</i>";
			if (hour>=23 && hour<=23)  comment="23:00 - 00:00<br>Nigel Ford<br><i>Featured Album</i>";	
			break;
		case 4:	//thursday
			if (hour>=0 && hour<6) comment="00:00 - 06:00<br>Overnight Requests";
			if (hour>=6 && hour<9) {
            if (week1 == true) comment="07:00 - 09:00<br>Steve Dack";
            if (week2 == true) comment="06:00 - 09:00<br>Clive";
            if (week3 == true) comment="06:00 - 09:00<br>Steve Wilson";
            if (week4 == true) comment="06:00 - 09:00<br>Clive";
            }
         if (hour>=9 && hour <12) {
            if (week1 == true) comment="09:00 - 12:00<br>Andy Gunton";
            if (week2 == true) comment="09:00 - 12:00<br>Dominic";
            if (week3 == true) comment="09:00 - 12:00<br>John Hinkley";
            if (week4 == true) comment="09:00 - 12:00<br>Nick Thomas"
         }     
			if (hour>=12 && hour<16) {
            if (week1 == true) comment="12:00 - 16:00<br>Steve Dack";
            if (week2 == true) comment="12:00 - 16:00<br>Johnny Diamond";
            if (week3 == true) comment="12:00 - 16:00<br>Angie Loveless";
            if (week4 == true) comment="12:00 - 16:00<br>Andy Gunton";
         }
         if (hour>=16 && hour<19) comment="16:00 - 19:00<br>Ralph Winser";	         if (hour>=19 && hour<21) comment="16:00 - 19:00<br>Dominic";	
			if (hour>=21 && hour<23) comment="21:00 - 23:00<br>Johnny Diamond<br><i>Rock &amp; Roll</i>";
			if (hour>=23 && hour<=23) comment="23:00 - 00:00<br>Dominic<br><i>Featured Album</i>";		
			break;      case 5:	//friday
			if (hour>=0 && hour<6) comment="00:00 - 06:00<br>Overnight Requests";
			if (hour>=6 && hour<9) {
            if (week1 == true) comment="06:00 - 09:00<br>Simon Halsey";
            if (week2 == true) comment="06:00 - 09:00<br>Clive";
            if (week3 == true) comment="06:00 - 09:00<br>Steve Wilson";
            if (week4 == true) comment="06:00 - 09:00<br>Clive";
            }
         if (hour>=9 && hour <12) {
            if (week1 == true) comment="09:00 - 12:00<br>Andy Gunton";
            if (week2 == true) comment="09:00 - 12:00<br>Andy Gunton";
            if (week3 == true) comment="09:00 - 12:00<br>John Hinkley";
            if (week4 == true) comment="09:00 - 12:00<br>Nick Thomas"
         }     
			if (hour>=12 && hour<16) {
            if (week1 == true) comment="12:00 - 16:00<br>Steve Dack";
            if (week2 == true) comment="12:00 - 16:00<br>Johnny Diamond";
            if (week3 == true) comment="12:00 - 16:00<br>Angie Loveless";
            if (week4 == true) comment="12:00 - 16:00<br>Andy Gunton";
         }
         if (hour>=16 && hour<19) comment="16:00 - 19:00<br>Ralph Winser";	
         if (hour>=19 && hour<21) {
            if (week1 == true) comment="19:00 - 21:00<br>Johnny Diamond<br><i>Requests</i>";
            if (week2 == true) comment="19:00 - 21:00<br>Clive<br><i>Requests</i>";
            if (week3 == true) comment="19:00 - 21:00<br>Johnny Diamond<br><i>Requests</i>";
            if (week4 == true) comment="19:00 - 21:00<br>Johnny Diamond<br><i>Requests</i>";
         }
			if (hour>=21 && hour<23) {
            if (week1 == true || week2 == true || week3 == true)
              comment="19:00 - 21:00<br>Simon Halsey<br><i>Variety Mix</i>";
            else
              comment="19:00 - 00:00<br>Various<br><i>End of Broadcast party - Close</i>";
         }	
			if (hour>=23 && hour<=23) {
            if (week1 == true) comment="19:00 - 21:00<br>Nick Thomas<br><i>Featured Album</i>";
            if (week2 == true) comment="19:00 - 21:00<br>Kayliegh Apps<br><i>Featured Band</i>";
            if (week3 == true) comment="19:00 - 21:00<br>Kayliegh Apps<br><i>Featured Band</i>";
            if (week4 == true) comment="19:00 - 00:00<br>Various<br><i>End of Broadcast party - Close</i>";
         }	
         break;       case 6:	//saturday
            if (hour>=0 && hour<6) comment="00:00 - 06:00<br>Overnight Requests";
				if (hour>=6 && hour<9) comment="00:00 - 06:00<br>Steve Wilson";
				if (hour>=9 && hour<12) comment="09:00 - 12:00<br>Andrew Raeburn";
				if (hour>=12 && hour<15) {
               if (week1 == true) 
                  comment="12:00 - 15:00<br>Andy Gunton";
               else // we must be in week 2, 3 or 4
                  comment="12:00 - 15:00<br>Andy Gunton";
            }
				if (hour>=15 && hour<18) {
               if (week1 == true) 
                  comment="15:00 - 18:00<br>Simon Halsey";
               else // we must be in week 2, 3 or 4
                  comment="15:00 - 18:00<br>Simon Halsey";
            }
				if (hour>=18 && hour<20) {
               if (week1 == true)
                  comment="18:00 - 20:00<br>Dominic";
               else // we must be in week 2, 3 or 4) 
                  comment="18:00 - 20:00<br>Dominic";
            }
				if (hour>=20 && hour<22) comment="20:00 - 22:00<br>Tony Bell";
				if (hour>=22 && hour<=23) comment="22:00 - 00:00<br>Alan Mills<br><i>Rock of Ages</i>";
				break;
	}

//debug
//document.write("<span class=onair>"+day+"<br></span>");
//document.write("<span class=onair>"+comment+"<br></span>");
//document.write("<span class=onair>"+week1+week2+week3+week4+"<br></span>");

   // late changes here
   if ((week3 == true) && (day == 1)) {
      if (hour>=23 && hour<=23) comment="23:00 - 00:00<br>Simon Halsey";
   }
   if ((week3 == true) && (day == 2)) {
      if (hour>=23 && hour<=23) comment="23:00 - 00:00<br>Dominic";
   }
   if ((week3 == true) && (day == 3)) {
      if (hour>=23 && hour<=23) comment="23:00 - 00:00<br>Nigel Ford";
   }
   if ((week3 == true) && (day == 4)) {
      if (hour>=23 && hour<=23) comment="23:00 - 00:00<br>Dominic";
   }
   if ((week3 == true) && (day == 5)) {
      if (hour>=23 && hour<=23) comment="23:00 - 00:00<br>Dominic";
   }   

   if ((week4 == true) && (day == 2)) {
      if (hour>=23 && hour<=23) comment="23:00 - 00:00<br>Dominic";
   }
   if ((week4 == true) && (day == 3)) {
      if (hour>=23 && hour<=23) comment="23:00 - 00:00<br>Nigel Ford";
   }
   if ((week4 == true) && (day == 4)) {
      if (hour>=23 && hour<=23) comment="23:00 - 00:00<br>Dominic";
   }  
   if ((week4 == true) && (day == 5)) {
      if (hour>=19 && hour <=23) comment="19:00 - 00:00<br>Final Night";
   }

//debug
//document.write("<span class=onair>"+comment+"<br></span>");
//document.write("<span class=onair>"+week1+week2+week3+week4+"<br></span>");

   // image look up section
   var image = new Boolean(false);
   var imgptr;
   if (comment.match("Alan Mills") != null) {image = true; imgptr="images/dj/alanmills.jpg";}
   if (comment.match("Andy Bantock") != null) {image = true; imgptr="images/dj/andyb.jpg";}
   if (comment.match("Andy Gunton") != null) {image = true; imgptr="images/dj/andygunton.jpg";}
   if (comment.match("Alan Mills") != null) {image = true; imgptr="images/dj/alanmills.jpg";}
   if (comment.match("Angie Loveless") != null) {image = true; imgptr="images/dj/angieloveless.jpg";}
   if (comment.match("Clive") != null) {image = true; imgptr="images/dj/clive.jpg";}
   if (comment.match("Dominic") != null) {image = true; imgptr="images/dj/dominicpress.jpg";}
   if (comment.match("Johnny Diamond") != null) {image = true; imgptr="images/dj/johnnydiamond.jpg";}
   if (comment.match("Nick Thomas") != null) {image = true; imgptr="images/dj/nickthomas.jpg";}
   if (comment.match("Nigel Ford") != null) {image = true; imgptr="images/dj/nigelford.jpg";}
   if (comment.match("Ralph Winser") != null) {image = true; imgptr="images/dj/ralphwinser.jpg";}
   if (comment.match("Richard Studholm") != null) {image = true; imgptr="images/dj/richardstudholm.jpg";}
   if (comment.match("Simon Halsey") != null) {image = true; imgptr="images/dj/simonhalsey.jpg";}
   if (comment.match("Simon Veness") != null) {image = true; imgptr="images/dj/simonveness.jpg";}
   if (comment.match("Steve Wilson") != null) {image = true; imgptr="images/dj/stevewilson.jpg";}
   if (comment.match("Tony Bell") != null) {image = true; imgptr="images/dj/tonybell.jpg";}
   // end image look up
   //debug
   //document.write("<span class=onair>"+imgptr+"<br></span>");

   // display programme info
	 document.write("<table height=120 width=180 cellpadding=0 cellspacing=0 border=0 align=center valign=top>");
	 document.write("<COLGROUP span=2 width=40><COLGROUP width=1><COLGROUP span=2 width=40>");
   document.write("<tr height=15><td colspan=5 class=onairheading>ON AIR NOW</td></tr>");
   document.write("<tr height=45><td colspan=4 class=onair>"+comment+"</td>");
   if (image == true)
      document.write("<td><img src="+imgptr+" height=45></td>");
   else
      document.write("<td></td>");  
   document.write("</tr>");
   
   // display link to programme schedule and recently played tracks
   document.write("<tr height=15><td colspan=5>");
   document.write("<a href=programmes.html target=body class=onairlink2>Schedule</a></td></tr>");
   document.write("<tr height=15><td colspan=5>");
   document.write("<a href=javascript:MM_openBrWindow('recent.html','','scrollbars=no,resizable=no,top=10,left=20,width=650,height=400')>");
   document.write("<span class=onairlink>Recently Played</span></a></td></tr>");

   // 'currently playing' marquee
   document.write("<tr height=15><td colspan=5>");
   document.write("<marquee scrollamount=3>");
   document.write("<iframe class=tframe src=http://hrock.oasw.co.uk/playout/hrock/shoutcast/scxml.php height=15 width=400 scrolling=no frameborder=0></iframe>");
   document.write("</marquee></td></tr>");

    // listen and cam links
 	 document.write("<tr height=15>");
   document.write("<td colspan=3><a href=javascript:MM_openBrWindow('listen.html','','scrollbars=no,resizable=no,top=10,left=20,width=470,height=610')>");
	 document.write("<img src=images/listen.gif width=15 height=15 valign=middle border=0 align=left>");
   document.write("<span class=listentextlink>Listen live</span></a></td>");
   //  document.write("<td width=1></td>");
   document.write("<td colspan=2><a href=javascript:onclick=popup_Window('15')>");
   document.write("<img src=images/cam.gif width=15 height=15 valign=middle border=0 align=left>");
   document.write("<span class=listentextlink>Webcam</span></a></td></tr>");
	 document.write("</table>");
}
else // not on air so display roses and thorns logo 
{
 	document.write("<table cellpadding=0 cellspacing=0 border=0 align=center>");
	document.write("<tr align=center valign=middle>");
 	document.write("<td height=35 valign=top align=center class=onair><img src=images/masthead/hastings_rock_logo_coloured_130.gif border=0 valign=middle align=centre></td>");
	document.write("</tr>");
	document.write("</table>");
}

//debug
//document.write("<span class=onair>"+month+soon+broadcasting+"<br></span>");
//document.write("<span class=onair>"+week1+week2+week3+week4+"<br></span>");

// stop hiding-->

