// JavaScript Document

function skyriaus_rodymas(skyrius) {
var	div = document.getElementById(skyrius);
	div.style.display = (div.style.display == 'block') ? 'none' : 'block';
}

function niekas() {
	var nieko;
	nieko = 1;
}

function paieska_focus(id, verte) {
var id2 = document.getElementById(id);
	if(id2.value==verte) { id2.value=''; }
	//id2.style.backgroundColor='#eef9df';
}

function paieska_blur(id, verte) {
var id2 = document.getElementById(id);
	if(id2.value=='') { id2.value=verte; }
	//id2.style.backgroundColor='#c6dca6';
}

function ajax1(elementas, byla)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Jusu narsykle nepalaiko AJAX!");
  return;
  } 
xmlHttp.onreadystatechange=function() 
{
	if (xmlHttp.readyState==4) 
	{ 
	document.getElementById(elementas).innerHTML=xmlHttp.responseText;
	}
}

var oble = "pozicija="+elementas;  
    xmlHttp.open("POST", byla, true);  
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
	xmlHttp.setRequestHeader("Content-length", oble.length);  
	xmlHttp.setRequestHeader("Connection", "close");  
	xmlHttp.send(oble);  
} 

function ajax3(elementas, byla)
{
xmlHttp3=GetXmlHttpObject3();
if (xmlHttp3==null)
  {
  alert ("Jusu narsykle nepalaiko AJAX!");
  return;
  } 
xmlHttp3.onreadystatechange=function() 
{
	if (xmlHttp3.readyState==4) 
	{
		if (xmlHttp3.responseText != '') { 
document.getElementById(elementas).innerHTML=xmlHttp3.responseText;
//var ge = document.getElementById(elementas);
//  ge.style.display = 'block';
//  ge.innerHTML = xmlHttp1.responseText;
 }
	}
}
xmlHttp3.open("GET", byla, true);
xmlHttp3.send(null);
}

function GetXmlHttpObject3()
{
var xmlHttp3=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp3=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp3=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp3=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp3;
}

function ajax2(elementas, byla)
{
xmlHttp1=GetXmlHttpObject1();
if (xmlHttp1==null)
  {
  alert ("Jusu narsykle nepalaiko AJAX!");
  return;
  } 
xmlHttp1.onreadystatechange=function() 
{
	if (xmlHttp1.readyState==4) 
	{
		if (xmlHttp1.responseText != '') { 
document.getElementById(elementas).innerHTML=xmlHttp1.responseText;
//var ge = document.getElementById(elementas);
//  ge.style.display = 'block';
//  ge.innerHTML = xmlHttp1.responseText;
 }
	}
}
xmlHttp1.open("GET", byla, true);
xmlHttp1.send(null);
}

function GetXmlHttpObject1()
{
var xmlHttp1=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp1=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp1=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp1=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp1;
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function timedout()
{
	ajax2('lenta', '/php/lenta.php')
    setTimeout ("timedout()", 2000);
}

	function plotis() {
		var x, y;
		x = screen.availWidth;
		y = screen.availHeight;
		if(document.all) { x = document.body.clientWidth; }
		else { x = innerWidth; }
		if(document.all) { y = document.body.clientHeight; }
		else { y = innerHeight; }
		/*
		if (x > 1890){
		document.body.style.backgroundImage = 'url(css/10.jpg)';
		document.getElementById('talpykla').style.width = "1880px";
		document.getElementById('turinys').style.width = "1840px";
		}
		else {
			if (x > 1590){
			document.body.style.backgroundImage = 'url(css/antanas2.jpg)';
			document.getElementById('talpykla').style.width = "1580px";
			document.getElementById('turinys').style.width = "1540px";
			}
			else {

				if (x > 1270){
				document.body.style.backgroundImage = 'url(css/antanas2.jpg)';
				document.getElementById('talpykla').style.width = "1260px";
				document.getElementById('turinys').style.width = "1220px";
				}
				else {
				document.body.style.backgroundImage = 'url(css/antanas2.jpg)';
				}
			}
		}
		*/
	//	y -= 90;
	//	document.getElementById('talpykla').style.minHeight = y+"px";
		if (x < 1270) { 
		document.getElementById('turinys').style.width = "780px"; 
		//document.getElementById('poraste_kaire').style.display = "none"; 
		}
		else {
			if (x < 1300) { 
			document.getElementById('turinys').style.width = "950px"; 
		}
		}
	}
	

function alternatyva(id, nr, kalba) {
	var elementas = 'a'+nr;
	ajax2(elementas,'php/ajax_alt.php?id2='+id+'&id3='+elementas+'&k='+kalba);
}

function vertinti(xy, id, balas, kalba) {
	ajax3(xy,'php/ajax_vertinimas.php?id4='+id+'&id5='+balas);
	ajax1(xy,'php/ajax_alt.php?id2='+id+'&k='+kalba);
}

function komentarai(id) {
	var elementas = 'kom'+id;
//	alert('valio');
	ajax3(elementas,'php/ajax_komentarai.php?id='+id);
//	ajax1(xy,'php/ajax_alt.php?id='+id);
}

// End -->
