
			function toggleVisibility(temp){
               if (document.getElementById(temp).style.display=="none"){
                       document.getElementById(temp).style.display="inline";
                       }
               else {   
                       document.getElementById(temp).style.display="none";
                       }
             }
			 
		function toggleVisibility2(temp, button) {
                if (document.getElementById(temp).style.display=="none"){
                        document.getElementById(temp).style.display="inline";
                        button.innerHTML = "<img src= 'images/minus.gif'>";
                }
                else {   
                        document.getElementById(temp).style.display="none";
                       button.innerHTML = "<img src= 'images/plus.gif'>";
                        }
        }	 
 

			
			function timezone () {
			var tz, d; 
			var s="";
				 d = new Date();
				 //s=d.getFullYear()+"/"+(d.getMonth() + 1)+"/"+d.getDate() + " ";
				 tz=d.getTimezoneOffset();
					if (tz < 0)
				      s +=  "+" + ((tz / 60)*-1) ;
				   else if (tz == 0)
				      s += "0";
				   else
				      s +=  + ((tz / 60)*-1);
					  //document.write(s);
					  return s;
			}
			
			function currentDate() {
				var monthStr = new Array(
											"Jan", "Feb", "Mar", 
											"Apr", "May", "Jun", 
											"Jul", "Aug", "Sep", 
											"Oct", "Nov", "Dec"
										);  
				var d; 
				var s="";
				d = new Date();
				s=d.getDate()+ " " + monthStr[d.getMonth()]+" "+ d.getFullYear()+ " ";
				return s;
			}
			
			function queryDate() {
				
				var d; 
				var s="";
				var monthStr="";
				var dayStr="";
				
				d = new Date();
				var day = d.getDate();
				var month = (d.getMonth() + 1);
				var year = d.getFullYear();
				if ( month < 10 ) {
					monthStr+="0"+month;
				}
				else {
					monthStr+=month;
				}
				if ( day < 10 ) {
					dayStr+="0"+day;
				}
				else {
					dayStr+=day;
				}
				s=year+monthStr+dayStr;
				return s;
			}
			
			function makeInvisible(temp) {
				doc=document.getElementById(temp);
				setTimeout( "doc.style.display='none';",4000 );
				
			}
			
			function makeVisible(temp) {
				doc=document.getElementById(temp);
				setTimeout( "doc.style.display='inline';",700 );
//block				makeInvisible(temp);
				setTimeout( "doc.style.display='none';",4000 );
			}
			
			
			
			function preselect(obj, preselected) {
				var selectBox=obj;
				for (i=0;i<selectBox.length;i++){
					if (selectBox.options[i].value==preselected){
						selectBox.selectedIndex=i;
					}
				}
			}
			
			function setCookie(country){
				document.cookie='country='+country+'; expires=Thu, 15 Oct 2099 20:47:11 UTC; path=/';
			}
			
			function setCookie2(name){
				document.cookie=name+'; expires=Thu, 15 Oct 2099 20:47:11 UTC; path=/';
			}
			
			
			
			
			function preload(obj, preselected) {
				var object=obj;
				//selectBox = document.getElementById(weather.tz);
				//selectBox = document.weather.tz;
				object.value=preselected;
			}
			
			function init() {
				makeInvisible("date");
				makeInvisible("timezone");
				makeInvisible("placename");
				makeInvisible("latd");
				makeInvisible("lond");
				makeInvisible("units");
				preselect(document.weather.date, queryDate());
				preselect(document.weather.tz, timezone());
			}
			
			function init2 () { 
				preselect(document.weather.date, queryDate());
				//preselect(document.weather.tz, timezone());
				preload(document.weather.date, queryDate());
				preload(document.weather.tz, timezone());
				
				preload(document.map.date, queryDate());
				preload(document.map.tz, timezone());
				
				preload(document.saved.date, queryDate());
				preload(document.saved.tz, timezone());
				
				tb=document.getElementById('textbox');
				tb.focus();
			}
			
			//window.onload=init;
			
			
			
			
			
			function showText(text) {
				myWindow = window.open('notes/'+text+'.php', text, 'status=0,titlebar=0,dependent=1,width=480,height=285');
			}
			
			
			function notes (page) {
				myWindow = window.open('notes/'+page+'.php', page, 'status=0,titlebar=0,dependent=1,width=480,height=285');
			}
			
			function setLocation(town, lat, lon) {
				//alert("town="+town+"/lat="+lat+"/lon="+lon);
				if (confirm("You can save only one location at a time. \nClick OK to save or Cancel to continue")==true){
					strTown = "town="+town+"/lat="+lat+"/lon="+lon;
					setCookie2(strTown);
				}
			}
			
			function readCookie(name){
				var nameEQ = name + "=";
				var ca = document.cookie.split(';');
				for(var i=0;i < ca.length;i++)
				{
					var c = ca[i];
					while (c.charAt(0)==' ') c = c.substring(1,c.length);
					if (c.indexOf(nameEQ) == 0) return c;//.substring(nameEQ.length,c.length);
				}
				return null;
			}
			
			function getLocation() {
				var strRead = readCookie('town');
				var ra = new Array();
				var ta=new Array();
				var townEQ = "town=";
				var latEQ = "lat=";
				var lonEQ = "lon=";
				
				if (strRead != null) {
					ta = strRead.split('/'); //array
					ra[0] =  ta[0].substring(townEQ.length,ta[0].length);
					//ra[0] = ta[0];
					ra[1] =  ta[1].substring(latEQ.length,ta[1].length);
					ra[2] =  ta[2].substring(lonEQ.length,ta[2].length);
					
					//document.write(ra[0]+" "+ra[1]+" "+ra[2]);
					return ra;
					//document.write(strRead);
				}
				
				return null;
				//document.close();
				//return readCookie('town');
			}
			
			
			