// by elar
function pic_win(pilt,laius,korgus,title) {  
	var src = "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'><TITLE>"+title+"</TITLE>"+
	"<BODY BGCOLOR='ffffff' topmargin='0' leftmargin='0' marginheight='0' marginwidth='0'>"+
	"<a href=\"#\" Onclick=\"self.close();\"><img src="+pilt+" border=0></a>"+
	"</BODY>";
	picwinpopup = window.open("","popDialog","height="+korgus+",width="+laius+",scrollbars=no");
	picwinpopup.document.write(src);
	picwinpopup.document.close();
}

// by elar (tőstetud siia modules/gallery/galerii.tpl'st)
function popGal(id,lang) {
	window.open('galerii.php?lang='+lang+'&id='+id,'','resizable=no,width=600,height=650,status=no,location=no,menubar=no,scrollbars=yes')
}
function popGSP(id,lang) {
	window.open('gsprod.php?lang='+lang+'&id='+id,'','resizable=no,width=520,height=650,status=no,location=no,menubar=no,scrollbars=yes')
}

function popIm(id){
	window.open("Showimage.php?id="+id,"popIm","top=10,left=20,resizable=no,width=200,height=200,status=no,location=no,menubar=no,scrollbars=yes")
}

function popProd(id){
	window.open("Showimage.php?id="+id+"&module=product","popProd","top=10,left=20,resizable=no,width=200,height=200,status=no,location=no,menubar=no,scrollbars=yes")
}


function popSpecialIm(id,module){
	window.open("Showimage.php?id="+id+"&module="+module,"popIm","top=10,left=20, resizable=no,width=200,height=200,status=no,location=no,menubar=no,scrollbars=yes")
}

function popUserRegForm(addValues){
	window.open("Register.php?"+addValues,"popUp","top=10,left=20,resizable=no,width=700,height=500,status=no,location=no,menubar=no,scrollbars=yes")
}

function checkInt(field, minInt, maxInt){
	var value=parseInt(field.value);
	field.value=value
	if((value<minInt) || (!value))
		field.value=minInt;
	else if(value>maxInt)
		field.value=maxInt;
}

function popCompare(){
	window.open("comparing.php?","popUp","top=10,left=20,resizable=yes,width=800,height=600,status=no,location=no,menubar=no,scrollbars=yes")
}

function popWin(url,he,wi){
	if(he<=0)he = '300';
	if(wi<=0)wi = '300';
	
	var kyssa=window.open(url,'','scrollbars=yes,width='+wi+',height='+he+',resizable=yes,top=10,left=10');	
}

function go(url) {
	window.location.href=url;
}

/*function printForm(id){
	window.open('printOrder.php',"popUp","top=10,left=20,resizable=no,width=700,height=500,status=no,location=no,menubar=no,scrollbars=yes")
}*/
function printForm(){
	go('order_pdf.php');
}

/*
var activeDMenuItem=0;
var activeMode=0;
function initLayers(maxID){
	for(i=1;i<=maxID;i++){
		var el=document.getElementById("pDmenu"+i);
		var el2=document.getElementById("Dbutton"+i);
		var el3=document.getElementById("Dmenu"+i);
		if(el && el2 && el3){
			var top= getTop(el2)+el2.offsetHeight;
			var left= getLeft(el2);
			var height=el3.offsetHeight;
			el.style.top=top;
			el.style.left=left;
			el.style.visibility='visible';
			el.style.height=1;
		}
	}
	refreshDMenu();
}

function showDLayer(id){
	activeMode=1;
	var el=document.getElementById("pDmenu"+id);
	var el2=document.getElementById("Dmenu"+id);
	
	if(activeDMenuItem && activeDMenuItem!=id)
		hideDLayer(activeDMenuItem);

	if(el && el2){
		var height=el2.offsetHeight;

		scroll(el,el.offsetHeight,height);
		activeDMenuItem=id
	}
}

function hideDLayer(id){ 
	if (document.readyState != 'complete') {
		setTimeout(function() { hideDLayer(id) }, 25);
		return;
	}

	var el=document.getElementById("pDmenu"+id);
	var el2=document.getElementById("Dmenu"+id);
	
	if(el && el2){
		var height=el2.offsetHeight;

		unscroll(el, height, 1);
		activeDMenuItem=0
	}
}

function refreshDMenu(lastMode){
	if(activeMode==0 && activeMode==lastMode &&  activeDMenuItem){
		hideDLayer(activeDMenuItem);	
	}	
	setTimeout('refreshDMenu("'+(activeMode?0:1)+'")',400); 	
}

function scroll(el,curHeight,height){
	var newHeight=curHeight+parseInt((height-curHeight)*0.2)+1
	if(newHeight>height)
		newHeight=height;

	el.style.height=newHeight;
	
	if(newHeight<height)
		setTimeout(function() { scroll(el,newHeight,height) }, 30);

	return;	
}

function unscroll(el,curHeight,height){
	if(activeDMenuItem==1)
		return ;
	var newHeight=parseInt((curHeight-height)/1.2)
	if(newHeight<height)
		newHeight=height;

	el.style.height=newHeight;
	
	if(newHeight>height)
		setTimeout(function() { unscroll(el,newHeight,height) }, 30);

	return;	
}

function getTop(item){
	var myTarget = item;  
	var top=0;
	while(myTarget!= document.body) {
		top += myTarget.offsetTop;    
		myTarget = myTarget.offsetParent;   
	} 
	return top;
}

function getLeft(item){
	var myTarget = item;  
	var left=0;
	while(myTarget!= document.body) {
		left += myTarget.offsetLeft;     
		myTarget = myTarget.offsetParent;   
	} 
	return left;
}
*/