var uriWindow;
function $(id)
{
	if(document.getElementById(id))
	{
		return document.getElementById(id);
	}
}

function clone(obj){

    if(obj == null || typeof(obj) != 'object')

        return obj;



    var temp = new obj.constructor(); // changed (twice)

    for(var key in obj)

        temp[key] = clone(obj[key]);



    return temp;

}

function focusFlash()
{
	$('flashLevel').style.zIndex = "6";
}

function unfocusFlash()
{
	$('flashLevel').style.zIndex = "0";

}

debugArray = new Array();
debugOn = true;
function debug(msg, targetId)
{
	if(debugOn)
	{
		curDate = new Date();
		dateStr = "["+curDate.getHours()+":"+curDate.getMinutes()+":"+curDate.getSeconds()+"] ";

		debugArray.push(dateStr + msg);
		$(targetId).innerHTML = " <b>-- javascript debug --</b> <br />";
		for(var i = 0; i < debugArray.length && i < 5; i++)
		{
			var c = debugArray.length-i-1;
			$(targetId).innerHTML += debugArray[c]+" <br />";
		}
	}
}

fi = true;
function cropTextBlock(target, lines) {
	var textNode = $(target);
	var temp = textNode.innerHTML;
	var newHTML = "";
	for(var i = 0; i < lines; i++)
	{
		newHTML += " <br />";
	}
	textNode.innerHTML = newHTML;
	var aimForHeight = textNode.offsetHeight;
	aimForHeight += (1 * i);
	textNode.innerHTML = temp;
	newHTML = textNode.innerHTML;
	while(textNode.offsetHeight > aimForHeight)
	{
		newHTML = newHTML.substring(0,newHTML.length-2);
		textNode.innerHTML = newHTML+"...";
	}

	fi = false;
}

function officePicker(dropdown)
{
	window.location.href = '/'+dropdown.options[dropdown.selectedIndex].value
}

function moveElement(target, newParent)
{
	$(newParent).appendChild($(target));
}

function toggleDisplay(id, toggles)
{
	toggles = toggles.split("|");
	if(document.getElementById(id))
	{
		object = document.getElementById(id);
		if(object.style)
		{
			if(object.style.display == toggles[0] && toggles[1])
			{
				object.style.display = toggles[1];
			}
			else if(object.style.display == toggles[1] && toggles[2])
			{
				object.style.display = toggles[2];
			}
			else
			{
				object.style.display = toggles[0];
			}
		}
	}

	return false;
}

function showLightBox(contentId)
{
	if($(contentId))
	{
		newCenterTop = 0;
		contentOnTheMove = false;
		$('lightbox_container').style.display = 'block';
		$('lightbox_center').style.display = 'block';
		$('lightbox_dump').appendChild($('lightbox_contents').childNodes[0]);
		$(contentId).style.display = 'block';
		$('lightbox_contents').appendChild($(contentId));
		setTimeout("$('lightbox_center').style.marginLeft = '-' + ($('lightbox_contents').offsetWidth/2) + 'px';", 1);

		this.close = function () {
			$('lightbox_container').style.display = 'none';
			$('lightbox_center').style.display = 'none';

			return false;
		}

		this.slideCenter = function () {
			if(newCenterTop > $('lightbox_center').offsetTop)
			{
				if(newCenterTop - $('lightbox_center').offsetTop < 4)
				{
					moveCenterTop = (newCenterTop - $('lightbox_center').offsetTop);
				}
				else
				{
					moveCenterTop = 4;
				}
			}
			else if(newCenterTop < $('lightbox_center').offsetTop)
			{
				if($('lightbox_center').offsetTop - newCenterTop < 4)
				{
					moveCenterTop = -(newCenterTop - $('lightbox_center').offsetTop);
				}
				else
				{
					moveCenterTop = -4;
				}
			}
			else
			{
				contentOnTheMove = false;
				return false;
			}
			$('lightbox_center').style.top = ($('lightbox_center').offsetTop + moveCenterTop) + 'px';
			setTimeout("this.slideCenter();",10);
		}

		this.position = function () {
			newTop = Window.getScrollTop()-document.body.offsetHeight;
			newHeight = Window.getHeight()+document.body.offsetHeight;

			offset = document.body.offsetHeight - Window.getScrollTop() - Window.getHeight();
			newHeight = newHeight + offset;

			$('lightbox_container').style.top = newTop+'px';
			$('lightbox_container').style.height = newHeight+'px';

			newCenterTop = Window.getScrollTop() + (Window.getHeight() / 2) - 100;
			newCenterTop = Math.round(newCenterTop);
			if($('lightbox_center').offsetTop == 0)
			{
				$('lightbox_center').style.top = newCenterTop+'px';
			}
			if(!contentOnTheMove)
			{
				contentOnTheMove = true;
				setTimeout("this.slideCenter();",10);
			}
		}

		$('close').onclick = $('lightbox_container').onclick = this.close;

		window.addEvent('scroll', this.position);
		window.addEvent('resize', this.position);
		this.position();
	}
}

function displayDiv(divId)
{
	var displayState = document.getElementById(divId).style.visibility;
	if (displayState != 'visible')
	{
		document.getElementById(divId).style.visibility = "visible";
	}
	else
	{
		document.getElementById(divId).style.visibility = "hidden";
	}
}

function hideLightBox()
{
	$('lightbox_container').style.display = 'none';
	$('lightbox_center').style.display = 'none';
}

function formValueHints(id)
{
	form = $(id);
	var formElements = form.elements;
	for(i = 0; i < formElements.length; i++)
	{
		if(formElements[i].title != "" && formElements[i].value == "")
		{
			formElements[i].value = formElements[i].title;
			formElements[i].onfocus = function () {
				if(this.value == this.title)
				{
					this.value = "";
				}
			};
			formElements[i].onblur = function () {
				if(this.value == "" && this.title != "")
				{
					this.value = this.title;
				}
			};
		}
	}

	form.addEvent("submit", function () {
		var formElements = this.elements;
		for(i = 0; i < formElements.length; i++)
		{
			if(formElements[i].title != "" && formElements[i].value == formElements[i].title)
			{
				formElements[i].value = "";
			}
		}
	});
}

var onBodyLoadFunctions = new Array();
function initBodyLoad()
{
	for(i = 0; i < onBodyLoadFunctions.length; i++)
	{
		eval(onBodyLoadFunctions[i]);
	}
}

function function_exists( function_name ) {
	if (typeof function_name == 'string'){
		return (typeof window[function_name] == 'function');
	} else {
		return (function_name instanceof Function);
	}
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

function getElementsByClassName(searchName, target)
{
	if(target == undefined)
	{
		target = document;
	}

	elementArray = target.getElementsByTagName('*');
	arrayLength = elementArray.length;
	returnArray = new Array();
	for(i = 0; i < arrayLength; i++)
	{
		if(elementArray[i].className == searchName)
		{
			returnArray.push(elementArray[i]);
		}
	}

	return returnArray;
}

function windowURI(url, w, h,time,resizable)	// windowURI(link,width,height,time(close the new window after x seconds),resizable(1 -> true)
{
	if(time == undefined)
		time = 0;

	if(resizable == undefined)
		resizable = 1;

	uriWindow = window.open(url,"Window_print","menubar=no,scrollbars=1,left=10,top=0,width="+w +" ,height="+h +",resizable="+resizable);

	if(time != 0 && time != -1)
	{
		setTimeout('uriWindow.close();',time);
	}
}

function windowPrint(url, w, h)
{
	//alert(url);
	printWindow=window.open(url,"Window_print","menubar=no,scrollbars=1,left=10,top=1,width="+w +" ,height="+h +",resizable=1")
}

var exampleWindow;
function windowExample(url, w, h)
{
	//alert(url);
	if(exampleWindow)
		exampleWindow.focus();
	exampleWindow=window.open(url,"Window_print","menubar=no,scrollbars=1,left=10,top=1,width="+w +" ,height="+h +",resizable=1")
}

function openWindow(text)
{
	while((text.indexOf("%BR%") != -1))
	{
		text = text.replace("%BR%","<BR>");
	}
	myWin = window.open("","nCt", "left=400, top=300,width=180,height=30,status=no,toolbar=no,menubar=no,scrollbars=auto,resizable=yes");
	myWin.document.write("<html><head><title>Note</title></head>");
	myWin.document.write ("<body><script>function closeWindow(){window.close()} \n\n setTimeout(\"closeWindow()\",1000);</script>"+text+"</body></html>");
	//setTimeout("myWin.close()",200);
	//myWin.document.write("<center><p><input type='button' value='Afsluiten' name='close' onClick='window.close()'></p><center>");
}

function CheckTab(el)
{
	if ((document.all) && (9==event.keyCode) && (event.ctrlKey))
	{
		el.selection=document.selection.createRange();
	    setTimeout("ProcessTab('" + el.id + "')",0);
	}
	if ((document.all) && (83==event.keyCode) && (event.ctrlKey))
	{
		document.forms[0].submit();
		openWindow('De pagina is opgeslagen');
	}
}

function ProcessTab(id)
{
	document.all[id].selection.text=String.fromCharCode(9);
	document.all[id].focus();
}

function changeColor(el, color1, color2)
{
	//alert(el);
	document.getElementById(el).style.background = (document.getElementById(el).style.background == color1) ? color2 : color1;
}

function test(cell,color1,color2)
{
	cell.style.background = (cell.style.background == color1) ? color2 : color1;
}

function checkUserForm()
{
	if(document.forms[0].username.value=="")
	{
		alert('U moet een gebruikersnaam opgeven!');
		return false;
	}

	/*if(document.forms[0].email.value=="")
	{
		alert('U moet email opgeven!');
		return false;
	}*/

	if(document.forms[0].password.value=="")
	{
		alert('U moet password opgeven!');
		return false;
	}

	var value = false;

	for(i=0;i<document.forms[0].elements.length;i++)
	{
		if(document.forms[0].elements[i].type=='checkbox')
		{
			if(document.forms[0].elements[i].checked==true)
			{
					value=true;
					break;
			}
		}
	}
	if(value==false)
	{
		alert('U dient minimaal 1 groep te selecteren!');
		return false;
	}
	return true;
}

function checkUpdateUserPropertiesForm()
{
	if(document.forms[0].username.value=="")
	{
		alert('U moet een gebruikersnaam opgeven!');
		return false;
	}

	/*if(document.forms[0].email.value=="")
	{
		alert('U moet email opgeven!');
		return false;
	}*/

	if(document.forms[0].password.value=="")
	{
		alert('U moet password opgeven!');
		return false;
	}

	return true;
}

function checkGroupForm()
{
	if(document.forms[0].name.value=="")
	{
		alert('U moet een naam voor de groep opgeven!');
		return false;
	}

	if(document.forms[0].profileId.value=="")
	{
		alert('U moet een profiel selecteren!');
		return false;
	}
}

function checkDescriptionAmount(maxAmount)
{
	if(document.descForm.personAmount.value<maxAmount)
	{
		return true;
	}
	else
	{
		alert("U kunt niet meer dan " + maxAmount + " personen inschrijven");
		return false;
	}
}

function TrackCount(fieldObj,countFieldName,maxChars)
{
	var countField = eval("fieldObj.form."+countFieldName);
	var diff = maxChars - fieldObj.value.length;

	// Need to check & enforce limit here also in case user pastes data
	if (diff < 0)
	{
		fieldObj.value = fieldObj.value.substring(0,maxChars);
		diff = maxChars - fieldObj.value.length;
	}
	countField.value = diff;
}

function LimitText(fieldObj,maxChars)
{
	var result = true;
	if (fieldObj.value.length >= maxChars)
		result = false;

	if (window.event)
		window.event.returnValue = result;
	return result;
}

function imgOn(menuObj)
{
	name = menuObj.name;
	leftImage = "img"+name+1;
	rightImage = "img"+name+2;
	document.images[leftImage].src="images/menu_low.gif";
	document.images[rightImage].src="images/menu2_low.gif";
}

function imgOut(menuObj)
{
	name = menuObj.name;
	leftImage = "img"+name+1;
	rightImage = "img"+name+2;
	document.images[leftImage].src="images/menu_hi.gif";
	document.images[rightImage].src="images/menu2_hi.gif";
}

function imgSubOn(menuObj)
{
	name = menuObj.name;
	leftImage = "subimg"+name+1;
	rightImage = "subimg"+name+2;
	document.images[leftImage].src="images/menu_sub_low.gif";
	document.images[rightImage].src="images/menu2_low.gif";
}

function imgSubOut(menuObj)
{
	name = menuObj.name;
	leftImage = "subimg"+name+1;
	rightImage = "subimg"+name+2;
	document.images[leftImage].src="images/menu_sub_hi.gif";
	document.images[rightImage].src="images/menu_sub2_hi.gif";
}

function checkAllFields(element)
{
	if(confirm("Hiermee gaat een eventuele selectie verloren"))
	{
		for(var i=0;i<document.forms[0].elements.length;i++)
		{
			document.forms[0].elements[i].checked=checkFields;
		}
		checkFields = !checkFields;
		if(checkFields)
			element.value = "alles aan";
		else
			element.value = "alles uit";
	}
}

function emptyForm()
{
	for(var i=0;i<document.forms[2].elements.length;i++)
	{
		if(document.forms[2].elements[i].type=="text")
			document.forms[2].elements[i].value="";
	}
}

function changeImage(img, newSrc)
{
	img.src = newSrc;
}

function open_new_window(location)
{
	new_window = window.open(location,"mailafriend","width=400,height=450,scrollbars=yes,left=10,top=10");
}

function checkAll(formName)
{
	for(var i=0;i<document.forms[formName].elements.length;i++)
	{
		if(document.forms[formName].elements[i].type=='checkbox' && document.forms[formName].elements[i].alt!='none')
			document.forms[formName].elements[i].checked = true;
	}
}

function unCheckAll(formName)
{
	for(var i=0;i<document.forms[formName].elements.length;i++)
	{
		if(document.forms[formName].elements[i].type=='checkbox' && document.forms[formName].elements[i].alt!='none')
			document.forms[formName].elements[i].checked = false;
	}
}

function checkElement(elementId)
{
	document.getElementById(elementId).checked = true;
}

/*function checkForm(formName, userId)
{
	var found = false;
	for(var i=0;i<document.forms[formName].elements.length;i++)
	{
		if(document.forms[formName].elements[i].type=='checkbox')
		{
			if(document.forms[formName].elements[i].checked==true)
			{
				found = true;
				break;
			}
		}
	}
	if(!found)
	{
		alert('Gelieve minimaal 1 gebruiker aan te vinken');
		checkElement('author_'+userId);
	}
	return found;
}*/

dropDownEdited = false;

function setEndHour(beginDropDown)
{
	var endHouresDropDown = document.getElementById('endhoures');
	var startMinutesDropDown = document.getElementById('startminutes');
	if(endHouresDropDown.selectedIndex<beginDropDown.selectedIndex)
	{
		endHouresDropDown.options[beginDropDown.selectedIndex].selected = true;
	}
	setEndMinute(startMinutesDropDown);
}

function setEndMinute(beginDropDown)
{
	var startHouresDropDown = document.getElementById('starthoures');
	var endHouresDropDown = document.getElementById('endhoures');
	var endMinutesDropDown = document.getElementById('endminutes');
	if(startHouresDropDown.selectedIndex==endHouresDropDown.selectedIndex)
	{
		if(endMinutesDropDown.selectedIndex<beginDropDown.selectedIndex)
		{
			endMinutesDropDown.options[beginDropDown.selectedIndex].selected = true;
		}
	}
}

function checkEmpty(elementNames)
{
	var errorElements = new Array();
	var j=0;
	for(var i=0;i<elementNames.length;i++)
	{
		if(document.getElementById(elementNames[i]).value=='')
		{
			errorElements[j] = elementNames[i];
			j++;
		}
	}
	return errorElements;
}

function checkAgenda()
{
	var elementArray = new Array("mainhead");
	var errorElements = checkEmpty(elementArray);
	var errorMessage = '';
	if(errorElements.length != 0)
	{
		for(var k=0;k < errorElements.length;k++)
		{
			if(errorElements[k]=='mainhead')
			{
				errorMessage += 'Gelieve een titel in te vullen';
			}
		}
		alert(errorMessage);
		return false;
	}
	return true;
}

var currentlySelected = -1;
function selectOne(dropDown,optionid)
{
	if(currentlySelected!=-1 || optionid)
	{
		for(var i=0;i<dropDown.options.length;i++)
		{
			if(optionid)
			{
				if(dropDown.options[i].id==optionid)
					dropDown.options[i].selected = true;
				else
					dropDown.options[i].selected = false;
			}
			else
			{
				if(i==currentlySelected)
					dropDown.options[i].selected = false;
				if(i==dropDown.selectedIndex)
					dropDown.options[i].selected = true;
			}
		}
	}
	currentlySelected = dropDown.selectedIndex;
}

function mouseOver(adminButton)
{
	var splittedSrc = adminButton.src.split("/");
	var restSrc = "";
	fileName = splittedSrc[splittedSrc.length-1];
	for(var i=0;i<splittedSrc.length-1;i++)
	{
		restSrc += splittedSrc[i] + "/";
	}
	var splittedFileName = fileName.split(".");
	adminButton.src =  restSrc + splittedFileName[0] + "_hov" + "." + splittedFileName[1];
}

function mouseOut(adminButton)
{
	var splittedSrc = adminButton.src.split("/");
	var restSrc = "";
	fileName = splittedSrc[splittedSrc.length-1];
	for(var i=0;i<splittedSrc.length-1;i++)
	{
		restSrc += splittedSrc[i] + "/";
	}
	var splittedFileName = fileName.split(".");
	var newFileName = splittedFileName[0].substring(0,splittedFileName[0].length-4);
	adminButton.src =  restSrc + newFileName + "." + splittedFileName[1];
}

function checkGroups()
{
	for(var i=0;i<document.forms.sendGroups.elements.length;i++)
	{
		if(document.forms.sendGroups.elements[i].type=="checkbox" && document.forms.sendGroups.elements[i].checked)
		{
			return true;
		}
	}
	alert('Gelieve een groep te kiezen.');
	return false;
}

function checkGroupAmount()
{
	var currentForm = document.forms[0];
	for(var i=0;i<currentForm.elements.length;i++)
	{
		if(currentForm.elements[i].type=="checkbox")
		{
			if(currentForm.elements[i].checked)
				return true;
		}
	}
	return confirm("Deze gebruiker is nu niet meer gekoppeld aan een groep. U vindt hem nu alleen nog terug in het overzicht van alle gebruikers.");
}

function displayFormat(dropDown)
{
	if(dropDown.options[dropDown.selectedIndex].value == 322)
		document.getElementById("obl_format").style.display = "";
	else
		document.getElementById("obl_format").style.display = "non";
}

function executeAction(action,actionObject)
{
	//alert(actionObject.id + ":" + action);
	switch(action)
	{
		case "display":
		{
			if(actionObject.style.display!="")
				actionObject.style.display = "";
			break;
		}
		case "hide":
		{
			if(actionObject.style.display!="none")
				actionObject.style.display = "none";
			break;
		}
	}
}

function getElementValue(elementName)
{
	return document.getElementById(elementName).value;
}

function getElementLength(elementName)
{
	//alert(document.getElementById(elementName).value.length);
	return document.getElementById(elementName).value.length;
}

function setVisibility(elementId,visible)
{
	if(visible)
		document.getElementById(elementId).style.display = "";
	else
		document.getElementById(elementId).style.display = "none";
}

function displayFormat(dropDown)
{
	if(dropDown.options[dropDown.selectedIndex].value == 1656)
		document.getElementById("obl_format").style.display = "";
	else
		document.getElementById("obl_format").style.display = "none";
}

function checkEmptyId(inputId)
{
	var translationArray = new Array(2);
	translationArray['content'] = '[[TRANSLATION.error_content]]';
	translationArray['mainhead'] = '[[TRANSLATION.error_mainhead]]';

	if(document.getElementById(inputId).value == '')
	{

		alert(translationArray[inputId]);
		return false;
	}
	return true;
}

function copyInputTo(copyFromElement,copyElementId) /* Copy the value from an element to another element onchange (e.g. menutitle to mainhead) */
{
	document.getElementById(copyElementId).value = document.getElementById(copyFromElement).value;
}

function createTarget(t)
{
    window.open("", t, "width=600,height=550,scrollbars=1");
    return true;
}

function getHTTPObject() {

  var xmlhttp;

  /*@cc_on

  @if (@_jscript_version >= 5)

    try {

      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {

      try {

        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

      } catch (E) {

        xmlhttp = false;

      }

    }

  @else

  xmlhttp = false;

  @end @*/

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {

    try {

      xmlhttp = new XMLHttpRequest();

    } catch (e) {

      xmlhttp = false;

    }

  }

  return xmlhttp;

}

function popUp(URL, width, height,scroll)
{
	if(!scroll) scroll = 0;
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars="+scroll+",location=0,statusbar=0,menubar=0,resizable=0,width="+width+",height="+height+",left = 320,top = 272');");
}

function checkNumeric(textfield,message)		// Checks whether the userinput is numeric or not
{
	inputstring = textfield.value;
	for (i = 0; i < inputstring.length; i++)
	{
		ch = inputstring.substring(i, i+1);
		if (ch < "0" || ch > "9")
		{
			if(message != '')
				alert(message);
			textfield.value = textfield.value.substring(0, i);
			textfield.focus();
			return false;
		}
	}
	return true;
}


function handleLoginSubmit(form)
{
	if(!md5_vm_test())
	{
		return true;
	}
	else
	{


		p = $('pass').value;
		c = $('challenge').value;

		document.getElementById('passwordS').value = hex_md5(hex_md5(p) + c);
		document.getElementById('loginnameS').value = document.getElementById('loginname').value
		document.getElementById('shadowForm').submit();
		return false;
	}

}

function generateRandomString(length)
{

	var retVal = '';

	for (i=0; i < length; i++)
	{
		retVal += String.fromCharCode((parseInt(Math.random() * 1000) % 94) + 33);
	}

	return retVal;
}

var emptiedElements = new Array();
function js_in_array(the_needle, the_haystack)
{
	var the_hay = the_haystack.toString();
	if(the_hay == ''){
		return false;
	}
	var the_pattern = new RegExp(the_needle, 'g');
	var matched = the_pattern.test(the_haystack);
	return matched;
}

function emptyValue(element)
{
	if(!js_in_array(element.id,emptiedElements))
	{
		emptiedElements[emptiedElements.length] = element.id;
		element.value='';
	}
}

var fixedModuleWindows = new Array();

function showModuleInfoDiv(elmId)
{
	if (!js_in_array(elmId, fixedModuleWindows))
	{
		scrollTop = window.getScrollTop();
		topCoord = scrollTop+20;

		document.getElementById(elmId).style.top = topCoord+'px';
		document.getElementById(elmId).style.left = '20px';
		document.getElementById(elmId).style.display = 'block';
	}
}

function clickModuleWindow(elmId)
{
	if (js_in_array(elmId, fixedModuleWindows))
	{
		// Remove this module window from the array
		tempArray = new Array();

		for (i=0; i<fixedModuleWindows.length; i++ )
		{
			if (fixedModuleWindows[i] != elmId)
			{
				tempArray[tempArray.length] = fixedModuleWindows[i];
			}
		}

		fixedModuleWindows = tempArray;
		delete tempArray;

		document.getElementById(elmId).style.display = 'none'; // Hide the module window
	}
	else
	{
		fixedModuleWindows[fixedModuleWindows.length] = elmId; // Put this module window in the array
		new Drag.Move($(elmId), {'container': bodyC});
		$(elmId).style.cursor = 'move';
	}
}

function moduleWindowOut(elmId)
{
	if (!js_in_array(elmId, fixedModuleWindows))
	{
		document.getElementById(elmId).style.display = 'none'; // Hide the module window
	}
}


function hookNoFlashMenuJS()
{
	mainMenu = $('menuNoFlash_UL');
	if(mainMenu)
	{
		for(i = 0; i < mainMenu.childNodes.length; i++)
		{
			if(mainMenu.childNodes[i].tagName == "LI" && mainMenu.childNodes[i].id != undefined && mainMenu.childNodes[i].id != "")
			{
				mainMenu.childNodes[i].onmouseover = function ()
				{
					displaySubMenu(this);
				}

				mainMenu.childNodes[i].onmouseout = mainMenu.childNodes[i].onmouseover;
			}
		}
	}
}

function displaySubMenu(menuParent)
{
	noflashSubMenus = new Array();
	a = document.getElementsByTagName("UL");
	  while (element = a[i++]) {
	    if (element.className == "subMenuNoFlash") {
	      noflashSubMenus.push(element);
	    }
	  }

	for(i = 0; i < noflashSubMenus.length; i++)
	{
		if(noflashSubMenus[i].id != "subMenuNoFlash_"+menuParent.id)
		{
			noflashSubMenus[i].style.display = "none";
		}
		else
		{
			noflashSubMenus[i].style.display = "block";
			noflashSubMenus[i].style.top = "23px";
			noflashSubMenus[i].style.left = (menuParent.offsetLeft-2)+"px";

			if(noflashSubMenus[i].offsetWidth < menuParent.offsetWidth)
			{
				noflashSubMenus[i].style.width = menuParent.offsetWidth+"px";
			}
		}
	}

}

function removeNonUrlChars(elmId)
{
	string = $(elmId).value;
	
	string = string.replace(/[^a-zA-Z 0-9 \- \_]+/g, '');
	string = string.replace(/\s+/g, '');

	$(elmId).value = string;
}