// JavaScript Document


function loadInfo(info){
	
	
	
	switch(info){
		
		case "temperature"	:		header = "Temperature";
									txt = "A measure of the average energy of molecules in the atmosphere. (°C)";
									break;
									
		case "humidity"		:		header = "Humidity";
									txt = "Relative humidity (%) is the amount of water vapour present in the air expressed as a percentage of the amount of water vapour that the air is capable of holding.";
									break;
									
					
		case "dewpoint"		:		header = "Dew Point";
									txt = "Dew-point (C) is the temperature to which air must be cooled for saturation (100% relative humidity) to occur, providing there is no change in water content. ";
									break;
		
		case "wind"			:		header = "Wind Speed And Direction";
									txt = "Wind speed (mph). \n\nThe direction from which the wind is blowing (expressed as a compass direction).";
									break;
		
		case "barometer"	:		header = "Barometer";
									txt = "The force per unit area exerted by the weight of the atmosphere above a point on or above the earth's surface. The standard unit of measurement for atmospheric pressure. One millibar is equivalent to 100 newtons per square meter. Standard surface pressure is 1,013.2 millibars";
									break;
	
		case "rain"			:		header = "Rainfall";
									txt = "Total rainfall (mm) during a set period of time.";
									break;
									
		case "rain_rate"	:		header = "Rainfall Rate";
									txt = "Rainfall rate (mm/hr) is a measure of how much rain falls in a unit of time.";
									break;	
	
		case "rain_storm"	:		header = "Rain Storm";
									txt = "Storm rain is the total amount (mm) of rain falling during a period of wet weather.  This 'wet weather' period starts when at least 0.5mm of rainfall is registered by the weather station and then continues to accumulate.  The wet weather period is only ended when it is followed by a continuous dry period of 24 hours.";
									break;	
		
		case "wind_chill"	:		header = "Wind Chill";
									txt = "Wind Chill (°C) takes into account how the speed of the wind affects our perception of the air temperature.  The faster the wind blows, the faster heat is carried away from your body and the colder you feel.";
									break;	
									
		
		case "thw"			:		header = "Temperature-Humidity-Wind ";
									txt = "The Temperature-Humidity-Wind (THW) Index uses temperature, humidity and wind to calculate an apparent temperature that incorporates the cooling effects of wind on our perception of temperature. ";
									break;	
		
		case "uv"			:		header = "Ultra-Violet (UV) Index";
									txt = "The UV Index measures the intensity of Ultra Violet light from the Sun. UV Index uses a scale of 0 to 16 to rate the current intensity of UV.  16 is the highest value.  The range of values during the current 24 hr period & the current reading are shown.";
									break;	
									
									
		case "solar_rad"	:		header = "Solar Radiation";
									txt = "Measurement of the intensity of sunlight (power received per unit area).  Normally, higher values indicate a brighter, sunnier day! During British winter time, intensities are lower due to the Sun's low height in the sky.";
									break;	
		
		case "heat_index"	:		header = "Heat Index";
									txt = "The Heat Index (C) uses the temperature and the relative humidity to determine how hot the air actually \"feels.\" ";
									break;	
	}
	
	document.editFrame2.document.theForm.header.value = header;
	document.editFrame2.document.theForm.txt.value = txt;
	
	
//document.editFrame2.document.body.innerHTML= "<html>\n<head>\n<title>Current Weather Conditions at Old Trafford, Manchester</title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n<link href=\"styles.css\" rel=\"stylesheet\" type=\"text/css\"></head>\n<body style=\"background-color:#bb0000\" >\n "+info+"</body>\n</html>\n";

	openEditWin('page2',460,170);
	
}




function reloadPage(){
	
	window.history.go(0);
	
}

function graphs(action){
	
	switch(action){
		
		case "show":	document.getElementById('weather_graphs').style.display="block";
						document.getElementById('show_graphs').style.display="none";
						document.getElementById('hide_graphs').style.display="block";
						document.location.href="#hide_graphs";
						break;
						
		case "hide":	document.getElementById('weather_graphs').style.display="none";
						document.getElementById('show_graphs').style.display="block";
						document.getElementById('hide_graphs').style.display="none";
						break;
		
		
	}
	
	
	
}



function openEnlarged(){
	
	document.getElementById('editFrame1').src = "web_cam_large.htm";
	openEditWin('page1');
	
	
}




function resizePage(page){
	
	
	
	switch(page){
		
		case "page1" : thisPage = document.getElementById('page1');
						docu = "editFrame1";
						pageW = 1301;
						pageH = 990;
		break;
		
		
		case "page2" : thisPage = document.getElementById('page2');
						docu = "editFrame1";
						pageW = 300;
						pageH = 280;
		break;
		
	
		
		
		
	}
	
	if((thisPage.style.top  != "")&&(parseInt(thisPage.style.top) >= 0)){
	
	
				screenW = document.body.clientWidth;
				screenH = document.body.clientHeight;
				
				if(pageW > (screenW - 50)){
					
					pageW = screenW - 50;
				}
				
				if(pageH > (screenH - 50)){
					
					pageH = screenH - 50;
				}
					
				
				leftpos = (screenW - pageW)/ 2;

				toppos = (screenH - pageH)/2;
				
				
				if(leftpos <= 0){
								
					leftpos = 10;
				}
				
				if(toppos <= 0){
								
					toppos = 10;
				}
				
				
				
				
				document.getElementById(docu).style.width = pageW;
				document.getElementById(docu).style.height = pageH;
				thisPage.style.top = toppos;
				thisPage.style.left = leftpos;
	
	}
	
	
}





function openEditWin(page,left,top){
	
			
	
				
				
				
	
				switch(page){
		
					case "page1" : thisPage = document.getElementById('page1');
									docu = "editFrame1";
									pageW = 1301;
									pageH = 990;
					break;
					
					case "page2" : thisPage = document.getElementById('page2');
									docu = "editFrame2";
									pageW = 300;
									pageH = 290;
					break;
			
					
				}
			
	
				screenW = document.body.clientWidth;
				screenH = document.body.clientHeight;
				
				
				if(pageW > (screenW - 50)){
					
					pageW = screenW - 50;
				}
				
				if(pageH > (screenH - 50)){
					
					pageH = screenH - 50;
				}
					
				
			
				leftpos = (screenW - pageW)/ 2;

				toppos = (screenH - pageH)/2;
				
				
				if(leftpos <= 0){
								
					leftpos = 10;
				}
				
				if(toppos <= 0){
								
					toppos = 10;
				}
				
				if(left){
					leftpos = left;
				}
				
				if(top){
					toppos = top;
				}
				
				
				
				
				document.getElementById(docu).style.width = pageW;
				document.getElementById(docu).style.height = pageH;
				thisPage.style.top = toppos;
				thisPage.style.left = leftpos;
	
	
	
}






function closePage(page,refreshStr){
	
	
				
	
	switch(page){
		
		case "page1"  :	document.getElementById('editFrame1').src = ""
						document.getElementById('editFrame1').style.width = "0px";
						document.getElementById('editFrame1').style.height ="0px";
						document.getElementById('page1').style.top = "-2000px";
						document.getElementById('page1').style.left = "-2000px";

						break;
						
		case "page2"  :	//document.getElementById('editFrame2').src = ""
						document.getElementById('editFrame2').style.width = "0px";
						document.getElementById('editFrame2').style.height ="0px";
						document.getElementById('page2').style.top = "-2000px";
						document.getElementById('page2').style.left = "-2000px";

						break;

		
		
	}
	

	
	
}