var laukas = "";


function show5(){
if (!document.layers&&!document.all)
return
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="AM" 
if (hours>12){
dn="PM"
hours=hours-12
}
if (hours==0)
hours=12
if (hours<=9)
hours="0"+hours
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
myclock=hours+":"+minutes+":"+seconds
if (document.layers){
document.layers.liveclock.document.write(myclock)
document.layers.liveclock.document.close()
}
else if (document.all)
liveclock.innerHTML=myclock
setTimeout("show5()",1000)
}

function datalife(){
var today = new Date()
var month = today.getMonth()+1
var year = today.getYear()
var day = today.getDate()
if(day<10) day = "0" + day
if(month<10) month= "0" + month 
if(year<1000) year+=1900
mydate=year + " " + month +" " + day
if (document.layers){
document.layers.livedate.document.write(mydate)
document.layers.livedate.document.close()
}
else if (document.all)
livedate.innerHTML=mydate
}

function datos_isskistymas(data_p,objektas1,objektas2,objektas3){
	var mytool_array=data_p.split("-");
	if (mytool_array[0]){
		document.getElementById("year_begin").value = mytool_array[0];
		document.getElementById("year_end").value = mytool_array[0]; 
	}else{
		document.getElementById("year_begin").value = "";
		document.getElementById("year_end").value = ""; 
	}
	if (mytool_array[1]){
		document.getElementById("month_begin").value = mytool_array[1]; 
		document.getElementById("month_end").value = mytool_array[1]; 
	}else{
		document.getElementById("month_begin").value = ""; 
		document.getElementById("month_end").value = ""; 
	}
	if (mytool_array[2]){
		document.getElementById("day_begin").value = mytool_array[2]; 
		document.getElementById("day_end").value = mytool_array[2]; 
	}else{
		document.getElementById("day_begin").value = ""; 
		document.getElementById("day_end").value = ""; 
	}
}


var clockID = 0;

function UpdateClock() {
	if(clockID) {
		clearTimeout(clockID);
		clockID  = 0;
	}
	var tDate = new Date();
	var hours=tDate.getHours();
	var minutes=tDate.getMinutes();
	var seconds=tDate.getSeconds();
	if (hours<=9){
		hours="0"+hours;
	}
	if (minutes<=9){
		minutes="0"+minutes;
	}
	if (seconds<=9){
		seconds="0"+seconds;
	}
	if (document.layers){
		document.layers.theClock.document.write("" + hours + ":" + minutes + ":" + seconds);
		document.layers.theClock.document.close()
	}else if (document.all){
		theClock.innerHTML="" + hours + ":" + minutes + ":" + seconds;
	}
	clockID = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
   clockID = setTimeout("UpdateClock()", 500);
}

function KillClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }
}
function paieska(){
	if (!laukas){
		laukas = "search[field]";
	}
		document.getElementById(laukas).value = "%"+document.getElementById(laukas).value+"%";
}

function Show_Hide(FormName,SelObject){
	if (document.images){
		for (i=0;i<FormName.length;i++){
			var txt_field=FormName.elements[i];
			if (txt_field.type=="text" && txt_field.title){
				if(SelObject.value==txt_field.title){
					document.getElementById(txt_field.title+'_1').style.display = "block";
					laukas = txt_field.name;
				}else{
					document.getElementById(txt_field.title+'_1').style.display = "none";
					txt_field.value = "";
				}
			}
		}
	}
}

