function opens(url){
	window.open(url, "mywin", "toolbar=1,scrollbars=1,left=40,top=20,width=1100,height=800");
}

function lasit(id){
	var xmlHttp;
	try{// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){ // Get the data from the server's response   
			if (xmlHttp.status == 200) {
				if (xmlHttp.responseText!="") document.getElementById(id).innerHTML=xmlHttp.responseText;
			}
			else statusalert(xmlHttp.status);
		}
	}
	var url="./getnews.php";
	parm="id="+id;

	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", parm.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(parm);
}

function aizvert(id){
	var xmlHttp;
	try{// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){ // Get the data from the server's response   
			if (xmlHttp.status == 200) {
				if (xmlHttp.responseText!="") document.getElementById(id).innerHTML=xmlHttp.responseText;
			}
			else statusalert(xmlHttp.status);
		}
	}
	var url="./closenews.php";
	parm="id="+id;

	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", parm.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(parm);
}

function showimg(id){
	var xmlHttp;
	try{// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){ // Get the data from the server's response   
			if (xmlHttp.status == 200) {
				if (xmlHttp.responseText!=""){
					document.getElementById("black").className="black2";
					document.getElementById("bigimg").className="bigimg2";
					document.getElementById("bigimg").innerHTML=xmlHttp.responseText;
				}
			}
			else statusalert(xmlHttp.status);
		}
	}
	var url="./findimg.php";
	parm="id="+id;

	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", parm.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(parm);
}

function closeimg(){
	document.getElementById("bigimg").className="bigimg";
	document.getElementById("black").className="black";
}

function showm(n){
	state=new Array(4);
	state[0]="hjertmans";
	//state[1]="treileri";
	//state[2]="laivas";
	state[3]="buras";
	//state[4]="plaveji";
	state[5]="dorote";

	var i=0;
	var statelength = state.length;
	while (i<statelength){
		if (document.getElementById("black"+state[i])){
			if(i==n-1){
				document.getElementById("black"+state[i]).className="blackmenu2";
				document.getElementById("white"+state[i]).className="whitemenu2";
			}
			else{
				document.getElementById("black"+state[i]).className="blackmenu";
				document.getElementById("white"+state[i]).className="whitemenu";
			}
		}
		i++;
	}
}

function statusalert (x){
	switch (x){
		case 404:
			alert ("Pieprasītais URL nav atrasts.");
			break;
		case 403:
			alert ("Pieeja liegta.");
			break;
		default:
			if (x!=0) alert ("ERORR: "+x);
			break;
	}
}



