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 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');	
}

startList = function() {
	if (document.getElementById) {
		navRoot = document.getElementById("mainMenuUL");
		if (navRoot) {
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=showDropdown;
					node.onmouseout=hideDropdown;
				}
			}
		}
	}
}
window.onload=startList;

function showDropdown() {
	if (document.all) this.className+=" over";
	var leftPos = findPosX(this);
	var topPos = findPosY(this);
	for (i=0; i<this.childNodes.length; i++) {
		node = this.childNodes[i];
		if (node.nodeName=="UL") {
			node.style.left = leftPos + "px";
			node.style.top = (topPos + 30) + "px";
		}
	}
}
function hideDropdown() {
	this.className="";
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}