//init language
////////////////////////


	if (navigator.userAgent.toLowerCase().indexOf("msie") != -1)
		{
		naLang=navigator.browserLanguage.toLowerCase().substr(0,2); 
		}
	else
		{
		naLang= navigator.language.toLowerCase().substr(0,2);
		}
	
	vaLang="";
	if(window.location.search) 
		{
		var va=window.location.search;
		pos=va.search(/lng/);
		if(pos!=-1)
			{
			vaLang=va.substr(pos+4,2); 
			}
		}

	if(!myLang)
		{
		if(vaLang)
			{
			myLang=vaLang;
			}
		else
			{
			myLang=naLang;
			}
		}

	switch(myLang)
		{
 		case "de" : myLang!="de"; break;
 		case "da" : myLang!="da"; break;
		default: myLang!="en"; break;
		}


	

//init styles
////////////////////////

    var MSIE=0;
    if(navigator.appName == "Microsoft Internet Explorer") MSIE=1;
	navigat = (navigator.appName == "Netscape") && (parseInt(navigator.appVersion) > 3); 
	var link2 = "nrm";
	if (navigat) 
		{
		var os = navigator.platform.substr(0,3); 
		if (os == "Win" || os == "IRI" || os == "Sun" || os == "X11") link2 = "ntw"; 
		else link2 = "nsc"; 
		} 

	document.write('<link rel="stylesheet" href="../styles/'+link2+'.css">');  



//init news ticker
////////////////////
 

  var ydir=-1;    
  var tics=68;
  var ticx=tics;   
  var ticy=396;  
  var ticker =0;
  var ticsize=16;
  var size=ticsize;


  
//get the cookies
////////////////////////


	function FixCookieDate (date) 
		{
		var base = new Date(0);
  		var skew = base.getTime(); // dawn of (Unix) time - should be 0
  		if (skew > 0) date.setTime (date.getTime() - skew);  // Except on the Mac - ahead of its time
		}

	function SetCookie (name,value,expires,path,domain,secure) 
		{
		document.cookie = name + "=" + escape (value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
		}

	function SaveCookie(name, value)
		{
		var expdate = new Date();
		FixCookieDate (expdate);
		expdate.setTime (expdate.getTime() + (36500 * 24 * 60 * 60 * 1000));  //100 save for years
	 	SetCookie (name, value, expdate);
		}

	function GetCookie (name) 
		{
		var arg = name + "=";
		var alen = arg.length;
		var clen = document.cookie.length;
		var i = 0;
		while (i < clen) 
			{
			var j = i + alen;
			if (document.cookie.substring(i, j) == arg) 
				{
				endstr = document.cookie.indexOf (";", j);
				if (endstr == -1) endstr = document.cookie.length;
				return unescape(document.cookie.substring(j, endstr));
				}
		        i = document.cookie.indexOf(" ", i) + 1;
			if (i == 0) break;
			}
		return null;
		}


//style routines
////////////////////////
	
	function jumpto(selObj) 
		{
		cs = selObj.selectedIndex; 
		selObj.selectedIndex = 0;
		if (selObj.options[cs].value != "none") location = selObj.options[cs].value;
		}; 
		
	function newin(link, winame, ifbars, ifsize, largh, altez) 
		{	
		if (ifbars == 'n') opzioni = "toolbar=0,menubar=0,location=0,status=0,resizable=1,scrollbars=1"; 
		else opzioni = "toolbar=1,menubar=1,location=1,status=1,resizable=1,scrollbars=1"; 
		if (ifsize == 'y') opzioni += ",width=" + largh + ",height=" + altez; 
		w = window.open(link, winame, opzioni); w.focus(); 
		return w; 
		};  
	
	function swapBgColor(obj, newColor) 
		{
		obj.style.backgroundColor = newColor;
		}

	
	function setHIbgCol(obj) { obj.style.backgroundColor = '#FCFCFC';	}
	function setLObgCol(obj) { obj.style.backgroundColor = '#E8E8E8';	}


	function bordo1(o) { o.style.borderColor = '#000000'; }
	function bordo0(o) { o.style.borderColor = '#ffffff'; } 


//jump MeteoServer Home 
////////////////////////

	function Home()
		{
		var VarUsrAgt = navigator.userAgent.toLowerCase();
		var szLang = ""

		if(window.location.search) 
			{
			var va=window.location.search;
			pos=va.search(/lng/);
			if(pos!=-1)
				{
				szLang=va.substr(pos+4,2); 
				}
			}
		if(!szLang)
			{
			if (VarUsrAgt.indexOf("msie") != -1)
				{
				szLang = navigator.browserLanguage.toLowerCase();
				}
			else
				{
				szLang = navigator.language.toLowerCase();
				}
			}

		switch(szLang.substr(0,2))
			{
			case "cs": SetIndex("cs"); break;
			case "da": SetIndex("da"); break;
			case "de": SetIndex("de"); break;
			case "el": SetIndex("el"); break;
			case "es": SetIndex("es"); break;
			case "fi": SetIndex("fi"); break;
			case "fr": SetIndex("fr"); break;
			case "hu": SetIndex("hu"); break;
			case "it": SetIndex("it"); break;
			case "nl": SetIndex("nl"); break;
			case "no": SetIndex("no"); break;
			case "pl": SetIndex("pl"); break;
			case "pt": SetIndex("pt"); break;
			case "ru": SetIndex("ru"); break;
			case "sk": SetIndex("sk"); break;
			case "sl": SetIndex("sl"); break;
			case "sv": SetIndex("sv"); break; 
			default: SetIndex("en"); break;
			}
		}
		
	function SetIndex(lng)
		{	
		window.location.href ="../sites/"+lng+"_home.htm";
		}
