
	/* Open a seperate window to display Abstract information
	*/
    function AbstractWindow(abstract){
       window.open('/showAbstract.php?session=' + abstract, abstract,'width=800,height=400,resizeable,scrollbars');
    }

	/* Open a standard prompt window (equivalent of F4 Prompt)
	*/
    function prompt1(PromptProgram) {
	    window.open('/maint/' + PromptProgram + ".php","prompt","width=700,height=400,resizeable,scrollbars");
    };

	/* return the selected informations from a prompt window (basically, code and description)
	*/   
	function returnPrompt1(selectedCode, selectedCodeValue, 
							selectedDescription, selectedDescriptionValue) {			
		opener.document.getElementById(selectedCode).value = selectedCodeValue;
		opener.document.getElementById(selectedDescription).innerHTML = selectedDescriptionValue;
		window.close();
	};

	/* Open a prompt window from the Schedule program (open communication between windows)
	*/
    function promptSchedule(PromptProgram) {
	    window.open("/maint/" + PromptProgram + ".php?Mode=S","prompt" + PromptProgram,"width=800,height=400,resizeable,scrollbars");
    };


	/* Open a seperate window to display HTML entered in a Text Area
	*/
    function showHTML(area){
    	var data = document.getElementById(area).value;
 
        var myForm = document.createElement("form");
        myForm.method="post" ;
        myForm.action = "/showHTML.php" ;
        myForm.target = "showHTML" ;
       var myInput = document.createElement("input") ;
        myInput.setAttribute("name", "data") ;
        myInput.setAttribute("value", data);
        myForm.appendChild(myInput) ;
        document.body.appendChild(myForm) ;
        window.open("", "showHTML",'width=800,height=400,resizeable,scrollbars');
        myForm.submit() ;
        document.body.removeChild(myForm) ;
        
    };

 	/* Wait for a specified number of milliseconds
 	*/ 	
  	function waitFor(millis) {
		var startDate = new Date();
		var dateNow = null;

		do { 
			dateNow = new Date(); 
		}
		while(dateNow-startDate < millis);
	};
  		
	/* Ensure that day information is being displayed when a user clicks a hiperlink on a list
		at the bottom of the pages
	*/
    function reg_link(myItem){
    var myItem = document.getElementById(myItem);
    var myButton = document.getElementById("button" + myItem.id);

        if (myItem.style.display == "none") {
            myItem.style.display = "block";
            myButton.src = "/images/arrowminus.gif";
        }
    };

	/* Show or hide the contents of a division and switch the display of a +/- button
	*/
    function show_hide(myItem){
    var myItem = document.getElementById(myItem);
    var myButton = document.getElementById("button" + myItem.id);

        if (myItem.style.display == "block") {
            myItem.style.display = "none";
            swapImage(myButton,"plus");
        }
        else {
            myItem.style.display = "block";
            swapImage(myButton,"minus");
        }
    };

    function swapImage(myImage, state) {
        if (state == "minus") {
            myImage.src = "/images/arrowminus.gif";
        }
        else {
            myImage.src = "/images/arrowplus.gif";
        }
    };
    
    /* To take care of one of those cruddy problems in IE. This functions ensures that sub menus
    	will work on the top left navigation menu
    */
	function startList() {
		if (document.all&&document.getElementById) {
			navRoot = document.getElementById("nav");
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
  					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	};

	/* Confirm delete when a delete key is pressed
	*/
	function confirmDelete() {
		if (confirm("Confirm Delete Request")) {
			return true;
		}
		else {
			return false;
		}
	};
	
	/* Send e-mail - parameter identifies which note format to use
			CIN = General information
	*/
	function sendEmail(type) {
		var mailTo = "mailto:";
		var name = "tuohyp";
		var at = "@comconadvisor.com";
		var subject = "I have a question";
		var body = "My question is";
		if (type == 'CIN') {
		}
		else if (type == 'xxx') {
			name = "registration";
			subject="I have a registration question";
			body="Please provide me with a booking form for Headstart Seminars only.";
		}
		self.location= mailTo + name + at + "?subject=" + subject + "&body=" + body;
	};
	
	/* Send an e-mail reference for a person
	*/
	function sendEmailReference(ref) {
		var mailTo = "mailto:";
		var name = "info";
		var at = "@systemideveloper.com";
		var subject = "Reference for the Summit";
		var body = "Please send me contact details for " + ref;
		self.location= mailTo + name + at + "?subject=" + subject + "&body=" + body;
	};	
	
	/* Validate the values input on the Alumni form
	*/
	function checkAlumniForm() {
	   var pressed = document.getElementById("cgioption").value;
	   for (counter = 0; counter < document.getElementById("cgioption").length; counter++) {
	   	alert(document.getElementById("cgioption")[counter].length);
	   }
	   if (pressed == "Delete" || pressed == "Cancel") {
	   		return true;
	   }
 	   var why = "";
    	why += checkEmail(document.getElementById("Email").value);
	    if (why != "") {
       		alert(why);
       		return false;
    	}
		return true;
	};
	
	
	/* Validate an e-mail address
	*/
	function checkEmail() {
		var error=false;
		var email=document.getElementById("Email").value;
		email = email.replace( /\s+$/g, "" );
		if (email != "") {

	    	var emailFilter=/^.+@.+\..{2,3}$/;
    		if (!(emailFilter.test(email))) { 
       			alert("Please enter a valid email address.\n");
       			error = true;
    		}
    		else {
       			var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         		if (email.match(illegalChars)) {
          			alert("The email address contains illegal characters.\n");
          			error = true;
       			}
    		}
		}
		document.getElementById("CheckButton").disabled = error;
	};
	
	
	
	/* return the value of the radio button that is checked */
	function getCheckedValue(radioObjName) {
		var radioObj = document.getElementsByName(radioObjName);
		var radioLength = radioObj.length;
		if(radioLength == undefined) {
			if(radioObj.checked) {
				return radioObj.value;
			}
			else {
				return "";
			}
		}
		for(var i = 0; i < radioLength; i++) {
			if(radioObj[i].checked) {
				return radioObj[i].value;
			}
		}
		return "";
	}

	/* Round to 2 decimal places */
	function r2(n) {
		ans = n * 1000
		ans = Math.round(ans /10) + ""
		while (ans.length < 3) {ans = "0" + ans}
		len = ans.length
		ans = '$' + ans.substring(0,len-2) + "." + ans.substring(len-2,len)
		return ans
	} 