	
	/**
	 * Shows element
	 */			
	function showElement(id)
	{
		var object = document.getElementById(id);
		object.style.display = 'block';
	}
	
	
	/**
	 * Hide element
	 */			
	function hideElement(id)
	{
		var object = document.getElementById(id);
		object.style.display = 'none';
	}
	
	
	/**
	 * Switch show/hide of element
	 */			
	function switchDisplayElement(id)
	{		
		$('#' + id).toggle();		
	}
	
	
	
	/**
	 * Shows curtain - for preventing double clicks
	 */			
	function showCurtain()
	{
		// move curtainText on center
		
		var object = document.getElementById('curtainText');
		var left = (document.body.clientWidth - 300) / 2;
		object.style.left = left + 'px';
		
		// removed - curtain is usually not visible on larges pages 
		/*
		var top = (document.body.clientHeight - 50) / 2;
		object.style.top = top + 'px';
		*/
		
		showElement('curtain');
		showElement('curtainText');
	}

	function hideCurtain()
	{
		$("#curtain").hide();
		$("#curtainText").hide();
	}
	
	
	/**
	 * Submit with confirmation and curtain
	 *
	 * @param string text confirmation text
	 */
	function safeSubmit(text)
	{
		if ((text=='') || confirm(text)) {
			showCurtain();
			this.disabled=true;
			return true;
		}
		else{
			return false;
		}
	}
	
	/**
	 * 1) Check values if 'next' button was pressed and if valuesCheck is requested
	 * 2) On successful valuescheck show curtain.
	 */
	function safeSubmitAndValuesCheck(submitType, valuesCheckFlag)
	{
		// values check
		if ((submitType == 'nextPage') && (valuesCheckFlag)) {
            if( window.valuesCheck !== undefined ) {
                checkResult = valuesCheck();
            } else {
                checkResult = form.valuesCheck();
            }
			if (checkResult) {
				checkResult = pilotValuesCheck();
			}
		} else {
			checkResult = true;
		}
		
		// curtain
		if (checkResult) {
			return safeSubmit('');
		} else {
			return false;
		}
	}
	
	
	/*
	 * PULLDOWN MENU 
	 */
	
	menuHover = function() {
		if (document.getElementById("mainMenuUL")) {
			var oMenu = document.getElementById("mainMenuUL").getElementsByTagName("LI");
			
			for (var i=0; i<oMenu.length; i++) {
				oMenu[i].onmouseover=function() {
					this.className+=" menuHover";
				}
			
				oMenu[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" menuHover"), "");
				}
			}
		}
	}
	
	if (window.attachEvent) {
		window.attachEvent("onload", menuHover);
	}


