var show_activ = 0;
var hide_activ = 0;
var boxesHideTimeout=null;
var boxesHideDelay=2000;
var numChars = new RegExp("[0-9]+");
var smallChars = new RegExp("[a-záéíóöőúüű]+");
var bigChars = new RegExp("[A-ZÁÉÍÓÖŐÚÜŰ]+");
var iranyitoszamChars = new RegExp("[0-9]");
var telefonChars = new RegExp("[0-9\(\)\/\+\-]");
var emailChars = new RegExp("[a-zA-Z0-9\-\.\_\@]");
var notEmailChars = new RegExp("[^\@]+");
var datumChars = new RegExp("[0-9\-\.]");
var calendarDefaultClasses = new Array();
//---------------------------------------------------------
function submitenter(myfield,e)
	{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	if (keycode == 13)
		{
		myfield.form.submit();
		return false;
		}
	else

		return true;
	}

//---------------------------------------------------------
function dataArraySelect(dataArray,searchedField,searchedValue)
	{
	var a;
	var returnArray=new Array();
	for (a=0;a<dataArray.length;a++)
		{
		if (dataArray[a][searchedField]==searchedValue)
			{
			returnArray.push(dataArray[a]);
			}
		}
	return returnArray;
	}
//---------------------------------------------------------
function activateDates(dateTdObjects)
{
var a,oTd,testArray;
for (a=0;a<dateTdObjects.length;a++)
	{
	oTd=document.getElementById(dateTdObjects[a]);
	if (oTd)
		{
		testArray=dataArraySelect(calendarDefaultClasses,0,dateTdObjects[a]);
		if (testArray.length==0)
			{
			calendarDefaultClasses.push(new Array(dateTdObjects[a],oTd.className));
			}
		oTd.className='active';
		}
	}
}
//---------------------------------------------------------
function deActivateDates(dateTdObjects)
{
var a,oTd,testArray;
for (a=0;a<dateTdObjects.length;a++)
	{
	oTd=document.getElementById(dateTdObjects[a]);
	if (oTd)
		{
		testArray=dataArraySelect(calendarDefaultClasses,0,dateTdObjects[a]);
		oTd.className=testArray[0][1];
		}
	}
}
//---------------------------------------------------------
function checkExprKey(sValidExpr,e)
/* 
** reg exp alapján elfogadja vagy visszautasítja a leütött karaktert
**
** sValidExpr: valid regular expression
** nKeycode: pressed key
** sKeycode: character representation of pressed key
** last modification: 2005.02.08. by zizi
*/
	{
	var nKeycode;
		
	if (window.event) nKeycode = window.event.keyCode;
	else if (e) nKeycode = e.which;
	else return true;

	var sKeycode = String.fromCharCode(nKeycode);
	if ((nKeycode==8)||(nKeycode==0)||(sValidExpr.exec(sKeycode))) return true;

	return false;
}
//---------------------------------------------------------
function checkExprPaste(sValidExpr,e)
// 	onPaste="return checkExprPaste(telefonChars,event)" - Firefox alatt nem jó!!!


/*
** reg exp alapján elfogadja vagy visszautasítja a paste-elni kívánt tartalmat, ha az text
** 
** sValidExpr: valid regular expression
** last modification: 2005.02.08.by zizi
*/
	{
	var i, j, s, w;


	if (window.event) s = window.clipboardData.getData("Text");
	else return true;

	j = s.length; 
	for (i = 0; i < j; i++)
		{
		w = s.charAt(i);
		if (! sValidExpr.exec(w)) return false;
		}
	return true;
}
//---------------------------------------------------------
function setBoxesHideTimeout()
	{
	if (boxesHideTimeout)
		{window.clearTimeout(boxesHideTimeout);}
	boxesHideTimeout=window.setTimeout("hideAllBoxes()",boxesHideDelay);
	}
//---------------------------------------------------------
function windowOpen(url,windowName,windowWidth,windowHeight)
	{
	html = window.open(url,windowName,"resizeable=0,scrollbars=0,width="+windowWidth+",height="+windowHeight);
	//html.document.belepesForm.referrer.value=window.location;
	}
//---------------------------------------------------------
function enlarge(PICname,w,h) {
	popup = window.open('','','toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=auto,width='+w+',height='+h);
	popup.document.write('<HTML><BODY><div style="position: absolute; left: 0px; top: 0px; right:0px; bottom:0px;"><TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0><TR VALIGN=MIDDLE><TD ALIGN=CENTER>'); popup.document.write('<IMG SRC="'+PICname+'" BORDER=0 OnClick=self.close()></TR></TD></TABLE></div></BODY></HTML>');
	popup.document.close();
}
//---------------------------------------------------------
function onFormListChange(formList)
	{
	formList.options[formList.selectedIndex].style.backgroundColor='#FFCC00';
	}
//---------------------------------------------------------
function scrollWindowOpen(url,windowName,windowWidth,windowHeight)
	{
	html = window.open(url,windowName,"resizable=0,scrollbars=1,width="+windowWidth+",height="+windowHeight);
	}
//---------------------------------------------------------
function resizableWindowOpen(url,windowName,windowWidth,windowHeight)
	{
	html = window.open(url,windowName,"resizable=1,scrollbars=1,width="+windowWidth+",height="+windowHeight);
	}
//---------------------------------------------------------
function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//---------------------------------------------------------

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
//---------------------------------------------------------

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//---------------------------------------------------------

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//---------------------------------------------------------

function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
// ----- ----- ----- ----- ----- ----- ----- -----
function ar_formaz(strObj)
	{
	var stringObject=String(strObj);
	var a;
	var returnString='';
	var counter=0;
	for (a=stringObject.length-1;a>=0;a--)
		{
		counter++;
		if (counter==4)
			{
			returnString=' '+returnString;
			counter=1;
			}
		returnString=stringObject.substr(a,1)+returnString;
		}
	return returnString;
	}

function getBokTitle(_index) {
	return document.getElementById('bok_title_' + _index) || {style:{}};
}

function _showTip(_index) {
	_hideTips();
	getBokTitle(_index).style.display = 'none';
}

function _hideTip(_index) {
	getBokTitle(_index).style.display = 'block';
	activ_hide = _index;
}

function _hideTips() {
	_hideTip(show_activ);
	show_activ = 0;      	
}

var _to = null;

function tipOver(_index) {
	if (_to) window.clearTimeout(_to);
        if (show_activ!=_index) _showTip(_index);
	show_activ = _index;
}

function tipOut(_index) {
	if (_to) window.clearTimeout(_to);
	_to = window.setTimeout('_hideTips()', 500);
}

//<-

browser = navigator.appName;
browserNum = parseInt(navigator.appVersion);
		
if ((browser == "Netscape") && (browserNum < 5))
{
	// Netscape 4.x
	layerRef = "document.layers['";
	endLayerRef = "']";
	styleRef = "";
}
else if ((browser == "Netscape") && (browserNum >= 5))
{
	// Netscape 6
	layerRef = "document.getElementById('";
	styleRef = ".style";
	endLayerRef = "')";
}
else
{
	// Internet Explorer
	layerRef = "document.all['";
	endLayerRef = "']";
	styleRef = ".style";
}

// emlékezés az éppen látható rétegre
oldLayer = "none";

function showMenu(layerName)
{
		// a kívánt réteg megjelenítése	
eval(layerRef + layerName + endLayerRef + styleRef + ".display = 'block'");
		// a második ablak elrejtése	
	if (oldLayer != "none")
	{
		eval(layerRef + oldLayer + endLayerRef + styleRef + ".display = 'none'");
	}
	if (oldLayer == layerName)
	{
		oldLayer = "none";
	}
	else
	{
		oldLayer = layerName;
	}
}


//---------------------------------------------------------

var menu = 0;

function hide () {
	for (i=1; i<=4; i++)	{
		document.getElementById("nagyito_" + i).style.visibility = "hidden";
		}
	}
function bekap (sorsz){
	on();
	hide();
	document.getElementById("nagyito_" + sorsz).style.visibility = "visible";
	}
function on (){	menu++;	}
function off ()	{ setTimeout("check()",0); }
function check (){
	menu--;
	if (menu==0) { hide(); }
	}