function leave()
{
	try
	{
		GUnload();
	}
	catch(err){ }
}
function ladda()
{
	try
	{
		document.startSidanSokForm.q_vad.focus();
	}
	catch(err){ }
	try
	{
		loadGMap();
	}
	catch(err){ }
}

function farga(x, val)
{
	if (val)
	{
		x.className="sub brightEdge";
	} else {
		x.className="sub";
	}
}

var menuTimer;
var menuCurrent = 0;

function menuGo(x)
{
	document.location.href=x;
}
function menuShow(x)
{
	if (x != menuCurrent)
	{
		menuHideReal(menuCurrent);
		menuCurrent = x;
	}
	clearTimeout(menuTimer);
	document.getElementById("submenu"+x).style.display='block';
}
function menuHide(x)
{
	menuTimer = setTimeout("menuHideReal("+x+")", 10);
}
function menuHideReal(x)
{
	try {document.getElementById("submenu"+x).style.display='none'; } catch(err){}
}

function submitSearch()
{
	if (document.sokrutaForm.sok.value != "")
		document.sokrutaForm.submit();
}
function kollaSok(x)
{
	return (document.sokrutaForm.sok.value != "");	
}

var sokExempel = true;
function clearSokRuta(x)
{
	if (sokExempel)
	{
		sokExempel = false; 
		document.sokrutaForm.sok.value="";
		document.sokrutaForm.sok.style.color="#000000";
	}
}

function kollaEntSok(x)
{
	return (document.litenSokRutaForm.litenSok.value != "");	
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+";path=/"+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function goTop()
{
	window.scrollTo(0,0);
}

function page(x)
{
	setCookie("sokSida", x);
	window.location.reload();
}
function pageLitenSok(x)
{
	setCookie("litenSokSida", x);
	window.location.reload();
}
function pageCode(x)
{
	setCookie("codePage", x);
	window.location.reload();
}
function gotoMedverkan()
{
	document.medverkanForm.submit();
}

function kollaTipsaFormen(x)
{
	if (	x.mottNamn.value == "" ||
			x.mottEpost.valye == "" ||
			x.sandNamn.value == "" ||
			x.sandEpost.value == "" ||
			x.kontroll.value.length != 5 )
	{
		alert("vänligen fyll i alla fält i formuläret.");
		return false;
	}
	return true;
}

mappix = new Array(22);

function preLoadMappix()
{
	mappix[0]= new Image();
	mappix[0].src = "/static/images/transparent.gif";
	mappix[1]= new Image();
	mappix[1].src = "/static/images/sverige/k.gif";
	mappix[2]= new Image();
	mappix[2].src = "/static/images/sverige/w.gif";
	mappix[3]= new Image();
	mappix[3].src = "/static/images/sverige/i.gif";
	mappix[4]= new Image();
	mappix[4].src = "/static/images/sverige/x.gif";
	mappix[5]= new Image();
	mappix[5].src = "/static/images/sverige/n.gif";
	mappix[6]= new Image();
	mappix[6].src = "/static/images/sverige/z.gif";
	mappix[7]= new Image();
	mappix[7].src = "/static/images/sverige/f.gif";
	mappix[8]= new Image();
	mappix[8].src = "/static/images/sverige/h.gif";
	mappix[9]= new Image();
	mappix[9].src = "/static/images/sverige/g.gif";
	mappix[10]= new Image();
	mappix[10].src = "/static/images/sverige/bd.gif";
	mappix[11]= new Image();
	mappix[11].src = "/static/images/sverige/m.gif";
	mappix[12]= new Image();
	mappix[12].src = "/static/images/sverige/ab.gif";
	mappix[13]= new Image();
	mappix[13].src = "/static/images/sverige/d.gif";
	mappix[14]= new Image();
	mappix[14].src = "/static/images/sverige/c.gif";
	mappix[15]= new Image();
	mappix[15].src = "/static/images/sverige/s.gif";
	mappix[16]= new Image();
	mappix[16].src = "/static/images/sverige/ac.gif";
	mappix[17]= new Image();
	mappix[17].src = "/static/images/sverige/y.gif";
	mappix[18]= new Image();
	mappix[18].src = "/static/images/sverige/u.gif";
	mappix[19]= new Image();
	mappix[19].src = "/static/images/sverige/o.gif";
	mappix[20]= new Image();
	mappix[20].src = "/static/images/sverige/t.gif";
	mappix[21]= new Image();
	mappix[21].src = "/static/images/sverige/e.gif";
}

var lastLanId = 1;

function mapShow(a,b)
{
	document.getElementById("kartbild").src = mappix[a].src;
	document.getElementById("lan"+lastLanId).style.textDecoration = 'none';
	if (a != 0)
	{
		document.getElementById("lan"+a).style.textDecoration = 'underline';
		lastLanId = a;
	}
}