var listMax=Array(24,24,12,23,5,6,7,8,9,10,11,12);
var listCOP= Array();
var listLNK= Array();
var listIMG= Array();

var tim	   = new Date();
var Today  = tim.getTime(); //-10800000; 
     tim   = new Date(Today);	
    Today  = tim.getTime(); 
  	
function GetEUMETChart(DropDownList,flag)
	{
	if(!flag) DropDownList.selectedIndex=0;
	myWin=window.open(DropDownList[DropDownList.selectedIndex].value, "_blank","location=no,menubar=no,status=no,toolbar=no,left=0,top=0,width="+screen.width+",height="+screen.height+",scrollbars=yes,resizable=yes");
	myWin.focus();          
	}

function GetUBnChart(DropDownList, flag)
	{
	if(!flag) DropDownList.selectedIndex=0;
	lnk="../sites/wfaxchart.php?cop=AHVRR = NOAA / University Bern%20 (Switzerland)&url=http://saturn.unibe.ch&img=http://saturn.unibe.ch/rsbern/noaa/dw/realtime/n1b/"+DropDownList[DropDownList.selectedIndex].value;
	myWin=window.open(lnk, "_blank","location=no,menubar=no,status=no,toolbar=no,width="+screen.width+",height="+screen.height+",scrollbars=yes,resizable=yes");
	myWin.focus();          
	}
	
function GetDWDChart(DropDownList, flag)
	{
	if(!flag) DropDownList.selectedIndex=0;
	lnk="../sites/wxchart.php?cop=DWD%20(Deutscher%20Wetterdienst)&url=http://www.dwd.de/bvbw/appmanager/bvbw/dwdwwwDesktop%3F_nfpb=true%26_pageLabel=_dwdwww_spezielle_nutzer_hobbymeteorologen_karten%26activePage=&lnk=DWD/HOBBYMET&img=http://www.dwd.de/bvbw/generator/Sites/DWDWWW/Content/Oeffentlichkeit/KU/KUPK/Hobbymet/Wetterkarten/"+DropDownList[DropDownList.selectedIndex].value+"__Bild,property=default.jpg";;
	myWin=window.open(lnk, "_blank","location=no,menubar=no,status=no,toolbar=no,width="+screen.width+",height="+screen.height+",scrollbars=yes,resizable=yes");
	myWin.focus();          
	}
	
function GetNoaaChart(DropDownList, flag)
	{
	if(!flag) DropDownList.selectedIndex=0;
	lnk="../sites/wxchart.php?cop=Met%20Office,%20from%20NOAA%20(USA)%20...TIF-Format&lnk=NWS Facsimile Charts&tiff=1&img=http://weather.noaa.gov/pub/fax/"+DropDownList[DropDownList.selectedIndex].value+"&url=http://weather.noaa.gov/fax/otherfax.shtml";
	myWin=window.open(lnk, "_blank","location=no,menubar=no,status=no,toolbar=no,width="+screen.width+",height="+screen.height+",scrollbars=yes,resizable=yes");
	myWin.focus();          
	}


function GetECMWFChart(DropDownList, flag)
	{

	if(!flag) DropDownList.selectedIndex=1;
	if((DropDownList[DropDownList.selectedIndex].value/1000)<1) DropDownList.selectedIndex++;

	country=DropDownList[DropDownList.selectedIndex].value/1000;
	country= parseInt(country);
	frc=DropDownList[DropDownList.selectedIndex].value%1000;
	lnk="../sites/wfaxchart.php?cop=ECMWF%20(European%20Centre%20for%20Medium-Range%20Weather%20Forecasts)&url=http://www.ecmwf.int&img=http://www.ecmwf.int/products/forecasts/d/getchart/catalog/products/forecasts/medium/deterministic/msl_uv850_z500!";

	if((DropDownList.selectedIndex%11) >5) lnk+="Geopotential%20500%20hPa!"+frc;
	else lnk+="Wind%20850%20and%20mslp!"+frc;
	switch(country)
		{
		case	1:	lnk+="!Europe"; break;
		case	2:	lnk+="!North%20America"; break;
		case	3:	lnk+="!South%20America"; break;
		case	4:	lnk+="!Asia"; break;
		case	5:	lnk+="!Australia"; break;
		case	6:	lnk+="!Africa"; break;
		case	7:	lnk+="!North%20hemisphere"; break;
		case	8:	lnk+="!South%20hemisphere"; break;
		}

	lnk+="!pop!od!oper!public_plots!";

	tim= new Date(Today);
	lnk+=tim.getUTCFullYear();
	month   = tim.getUTCMonth()+1;
	day		= tim.getUTCDate();
	hour	= tim.getUTCHours();

	if(month<10)lnk+="0"+month;
	else lnk+=""+month;
	if(day<10)lnk+="0"+day;
	else lnk+=day;
	if(hour<12) lnk+="00";
	else lnk+="12";

	lnk+="!!chart.gif";

	myWin=window.open(lnk, "_blank","location=no,menubar=no,status=no,toolbar=no,width="+screen.width+",height="+screen.height+",scrollbars=yes,resizable=yes");
	myWin.focus();          
	}
	

function GetNEMOCChart(DropDownList, flag)
	{

	if(!flag) DropDownList.selectedIndex=0;

	frc=DropDownList[DropDownList.selectedIndex].value%1000;
	lnk="../sites/wfaxchart.php?cop=NEMOC%20(Naval%20European%20Meteorology%20and%20Oceanography%20Center)&url=https://www.nemoc.navy.mil&img=https://www.nemoc.navy.mil/auto/charts/"+DropDownList[DropDownList.selectedIndex].value+".gif";
	myWin=window.open(lnk, "_blank","location=no,menubar=no,status=no,toolbar=no,width="+screen.width+",height="+screen.height+",scrollbars=yes,resizable=yes");
	myWin.focus();          
	}
	
function GetOWSChart(DropDownList, flag)
	{
	
	if(!flag) DropDownList.selectedIndex=0;

	if(DropDownList.selectedIndex<10) lnk="http://ows.public.sembach.af.mil/wxcharts/"+DropDownList[DropDownList.selectedIndex].value+".htm";
	else lnk="http://ows.public.sembach.af.mil/asp/syn00120_looperb.php?name=synoptic&loc=GifImages"

	myWin=window.open(lnk, "_blank","location=no,menubar=no,status=no,toolbar=no,width="+screen.width+",height="+screen.height+",scrollbars=yes,resizable=yes");
	myWin.focus();           
	}

function GetUKChart(DropDownList, flag)
	{

	if(!flag) DropDownList.selectedIndex=0;

	lnk="../sites/wfaxchart.php?cop=Met%20Office%20UK&url=http://www.metoffice.com&img=http://www.metoffice.com/weather/charts/FSXX00T_"+DropDownList[DropDownList.selectedIndex].value+".jpg";
	myWin=window.open(lnk, "_blank","location=no,menubar=no,status=no,toolbar=no,width="+screen.width+",height="+screen.height+",scrollbars=yes,resizable=yes");
	myWin.focus();          
	}


function GetUKEXChart(DropDownList, flag)
	{

	if(!flag) DropDownList.selectedIndex=0;

	lnk="../sites/wfaxchart.php?cop=Met%20Office,%20from%20NOAA%20(USA)%20...TIF-Format%20--->%20use%20the%20link&url=http://weather.noaa.gov/fax/otherfax.shtml&img=http://weather.noaa.gov/fax/otherfax.shtml";
	myWin=window.open(lnk, "_blank","location=no,menubar=no,status=no,toolbar=no,width="+screen.width+",height="+screen.height+",scrollbars=yes,resizable=yes");
	myWin.focus();          
	}
//http://weather.noaa.gov/pub/fax/PPV"+DropDownList[DropDownList.selectedIndex].value+"89.TIF";


function GetMFChart(DropDownList, flag)
	{

	if(!flag) DropDownList.selectedIndex=0;
	lnk="../sites/wfaxchart.php?cop=Meteo%20France&url=http://www.meteo.fr&img=http://www.meteo.fr/marine/naviweb/cartes/"+DropDownList[DropDownList.selectedIndex].value+".gif";
	myWin=window.open(lnk, "_blank","location=no,menubar=no,status=no,toolbar=no,width="+screen.width+",height="+screen.height+",scrollbars=yes,resizable=yes");
	myWin.focus();          
	}

function FillDropDownLists()
{
	SetList1and2();
	SetList3();
}


function SetList1and2()
	{
	i=0; src=""; index1=index2=0;

	while (document.getElementById("list1").length > 0 ) 
	   	{
	   	document.getElementById("list1").options[document.getElementById("list1").length-1] = null;
	   	}
	while (document.getElementById("list2").length > 0 ) 
	   	{
	   	document.getElementById("list2").options[document.getElementById("list2").length-1] = null;
	   	}

	tim= new Date(Today);
    lnk="http://oiswww.eumetsat.org/IPPS/html/SpectralChannels/MSG2/";
	  
   	set="latest IR 3.9 color";
	document.getElementById("list1").options[index1]=new Option(set);
	document.getElementById("list2").options[index2]=new Option(set);
	document.getElementById("hrefwx01").href =document.getElementById("list1").options[index1++].value=lnk+"IR039/COLOR/CENTRALEUROPE/index.htm";
	document.getElementById("hrefwx02").href =document.getElementById("list2").options[index2++].value=lnk+"IR039/COLOR/FULLDISC/index.htm";
	
   	set="latest IR 10.8 color";
	document.getElementById("list1").options[index1]=new Option(set);
	document.getElementById("list2").options[index2]=new Option(set);
	document.getElementById("list1").options[index1++].value=lnk+"IR108/COLOR/CENTRALEUROPE/index.htm";
	document.getElementById("list2").options[index2++].value=lnk+"IR108/COLOR/FULLDISC/index.htm";

   	set="latest VIS 0.6 color";
	document.getElementById("list1").options[index1]=new Option(set);
	document.getElementById("list2").options[index2]=new Option(set);
	document.getElementById("list1").options[index1++].value=lnk+"VIS006/COLOR/CENTRALEUROPE/index.htm";
	document.getElementById("list2").options[index2++].value=lnk+"VIS006/COLOR/FULLDISC/index.htm";

  	set="latest IR 3.9 b&w";
	document.getElementById("list1").options[index1]=new Option(set);
	document.getElementById("list2").options[index2]=new Option(set);
	document.getElementById("list1").options[index1++].value=lnk+"IR039/BW/CENTRALEUROPE/index.htm";
	document.getElementById("list2").options[index2++].value=lnk+"IR039/BW/FULLDISC/index.htm";
	
   	set="latest IR 10.8 b&w";
	document.getElementById("list1").options[index1]=new Option(set);
	document.getElementById("list2").options[index2]=new Option(set);
	document.getElementById("list1").options[index1++].value=lnk+"IR108/BW/CENTRALEUROPE/index.htm";
	document.getElementById("list2").options[index2++].value=lnk+"IR108/BW/FULLDISC/index.htm";

   	set="latest VIS 0.6 b&w";
	document.getElementById("list1").options[index1]=new Option(set);
	document.getElementById("list2").options[index2]=new Option(set);
	document.getElementById("list1").options[index1++].value=lnk+"VIS006/BW/CENTRALEUROPE/index.htm";
	document.getElementById("list2").options[index2++].value=lnk+"VIS006/BW/FULLDISC/index.htm";

   	set="latest WV 6.2 b&w";
	document.getElementById("list1").options[index1]=new Option(set);
	document.getElementById("list2").options[index2]=new Option(set);
	document.getElementById("list1").options[index1++].value=lnk+"WV062/BW/CENTRALEUROPE/index.htm";
	document.getElementById("list2").options[index2++].value=lnk+"WV062/BW/FULLDISC/index.htm";

	document.getElementById("list1")[0].selected =true;
	document.getElementById("list2")[0].selected =true;
	}



function SetList3()
	{
	mon = Array("JAN","FEB","MAR","APR","MAI","JUN","JUL","AUG","SEP","OCT","NOV","DEC");


	while (document.getElementById("list3").length > 0 ) 
	   	{
	   	document.getElementById("list3").options[document.getElementById("list3").length-1] = null;
	   	}

	for(i=0; i<Sx; i++)
		{
		tim=	new Date(St[i]*1000);	

		month   = tim.getUTCMonth()+1;
		day		= tim.getUTCDate();
		hour	= tim.getUTCHours();
		min		= tim.getUTCMinutes();
		sec		= tim.getUTCSeconds();
    	year    = tim.getUTCFullYear();
    	
        if(month<10) m="0"+month;
		else m=""+month;
		if(day<10)	d="0"+day;
		else d=""+day;
		if(hour<10)	H="0"+hour;
		else H=""+hour;
		if(min<10)	M="0"+min;
		else M=""+min;
		if(sec<10)	S="0"+sec;
		else S=""+sec;

		set="N"+(Ss[i]%100)+" "+d+"."+mon[month-1]+" "+H+":"+M;
		if(Ss[i]>=100) set+=" color";
		else set+="  b & w";

		val="N"+(Ss[i]%100)+"_"+year+m+d+H+M+S;
		if(Ss[i]>=100) val+="-fc-";
		else val+="-c4-";
		val+="corrected.jpg";

		txt=set+" 640";
		document.getElementById("list3").options[i*4]=new Option(txt);
		txt="640/"+val;
		document.getElementById("list3").options[i*4].value=txt;

		txt=set+" 800";
		document.getElementById("list3").options[i*4+1]=new Option(txt);
		txt="800/"+val;

		document.getElementById("list3").options[i*4+1].value=txt;
		txt=set+" 1024";
		document.getElementById("list3").options[i*4+2]=new Option(txt);
		txt="1024/"+val;

		document.getElementById("list3").options[i*4+2].value=txt;
		txt=set+" full";
		document.getElementById("list3").options[i*4+3]=new Option(txt);
		txt=val;
		document.getElementById("list3").options[i*4+3].value=txt;
		}

	document.getElementById("list3")[0].selected =true;
	}

