// JavaScript Document		
	

	/*function determineBrowserType() {
	  form = document.forms[0];
	  if (document.all) { // IE
		form.browserType.value = "IE"
	  } else { // Netscape
		form.browserType.value = "Netscape"
	  }
	 alert(form.browserType.value)
	}	
	*/
	
	function MM_findObj(n, d) { //v4.0
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && document.getElementById) x=document.getElementById(n); return x;
	}
	
	function MM_showHideLayers() { //v3.0
	  var i,p,v,obj,args=MM_showHideLayers.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
		obj.visibility=v; }
	}
	
	
	// Step 3 - show/hide arrow for Ref 1
	function toggleRef(callingLink, changeDiv)
	{
		var ref = document.getElementById(changeDiv);
		var reflink = document.getElementById(callingLink.id);
		if (ref.style.display == 'none') {
			ref.style.display = 'block'			
			if(reflink.className.indexOf('edit')>0){
				reflink.className = 'arrowdownedit';}else{
				reflink.className = 'arrowdown';}
		} else {
			ref.style.display = 'none'
			if(reflink.className.indexOf('edit')>0){
				reflink.className = 'arrowonedit';}else{
				reflink.className = 'arrowon';}
		}
		
	}
	
	
	// Step 4 - profile questions
	
	/**********************************************************
		<span>s or <div>s come in pairs. The
		"contracted" forms have id=c0, c1, c2 (etc.), and
		the "expanded" forms have id=e0, e1, e2 (etc.)
	
		This function swaps the pair with the given
		divNum, and shows the expanded div if expanding is
		true, or the short one if expanding is false.
	**********************************************************/
	function swap( divNum, expanding )
	{
		if (expanding)
		{		
			setIdProperty("s" + divNum, "display", "none", true, divNum);
			setIdProperty("l" + divNum, "display", "inline", true, divNum);
		}
		else
		{
			setIdProperty("s" + divNum, "display", "inline", false, divNum);
			setIdProperty("l" + divNum, "display", "none", false, divNum);
		}		
	}

	setIdProperty = function(myval,x,y,toexpand, divNum)
	{
		if(toexpand)
		{
			
			if (myval=="s" + divNum)
			{				
				var theShort = document.getElementById(myval);		
				theShort.style.display = "none";				
			}
			
			if (myval=="l" + divNum)
			{				
				var theLong = document.getElementById(myval);		
				theLong.style.display = "inline";				
			}			
		}
		else
		{			
			if (myval=="s" + divNum)
			{				
				var theLong = document.getElementById(myval);		
				theLong.style.display = "inline";	
			}
			
			if (myval=="l" + divNum)
			{				
				var theShort = document.getElementById(myval);		
				theShort.style.display = "none";
			}				
		}
	}	
	
	// Help Box
	/***********************************************
	* Drop Down/ Overlapping Content-  Dynamic Drive (www.dynamicdrive.com)
	* This notice must stay intact for legal use.
	* Visit http://www.dynamicdrive.com/ for full source code
	***********************************************/
	
	function getposOffset(overlay, offsettype){
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	while (parentEl!=null){
	totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
	parentEl=parentEl.offsetParent;
	}
	return totaloffset;
	}
	
	function overlay(curobj, subobjstr, opt_position){
	if (document.getElementById){
	var subobj=document.getElementById(subobjstr)
	subobj.style.display=(subobj.style.display!="block")? "block" : "none"
	var xpos= 30 + getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
	var ypos= -30 + getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
	subobj.style.left=xpos+"px"
	subobj.style.top=ypos+"px"
	subobj.style.zIndex=20000
	// Wilson: Shim doesn't work in Opera, will overlay over the help box, so I excluded it.
	if(navigator.userAgent.indexOf('Opera') == -1){
		var shimobj=document.getElementById('selectBoxShim')
		if(subobj.style.display=="none"){
			shimobj.style.left="1px"
			shimobj.style.top="1px"
			shimobj.style.display="none"
		} else {
		shimobj.style.left=xpos+"px"
		shimobj.style.top=ypos+"px"
		shimobj.style.display="block"
		}
		shimobj.style.width=subobj.offsetWidth
		shimobj.style.height=subobj.offsetHeight
	}
	return false
	}
	else
	return true
	}
	
	function overlayclose(subobj){
	var subobj=document.getElementById(subobj)
	subobj.style.display="none"
	// Shim doesn't work in Opera, will overlay over the help box, so I excluded it.
	if(navigator.userAgent.indexOf('Opera') == -1){
		var shimobj=document.getElementById('selectBoxShim')
		shimobj.style.left="1px"
		shimobj.style.top="1px"
		shimobj.style.display="none"
		shimobj.style.width=subobj.offsetWidth
		shimobj.style.height=subobj.offsetHeight
	}
	}	
	// end Help	
	
	// Program Start Dates
	function showHideDates()
	{
		document.frmStep1.submit();		
	}
	
	function labelClickSupportSafari()
	{
		if (navigator.userAgent.indexOf("Safari") > 0) 
		  {
		  var labels = document.getElementsByTagName("label");
		  for (i = 0; i < labels.length; i++)
			{
			labels[i].addEventListener("click", addLabelFocus, false);
			}
		  }
 
		function addLabelFocus()
		  {
		  var item = document.getElementById(this.getAttribute("for"));
		  item.focus();
		  if (item.getAttribute("type") == "checkbox")
			{
			if (!item["checked"])
			  {
			  item["checked"] = true;
			  }
			else
			  {
			  item["checked"] = false;
			  }
			}
		  else if (item.getAttribute("type") == "radio")
			{
			var allRadios = document.getElementsByTagName("input");
			var radios = new Array();
			for (i = 0; i < allRadios.length; i++)
			  {
			  if (allRadios[i].getAttribute("name") == item.getAttribute("name"))
				{
				radios.push(allRadios[i]);
				}
			  }
			for (i = 0; i < radios.length; i++)
			  {
			  if (radios[i]["checked"] && 
			  radios[i].getAttribute("id") != item.getAttribute("id"))
				{
				radios[i]["checked"] = false;
				}
			  }
			item["checked"] = true;
			}
		  }
	}
	// Step 1	
	function onloadFunctionStep1()
	{				
		var theNoJShelp = document.getElementById("noJShelp");			
		theNoJShelp.style.display = "none";
		
		var theText = document.getElementById("defaultStartDates");			
		theText.style.display = "block";
		
		var thenoJavascriptDates = document.getElementById("noJavascriptStartDates");			
		thenoJavascriptDates.style.display = "none";			
		
		var theDates = document.getElementById("programStartDates");			
		theDates.style.display = "none";
		
		var selectedProgram = document.getElementById("selectProgram");
		
		//alert(selectedProgram.value);
		if (selectedProgram.value != "" )
		{
			
			var theText = document.getElementById("defaultStartDates");			
			theText.style.display = "none";	
			var theDates = document.getElementById("programStartDates");			
			theDates.style.display = "block";
			
			var showFullDates = document.getElementById("addWaitlist");	
			//showFullDates.style.display = "block";		
			
				
			var waitlistsel_nojs = document.getElementById("check_waitlist_nojs");
			//alert(waitlistsel_nojs);
			if (waitlistsel_nojs) {
			waitlistsel_nojs.style.display = "none";	
			}
			var waitlistsel = document.getElementById("check_waitlist");
			if (waitlistsel) {
			waitlistsel.style.display = "block";
			}
			
		}
		
		labelClickSupportSafari();
	}
	
	function addWaitlistDates()
	{
		var showFullDates = document.getElementById("addWaitlist");						
		showFullDates.style.display = "block";	
		
		var waitlistlink = document.getElementById("check_waitlist");
		waitlistlink.style.display = "none";
	
	}	
	
	// Step 2
	function onloadFunctionStep2()
	{
		document.frmStep2.rqf_txtFirstName.focus();
		
		var theNoJShelp = document.getElementById("noJShelp");			
		theNoJShelp.style.display = "none";
		
		labelClickSupportSafari();
		countryCode();
		
	}
	
	// Step 3
	function onloadFunctionStep3()
	{		
		//document.frmStep3.rqf_txtRefFullName1.focus();		
		var theNoJShelp = document.getElementById("noJShelp");			
		theNoJShelp.style.display = "none";
		
		var postSecondaryYesNo = document.getElementById("postSecondaryYesNo");			
		postSecondaryYesNo.style.display = "block";			
		
		var noJSpostSecondary = document.getElementById("noJSpostSecondary");			
		noJSpostSecondary.style.display = "none";			
		
		var institution = document.getElementById("institution");			
		institution.style.display = "none";
		
		var add_institution = document.getElementById("addInstitution");			
		add_institution.style.display = "none";
		
		var resumeYesNo = document.getElementById("resumeYesNo");			
		resumeYesNo.style.display = "block";			
		
		var noJSworkExperience = document.getElementById("noJSworkExperience");			
		noJSworkExperience.style.display = "none";			
		
		var workExperienceBox = document.getElementById("workExperienceBox");			
		workExperienceBox.style.display = "none";			
		
		//text limits
		var noJSmaxChars1 = document.getElementById("noJSmaxCharacters1");			
		noJSmaxChars1.style.display = "none";		
		var maxChars1 = document.getElementById("maxCharacters1");			
		maxChars1.style.display = "block";
		var noJSmaxChars2 = document.getElementById("noJSmaxCharacters2");			
		noJSmaxChars2.style.display = "none";		
		var maxChars2 = document.getElementById("maxCharacters2");			
		maxChars2.style.display = "block";
		var noJSmaxChars3 = document.getElementById("noJSmaxCharacters3");			
		noJSmaxChars3.style.display = "none";		
		var maxChars3 = document.getElementById("maxCharacters3");			
		maxChars3.style.display = "block";
		
		var checkPostSecondary = document.getElementById("hidden_radioPostSecondary");
		
		if(checkPostSecondary.value == "yes")
		{	
			var postSecVal = document.getElementById("radioPostSecondary1");
			postSecVal.checked = true;

			postSecondaryYesStep3();			
		}else
		{
			var postSecVal = document.getElementById("radioPostSecondary2");
			postSecVal.checked = true;
		}
			
		var checkResume = document.getElementById("hidden_radioResume");
			
		if(checkResume.value == "no")
		{			
			workExperienceNoStep3();			
		}else
		{
			var resumeYesNoVal = document.getElementById("radioResume1");
					
			resumeYesNoVal.checked = true;			
		}
		
		labelClickSupportSafari();
	}
	
	function postSecondaryYesStep3()
	{
		var noJSpostSecondary = document.getElementById("noJSpostSecondary");			
		noJSpostSecondary.style.display = "none";
		
		var postSecondary = document.getElementById("postSecondary");			
		postSecondary.style.display = "block";	
		
		var institution = document.getElementById("institution");			
		institution.style.display = "block";
		
		var add_institution = document.getElementById("addInstitution");			
		add_institution.style.display = "block";		
	}
	
	function postSecondaryNoStep3()
	{
		var noJSpostSecondary = document.getElementById("noJSpostSecondary");			
		noJSpostSecondary.style.display = "none";
		
		var postSecondary = document.getElementById("postSecondary");			
		postSecondary.style.display = "none";	
		
		var institution = document.getElementById("institution");			
		institution.style.display = "none";	
		
		var add_institution = document.getElementById("addInstitution");			
		add_institution.style.display = "none";			
	}
	
	function workExperienceYesStep3()
	{
		var workExperience = document.getElementById("workExperience");			
		workExperience.style.display = "none";			
		
		var noJSworkExperience = document.getElementById("noJSworkExperience");			
		noJSworkExperience.style.display = "none";			
		
		var workExperienceBox = document.getElementById("workExperienceBox");			
		workExperienceBox.style.display = "none";
		
		var resumeYesNoVal = document.getElementById("radioResume1");			
		resumeYesNoVal.checked = true;		
		
	}
	
	function workExperienceNoStep3()
	{
		var workExperience = document.getElementById("workExperience");			
		workExperience.style.display = "block";	
		
		var noJSworkExperience = document.getElementById("noJSworkExperience");			
		noJSworkExperience.style.display = "none";			
		
		var workExperienceBox = document.getElementById("workExperienceBox");			
		workExperienceBox.style.display = "block";
		
		var resumeYesNoVal = document.getElementById("radioResume2");			
		resumeYesNoVal.checked = true;		
	}
	
	// end Step3
	
	// Step 4
	function onloadFunctionStep4()
	{
		document.frmStep4.rqf_profileExperience.focus();
		
		var theNoJShelp = document.getElementById("noJShelp");			
		theNoJShelp.style.display = "none";
		
		var noJSmaxChars1 = document.getElementById("noJSmaxCharacters1");			
		noJSmaxChars1.style.display = "none";
		var maxChars1 = document.getElementById("maxCharacters1");			
		maxChars1.style.display = "block";
		
		var noJSmaxChars2 = document.getElementById("noJSmaxCharacters6");			
		noJSmaxChars2.style.display = "none";
		var maxChars2 = document.getElementById("maxCharacters6");			
		maxChars2.style.display = "block";
		
		var noJSmaxChars3 = document.getElementById("noJSmaxCharacters7");			
		noJSmaxChars3.style.display = "none";
		var maxChars3 = document.getElementById("maxCharacters7");			
		maxChars3.style.display = "block";
		
		var noJSmaxChars4 = document.getElementById("noJSmaxCharacters4");			
		noJSmaxChars4.style.display = "none";
		var maxChars4 = document.getElementById("maxCharacters4");			
		maxChars4.style.display = "block";
		
		var noJSmaxChars5 = document.getElementById("noJSmaxCharacters5");			
		noJSmaxChars5.style.display = "none";
		var maxChars5 = document.getElementById("maxCharacters5");			
		maxChars5.style.display = "block";
	}
	// Step 5
	function onloadFunctionStep5()
	{
		var theNoJShelp = document.getElementById("noJShelp");			
		theNoJShelp.style.display = "none";
		
		var theCCradio1= document.getElementById("radioPayment1");
		//alert(theCCradio1.checked);
		if (theCCradio1.checked == true)
		{		
			blurCCpayment("PayCCOnline");
		}
		var theCCradio2= document.getElementById("radioPayment2");
		//alert(theCCradio2.checked);
		if (theCCradio2.checked == true)
		{		
			blurCCpayment("PayCCPhone");
		} 
		var theCCradio3= document.getElementById("radioPayment3");
		//alert(theCCradio3.checked);
		if (theCCradio3.checked == true)
		{		
			blurCCpayment("PayOther");
		}
		
		labelClickSupportSafari();	
	}
	
	
	function blurCCpayment(radioPayment)
	{
		//alert(radioPayment);
		if (radioPayment == "PayCCOnline")
		{				
			var theCCcard= document.getElementById("selectCreditCard");			
			theCCcard.disabled = false;	
			var theCCnumber= document.getElementById("txtCreditCardNum");			
			theCCnumber.disabled = false;
			var theCCname= document.getElementById("txtCardholderName");			
			theCCname.disabled = false;	
			document.frmStep5.Date_Month.disabled = false;			
			document.frmStep5.Date_Year.disabled = false;
			var theCCcode= document.getElementById("txtCardCVC");			
			theCCcode.disabled = false;
		}
					
		if (radioPayment == "PayCCPhone")
		{				
			var theCCcard= document.getElementById("selectCreditCard");
			theCCcard.value = "";	
			theCCcard.disabled = true;	
			var theCCnumber= document.getElementById("txtCreditCardNum");
			theCCnumber.value = "";
			theCCnumber.disabled = true;
			var theCCname= document.getElementById("txtCardholderName");
			theCCname.value = "";
			theCCname.disabled = true;	
			document.frmStep5.Date_Month.disabled = true;
			document.frmStep5.Date_Year.disabled = true;	
			var theCCcode= document.getElementById("txtCardCVC");	
			theCCcode.value = "";	
			theCCcode.disabled = true;
		}
			
		if (radioPayment == "PayOther")
		{				
			var theCCcard= document.getElementById("selectCreditCard");
			theCCcard.value = "";	
			theCCcard.disabled = true;	
			var theCCnumber= document.getElementById("txtCreditCardNum");
			theCCnumber.value = "";
			theCCnumber.disabled = true;
			var theCCname= document.getElementById("txtCardholderName");
			theCCname.value = "";
			theCCname.disabled = true;	
			document.frmStep5.Date_Month.disabled = true;
			document.frmStep5.Date_Year.disabled = true;
			var theCCcode= document.getElementById("txtCardCVC");
			theCCcode.value = "";	
			theCCcode.disabled = true;
		}
	}
	
	
	// Step 6
	function onloadFunctionStep6()
	{
		var theNoJShelp = document.getElementById("noJShelp");			
		theNoJShelp.style.display = "none";
		var thePrintLink = document.getElementById("printLink");			
		thePrintLink.style.display = "block";
		var thenoJSPrintLink = document.getElementById("noJSprintLink");			
		thenoJSPrintLink.style.display = "none";
		
	}
	// confirm.php page
	function onloadFunctionConfirm()
	{	
	
		var ref1 = document.getElementById("ref1");		
		ref1.style.display = "block";
		var noJSref1 = document.getElementById("noJSref1");			
		noJSref1.style.display = "none";
		
		var ref2 = document.getElementById("ref2");			
		ref2.style.display = "block";
		var noJSref2 = document.getElementById("noJSref2");			
		noJSref2.style.display = "none";
		
		var work = document.getElementById("work");	
		if(work)
		{
			work.style.display = "block";		
			var noJSwork = document.getElementById("noJSwork");			
			noJSwork.style.display = "none";
		}
		var profile1 = document.getElementById("profile1");			
		profile1.style.display = "block";
		var noJSprofile1 = document.getElementById("noJSprofile1");			
		noJSprofile1.style.display = "none";
		
		var profile2 = document.getElementById("profile2");			
		profile2.style.display = "block";
		var noJSprofile2 = document.getElementById("noJSprofile2");			
		noJSprofile2.style.display = "none";
		
		var profile3 = document.getElementById("profile3");			
		profile3.style.display = "block";
		var noJSprofile3 = document.getElementById("noJSprofile3");			
		noJSprofile3.style.display = "none";
		
		var profile4 = document.getElementById("profile4");			
		profile4.style.display = "block";
		var noJSprofile4 = document.getElementById("noJSprofile4");			
		noJSprofile4.style.display = "none";
		
		var profile5 = document.getElementById("profile5");			
		profile5.style.display = "block";
		var noJSprofile5 = document.getElementById("noJSprofile5");			
		noJSprofile5.style.display = "none";
	}
	
	
	turnOnItem = function(dropdown)
	{
		dropDownID = document.getElementById(dropdown);		
		dropDownID.style.display = "block";	
	}		
	
	turnOffItem = function(dropdown)
	{
		dropDownID = document.getElementById(dropdown);
		dropDownID.style.display = "none";	
	}	
	
	// Country (drop down list)
	countryCode = function()
	{	
	
		selectedCountry = document.getElementById("selectCountry");
		//alert(selectedCountry.value);
		
		if( (selectedCountry.value == 'Canada') || (selectedCountry.value == 'United States') || (selectedCountry.value == "India"))
		{
			
			switch(selectedCountry.value)
			{
				case "Canada":
					turnOnItem("state_Canada");
					turnOnItem("prov_check_asterisk");
					turnOffItem("prov_check");
					turnOffItem("state_US");
					turnOffItem("state_India");
					turnOffItem("state_txt");
				break;
					
				case "United States":
					turnOnItem("state_US");
					turnOnItem("prov_check_asterisk");
					turnOffItem("prov_check");
					turnOffItem("state_Canada");
					turnOffItem("state_India");
					turnOffItem("state_txt");
				break;
				
				case "India":
					turnOnItem("state_India");
					turnOnItem("prov_check_asterisk");
					turnOffItem("prov_check");
					turnOffItem("state_Canada");
					turnOffItem("state_US");
					turnOffItem("state_txt");
				break;
			}	
		}		
		else
		{			
			turnOnItem("state_txt");
			turnOffItem("prov_check_asterisk");
			turnOnItem("prov_check");
			turnOffItem("state_US");
			turnOffItem("state_Canada");
			turnOffItem("state_India");
					
		}
		
		/*
		
		if( (selectedCountry.value == 'Canada') || (selectedCountry.value == 'United States'))
		{
			
			switch(selectedCountry.value)
			{
				case "Canada":
					turnOnItem("state_Canada");
					turnOffItem("state_US");
					turnOffItem("state_India");
					turnOffItem("state_txt");
				break;
					
				case "United States":
					turnOnItem("state_US");
					turnOffItem("state_Canada");
					turnOffItem("state_India");
					turnOffItem("state_txt");
				break;
			}
					
		}
		
		else if(selectedCountry.value != " ")
		{
			
			if (selectedCountry.value == "India")
			{
					turnOnItem("state_India");
					turnOffItem("state_Canada");
					turnOffItem("state_US");
					turnOffItem("state_txt");
			}
			else
			{
					turnOnItem("state_txt");
					turnOffItem("state_US");
					turnOffItem("state_Canada");
					turnOffItem("state_India");
			}			
		}
		*/
		
		
	};

