// JavaScript Document
<!--
    var alreadySubmitted = false;
    /**
     * This method is used to change the submit action of
     * the form.
     */
    function changeSubmitAction(formId, action)
    {
        
        var form = document.getElementById(formId);
        // verify that the form has not been submitted.
        if (alreadySubmitted == true) {
              window.status="Submitted";
              return;
        }

        // else set the submitted indicator
       alreadySubmitted = true;

        // reset the submitted indicator after 10 seconds.
       setTimeout('alreadySubmitted = false;window.status="Unlocked";', (1000*10));

        form.action = action;
        
        return true;
    }

    /**
     * This method is used to submit form.
     */
    function submitForm(formId, action)
    {
        var form = document.getElementById(formId);
        // verify that the form has not been submitted.
        if (alreadySubmitted == true) {
              window.status="Submitted";
              return;
        }

        // else set the submitted indicator
       alreadySubmitted = true;

        // reset the submitted indicator after 10 seconds.
       setTimeout('alreadySubmitted = false;window.status="Unlocked";', (1000*10));

        form.action = action;

        // submit form
        form.submit();
        
        return false;
    }


    function freshSearch(formId, action)
    {
        var form = document.getElementById(formId);
 
        form.uniqueSortProperty.value = "";

        return submitForm(formId, action);
    }

    function changePage(formId, action, offset)
    {
        var form = document.getElementById(formId);
 
        form.offset.value = offset;

        return submitForm(formId, action);
    }

    function sortByProperty(formId, action, property)
    {
        var form = document.getElementById(formId);

        // switch order direction if same property

        if (form.uniqueSortProperty.value == property) {
            if (form.uniqueSortPropertyOrder.value == '0') {
                form.uniqueSortPropertyOrder.value = 1;
            } else {
                form.uniqueSortPropertyOrder.value = 0;
            }
        } else {
            form.uniqueSortPropertyOrder.value = 0;
        }
 
        form.uniqueSortProperty.value = property;
        


        return submitForm(formId, action);
    }

	/**
	 * Open a popup
	 */
	function popUp(id, URL) {
		window.open(URL, id, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,width=500,height=300');
		return false;
	}
	
	/**
	 * Open selection page in popup
	 */
	function goToSelectionPopup(url, formId, formElement, searchParameter) {
		var form = document.getElementById(formId);
		var searchEntry = form.elements[formElement].value;
		return popUp(formElement, url + '?' + searchParameter + '=' + searchEntry);
	}

	/**
	 * This method is used to update the parent form with the selection made in the current page
	 */
	function updateSelectionAndExit(currentForm, selection, parentForm, parentFormSearchEntry) {
		var currentForm = document.getElementById(currentForm);
		var parentForm = window.opener.document.getElementById(parentForm);
		var citySelectObject = currentForm.elements[selection];
		var citySelectObjectText = citySelectObject.options[citySelectObject.options.selectedIndex].text
		parentForm.elements[selection].value = citySelectObject.value;
		parentForm.elements[parentFormSearchEntry].value = citySelectObjectText;
		window.close();
	}


    /**
     * Nullifys an element of the form that are passed as parameters
     */
    function nullifyFormElement(formId, elementId, e) {
        if(document.all)e = event;
        if(e.keyCode != 9 && e.keyCode != 13) {
            var form = document.getElementById(formId);
            form.elements[elementId].value=null;
        }
    }    
        
    /**
     * Flags the window as loaded in the status flag
     */
    function flagWindowLoaded() {
		window.statusFlag = 'windowLoaded';
		return true;
	}
	
    /**
     * Flags the window as not loaded in the status flag
     */
    function flagWindowNotLoaded() {
		window.statusFlag = 'windowNotLoaded';
		return true;
	}
-->