function login(tz){

	dd=new Date();

	tz=dd.getTimezoneOffset();

	document.location.href='?tz='+tz;

}



function getWindowSize(){

	if( typeof( window.innerWidth ) == 'number' ) {

    //Non-IE

    Width = window.innerWidth;

    Height = window.innerHeight;

  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {

    //IE 6+ in 'standards compliant mode'

    Width = document.documentElement.clientWidth;

    Height = document.documentElement.clientHeight;

  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {

    //IE 4 compatible

    Width = document.body.clientWidth;

    Height = document.body.clientHeight;

  }

  return new Array(Width,Height);

}



function oG(site)

{

	urlnew='./fcgraphs.php?s='+site;

	graphWin=window.open(urlnew,'','height=900,width=1000,scrollbars=yes,resizable=yes');

	if (window.focus) {graphWin.focus()}

}



function oTFC(site)

{

	urlnew='./fcview.php?fc='+site;

	graphWin=window.open(urlnew,'','height=800,width=1000,scrollbars=yes,resizable=yes');

	if (window.focus) {graphWin.focus()}

}



function openGuide()

{

	guideWin=window.open('./guide/ForecastGuide.htm','Guide','height=640,width=960,scrollbars=yes,resizable=yes');

	if (window.focus) {guideWin.focus()}

}



function openERI(imp)

{

	urlnew='http://222.154.238.78/eri/eri_map.php?imp='+imp;

	graphWin=window.open(urlnew,'','height=660,width=900,scrollbars=yes,resizable=yes');

	if (window.focus) {graphWin.focus()}

}





function showStatus(text) {

    window.setTimeout('window.status="' + text + '"', 1);

}



function Hover() {

	var Elements = document.getElementById("leftmenu").getElementsByTagName("LI");

	for (var i=0; i<Elements.length; i++) {

		Elements[i].onmouseover=function() {

			this.className+=" hover";

		}

		Elements[i].onmouseout=function() {

			this.className=this.className.replace(new RegExp(" hover\\b"), "");

		}

	}

}



function gridSelect(menuitem) {

	var Elements = document.getElementById("leftmenu").getElementsByTagName("LI");

	for (var i=0; i<Elements.length; i++) {

		Elements[i].onmouseover=function() {

			this.className+=" hover";

		}

		Elements[i].onmouseout=function() {

			this.className=this.className.replace(new RegExp(" hover\\b"), "");

		}

	}

}



var current=0;

var maptype=0;

var maptitle=new Array('Significant wave height [m]','Peak period [s]','10m wind [kts]',

'Sea surface temperature [C]','Visible satellite','Storm surge elevation [m]','Surface visibility [km]','Precipitation [mm/hr]');



function thenext() {

if (current<document.slideform.slide.length-1) {

	document.slideform.slide.selectedIndex = ++current;

}else{

 	first();	

}

change();

}



function previous() {

if (current-1 >= 0) {

	document.slideform.slide.selectedIndex = --current;

}else{

	last();	

}

change();

}



function first() {

current = 0;

document.slideform.slide.selectedIndex = 0;

change();

}



function last() {

current = document.slideform.slide.length-1;

document.slideform.slide.selectedIndex = current;

}



function change() {

current = document.slideform.slide.selectedIndex;

maptype = document.slideform.typelist.selectedIndex;

if (maptype==3)

 {current=0;

 document.slideform.slide.selectedIndex = current;

}

charttitle.innerText=maptitle[maptype];

var mapstr=document.slideform.typelist[maptype].value

document.images.show.src = mapstr.replace(/HH/,document.slideform.slide[current].value)+'.png';

document.images.cbar.src = mapstr.replace(/[_a-zA-Z]+(HH|12|0)/,'cbar')+'.png';

}



function preloadImages(the_images_array) {

for (var loop = 0; loop < the_images_array.length; loop++)

{

 	var an_image = new Image();

	an_image.src = the_images_array[loop];

}

}

