function moveTo(element,x, y) {
  element.style.marginLeft= x;
  element.style.marginTop =y;
}

function didinti(obj){
	var element=document.getElementById('la');
	document.getElementById('img').src=obj;
	element.style.display="block";
	element.style.position="absolute";
	element.style.zIndex="10";
	if (parseInt(navigator.appVersion)>3) {
 		if (navigator.appName=="Netscape") {
  				winW = window.innerWidth;
  				winH = window.innerHeight;
 				}
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
			  winW = document.body.offsetWidth;
  				winH = document.body.offsetHeight;
 				}
		}
	var aukstis=element.style.height;
	var plotis=element.style.width;	
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			moveTo(element,((winW/7)-(plotis/2)-80),-aukstis-300);
			}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			moveTo(element,((winW/7)-(plotis/2)-80),-aukstis-300);
			}
		}
	else
				moveTo(element,((winW/7)-(plotis/2)),-aukstis);
	element.focus();
}
function close(){
	var element=document.getElementById('la');
	element.style.display="none";
}

function keisk(id,who,url){
	var test=url.search("&");
	if (test>=0){
			url=url+"&";
			}
	  else{
		if (test==-1)
			url=url+"?";
	  	}
	if (who==1) {
	window.open(url+"rusiuoti="+id,"_self");
	}
	if (who==2) 
	window.open(url+"rodyti="+id,"_self");
}
function submitas(){
	document.getElementById("forma").submit();
}
function ismesti(url,id){
	var element=document.getElementById('form');
	if (id=="2"){
			element.action=url+"/confirm_view";
	}
	else{
		element.action=url+"/krepselis_view";
	}
}
			function submitCart(){
				document.getElementById('cart').submit()
			}
			function trintiCart(id){
				if (confirm("Ar norite ištrinti šią prekę?")){
					document.getElementById('kiekis_'+id).value=0
					document.getElementById('cart').submit()
					return true
				}
				else return false
			}
			function deleteCart(){
				document.getElementById('cart').action = './removeCart'
				document.getElementById('came_from').value=""
				document.getElementById('cart').submit()
			}
			function orderCart(){
				document.getElementById('came_from').value='cart_order'
				document.getElementById('cart').submit()
			}
			

