﻿function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
  	x.src=x.oSrc;
}

function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() {
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function changeBG(id, color){
	alert("tmp")
	document.all[id].style.backgroundColor = color;
}


function hide_fld(sID)
{
	if (document.all[sID+ "_id"].style.display=='none') 
		document.all[sID+ "_id"].style.display = '';
	else
		document.all[sID+ "_id"].style.display = 'none';
}

function regform () {
	var iki, param,i, amount;
	iki=document.forms["regnew"].length-2;
	param = true;
    for (i=0; i < iki; i++) {
    	amount = document.forms["regnew"].elements[i].value;
        if (amount == "" && i != 2 && i != 9)
        	param = false;
        }
        if (param==true) {
        	var rezult, s
            s = new String(document.forms["regnew"].elements["email"].value);
            rezult = s.search("@");
            if (rezult > 0)
            	document.regnew.submit();
            else
            	alert("El. paštas nurodytas neteisingai");
        }
       	else
       	alert("Pariškinti laukai negali būti tušti");
}

function winconfirm(url, lang)
{
	var  conf;
	switch (lang) {
 	case 'eng':
  		conf="Are you sure you want to delete this record?";
		break;
  	default:
		conf="Jus tikrai norite ištrinti šitą įrašą?";
  		break;
  	} 
	if (window.confirm(conf)) {
		document.location.href=url;	
 	}
}

function submit_new_comment() {
if (document.forma.comment.value !="" && document.forma.nick.value!="") 	
	document.forma.submit();
else
	alert("Laukai negali būti tušti")	
}

function vote() {
	document.voting.submit();
}
function dosubmit() {
	document.reg.submit();
}
function unisubmit() {
	document.uniform.submit();
}
function open_window_detail(url,target, width,height,top,left,toolbar, status, menubar, scrollbars, resize)
{	
	var options = "toolbar=" + toolbar +  ",status=" + status + ",menubar=" + menubar + ",scrollbars=" + scrollbars + ",resizable=" + resize + ",top=" + top + ",left=" + left + ",width=" + width + ",height="+ height;
	var adv= window.open( url,target,options);
}

function open_window(url, winname, width,height,top,left)
{	
	var s, m;
	var d;
	var shortoptions 
	var options = "toolbar=0,status=0,menubar=0,scrollbars=1, resizable=1,"
	shortoptions="top=" + top + ",left=" + left + ",width=" + width + ",height="+ height;
	
	if (winname=='gener') {
		d = new Date();
		s = d.getSeconds();
		m = d.getMinutes();
		s="s" + s;
		m="m" + m; 
		winname="content" + s + m;
	}
	
	options=options + shortoptions;  
	var adv= window.open( url,winname,options);
}

function subscribe(act) {
	var def="vardas@e-paštas.lt";
	if (act=="def") {
		if (document.subscribe_frm.email.value=="") 
			document.subscribe_frm.email.value=def;
	}
	else {
		if (document.subscribe_frm.email.value==def)
			document.subscribe_frm.email.value="";
	}		
}
 

 
function change_data(img, txt) {

	if (img!='' && img!='/images/spacer.gif')
		document.main_pic.src=img;
	
	document.all.xxx.innerText=txt;
}

