//Hover efektas
function hover(action,active,id,class_suffix){
	if(active!='') return;
	var obj=document.getElementById(id);
	if(action==1){
		obj.className=obj.className+class_suffix;
		}
	else{
		obj.className=obj.className.substr(0,obj.className.length-class_suffix.length);
		}
}
function set_mailer(id,one,two,three){ 
	var obj=document.getElementById(id);
	obj.href='mailto:'+one+two+three;
	}
   
function resize(h,w,path){
	var kof_h;
	var kof_w;
	var kof;
	var img,con;
	var x,y;
	sw=screen.width;
	sh=screen.height-200;
	kof_h=h/sh;
	kof_w=w/sw;
	var extra=0;
	//Pagal narsykle pridedam paklaidas
	if(navigator.appName=="Microsoft Internet Explorer"){
		extra=100;
		}
	if(navigator.appName=="Netscape"){
		extra=65;
		}	
	if(navigator.appName=="Opera"){
		extra=60;
		}			
	
	//Tikriname ar paveiksliuko dedamoji buvo didesne uz ekrano ir resiziname
	if(kof_h>1 || kof_w>1){
		if(kof_h>kof_w){
			kof=kof_h
			}
		else{
			kof=kof_w;
			}
		h=h/kof;
		w=w/kof;
		}
	img=document.getElementById('image');
	img.style.width=w+'px';
	img.style.height=h+'px';
	con=document.getElementById('container');
	//self.resizeTo(w,document.body.clientHeight+100);
	self.resizeTo(w,con.offsetHeight+extra);
	
	//Centruojame langa i vidury
	x=((sw/2)-(w/2));
	y=((sh=screen.height/2)-(h/2));
	self.moveTo(x,y);
	}
	
function resize_container(){
	var maxx=0;
	var container=document.getElementById('container');
	var center=document.getElementById('center1');
	var right=document.getElementById('right1');
	var left=document.getElementById('left1');	
	if(left!=null){
		if(left.offsetHeight>maxx){
			maxx=left.offsetHeight;
			}	
		}
	if(center!=null){		
		if(center.offsetHeight>maxx){
			maxx=center.offsetHeight;
			}
		}
	if(right!=null){		
		if(right.offsetHeight>maxx){
			maxx=right.offsetHeight;
			}
		}
	if(document.body.clientHeight<=maxx){
		container.style.height=maxx+"px";
		}		
	else{
		container.style.height='100%';
		}
	if(document.getElementById('products_list')!=null){		
		document.getElementById('products_list').style.display="block";
		var height=document.getElementById('products_list').offsetHeight;
		if(height>container.offsetHeight-350){
			document.getElementById('products_list').style.height=(container.offsetHeight-350)+'px';
			}
		else{
			document.getElementById('products_list').style.height=height+'px';
			}
		}
	if(document.getElementById('news_list')!=null){	
		document.getElementById('news_list').style.height=(container.offsetHeight-450)+'px';
		}	
	}
function restore_input(name,value){
	var form=document.getElementById("products");
	var inp=form.getElementsByTagName("input");
	for (var i = 0; i < inp.length; i++){
		if(inp[i].name!=name){
			if(isNaN(inp[i].value)==true || inp[i].value==''){
				inp[i].value=value;
				}
			}
		}
	}
function rodyti_paveiksliuka(kelias,h,w){
//alert(h+" "+w);
sw=screen.width;
sh=screen.height-80;
if (h>sh){
	kof=sh/h;
	h=sh;
	w=kof*w;
	}
if (w>sw) {
	kof=sw/w;
	w=sw;
	h=kof*h;
	}
x=((sw/2)-(w/2));
y=((sh/2)-(h/2));
image=window.open('',(new Date()).getTime(),'toolbar=no,status=no,resizeable=no,scrollbars=0,width='+w+',height='+h+',left='+x+',top='+y);
image.moveTo(x,y);
image.document.write('<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" onClick="window.close()" style="cursor:hand;cursor:pointer;">')
image.document.write('<img src="'+kelias+'" height="'+h+'" width="'+w+'"/>');
image.document.write('</body>');
}
