<!-- Hide

// ----------------- Sutik kezelese
var expDays = 30;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function SetCookie (name, value) {
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = "/";
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
		((path == null) ? "" : ("; path=" + path)) +  
		((domain == null) ? "" : ("; domain=" + domain)) +    
		((secure == true) ? "; secure" : "");
}

function getCookieVal (offset) {  
var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1) endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg) return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}
	return null;
}

function SetCookie2(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
}

// _w : which span ID
// _h : (h)ide or (s)how
function toggleT(_w,_h) {
	if (document.all) { // is IE
		if (_h=='s') eval("document.all."+_w+".style.visibility='visible';");
		if (_h=='h') eval("document.all."+_w+".style.visibility='hidden';");
	} else { // is NS? 
		if (_h=='s') eval("document.layers['"+_w+"'].visibility='show';");
		if (_h=='h') eval("document.layers['"+_w+"'].visibility='hide';");
	}
}

// toggle visibility of a form element
function toggleVis(_id) {
	if (document.all) { // is IE
		eval("var currentstate = document.all."+_id+".style.visibility;");
	}
	else { // NS
		eval("var currentstate = document.layers['"+_id+"'].visibility;");
	}
	if (currentstate=="visible" || currentstate=="show") {
		toggleT(_id,'h');
	} else {
		toggleT(_id,'s');
	}
}

function togglefields() {
	var theval = document.class_editor_form.t.options[document.class_editor_form.t.selectedIndex].value;
	var theval = document.class_editor_form.t.value;
	if (theval==1) {
		toggleT('divt1','s');
		toggleT('divt2','h');
		toggleT('divt3','h');
	}
	if (theval==2) {
		toggleT('divt1','h');
		toggleT('divt2','s');
		toggleT('divt3','h');
	}
	if (theval==3) {
		toggleT('divt1','h');
		toggleT('divt2','h');
		toggleT('divt3','s');
	}
}

// toggle on/off form elements for the scanner input form
function toggleScannerFields() {
	var theval = document.class_editor_form.scannertype.options[document.class_editor_form.scannertype.selectedIndex].value;
	var theval = document.class_editor_form.scannertype.value;
//	alert('val='+theval);
	if (theval==1) {
		toggleT('div_speed','h');
		toggleT('div_park','h');
	}
	if (theval==2) {
		toggleT('div_speed','s');
		toggleT('div_park','h');
	}
	if (theval==3) {
		toggleT('div_speed','h');
		toggleT('div_park','s');
	}
}

function getElement(id) { 
return document.getElementById ? document.getElementById(id) : 
document.all ? document.all(id) : null; 
} 

function displayEl(id) { 
var el = getElement(id); 
if (el && el.style) el.style.display = ''; 
} 

function undisplayEl(id) { 
var el = getElement(id); 
if (el && el.style) el.style.display = 'none'; 
} 
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-


function numOnly(oTxt) {
    if (!/^[\d\.]+$/.test(oTxt.value) || isNaN(oTxt.value)) {
        oTxt.value = oTxt.value.substring(0,oTxt.value.length-1);
    }
}

function urlencode(text) {
	text=text.replace(/\//g,"%2F");
	text=text.replace(/\?/g,"%3F");
	text=text.replace(/\\/g,"%2F");
	text=text.replace(/=/g,"%3D");
	text=text.replace(/&/g,"%26");
    return text;
  }

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_swapImgRestore() { //v3.0
  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 MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

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 validate(form,field) {
	var theval = eval("this.document." + form + "." + field + ".value");
//	alert (field + "=" + theval + "\nvalue="+theval.value + "\n");
	if (!theval || theval == "") {
		return false;
	}
	return true;
}

function validate_form(form,fields,fieldnames) {
	var field_array = fields.split(",");
	var fieldname_array = fieldnames.split(",");
	var res = true;
	var part_num=0;
	var req_fields = "";
	while (part_num < field_array.length) {
		if (!validate(form, field_array[part_num])) {
			req_fields = req_fields + '\n'+fieldname_array[part_num];
//			alert(fieldname_array[part_num]+" is a required field!");
			res = false;
		}
		part_num+=1;
	}
	if (res==true) {
		eval (form+'.editor_submit_js.value=1;');
		eval (form+'.submit();');
	} else {
		alert('A következő mező(ke)t kötelező kitölteni:\n'+req_fields+'\n\nEllenőrizze az adatokat és próbálja újra.');
	}
}

function checkAll(field) {
	for (i = 0; i < field.length; i++) {
		field[i].checked = true;
	}
}

function uncheckAll(field) {
	for (i = 0; i < field.length; i++) {
		field[i].checked = false;
	}
}

var nn4 = (navigator.appName.indexOf("Netscape") > -1 && navigator.appVersion.indexOf("4") > -1) ? true:false
var ie = (document.all) ? true:false
var nn6 = (document.getElementById && !document.all) ? true:false

function browser(id) {
	var layer = (nn4) ? document.layers[id] : (ie) ? document.all[id] : document.getElementById(id)
	return layer;
}

function writeContent(id,text) {
	var layer = browser(id);  //get path to layer using global browser function
	var content;
	content = text;
	if (nn4) {
		layer.document.open();
		layer.document.write(content); //write content to layer
		layer.document.close();
//		layer.visibility="visible"	//change visibility to visible
	}
	else {
		layer.innerHTML = content  //write content to layer
//		layer.style.visibility="visible"	//change visibility to visible
	}
}

function showLayer(id) {
	var layer = browser(id);
	if (!nn4) {
		layer.style.visibility="visible";
	} else {
		layer.visibility="visible";
	}
}

function hideLayer(id) {
	var layer = browser(id);
	if (!nn4) {
		layer.style.visibility="hidden";
	} else {
		layer.visibility="hidden";
	}
}

function fill_shipping_data (form_name) {
	eval("document."+form_name+".ship_name.value = document."+form_name+".contact_name.value");
	eval("document."+form_name+".ship_company.value = document."+form_name+".company.value");
	eval("document."+form_name+".ship_address.value = document."+form_name+".address.value");
	eval("document."+form_name+".ship_city.value = document."+form_name+".city.value");
	eval("document."+form_name+".ship_state.value = document."+form_name+".state.value");
	eval("document."+form_name+".ship_zip.value = document."+form_name+".zip.value");
	return true;
}

// check validity of an email address
function emailcheck(cur, fieldname) {
	var string1 = eval("cur."+fieldname.name+".value");
	if ( (string1.indexOf("@") == -1) || (string1.indexOf(".") == -1) ) {
		alert("Please input a valid email address!\n");
		return false;
	}
}

// delete link confirmation popup message
function confirmLink(theLink, theSqlQuery) {
    var is_confirmed = confirm(theSqlQuery);
    if (is_confirmed) {
        theLink.href += '&is_js_confirmed=1';
    }
    return is_confirmed;
}

// table row color changer as mouse moves over
// stolen from PHPmySQLAdmin :\
function setPointer(theRow, thePointerColor) {
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') { return false; }
    if (typeof(document.getElementsByTagName) != 'undefined') {
		var theCells = theRow.getElementsByTagName('td');
    } else if (typeof(theRow.cells) != 'undefined') {
		var theCells = theRow.cells;
    } else {
		return false;
	}
    var rowCellsCnt  = theCells.length;
//    for (var c = 0; c < rowCellsCnt; c++) { theCells[c].style.backgroundColor = thePointerColor; }
    for (var c = 0; c < rowCellsCnt; c++) {
		theCells[c].className = thePointerColor;
	}
    return true;
}

// open an URL in a new window
function openNewWindow(URL,window_width,window_height) {
	day = new Date();
	id = day.getTime();
	if (window_width=="") {window_width='250';}
	if (window_height=="") {window_height='300';}
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width="+window_width+",height="+window_height+"');");
}

// open an URL in a new window
function openPalmWindow(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=230,height=370');");
}

function wait_and_redirect(delay,page) {
	string="pauseforalert("+page+");";
	setTimeout(string,delay);
}

function pauseforalert(page) {
	eval ("window.location="+page);
}

function checkEmail(strng) {
	var error=true;
	if (strng == "") {
	   error = false;
	}
    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = false;
    }
    else {
	//test email for illegal characters
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
		if (strng.match(illegalChars)) {
			error = false;
		}
    }
	return error;    
}

// email
function checkEmail_2(strng) {
	var error="";
	if (strng == "") {
	   error = "You didn't enter an email address.\n";
	}
    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
	//test email for illegal characters
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
		if (strng.match(illegalChars)) {
			error = "The email address contains illegal characters.\n";
		}
    }
	return error;    
}


// phone number - strip out delimiters and check for 10 digits

function checkPhone (strng) {
	var error = "";
	if (strng == "") {
	   error = "You didn't enter a phone number.\n";
	}
	var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
    if (isNaN(parseInt(stripped))) {
       error = "The phone number contains illegal characters.";
      }
    if (!(stripped.length == 10)) {
	error = "The phone number is the wrong length. Make sure you included an area code.\n";
    } 
	return error;
}


// password - between 6-8 chars, uppercase, lowercase, and numeral
function checkPassword (strng) {
	var error = "";
	if (strng == "") {
	   error = "You didn't enter a password.\n";
	}
    var illegalChars = /[\W_]/; // allow only letters and numbers
    if ((strng.length < 6) || (strng.length > 8)) {
       error = "The password is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
      error = "The password contains illegal characters.\n";
    } 
    else if (!((strng.search(/(a-z)+/)) && (strng.search(/(A-Z)+/)) && (strng.search(/(0-9)+/)))) {
       error = "The password must contain at least one uppercase letter, one lowercase letter, and one numeral.\n";
    }  
	return error;    
}    


// username - 4-10 chars, uc, lc, and underscore only.
function checkUsername (strng) {
	var error = "";
	if (strng == "") {
	   error = "You didn't enter a username.\n";
	}
    var illegalChars = /\W/; // allow letters, numbers, and underscores
    if ((strng.length < 4) || (strng.length > 10)) {
       error = "The username is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "The username contains illegal characters.\n";
    } 
	return error;
}       


// non-empty textbox
function isEmpty(strng) {
	var error = "";
	if (strng.length == 0) {
		error = "The mandatory text area has not been filled in.\n"
	}
	return error;	  
}

// was textbox altered
function isDifferent(strng) {
	var error = ""; 
	if (strng != "Can\'t touch this!") {
		error = "You altered the inviolate text area.\n";
	}
	return error;
}

// exactly one radio button is chosen
function checkRadio(checkvalue) {
	var error = "";
   if (!(checkvalue)) {
       error = "Please check a radio button.\n";
    }
	return error;
}

// valid selector from dropdown list
function checkDropdown(choice) {
	var error = "";
    if (choice == 0) {
    	error = "You didn't choose an option from the drop-down list.\n";
    }    
	return error;
}    

//-->

