// JavaScript Document

var menuText = new Array();

menuText[0] = ":: This is the  website for QES, Kirkby Lonsdale (015242 71275)";
menuText[1] = ":: Click the Home link anywhere on the site to return to this homepage";
menuText[2] = ":: News each day on school life...sports, trips, exams etc";
menuText[3] = ":: Photo galleries on dramas, sports, trips...You name it!";
menuText[4] = ":: Day by day, week by week guide to what's happening at QES";
menuText[5] = ":: Subjects, Staff, Policies, Exams, Ofsted, History, Form Tutors...It's all here!";
menuText[6] = ":: Interactive Feedback Board, daily bulletins, document downloads";
menuText[7] = ":: Pages for individual Clubs and Teams";
menuText[8] = ":: Governors, School Councils and the PTA.";
menuText[9] = ":: A virtual tour of the school site";
menuText[10] = ":: Information on applying for places in Year 7 and Sixth Form";
menuText[11] = ":: Current vacancies plus application form downloads";

var freeRiceLinks = new Array();
freeRiceLinks[1] = "http://www.freerice.com/index.php?&t=151445112495&s=French";
freeRiceLinks[2] = "http://www.freerice.com/index.php?&t=10629763282&s=Chemical%20Symbols%20(Basic)";
freeRiceLinks[3] = "http://www.freerice.com/index.php?&t=17223291504&s=Identify%20Countries%20on%20the%20Map";
freeRiceLinks[4] = "http://www.freerice.com/index.php?&t=257455194035&s=Multiplication%20Table";
freeRiceLinks[5] = "http://www.freerice.com/index.php?&t=145430105850&s=English%20Vocabulary";
freeRiceLinks[6] = "http://www.freerice.com/index.php?&t=403170189410&s=Famous%20Paintings";

function displaySmallSideBanners()
{
	if (numberOfSmallBanners > 0)
	{
		var tempImageID=0;
		for(var i=0;i<numberOfSmallBanners;i++)
		{
			tempImageID=900+i;
			document.write('<tr>');
			document.write('<td>');
			document.write('<a href="' + smallBannerLink[i] + '" target="' + smallBannerTarget[i] + '">');
			document.write('<img src="' + smallBannerGraphic[i] + '" border="0" alt="' + smallBannerAlt[i] + '"  style="margin-top: 2px; margin-bottom: 0px; filter:alpha(opacity=100);" onMouseOver="changeOpacity(' + tempImageID + ', 50)" onMouseOut="changeOpacity(' + tempImageID + ', 100)" src="home/images/navbar0809/newsletters.gif" name="img' + tempImageID + '"  id="' + tempImageID + '">  ');
			document.write('</a>');
			document.write('</td>');
			document.write('</tr>');
		}
	}
	else
	{
		//document.write('<tr><td>&nbsp;</td></tr>');
	}
}



function displayBigBanners()
{
	if (numberOfBigBanners > 0)
	{
		for(var i=0;i<numberOfBigBanners;i++)
		{
			document.write('<tr>');
			document.write('<td>');
			document.write('<div align="center">');
			
			if (bigBannerImageMap[i].length>0)
			{
				document.write('<img src="' + bigBannerGraphic[i] + '" border="0" usemap="' + bigBannerImageMap[i] + '" alt="' + bigBannerAlt[i] + '"  style="margin-top: 1px; margin-bottom: 0px">');
			}
			else
			{
				document.write('<a href="' + bigBannerLink[i] + '" target="' + bigBannerTarget[i] + '">');
				document.write('<img src="' + bigBannerGraphic[i] + '" border="0" alt="' + bigBannerAlt[i] + '"  style="margin-top: 1px; margin-bottom: 0px">');				
				document.write('</a>');
			}

			document.write('</div>');
			document.write('</td>');
			document.write('</tr>');
		}
	}
	else
	{
		//document.write('<tr><td>&nbsp;</td></tr>');
	}
	
	
	

	if (displayFreeRice == 1)
	{
		var intRandom = getRandom(6);
		
		document.write('<tr>');
		document.write('<td>');
			
		document.write('<a href="' + freeRiceLinks[intRandom] + '" target="_blank">');
		document.write('<img src="http://www.queenelizabeth.cumbria.sch.uk/home/banners/0809/freeRice' + intRandom + '.gif" border="0" alt="While playing on Free Rice, click FAQ at the top of the page to find out how you are helping hungry people."  style="margin-top: 1px; margin-bottom: 0px">');				
		document.write('</a>');

		document.write('</td>');
		document.write('</tr>');
	}

	
}

function writeTopImages()
{
	document.write ('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
	document.write ('<tr valign="middle">');
	document.write ('<td valign="bottom">');
	//document.write ('<img src="home/sideimages/remembrance/1.gif" width="40" height="40">');
	writeTopImage06(1);
	//writeTopImagePink(1);
	document.write ('</td>');
	document.write ('<td valign="bottom">');
	//document.write ('<img src="home/sideimages/remembrance/2.gif" width="40" height="40">');
	writeTopImage06(2);
	//writeTopImagePink(2);
	document.write ('</td>');
	document.write ('<td valign="bottom">');
	//document.write ('<img src="home/sideimages/remembrance/3.gif" width="40" height="40">');
	writeTopImage06(3);
	//writeTopImagePink(3);
	document.write ('</td >');
	document.write ('<td valign="bottom">');
	//document.write ('<img src="home/sideimages/remembrance/4.gif" width="40" height="40">');
	writeTopImage06(4);
	//writeTopImagePink(4);
	document.write ('</td>');
	document.write ('</tr>');
	document.write ('</table>');	
}



function updateMenuText(menuNumber)
{
		var tempDIV = document.getElementById("menuTextDIV");
		tempDIV.innerHTML = menuText[menuNumber];
}

	function changeOpacity(imageID, newOpacity)
	{
		//var temp= 'document.imgMain.style.filter:alpha(opacity=' + newOpacity + ')';
		var temp= 'document.img' + imageID + '.filters.alpha.opacity = ' + newOpacity;
		eval(temp);
	}
	
	function loadTopical()
	{
		var strTopicalPage = document.frmSelectTopical.cboSelectTopical.value;
		//alert(strTopicalPage);
		
		if(!(strTopicalPage=="0"))
		{
			this.location = '/topical/'+strTopicalPage+'/index.php';
		}
	}
	
	function loadShowcase()
	{
		var strGalleryIndex = document.frmShowcase.cboSelectShowcase.value;
		//alert(strTopicalPage);
		
		if(!(strGalleryIndex=="0"))
		{
			this.location = '/snapshots/displayGallery.php?lnkSnapshotID='+strGalleryIndex;
		}
	}
	
 
	function addToFavourites() 
	{ 
		//alert("here");
		// script by http://www.hypergurl.com 
		
		if (window.external) 
		{ 
			var urlAddress = "http://www.queenelizabeth.cumbria.sch.uk"; 
			var pageName = "Website for QES, Kirkby Lonsdale";
			
			window.external.AddFavorite(urlAddress,pageName) ;
		} 
		else 
		{ 
			alert("Sorry! Your browser doesn't support this function. Please add to Favourites in your normal way."); 
		} 
	} 
	
	function loadComboLink() 
	{ 
		var linkURL = document.frmSelectSite.cboSelectSite.value;
		//alert(linkURL);
		
		window.open(linkURL);
		
	} 
	
	function resetLinksCombo() 
	{ 
		document.frmSelectSite.cboSelectSite.value = 0;
	
	} 
	
	
	
	
function jonnyMessage()
{
	//alert("Sorry - the bad news is that this page won't load on school PCs. The good news is that you just need to use Firefox. Just click on Start and Programs, then select Mozilla Firefox from the list.");
	window.open("http://share.findmespot.com/shared/faces/viewspots.jsp?&glId=0z5RgRC3dDQH8R8HMRNhYjOxsdJz14UnB");
}
function changePEView()
{
		var selectedPEView = document.frmSelectPEView.cboSelectPEView.value;
		var temp = 'document.iframePE.location="http://www.queenelizabeth.cumbria.sch.uk/home/special/0708/pekitvote/' + selectedPEView + '.htm"';
		//alert(temp);
		eval(temp);
}

function loadSport()
{
	var selectedSport = document.frmSelectSport.cboSelectSport.value;
	if (!selectedSport==0)
	{
		var temp='window.open("'+selectedSport+'")';
		eval(temp);
	}
	
}



	function changeImage(month) 
{
	//alert("ID is:" + imageID + "  state is: " + state);

	var temp = "document.imgAnimation.src= '/home/special/reviewof0506/images/animations/" + month + "Animation.gif'";	

	//alert(temp);
	eval(temp);

	
}


function displayBigImage(imageID)
{
	//alert(letter);
	
		var popup = window.open("/home/picoftheday/imagesofqes/bigimage.htm","","height=600,width=640, top=5, left=5, scrollbars=yes");
		var newdocument = popup.document;
		var temp = '<img src="/common/graphics/imagesofqes/large/pic (' + imageID + ').jpg" alt="These photographs were originallt shot by Mr Davies and Mr Gabrysch for our school newsletters.">';
	
		newdocument.write(temp);

}

function updateIframes(index)
{
	//alert("here");
	
	//parent.iframeUpdates.bgColor = "#e0e0d0";
	     /*document.frames.iframeSpecialMessages.document.body.style.backgroundColor="#e0e0d0"; 
	     document.frames.iframeUpdates.document.body.style.backgroundColor="#e0e0d0"; 
	     document.frames.iframeNews.document.body.style.backgroundColor="#e0e0d0"; */
}		



function displayCountdown()
{
	// Countdown script distributed by http://www.hypergurl.com

	var today=new Date()

	//Enter the date for your countdown. Month first then day. Example 6th month 26th day. 
	var countdown=new Date(today.getFullYear(), 12, 25)

	//Enter your message here! Change words below to suit
	var beforedayText="left until Christmas Day"
	var ondaytext="Today is Christmas Day. Have a good one!"

	var monthtext=new Array("Jan","Feb","Mar","April","May","June","July","Aug","Sep","Oct","Nov","Dec")
	countdown.setMonth(countdown.getMonth()-1) //change to 0-11 month format
	var showdate="("+monthtext[countdown.getMonth()]+" "+countdown.getDate()+")" 

	var one_day=1000*60*60*24
	var calculatediff=""

	calculatediff=Math.ceil((countdown.getTime()-today.getTime())/(one_day))
	if (calculatediff<0)
	{ 
		var nextyeartoday=new Date()
		nextyeartoday.setFullYear(today.getFullYear()+1)
		calculatediff=Math.ceil((nextyeartoday.getTime()-today.getTime())/(one_day)+calculatediff)
	}


	document.write('<p class="diaryColumnHeaders" style="text-align: center; ">'+calculatediff+'</p>');	

	//document.write('<span class="bigStripHeader" style="text-align: left; color: #008000">'+calculatediff+'</span>');
}

function displayCountdownY13()
{
	// Countdown script distributed by http://www.hypergurl.com

	var today=new Date()

	//Enter the date for your countdown. Month first then day. Example 6th month 26th day. 
	var countdown=new Date(today.getFullYear(), 5, 25)

	//Enter your message here! Change words below to suit
	var beforedayText="left until Christmas Day"
	var ondaytext="Today is Christmas Day. Have a good one!"

	var monthtext=new Array("Jan","Feb","Mar","April","May","June","July","Aug","Sep","Oct","Nov","Dec")
	countdown.setMonth(countdown.getMonth()-1) //change to 0-11 month format
	var showdate="("+monthtext[countdown.getMonth()]+" "+countdown.getDate()+")" 

	var one_day=1000*60*60*24
	var calculatediff=""

	calculatediff=Math.ceil((countdown.getTime()-today.getTime())/(one_day))
	if (calculatediff<0)
	{ 
		var nextyeartoday=new Date()
		nextyeartoday.setFullYear(today.getFullYear()+1)
		calculatediff=Math.ceil((nextyeartoday.getTime()-today.getTime())/(one_day)+calculatediff)
	}


	//document.write('<p class="diaryColumnHeaders" style="text-align: center">'+calculatediff+'</p>');	

	document.write('<span class="bigStripHeader" style="text-align: left; color: #008000">'+calculatediff+'</span>');
}