// JavaScript Document

var menuobj;
var over = false;

function get(id)
{
	return document.getElementById(id);
}

function mouseX(evt) 
{
if (evt.pageX) return evt.pageX;
else if (evt.clientX)
   return evt.clientX + (document.documentElement.scrollLeft ?
   document.documentElement.scrollLeft :
   document.body.scrollLeft);
else return null;
}

function mouseY(evt) 
{
if (evt.pageY) return evt.pageY;
else if (evt.clientY)
   return evt.clientY + (document.documentElement.scrollTop ?
   document.documentElement.scrollTop :
   document.body.scrollTop);
else return null;
}

function windowW()
{
	var winW = 630;

	if (parseInt(navigator.appVersion)>3) 
	{
 		if (navigator.appName.indexOf("Microsoft")!=-1) 
  			winW = document.body.offsetWidth;
		else
			winW = window.innerWidth;		
	}
	return winW;
}

function windowWTop()
{
	var winW = 630;

	if (parseInt(navigator.appVersion)>3) 
	{
 		if (navigator.appName.indexOf("Microsoft")!=-1) 
  			winW = top.document.body.offsetWidth;
		else
			winW = top.window.innerWidth;		
	}
	return winW;
}

function windowH()
{
	var winH = 460;
	
	if (parseInt(navigator.appVersion)>3) 
	{
 		if (navigator.appName.indexOf("Microsoft")!=-1)
  			 winH = document.documentElement.clientHeight; //winH = document.body.offsetHeight;
		else
			winH = window.innerHeight;
	}
	return winH;
}

function windowHTop()
{
	var winH = 460;

	if (parseInt(navigator.appVersion)>3) 
	{
 		if (navigator.appName.indexOf("Microsoft")!=-1)
  			winH = top.document.documentElement.clientHeight;
		else
			winH = top.window.innerHeight;
	}
	return winH;
}

function gotourl() 
{
  var i, args=gotourl.arguments; 
  for (i=0; i<(args.length-1); i+=2) 
  	eval(args[i]+".location='"+args[i+1]+"'");
}

function compare(val1, val2)
{
	if(val1 == val2)
		return true;
	else return false;
}

function show_div(div_id)
{
	var the_div = document.getElementById(div_id);
	if(the_div != null)
	{
		//the_div.style.top = mouseY(evt) - 25 + "px";
		//the_div.style.left = mouseX(evt) + "px";
		the_div.style.visibility = "visible";
	}
}

function hide_div(div_id)
{
	var the_div = document.getElementById(div_id);
	if(the_div != null)
	{
		the_div.style.visibility = "hidden";
		if(document.getElementById('big_img') != null)
			document.getElementById('big_img').src = 'blank.gif';
	}
}

function hide_div_top(div_id)
{
	var the_div = top.document.getElementById(div_id);
	if(the_div != null)
	{
		the_div.style.visibility = "hidden";
		the_div.style.left = "-800px";
		var sh_div = top.document.getElementById(div_id + "_shadow");
		if(sh_div != null)
		{
			sh_div.style.visibility = "hidden";
			sh_div.style.left = "-600px";
		}
	}
}

function show_div_center(div_id)
{
	var the_div = document.getElementById(div_id);
	if(the_div != null)
	{
		var width = the_div.style.width.substr(0,the_div.style.width.length-2);
		var height = the_div.style.height.substr(0,the_div.style.height.length-2);
		
		var toTop = 260; //windowH()/2 - height/2;
		var toLeft = windowW()/2 - width/2;		
		
		the_div.style.top = toTop + document.documentElement.scrollTop + "px";
		the_div.style.top = toTop + document.body.scrollTop + "px";
		the_div.style.left = toLeft + document.documentElement.scrollLeft + "px";
		the_div.style.left = toLeft + document.body.scrollLeft + "px";
		the_div.style.visibility = "visible";
	}
}

function show_picture_div_horiz_center(div_id, pic, title)
{
	var the_div = document.getElementById(div_id);	
	if(the_div != null)
	{
		
		var width = the_div.style.width.substr(0,the_div.style.width.length-2);
		var height = the_div.style.height.substr(0,the_div.style.height.length-2);
		if(pic.indexOf('.gif') == -1)
			document.getElementById('big_img').src = 'thumbnail.php?w=' + String(width-2) + '&h=0&img=' + pic;
		else
			document.getElementById('big_img').src = pic;
		
		var toTop = 60;
		var toLeft = windowW()/2 - width/2;		
		
		document.getElementById('kep_header').innerHTML = title;
				
		//the_div.style.top = toTop + document.documentElement.scrollTop + "px";
		the_div.style.top = toTop + document.body.scrollTop + "px";
		//the_div.style.left = toLeft + document.documentElement.scrollLeft + "px";
		the_div.style.left = toLeft + document.body.scrollLeft + "px";
		the_div.style.visibility = "visible";
	}
}

function show_div_center_top(div_id)
{
	var the_div = top.document.getElementById(div_id);
	if(the_div != null)
	{
		var width = the_div.style.width.substr(0,the_div.style.width.length-2);
		var height = the_div.style.height.substr(0,the_div.style.height.length-2);

		var toTop = windowHTop()/2 - height/2;
		var toLeft = windowWTop()/2 - width/2;		

		the_div.style.top = toTop + top.document.documentElement.scrollTop + "px";
		the_div.style.left = toLeft + top.document.documentElement.scrollLeft + "px";
		the_div.style.visibility = "visible";
		//WCH.Apply(div_id);
		
		var sh_div = top.document.getElementById(div_id + "_shadow");
		if(sh_div != null)
		{
			sh_div.style.top = toTop + document.documentElement.scrollTop + 15 + "px";
			sh_div.style.left = toLeft + document.documentElement.scrollLeft + 15 + "px";
			sh_div.style.visibility = "visible";
			//WCH.Apply(div_id + "_shadow");
		}
	}
}

function detail_sum(dbobj, arobj, sumobj)
{
	if(!isFinite(dbobj.value))
		dbobj.value = "1";
	sumobj.value = dbobj.value * arobj.value + " Ft";
}

/*function goto(urlstr)
{	
	document.location = urlstr;
	return true;
}*/