var juba;

function pikkuikku(kama,kamb)
{
	var cur;
	if(kamb===undefined){
		kamb="";
	}else{
		kamb="&lisuke="+kamb;
	}
	juba=document.getElementById('warn');
	cur=document.getElementById('cur').value;
	dor=document.getElementById('kieli').value;
	loadXMLDoc("index.php?js="+kama+"&dir="+cur+"&k="+dor+kamb,"GET",null);
	juba.className="loginbox";
}

function sulku()
{
	x=document.getElementById('warn');
	x.className="emptywarn";
	x.innerHTML="";
}

function loadXMLDoc(url,omena,kama)
{
	if(kama!==""){
		//x=kama;
		x=encodeURI(kama);
	}else{
		x=null;
	}
	xmlhttp=null;
	if (window.XMLHttpRequest)
		{// code for Firefox, Opera, IE7, etc.
		xmlhttp=new XMLHttpRequest();
		}
	else if (window.ActiveXObject)
		{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	if (xmlhttp!=null)
		{
		xmlhttp.onreadystatechange=state_Change;
		xmlhttp.open(omena,url,true);
		if(x!==null){
			xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		}
		xmlhttp.send(x);
		}
	else
		{
		alert("Your browser does not support XMLHTTP.");
		}
}

function state_Change()
{
if (xmlhttp.readyState==4)
  {// 4 = "loaded"
  if (xmlhttp.status==200)
    {// 200 = "OK"
    juba.innerHTML=xmlhttp.responseText;
    try{x=document.getElementById('aktiivi');}
    catch(err){x=null;}
    if(x!==null){
    	x.focus();
    }
    }
  else
    {
    juba.innerHTML="Problem retrieving data:" + xmlhttp.statusText;
    }
  }
}

function kesken()
{
	alert('Kesken...');
}