var menuHideTimeout=null;
var menuHideDelay=1000;
var menuShowDelay=400;
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 fbrkShowMenu1AfterTime(sMenu1Id)
{
fbrkClearMenuTimeout();
menuHideTimeout=window.setTimeout("fbrkShowMenu1('"+sMenu1Id+"')",menuShowDelay);
}
//---------------------------------------------------------
function fbrkShowMenu1(sMenu1Id)
{
fbrkClearMenuTimeout();
var menu1=document.getElementById('menu1');
var selectedMenu1=document.getElementById(sMenu1Id);
var menu2=document.getElementById('menu2');
menu1.innerHTML=selectedMenu1.innerHTML;
menu2.innerHTML='';
}
//---------------------------------------------------------
function fbrkShowMenu2AfterTime(sMenu2Id)
{
fbrkClearMenuTimeout();
menuHideTimeout=window.setTimeout("fbrkShowMenu2('"+sMenu2Id+"')",menuShowDelay);
}
//---------------------------------------------------------
function fbrkShowMenu2(sMenu2Id)
{
fbrkClearMenuTimeout();
var menu2=document.getElementById('menu2');
var selectedMenu2=document.getElementById(sMenu2Id);
menu2.innerHTML=selectedMenu2.innerHTML;
}
//---------------------------------------------------------
function fbrkClearMenuTimeout()
{
if (menuHideTimeout)
	{window.clearTimeout(menuHideTimeout);}
}
//---------------------------------------------------------
function fbrkHideMenuAfterTime()
{
fbrkClearMenuTimeout();
menuHideTimeout=window.setTimeout("fbrkHideMenu()",menuHideDelay);
}
//---------------------------------------------------------
function fbrkHideMenu()
{
var menu1=document.getElementById('menu1');
var menu2=document.getElementById('menu2');

if (document.getElementById('menu1'+defaultMenu1))
	{
	menu1.innerHTML=(defaultMenu1=='')?'':document.getElementById('menu1'+defaultMenu1).innerHTML;
	}
else
	{
	menu1.innerHTML='';
	}
menu2.innerHTML=(defaultMenu2=='')?'':document.getElementById('menu2'+defaultMenu2).innerHTML;
}
//---------------------------------------------------------
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 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;
	}
// ----- ----- ----- ----- ----- ----- ----- -----
var fbrkAllChecked = new Array();
// ----- ----- ----- ----- ----- ----- ----- -----
function fbrkGetCheckboxStatusIndex(oId)
{
var a;
for (a=0;a<fbrkAllChecked.length;a++)
	{
	if (fbrkAllChecked[a][0]==oId)
		{
		return a;
		}
	}

var newOId = new Array();
newOId.push(oId);
newOId.push(false);
fbrkAllChecked.push(newOId);
return fbrkAllChecked.length-1;
}
// ----- ----- ----- ----- ----- ----- ----- -----
function fbrkCheckAllCheckbox(formId,searchedPropertyName,searchedPropertyValue,invertSelect)
{
var f=document.getElementById(formId);

var oId=formId+searchedPropertyName+searchedPropertyValue;
var sIndex=fbrkGetCheckboxStatusIndex(oId);

if (fbrkAllChecked[sIndex][1])
	{ fbrkAllChecked[sIndex][1] = false; }
else
	{ fbrkAllChecked[sIndex][1] = true; }
for (var i=0;i<f.elements.length;i++)
	{
	var e = f.elements[i];
	if (e.type.toLowerCase()=="checkbox")
		{
		var eValue=(invertSelect)?!e.checked:fbrkAllChecked[sIndex][1];
		if ((searchedPropertyName=='name')&&(e.name==searchedPropertyValue))
			e.checked = eValue;
		if ((searchedPropertyName=='className')&&(e.className==searchedPropertyValue))
			e.checked = eValue;
		}
	}
}
// ----- ----- ----- ----- ----- ----- ----- -----
function fbrkSubmitFormWithType(formID,submit_type_value)
{
var f=document.getElementById(formID);
var submit_type=f.submit_type;
submit_type.value=submit_type_value;
f.submit();
}
