function openPopup(url) { 
    myPopup = window.open(url,'myPopup','directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=yes,width=200,height=200');
	if (myPopup.blur) myPopup.focus();
}
function highlight(object) {
    if (document.getElementById && document.getElementById(object) != null){
         node = document.getElementById(object).style.background='#F2F2F2';
	}
}
function lowlight(object,bgcolor) {
    if (document.getElementById && document.getElementById(object) != null)
         node = document.getElementById(object).style.background=bgcolor;
}
function confirmSubmit(cText) {
	var agree=confirm(cText);
	if (agree)
		return true ;
	else
		return false ;
}
function checkUncheckAll(theElement) {
	var theForm = theElement.form, z = 0;
	while (theForm[z].type == 'checkbox') {
		theForm[z].checked = theElement.checked;
		z++;
	}
}

function CheckAll(fmobj) {
  for (var i=0;i<fmobj.elements.length;i++) {
    var e = fmobj.elements[i];
    if ( (e.name != 'checkall') && (e.type=='checkbox') && (!e.disabled) ) {
      e.checked = fmobj.checkall.checked;
    }
  }
}

function getRandomNum(lbound, ubound) {
	return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}
function getRandomChar(number, lower, upper, other, extra) {
	var numberChars = "0123456789";
	var lowerChars = "abcdefghijklmnopqrstuvwxyz";
	var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var otherChars = "`~!@#$%^*()-_=+[{]}\\|;:'\",<.>/? ";
	var charSet = extra;
	if (number == true)
	charSet += numberChars;
	if (lower == true)
	charSet += lowerChars;
	if (upper == true)
	charSet += upperChars;
	if (other == true)
	charSet += otherChars;
	return charSet.charAt(getRandomNum(0, charSet.length));
}
function getPassword(length, extraChars, firstNumber, firstLower, firstUpper, firstOther,
latterNumber, latterLower, latterUpper, latterOther) {
	var rc = "";
	if (length > 0)
	rc = rc + getRandomChar(firstNumber, firstLower, firstUpper, firstOther, extraChars);
	for (var idx = 1; idx < length; ++idx) {
		rc = rc + getRandomChar(latterNumber, latterLower, latterUpper, latterOther, extraChars);
	}
	return rc;
}
function redirectMail() {
	window.location.href= 'http://pop.escapenet.ch/admin.asp?strFormView=mail'
}
function redirectAdmin() {
	window.location.href= 'https://pop.escapenet.ch/admin.asp?strFormView=admin'
}
function redirectEndor() {
	window.location.href= 'http://service.escapenet.ch/admin.asp?action=endor'
}
function redirectBeta() {
	window.location.href= 'http://pop.escapenet.ch'
}
	
function rtedit(fid,lid){
	window.open("rtedit.aspx?fid="+fid+"&lid="+lid,"rtedit","toolbar=no,location=no,directories=no,scrollbars=no,status=yes,menubar=no,resizable=no,width=400,height=500");
}

function openWin( windowURL, windowName, windowFeatures ) { 
	return window.open( windowURL, windowName, windowFeatures ) ; 
}

function folderswitch(theFolder) {
	if (theFolder.className=='folderminus') {
		theFolder.className='folderplus';
	}
	else {
		theFolder.className='folderminus';
	}
}
