function Toliau() {
	i=0;
	Forma_ok = false;
	a_ats_id_obj = document.getElementsByName('ats_id[]');

	while(typeof(a_ats_id_obj[i]) != "undefined"){
		if(a_ats_id_obj[i].checked)
			Forma_ok = true;
		if(a_ats_id_obj[i].type == "hidden")
			Forma_ok = true;
		i++;
	}

	if(typeof(a_ats_id_obj[0]) == "undefined" && a_ats_id_obj[0].type != "hidden")
		Forma_ok = true;

	if(Forma_ok)
		document.getElementById('forma').submit();
	else{
		document.getElementById('klaida').innerText = "Pasirinkite atsakymą!";
		document.getElementById('klaida').style.display = "";
	}

}
function InputStatus(Status) {
	//alert(Status)
	if(typeof(document.getElementById('forma').AtsInput) != "undefined"){
		i=0;
		while(document.getElementById("Ats_id_"+(++i)) !=null && i<10){}
		if(document.getElementById("Ats_id_"+(i-1)).checked != true){
			document.getElementById('forma').AtsInput.style.borderColor="gray";
			document.getElementById('forma').AtsInput.style.backgroundColor="whitesmoke";
			document.getElementById('forma').AtsInput.disabled=true;
		}else{
			document.getElementById('forma').AtsInput.style.borderColor="#245296";
			document.getElementById('forma').AtsInput.style.backgroundColor="#FBF6E9";
			document.getElementById('forma').AtsInput.disabled=false;
		}
	}
}

function Resize(){

	if(window.name.search("Langelis") > -1){

		window.resizeTo(300, 200);

		cWidth = this.document.body.clientWidth;
		sWidth = this.document.body.scrollWidth;
		rWidth = window.screen.availWidth;

		cHeight = this.document.body.clientHeight;
		sHeight = this.document.body.scrollHeight;
		rHeight = window.screen.availHeight;

		if((rHeight - 150) < (sHeight + 40)){
			height = rHeight - 150;
		}else{
			height = sHeight + 40;		
		}

		if((rWidth - 20) < (sWidth + 40)){
			width = rWidth - 20;
			height += 20;
		}else{
			width = sWidth + 40;
		}
		window.resizeTo(width, height);
	}
}

var Tip = Array();

Xoffset=-20;
Yoffset= -45;
var isNS4=document.layers?true:false;
var isIE=document.all?true:false;
var isNS6=!isIE&&document.getElementById?true:false;
var old=!isNS4&&!isNS6&&!isIE;
var SleptiTipa = false;

var skn, TipNr, addY, headerTxt;


function LoadToolTip()
{
	if(isNS4)skn=document.ToolTipObj;
	if(isIE)skn=document.all.ToolTipObj.style;
	if(isNS6)skn=document.getElementById("ToolTipObj").style;
	TipIsReady = true;
}



function ToolTip(TipNr1, addY1, headerTxt1){
	if(document.readyState == "complete"){
		TipNr = TipNr1;
		addY = addY1;
		headerTxt = headerTxt1;
		setTimeout("ToolTipShow(TipNr,addY, headerTxt)", 800);
	}
}


function ToolTipShow(TipNr ,addY, headerTxt)
{
	if(typeof(Plotis) != 'undefined' && typeof(x) != 'undefined'){
		SleptiTipa = false;
		if(typeof(TipNr) == 'number'){
			var txt = Tip[TipNr][0];
			var header = typeof(Tip[TipNr][1]) == 'undefined'?"":Tip[TipNr][1];
		}else{
			var txt = TipNr;	
			var header = typeof(headerTxt) == 'undefined'?"":headerTxt;
		}


		if(addY == -1){
			Yoffset = header == ""?-27:-55;
		}else{
			Yoffset = 5;
		}

		var content = "<TABLE cellpadding=1 cellspacing=0px border=0 bgcolor=#FFFFE1 Style='border:solid 1px black' onmouseover=\"SleptiTipa = false;\" ONMOUSEOUT=\"SleptiTipa = true;DoRemoveTip()\">";
		content+= "<TBody Style='font-family:Verdana;font-size:10'>";
		if(header != "")content+= "<TR><TD>&nbsp;</TD><TD><B>"+header+"</B></TD><TD>&nbsp;</TD></TR>";
		content+="<TR><TD>&nbsp;</TD><TD>"+txt+"</TD><TD>&nbsp;</TD></TR></Tbody><TABLE>";

		if(!old)
		{
		if((Plotis - x) < 150){
			x-=50;
		}
		if((Plotis - x) < 150){
			x-=50;
		}
		if((Plotis - x) < 150){
			x-=30;
		}
		x += Xoffset;
		y += Yoffset;
		//if(isIE)y -= event.offsetY;

		skn.left = x+25;
		skn.top= y;

		if(isNS4)
		{
			skn.document.open();
			skn.document.write(content);
			skn.document.close();
			skn.visibility="visible";
		}
		if(isNS6)
		{
			document.getElementById("ToolTipObj").style.position="absolute";
			document.getElementById("ToolTipObj").style.left=x;
			document.getElementById("ToolTipObj").style.top=y;
			document.getElementById("ToolTipObj").innerHTML=content;
			skn.visibility="visible";
		}
		if(isIE)
		{
			document.all("ToolTipObj").innerHTML=content;
			skn.visibility="visible";
		}

		}
	}
	setTimeout("DoRemoveTip(true)", 7000);
}

var x;
var y;
function get_mouse(e){
	x=(isNS4||isNS6)?e.pageX:event.clientX+document.body.scrollLeft; 
	y=(isNS4||isNS6)?e.pageY:event.clientY+document.body.scrollTop; 
}


function NoTip(){
	if(document.readyState == "complete"){
		SleptiTipa = true;
		setTimeout("DoRemoveTip()", 250);
	}
}

function DoRemoveTip(force){
	if(SleptiTipa || force)if(!old)skn.visibility="hidden";
}

if(isNS4)
	document.captureEvents(Event.MOUSEMOVE); 
if(isNS6)
	document.addEventListener("mousemove", get_mouse, true);
if(isNS4||isIE)
	document.onmousemove=get_mouse;

