/**
 * @Project   CareerDegreeSource.com - CDS 
 *  �2006 CareerDegreeSource.com 
 * @date    2006/03/09
 * @author   �2006 PennyWise Solutions.
 */

// JavaScript Document
/*var CapellaError = '';
var CapellaPhoneError = '';
var CapellaPhoneError2 = '';
var waitResponse = '';*/
var zipStateError = '';
var hidden_zipcode;
function Trim(strValue){
    return LTrim(RTrim(strValue));
}
function LTrim(strValue){
    var LTRIMrgExp = /^\s */;
    return strValue.replace(LTRIMrgExp, "");
}
function RTrim(strValue){
    var RTRIMrgExp = /\s *$/;
    return strValue.replace(RTRIMrgExp, "");
}
function IsEmpty(fn,ofn) {
 var _tv = Trim(fn.value)
   if ((_tv.length==0) || (_tv==null)) {
	 if(fn.focus) fn.focus(); alert('Please Enter the '+ofn+'.'); return false;
   }else return true
}
function minLengthCheck(fn,ofn,length){
if(fn.value != ''){
 if(fn.value.length < length){
  if(fn.focus) fn.focus();
	alert(' Please The Field '+ofn+' should have minimum '+length+' characters.');return false;
  }else return true;
}else return true;
}
function maxLengthCheck(fn,ofn,length){
if(fn.value != ''){
if(fn.value.length > length){
  if(fn.focus) fn.focus();
	alert(' Please The Field '+ofn+' should have less than or equal to '+length+' characters.');return false;
  }else return true;
}else return true;
}
function alphabetsCheck(fn,ofn){
  if((fn.value.search
	&& fn.value.search(new RegExp('^[a-zA-Z]+$','g'))==-1 && fn.value.length>0)){
		if(fn.focus) fn.focus();
		alert('Please '+ofn+' can contain only alphabets');
		return false;
  }else return true;
}
function numbersCheck(fn,ofn){
 if((fn.value.search && fn.value.search(new RegExp('^[0-9]+$','g'))==-1 && fn.value.length>0)){
	if(fn.focus) fn.focus();
		alert('Please '+ofn+' can contain only numbers');
		return false;
	}else return true;
}
function alphaNumericCheck(fn,ofn){
if((fn.value.search && fn.value.search(new RegExp('^[a-zA-Z0-9 \\n]+$','g'))==-1 && fn.value.length>0)){
 if(fn.focus) fn.focus();
	alert('Please '+fn+'s can contain only numbers & characters');
 return false;
}else return true;
}
function ValidateEmail(theinput){
var s=theinput.value
if(s.search){  
	return (s.search(new RegExp('^([-!#$%&\'*+./0-9=?A-Z^_`a-z{|}~'+unescape('%7F')+'])+@([-!#$%&\'*+/0-9=?A-Z^_`a-z{|}~'+unescape('%7F')+']+\\\.)+[a-zA-Z]{2,6}$','gi'))>=0)
}
if(s.indexOf){
	var at_character=s.indexOf('@')
	if(at_character<=0 || at_character+4>s.length) return false;
}
if(s.length<6) return false;
else return true;
}
function emailCheck(fn,ofn){																									
  if(ValidateEmail(fn)==false && fn.value.length>0){
	if(fn.focus) fn.focus();
		alert('Please Enter a valid Email ID');
		return false;
  }else return true;
}
function checkboxValidation(fn,ofn,_ofn){
 var ar = _ofn+'[]' ;
 var len = fn.elements[ar].length;
  var flag = false,i;
   for(i=0;i<len;i++){
		if ( fn.elements[ar][i].checked  == false ){ 
		  flag = false;
		 }else{
		   flag = true ;
		   break;
		 } 
   }
   if ( !flag ){
   flag = false;
	alert('It was not specified the '+ofn+'.');
		return false;
   }else return true;
}
function radioButtonValidation(fn,ofn,_ofn){
 var len = fn.elements[_ofn].length;
  var flag = false,i;
   for(i=0;i<len;i++){
		if ( fn.elements[_ofn][i].checked  == false ){ 
		  flag = false;
		 }else{
		   flag = true ;
		   break;
		 } 
   }
   if ( !flag ){
   flag = false;
	alert('It was not specified the '+ofn+'.');
		return false;
   }else return true;
}
function checkboxRadioValidation4(fn,ofn){
  var flag = false;
		if ( fn.checked  == false ){ 
		  flag = false;
		 }
		 else {
		   flag = true ;
		  } 
   if ( !flag ){
   flag = false;
	alert('It was not specified the '+ofn+'.')
		return false;
   }else return true;
}
function isEmptySelect(fn,ofn) {
	if(fn.options[fn.selectedIndex].value =='select' || fn.options[fn.selectedIndex].value == '' || fn.options[fn.selectedIndex].value == 0){
		if(fn.focus) fn.focus();
		alert('Please Select the '+ofn+'.');
		return false;
	}else return true;
}
function PhoneValidation(fn,ofn,ptype,length){
if(fn.value ==''){
	if(fn.focus) fn.focus();
	alert('Please Enter The '+ ofn +' '+ ptype +' Number.');return false;}
if((fn.value.search	&& 
	    fn.value.search(new RegExp('^[0-9]+$','g'))==-1 && 
		fn.value.length >0 ))
		{
			if(fn.focus)
				fn.focus();
			alert('Please The '+ ofn +' '+ ptype +' Number can contain only numbers.');return false;		}
	if(( fn.value.length != length))
		{
			if(fn.focus)
				fn.focus();
			alert('Please The '+ ofn +' '+ ptype +' Length should be '+length+' digits.');return false;		}
 return true;
}
function getHttpRequestObj() {
  var req = false;
  if(window.XMLHttpRequest) {
      try {
         req = new XMLHttpRequest();
      } 
      catch(e) {
         req = false;
      }
  } 
  else if(window.ActiveXObject) {
      try {
         req = new ActiveXObject("Msxml2.XMLHTTP");
      } 
      catch(e) {
         try {
            req = new ActiveXObject("Microsoft.XMLHTTP");
         } 
         catch(e) {
            req = false;
         }
      }
  }
  return req;
}
/*function handleHttpResponse4Zip() {
	   var state_select = '';
	   var city_text    = ''; 
	   
	   var stateArray = ['state','State','county','STATE','Element13','element13','ELEMENT13'];
	   for(i=0;i<document.request_form.elements.length;i++){
	      for(j=0;j<stateArray.length;j++){
	        if ( Trim(document.request_form.elements[i].name) == stateArray[j] )
				state_select = document.request_form.elements[i];
		  }
	   }
	   
	  var cityArray = ['City','city','element12','Element12','CITY','ELEMENT12'];
	  for(i=0;i<document.request_form.elements.length;i++){
	      for(j=0;j<cityArray.length;j++){
	        if ( Trim(document.request_form.elements[i].name) == cityArray[j] )
				city_text = document.request_form.elements[i];
		  }
	   }
		 if(http.readyState == 4){
				   var data = parseResponseText(http.responseText);
						 if(data) {
							city_text.value = data[0];
							state_select.value = data[1];
						 }else {
							// no zip info found - clear state/city elements
							state_select.value = "";
							city_text.value = "";
						 }
		}
			  
}
function populateCityState() {
	   var zipArray = ['zip','ZIP','Zip','Zip_code','zip_code','element14','Element14','ELEMENT14'];
	   for(i=0;i<document.request_form.elements.length;i++){
	      for(j=0;j<zipArray.length;j++){
	        if ( Trim(document.request_form.elements[i].name) == zipArray[j] )
				zipValue = document.request_form.elements[i].value;
		  }
	   }
	  
	   var zipcode = Trim(zipValue);

	      var url = 'populate_city_state_byzip.php?zipcode=' + zipcode;
		     http = getHttpRequestObj();
			    http.onreadystatechange = handleHttpResponse4Zip;
				   http.open('GET', url, true);
				      http.send(null);

}

function parseResponseText(str) {
	  if(str.indexOf('NOT FOUND') != -1) {
		        return null;
	  }
	    
	    var parsed = Array();
		  parsed = str.split('|');

		    return parsed;
}
*/
// CDS-E110: CODE ADDED FOR VALIDATING ZIP FOR A GIVEN CAMPUS
function validateCampusZip(){
	var campus = document.request_form.c_id ;
	    campus = campus.options[campus.selectedIndex].value ; 
		
	var zip = document.request_form.zipCode.value ;
	
	if (zip != '' && campus != '' && campus != 'select') {
		var getProcess = document.getElementById('pSubmit');
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'none';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'block';
		//var getButton  = document.getElementById('sButton');
	//	getButton.innerHTML = "<img src='ces-images/btn-submit-requestDis.gif' alt='Submit' width='79' height='22' border='0'/>";
		var url = 'validateCampusZip.php?zip='+zip +'&campus='+campus;
		http = getHttpRequestObj();
		waitResponse = 'Validating zip code ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseCampusZip;
		http.open('GET', url, true);
		http.send(null);
	}
	
}
/* only zip validated here */
function handleHttpResponseCampusZip(){
	if(http.readyState == 4){
	   var response = http.responseText;
	   // var getButton  = document.getElementById('sButton');
	   var getButton  = document.getElementById('sButton');
			getButton.style.display = 'block';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'none';
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		waitResponse = '';
			 if(response == 1) {
				CampusZipError = '';
			 }else if(response == 0){
				CampusZipError = 'Please Enter a Valid Zip Code for the Campus selected.';
			 }
   }
}
//END OF CODE FOR VALIDATING ZIP FOR GIVEN CAMPUS

// CHR442 IDAT - New School: CODE ADDED FOR VALIDATING ZIP FOR A GIVEN CAMPUS
function validateIADTCampusZip(){
	var campus = document.request_form.sycampusid ;
	    campus = campus.options[campus.selectedIndex].value ; 
		
	var zip = document.request_form.addr_zipcode.value ;
	
	if (zip != '' && campus != '' && campus != 'select') {
		var getProcess = document.getElementById('pContinue');
		var cgetButton  = document.getElementById('cButton');
			cgetButton.style.display = 'none';
		var cbdButton  = document.getElementById('dcButton');
			cbdButton.style.display = 'block';
		var astep2  = document.getElementById('astep2');
			astep2.style.display = 'none';
		var step2  = document.getElementById('pstep2');
			step2.style.display = 'block';
		//var getButton  = document.getElementById('sButton');
	//	getButton.innerHTML = "<img src='ces-images/btn-submit-requestDis.gif' alt='Submit' width='79' height='22' border='0'/>";
		var url = 'validateCampusZip.php?zip=' + zip +'&campus='+campus;
		http = getHttpRequestObj();
		waitResponse = 'Validating zip code ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseIADTCampusZip;
		http.open('GET', url, true);
		http.send(null);
	}
	
}
/* only zip validated here */
function handleHttpResponseIADTCampusZip(){
	if(http.readyState == 4){
	   var response = http.responseText;
	   // var getButton  = document.getElementById('sButton');
	    var cgetButton  = document.getElementById('cButton');
			cgetButton.style.display = 'block';
		var cbdButton  = document.getElementById('dcButton');
			cbdButton.style.display = 'none';
		var astep2  = document.getElementById('astep2');
			astep2.style.display = 'block';
		var step2  = document.getElementById('pstep2');
			step2.style.display = 'none';
		var getProcess = document.getElementById('pContinue');
		getProcess.innerHTML = '';
		waitResponse = '';
			 if(response == 1) {
				CampusZipError = '';
			 }else if(response == 0){
				CampusZipError = 'International Academy of Design and Technology does not accept inquiries for this program from your state.';
			 }
   }
}
//CHR442 IDAT - New School END OF CODE FOR VALIDATING ZIP FOR GIVEN CAMPUS

// CHR603 Devry Acceptable Zip Codes - START
function parseResponseText(str) {
	  if(str.indexOf('NOT FOUND') != -1) {
		        return null;
				  }
	    
	    var parsed = Array();
		  parsed = str.split('|');

		    return parsed;
}
function validateDevryZip(){

	var zip = Trim(document.request_form.zip.value) ;
	var campus1 = 295;
	var campus2 = 298;
	
	if ( zip != '' && isNumeric(zip) && (zip.toString().length == 5 ) ) {
		var getProcess = document.getElementById('pContinue');
		var cgetButton  = document.getElementById('cButton');
			cgetButton.style.display = 'none';
		var cbdButton  = document.getElementById('dcButton');
			cbdButton.style.display = 'block';
		var astep2  = document.getElementById('astep2');
			astep2.style.display = 'none';
		var step2  = document.getElementById('pstep2');
			step2.style.display = 'block';
		var url = 'validateDevryZip.php?zip=' + zip +'&campus1='+campus1+'&campus2='+campus2;
		http = getHttpRequestObj();
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseDevryZip;
		http.open('GET', url, true);
		http.send(null);
	}
}

function addClassroompreferenceOption(flag) {

 var selectbox = document.request_form.classroompreference;
 var i;
 for(i=selectbox.options.length-1;i>=0;i--) {
    selectbox.remove(i);
 }
 
 	  var browserName = navigator.appName; 
      var version = navigator.appVersion;
	  var progs   = document.request_form.classroompreference;
	  var opt = document.createElement("OPTION");
				opt.value = 'select';
				opt.text  = 'select';
	  if (browserName=="Netscape" && version.indexOf('Safari') != -1)
	  {
	  	progs.options[progs.length] = opt;
	  }else {
	  	progs.options.add(opt);		  
	  }
	  if (flag == 1){
		  var opt = document.createElement("OPTION");
					opt.value = 'In Classroom';
					opt.text  = 'In Classroom';
					opt.setAttribute('selected','selected');
		  if (browserName=="Netscape" && version.indexOf('Safari') != -1)
		  {
		  	progs.options[progs.length] = opt;
		  }else {
		  	progs.options.add(opt);
		  	progs.options.selectedIndex	= 1;	  
		  }
	  }else if (flag == 0){
		  var opt = document.createElement("OPTION");
			opt.value = 'In Classroom';
			opt.text  = 'In Classroom';
			
			if (browserName=="Netscape" && version.indexOf('Safari') != -1)
			{
				progs.options[progs.length] = opt;
			}else {
				progs.options.add(opt);	  
			} 
			var opt = document.createElement("OPTION");
			opt.value = 'Online';
			opt.text  = 'Online';
			
			if (browserName=="Netscape" && version.indexOf('Safari') != -1)
			{
				progs.options[progs.length] = opt;
			}else {
				progs.options.add(opt);	  
			}
			var opt = document.createElement("OPTION");
			opt.value = 'Both';
			opt.text  = 'Both';
			
			if (browserName=="Netscape" && version.indexOf('Safari') != -1)
			{
				progs.options[progs.length] = opt;
			}else {
				progs.options.add(opt);	  
			}
	  }
 
}

/* only zip validated here */
function handleHttpResponseDevryZip(){
	if(http.readyState == 4){
	    var data = parseResponseText(http.responseText);
	   // var getButton  = document.getElementById('sButton');
	    var cgetButton  = document.getElementById('cButton');
			cgetButton.style.display = 'block';
		var cbdButton  = document.getElementById('dcButton');
			cbdButton.style.display = 'none';
		var astep2  = document.getElementById('astep2');
			astep2.style.display = 'block';
		var step2  = document.getElementById('pstep2');
			step2.style.display = 'none';
		var getProcess = document.getElementById('pContinue');
		getProcess.innerHTML = '';
				
			 if(data[0] == 1 && data[1] == 1) {
                CampusZipConfirmError = '';
				CampusZipError = '';
				addClassroompreferenceOption('1');
			 }else if(data[0] == 0 && data[1] == 1) {
                CampusZipConfirmError = 'DeVry offers highly engaged onsite classes in the area of your zip code. Would you like to learn more by enrolling in onsite?';
				CampusZipError = '';
				addClassroompreferenceOption('0');
			 }else if(data[0] == 0 && data[1] == 0){
                CampusZipConfirmError = '';
				addClassroompreferenceOption('0'); 
				CampusZipError = 'Sorry, DeVry University does not have any campuses in your area.  However, DeVry does offer your chosen program of study online.  If you are interested in attending DeVry Online, please select the online option.';

			 }
   }
}



function onloadDevryZip(){
	
	var zip = Trim(document.request_form.zip.value) ;
	var campus1 = 295;
	var campus2 = 298;
			
	if ( zip != '' && isNumeric(zip) && (zip.toString().length == 5 ) ) {
		var url = 'validateDevryZip.php?zip=' + zip +'&campus1='+campus1+'&campus2='+campus2;
		httponloadDevryZip = getHttpRequestObj();
		httponloadDevryZip.onreadystatechange = handleHttpResponseonloadDevryZip;
		httponloadDevryZip.open('GET', url, true);
		httponloadDevryZip.send(null);
	}
	
}

function handleHttpResponseonloadDevryZip(){
	if(httponloadDevryZip.readyState == 4){
	    var data = parseResponseText(httponloadDevryZip.responseText);   
	    		
			 if(data[0] == 1 && data[1] == 1) {
                    CampusZipConfirmError = '';
					CampusZipError = '';
					addClassroompreferenceOption('1');
			 }else if(data[0] == 0 && data[1] == 1) {
                    CampusZipConfirmError = 'DeVry offers highly engaged onsite classes in the area of your zip code. Would you like to learn more by enrolling in onsite?';
					CampusZipError = '';
					addClassroompreferenceOption('0');
			 }else if(data[0] == 0 && data[1] == 0){
                    CampusZipConfirmError = '';
					addClassroompreferenceOption('0');
					CampusZipError = 'Sorry, DeVry University does not have any campuses in your area.  However, DeVry does offer your chosen program of study online.  If you are interested in attending DeVry Online, please select the online option.';
				
			 }
   }
}

function isNumeric(value) {
  if (!value.toString().match(/^[-]?\d*\.?\d*$/)) return false;
  return true;
}

// CHR603 Devry Acceptable Zip Codes - END


 	//CDS-E177 -Removing Hard-coding from Capella for validation
function handleHttpResponseStateZip(){
	
	if(http.readyState == 4){
	   var response = http.responseText;
	   //alert('zip'+ response)
	  // var getButton  = document.getElementById('sButton');
	  var getButton  = document.getElementById('sButton');
			getButton.style.display = 'block';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'none';
	   var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		waitResponse = '';
	//	getButton.innerHTML = '<input type="image" src="ces-images/btn-submit-request.gif" alt="Submit" width="79" height="22" border="0" style="cursor:pointer">';
			 if(response == 1) {
				CapellaError = '';
			 }else if(response == 0){
				CapellaError = 'Please Enter a Valid Zip Code for the State selected.';
			 }
	validateState_Phone();
	//validateState_Phone2();
   }
   //
}
 	//CDS-E177 -Removing Hard-coding from Capella for validation
function validateState_Zip(){
	var state = document.request_form.STATE ;
	    state = state.options[state.selectedIndex].value ; 
		
	var zip = document.request_form.ZIP.value ;
	
	if (zip != '' && state != '' && state != 'select') {
		//alert(zip+state);
		var getProcess = document.getElementById('pSubmit');
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'none';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'block';
		//var getButton  = document.getElementById('sButton');
	//	getButton.innerHTML = "<img src='ces-images/btn-submit-requestDis.gif' alt='Submit' width='79' height='22' border='0'/>";
		var url = 'validateStateZip.php?zip=' + zip +'&state='+state;
		http = getHttpRequestObj();
		waitResponse = 'Validating zip code ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseStateZip;
		http.open('GET', url, true);
		http.send(null);
	}
	
}
/* only zip validated here */

function handleHttpResponseZip(){
	
	if(http.readyState == 4){
	   var response = http.responseText;
	   // var getButton  = document.getElementById('sButton');
	   var getButton  = document.getElementById('sButton');
			getButton.style.display = 'block';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'none';
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		waitResponse = '';
		//getButton.innerHTML = '<input type="image" src="ces-images/btn-submit-request.gif" alt="Submit" width="79" height="22" border="0" style="cursor:pointer">';
			 if(response == 1) {
				CapellaError = '';
			 }else if(response == 0){
				CapellaError = 'Please Enter a Valid Zip Code for the State selected.';
			 }
   }
}
	//CDS-E177 -Removing Hard-coding from Capella for validation
function validateZip(){
	var state = document.request_form.STATE ;
	    state = state.options[state.selectedIndex].value ; 
		
	var zip = document.request_form.ZIP.value ;
	
	if (zip != '' && state != '' && state != 'select') {
		
		var getProcess = document.getElementById('pSubmit');
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'none';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'block';
		//var getButton  = document.getElementById('sButton');
		//getButton.innerHTML = "<img src='ces-images/btn-submit-requestDis.gif' alt='Submit' width='79' height='22' border='0'/>";
		var url = 'validateStateZip.php?zip=' + zip +'&state='+state;
		http = getHttpRequestObj();
		waitResponse = 'Validating zip code ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseZip;
		http.open('GET', url, true);
		http.send(null);
	}
	
}

// End here
//CDS-E177 -Removing Hard-coding from Capella for validation
function handleHttpResponseStatePhone(){
	
	if(http.readyState == 4){
	   var response = http.responseText;
	   //alert('a1'+ response);
	    //var getButton  = document.getElementById('sButton');
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'block';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'none';
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		waitResponse = '';
		//getButton.innerHTML = '<input type="image" src="ces-images/btn-submit-request.gif" alt="Submit" width="79" height="22" border="0" style="cursor:pointer">';
			 if(response == 1) {
				CapellaPhoneError = '';
			 }else if(response == 0){
				CapellaPhoneError = 'Please Enter a Valid Home Area code for the State selected.';
			 }
	validateState_Phone2();		 
   }
}
//CDS-E177 -Removing Hard-coding from Capella for validation
function validateState_Phone(){
	
	var state = document.request_form.STATE ;
	    state = state.options[state.selectedIndex].value ; 
	
	var area = document.request_form.p1_108_4.value ;
	
	if (area != '' && state != '' && state != 'select') {
		var getProcess = document.getElementById('pSubmit');
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'none';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'block';
		//var getButton  = document.getElementById('sButton');
		//getButton.innerHTML = "<img src='ces-images/btn-submit-requestDis.gif' alt='Submit' width='79' height='22' border='0'/>";
		var url = 'validateStatePhone.php?area=' + area +'&state='+state;
		http = getHttpRequestObj();
		waitResponse = 'Validating phone number ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating phone number ...";
		http.onreadystatechange = handleHttpResponseStatePhone;
		http.open('GET', url, true);
		http.send(null);
	}
	
	
}	
// phone 2 validation starts here
//CDS-E177 -Removing Hard-coding from Capella for validation
function handleHttpResponseStatePhone2(){
	
	if(http.readyState == 4){
	   var response = http.responseText;
	   //alert('a2'+ response);
	    //var getButton  = document.getElementById('sButton');
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'block';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'none';
		waitResponse = '';
		//getButton.innerHTML = '<input type="image" src="ces-images/btn-submit-request.gif" alt="Submit" width="79" height="22" border="0" style="cursor:pointer">';
			 if(response == 1) {
				CapellaPhoneError2 = '';
			 }else if(response == 0){
				CapellaPhoneError2 = 'Please Enter a Valid Work Area code for the State selected.';
			 }
   }
}

//CDS-E177 -Removing Hard-coding from Capella for validation
function validateState_Phone2(){
	
	var state = document.request_form.STATE ;
	    state = state.options[state.selectedIndex].value ; 
    var area = document.request_form.p1_108_5.value ;
	
	if (area != '' && state != '' && state != 'select') {
		var getProcess = document.getElementById('pSubmit');
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'none';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'block';
		//getButton.innerHTML = "<img src='ces-images/btn-submit-requestDis.gif' alt='Submit' width='79' height='22' border='0'/>";
		var url = 'validateStatePhone.php?area=' + area +'&state='+state;
		http = getHttpRequestObj();
		waitResponse = 'Validating phone number ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating phone number ...";
		http.onreadystatechange = handleHttpResponseStatePhone2;
		http.open('GET', url, true);
		http.send(null);
	}
}

/* Area code & prefix phone validations */

// phone 2 validation starts here
function handleHttpResponseAreaPrefix1(){
	
	if(http.readyState == 4){
	   var response = http.responseText;
	   //alert('a2'+ response);
	    //var getButton  = document.getElementById('sButton');
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'block';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'none';
		waitResponse = '';
		

		//getButton.innerHTML = '<input type="image" src="ces-images/btn-submit-request.gif" alt="Submit" width="79" height="22" border="0" style="cursor:pointer">';
			 if(response == 1) {
				PhoneAreaPrefixError1 = '';
			 }else if(response == 0){
				PhoneAreaPrefixError1 = 'Please Enter a Valid Phone Number.';
			 }
   }
}

function validateAreaCode_Prefix1(a,p){
    var area = a.value ;
    var prefix = p.value ;

	if (area != '' && prefix != '' ) {
		var getProcess = document.getElementById('pSubmit');
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'none';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'block';
		var url = 'validatePhoneAreaCodePrefix.php?area=' + area +'&prefix='+prefix;
		http = getHttpRequestObj();
		waitResponse = 'Validating phone number ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating phone number ...";
		http.onreadystatechange = handleHttpResponseAreaPrefix1;
		http.open('GET', url, true);
		http.send(null);
	} else {
        PhoneAreaPrefixError1 = '';
    }
}
function validateAreaCode_PrefixOnLoad1(a,p){
    var area = a.value ;
    var prefix = p.value ;

	if (area != '' && prefix != '' ) {
		var url = 'validatePhoneAreaCodePrefix.php?area=' + area +'&prefix='+prefix;
		http = getHttpRequestObj();
		http.onreadystatechange = handleHttpResponseAreaPrefix1;
		http.open('GET', url, true);
		http.send(null);
	} else {
        PhoneAreaPrefixError1 = '';
    }
}
function validateAreaCode_PrefixOnLoad2(a,p){
    var area = a.value ;
    var prefix = p.value ;

	if (area != '' && prefix != '' ) {
		var url = 'validatePhoneAreaCodePrefix.php?area=' + area +'&prefix='+prefix;
		http = getHttpRequestObj();
		http.onreadystatechange = handleHttpResponseAreaPrefix2;
		http.open('GET', url, true);
		http.send(null);
	} else {
        PhoneAreaPrefixError2 = '';
    }
}
/* END HERE */
/* Area code & prefix phone validations */

// phone 2 validation starts here
function handleHttpResponseAreaPrefix2(){
	
	if(http.readyState == 4){
	   var response = http.responseText;
	   //alert('a2'+ response);
	    //var getButton  = document.getElementById('sButton');
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'block';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'none';
		waitResponse = '';
		

		//getButton.innerHTML = '<input type="image" src="ces-images/btn-submit-request.gif" alt="Submit" width="79" height="22" border="0" style="cursor:pointer">';
			 if(response == 1) {
				PhoneAreaPrefixError2 = '';
			 }else if(response == 0){
				PhoneAreaPrefixError2 = 'Please Enter a Valid Phone Number.';
			 }
   }
}

function validateAreaCode_Prefix2(a,p){
    var area = a.value ;
    var prefix = p.value ;

	if (area != '' && prefix != '' ) {
		var getProcess = document.getElementById('pSubmit');
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'none';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'block';
		var url = 'validatePhoneAreaCodePrefix.php?area=' + area +'&prefix='+prefix;
		http = getHttpRequestObj();
		waitResponse = 'Validating phone number ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating phone number ...";
		http.onreadystatechange = handleHttpResponseAreaPrefix2;
		http.open('GET', url, true);
		http.send(null);
	} else {
        PhoneAreaPrefixError2 = '';
    }
}

function validateAreaCode_PrefixOnLoad3(a,p){
    var area = a.value ;
    var prefix = p.value ;

	if (area != '' && prefix != '' ) {
		var url = 'validatePhoneAreaCodePrefix.php?area=' + area +'&prefix='+prefix;
		http = getHttpRequestObj();
		http.onreadystatechange = handleHttpResponseAreaPrefix3;
		http.open('GET', url, true);
		http.send(null);
	} else {
        PhoneAreaPrefixError3 = '';
    }
}

/* Area code & prefix phone validations */

// phone 2 validation starts here
function handleHttpResponseAreaPrefix3(){
	
	if(http.readyState == 4){
	   var response = http.responseText;
	   //alert('a2'+ response);
	    //var getButton  = document.getElementById('sButton');
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'block';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'none';
		waitResponse = '';
		

		//getButton.innerHTML = '<input type="image" src="ces-images/btn-submit-request.gif" alt="Submit" width="79" height="22" border="0" style="cursor:pointer">';
			 if(response == 1) {
				PhoneAreaPrefixError3 = '';
			 }else if(response == 0){
				PhoneAreaPrefixError3 = 'Please Enter a Valid Phone Number.';
			 }
   }
}

function validateAreaCode_Prefix3(a,p){
    var area = a.value ;
    var prefix = p.value ;

	if (area != '' && prefix != '' ) {
		var getProcess = document.getElementById('pSubmit');
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'none';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'block';
		var url = 'validatePhoneAreaCodePrefix.php?area=' + area +'&prefix='+prefix;
		http = getHttpRequestObj();
		waitResponse = 'Validating phone number ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating phone number ...";
		http.onreadystatechange = handleHttpResponseAreaPrefix3;
		http.open('GET', url, true);
		http.send(null);
	} else {
        PhoneAreaPrefixError3 = '';
    }
}
// for all forms zip/state validations

function handleHttpResponseStateZipAll(){
	
	if(http.readyState == 4){
	   var response = http.responseText;
	   // var getButton  = document.getElementById('sButton');
	   var getButton  = document.getElementById('sButton');
			getButton.style.display = 'block';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'none';
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		waitResponse = '';
		//getButton.innerHTML = '<input type="image" src="ces-images/btn-submit-request.gif" alt="Submit" width="79" height="22" border="0" style="cursor:pointer">';
			 if(response == 1) {
				zipStateError = '';
			 }else if(response == 0){
				zipStateError = 'Please Enter a Valid Zip Code for the State selected.';
			 }
   }
}

function validateStateZip(z,s,f){

	var state = s.options[s.selectedIndex].value ; 
	var zip = z.value ;

	
	if (zip != '' && state != '' && state != 'select') {
		
		var getProcess = document.getElementById('pSubmit');
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'none';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'block';
		//var getButton  = document.getElementById('sButton');
		//getButton.innerHTML = "<img src='ces-images/btn-submit-requestDis.gif' alt='Submit' width='79' height='22' border='0'/>";
		var url = 'validateStateZip.php?zip=' + zip +'&state='+state+'&format='+f;
		http = getHttpRequestObj();
		waitResponse = 'Validating zip code ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseStateZipAll;
		http.open('GET', url, true);
		http.send(null);
	}
	
}
// step1 zip state validations

function handleHttpResponseStateZip1(){
	
	if(http.readyState == 4){
	   var response = http.responseText;
	   var getButton  = document.getElementById('s1Button');
			getButton.style.display = 'block';
		var dButton  = document.getElementById('d1Button');
			dButton.style.display = 'none';
		var getProcess = document.getElementById('p1Submit');
		getProcess.innerHTML = '';
		waitResponse = '';
			 if(response == 1) {
				zipStateError = '';
			 }else if(response == 0){
				zipStateError = 'Please Enter a Valid Zip Code for the State selected.';
			 }
   }
}

function validateStateZip1(z,s,f){

	var state = s.options[s.selectedIndex].value ; 
	var zip = z.value ;

	
	if (zip != '' && state != '' && state != 'select') {
		
		var getProcess = document.getElementById('p1Submit');
		var getButton  = document.getElementById('s1Button');
			getButton.style.display = 'none';
		var dButton  = document.getElementById('d1Button');
			dButton.style.display = 'block';
		var url = 'validateStateZip.php?zip=' + zip +'&state='+state+'&format='+f;
		http = getHttpRequestObj();
		waitResponse = 'Validating zip code ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseStateZip1;
		http.open('GET', url, true);
		http.send(null);
	}
	
}
//END here

/* CDS - E94  Argosy Implementation starts here */

function validateCampusZipPrograms() {

var campus = document.request_form.locationCode;
    campus = campus.options[campus.selectedIndex].value

var program = document.request_form.programOfInterest ;
	    program = program.options[program.selectedIndex].value ; 
		
var zip = document.request_form.addressZip.value ;

	if(campus!='' && zip != '' && program != '') {
		
		var getProcess = document.getElementById('pSubmit');
		var getButton  = document.getElementById('sButton');
			getButton.style.display = 'none';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'block';

		var url = 'validateCampusZipPrograms.php?zip=' + zip +'&campus='+campus+'&program='+escape(program);
			http = getHttpRequestObj();
			waitResponse = 'Validating Campus,Zip and Program ...';
			getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating Campus,Zip and Program ...";
			http.onreadystatechange = handleHttpResponseCampusZipProgram;
			http.open('GET', url, true);
			http.send(null);	
	}
	
}
function handleHttpResponseCampusZipProgram(){
	
	if(http.readyState == 4){
	   var response = http.responseText;
	   var getButton  = document.getElementById('sButton');
			getButton.style.display = 'block';
		var dButton  = document.getElementById('dButton');
			dButton.style.display = 'none';
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		waitResponse = '';
			 if(response == 1) {
				campusZipProgramError = '';
			 }else if(response == 0){
				campusZipProgramError = 'Please Enter a Valid Zip Code for the Campus selected.';
			 }
   }
}

/* CDS - E94  Argosy Implementation ends here */

//CHR693 Capella University through new vendor - Cole&Weber - Start Here
function MSPhDalertmessage(){
 var progcode = document.request_form.program_code;
 var v = progcode.options[progcode.selectedIndex];

if( v.value == '368' || v.value == '370' || v.value == '353' || v.value == '622'){
        alert('Thank you for your interest in Capella University.  The specialization you have selected is for current K-12 professionals interested in extending their education with a graduate degree.  Please be aware that this specialization does not lead to initial teacher licensure.');
	}
if(  v.value == '1410'){
        alert('Thank you for your interest in Capella University.  Please be aware that the specialization you have selected is for current licensed registered nurses with a master’s degree in Nursing.');
	}

}
//CHR693 Capella University through new vendor - Cole&Weber - End Here


/* CDS -E110 Functions for Date Of Birth for Pepperdine */

//Get days in Month by passing iMonth and Year
function daysInMonth(iMonth, iYear){
	return 32 - new Date(iYear, iMonth, 32).getDate();
}

// Get Day Select Box options Passing Month and Year
function getDayOptions() {
	var month = document.request_form.age_month;
    	month = month.options[month.selectedIndex].value; 
	var year = document.request_form.age_year;
    	year = year.options[year.selectedIndex].value; 
	var noofdays;
	if(month=='select' || year =='select') {
		noofdays = 31
	} else {
		month = month - 1;
		noofdays = daysInMonth(month, year);
	}
	
	for(i=document.request_form.age_day.options.length-1;i>=0;i--)  { 
		document.request_form.age_day.remove(i);  
	} 
	var optn1 = document.createElement('OPTION'); 
	optn1.value = "select"
	optn1.text = "Day";
	document.request_form.age_day.options.add(optn1);
	for(var i=1;i<=noofdays;i++) {
		var optn1 = document.createElement('OPTION'); 
		optn1.value = optn1.text = i;
		document.request_form.age_day.options.add(optn1);
	}

}
/* CDS -E110 Functions for Date Of Birth for Pepperdine Ends*/
// CHR442 IDAT - New School: CODE ADDED FOR VALIDATING ZIP FOR A GIVEN CAMPUS Degree tree version
function validateIADTCampusZipDT(){
	var campus = document.request_form.sycampusid ;
	    campus = campus.options[campus.selectedIndex].value ;

	var zip = document.request_form.addr_zipcode.value ;

	if (zip != '' && campus != '' && campus != 'select') {
		var getProcess = document.getElementById('pSubmit');
		var cgetButton  = document.getElementById('sButton');
			cgetButton.style.display = 'none';
		var cbdButton  = document.getElementById('dButton');
			cbdButton.style.display = 'block';
		//var getButton  = document.getElementById('sButton');
	//	getButton.innerHTML = "<img src='ces-images/btn-submit-requestDis.gif' alt='Submit' width='79' height='22' border='0'/>";
		var url = 'validateCampusZip.php?zip=' + zip +'&campus='+campus;
		http = getHttpRequestObj();
		waitResponse = 'Validating zip code ...';
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseIADTCampusZipDT;
		http.open('GET', url, true);
		http.send(null);
	}

}
/* only zip validated here */
function handleHttpResponseIADTCampusZipDT(){
	if(http.readyState == 4){
	   var response = http.responseText;
	   // var getButton  = document.getElementById('sButton');
	    var cgetButton  = document.getElementById('sButton');
			cgetButton.style.display = 'block';
		var cbdButton  = document.getElementById('dButton');
			cbdButton.style.display = 'none';
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		waitResponse = '';
			 if(response == 1) {
				CampusZipError = '';
			 }else if(response == 0){
				CampusZipError = 'International Academy of Design and Technology does not accept inquiries for this program from your state.';
			 }
   }
}
//CHR442 IDAT - New School END OF CODE FOR VALIDATING ZIP FOR GIVEN CAMPUS Degree tree version
// CHR603 Devry Acceptable Zip Codes - START Degree tree version

function validateDevryZipDT(){

	var zip = Trim(document.request_form.zip.value) ;
	var campus1 = 295;
	var campus2 = 298;

	if ( zip != '' && isNumeric(zip) && (zip.toString().length == 5 ) ) {
		var getProcess = document.getElementById('pSubmit');
		var cgetButton  = document.getElementById('sButton');
			cgetButton.style.display = 'none';
		var cbdButton  = document.getElementById('dButton');
			cbdButton.style.display = 'block';
		var url = 'validateDevryZip.php?zip=' + zip +'&campus1='+campus1+'&campus2='+campus2;
		http = getHttpRequestObj();
		getProcess.innerHTML = "<img src='ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseDevryZipDT;
		http.open('GET', url, true);
		http.send(null);
	}
   }

/* only zip validated here */
function handleHttpResponseDevryZipDT(){
	if(http.readyState == 4){
	    var data = parseResponseText(http.responseText);
	    var cgetButton  = document.getElementById('sButton');
			cgetButton.style.display = 'block';
		var cbdButton  = document.getElementById('dButton');
			cbdButton.style.display = 'none';
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';

			 if(data[0] == 1 && data[1] == 1) {
                CampusZipConfirmError = '';
				CampusZipError = '';
				addClassroompreferenceOption('1');
			 }else if(data[0] == 0 && data[1] == 1) {
                CampusZipConfirmError = 'DeVry offers highly engaged onsite classes in the area of your zip code. Would you like to learn more by enrolling in onsite?';
				CampusZipError = '';
				addClassroompreferenceOption('0');
			 }else if(data[0] == 0 && data[1] == 0){
                CampusZipConfirmError = '';
				addClassroompreferenceOption('0');
				CampusZipError = 'Sorry, DeVry University does not have any campuses in your area.  However, DeVry does offer your chosen program of study online.  If you are interested in attending DeVry Online, please select the online option.';

			 }
   }
 }
 // CHR603 Devry Acceptable Zip Codes -END Degree tree version

/* CHR678 UMUC Date of Birth field - Start Here */
function getDayOptionsumuc() {
	var month = document.request_form.birthmonth;
    	month = month.options[month.selectedIndex].value;
	var year = document.request_form.birthyear;
    	year = year.options[year.selectedIndex].value;
	var noofdays;
	if(month=='select' || year =='select') {
		noofdays = 31
	} else {
		month = month - 1;
		noofdays = daysInMonth(month, year);
	}

	for(i=document.request_form.birthday.options.length-1;i>=0;i--)  {
		document.request_form.birthday.remove(i);
	}
	var optn1 = document.createElement('OPTION');
	optn1.value = "select"
	optn1.text = "Day";
	document.request_form.birthday.options.add(optn1);
	for(var i=1;i<=noofdays;i++) {
		var optn1 = document.createElement('OPTION');
		optn1.value = optn1.text = i;
		document.request_form.birthday.options.add(optn1);
	}

}
 /* CHR678 UMUC Date of Birth field - Ends Here */
 // CHR688 Schools for Canada Site: CODE ADDED FOR PREPOPULATING CAMPUS PROGRAMS START HERE
function getCanadaCampusPrograms(sid){
    if(sid == '330') {
        var campusnew = document.request_form.campus ;
        var zip = document.request_form.postal_code.value;
    } else {
        var campusnew = document.request_form.CampusID ;
        var zip = document.request_form.PostalZipCode.value;
    }
	    campusid = campusnew.options[campusnew.selectedIndex].value ;

	if ( campusid != '') {
		var url = '/getCanadaCampus_programs.php?campus='+campusid +'&schoolId='+sid;
		http = getHttpRequestObj();
		http.onreadystatechange = handleHttpResponseCanadaCampusPrograms;
		http.open('GET', url, true);
		http.send(null);
        if(zip != ''){
        setTimeout("validateCanadaCampusZip("+sid+")",800);
        }
	}

}

function getCanadaCampusProgramsDT(sid){
    if(sid == '330') {
        var campusnew = document.request_form.campus ;
        var zip = document.request_form.postal_code.value;
    } else {
        var campusnew = document.request_form.CampusID ;
        var zip = document.request_form.PostalZipCode.value;
    }
	    campusid = campusnew.options[campusnew.selectedIndex].value ;

	if ( campusid != '') {
		var url = '/getCanadaCampus_programs.php?campus='+campusid +'&schoolId='+sid;
		http = getHttpRequestObj();
		http.onreadystatechange = handleHttpResponseCanadaCampusPrograms;
		http.open('GET', url, true);
		http.send(null);
        if(zip != ''){
        setTimeout("validateCanadaCampusZipDT("+sid+")",800);
        }
	}

}

function handleHttpResponseCanadaCampusPrograms(){

   if(http.readyState == 4){
      var progStr = http.responseText;
	  var arr1 = Array();
	  arr1 = progStr.split("\t");
      var sid = arr1[0];
      var arr = arr1[1].split("\n");
		if(progStr){
			updatePrograms(sid,arr);
		}
       }

}

function updatePrograms(sid,a) {
  var browserName = navigator.appName;
  var version = navigator.appVersion;
	if(a.length != 0) {
		clearPrograms(sid);

		var progs = getProgramsElem(sid);


		for(var i=0;i<a.length;i++){
			if(a[i]){
				var arr = Array();
				arr = a[i].split(":");
    			var opt = document.createElement("OPTION");
				opt.value = arr[0];
				opt.text = arr[1];
				if (browserName=="Netscape" && version.indexOf('Safari') != -1)
				{
				  progs.options[progs.length] = opt;
				}else {
				  progs.options.add(opt);
				}

			}
		}
	}
}

function clearPrograms(sid) {
 var selectbox = getProgramsElem(sid);
 var i;
 for(i=selectbox.options.length-1;i>=0;i--) {
    selectbox.remove(i);
 }

}
function getProgramsElem(sid) {
   if(sid == '330')
       return document.request_form.program_code;
   else
       return document.request_form.ProgramID;
}
// CHR688 Schools for Canada Site: CODE ADDED FOR PREPOPULATING CAMPUS PROGRAMS ENDS HERE

// CHR688 Schools for Canada Site: CODE ADDED FOR VALIDATING ZIP FOR A GIVEN CAMPUS START HERE
function validateCanadaCampusZip(sid){

    if(sid == '330') {
        var campus = document.request_form.campus ;
        var zip = document.request_form.postal_code.value ;
    } else {
        var campus = document.request_form.CampusID ;
        var zip = document.request_form.PostalZipCode.value ;
    }
    if(sid == '325') {
        campusid = campus.value ;
    } else {
        campusid = campus.options[campus.selectedIndex].value ;
    }

    // SETTING THE TIME GAP USING setTimeout() function BETWEEN THE TWO AJAX FUNCTIONS

	if (zip != '' && campusid != '' && campusid != 'select' ) {
		var getProcess = document.getElementById('pContinue');
		var cgetButton  = document.getElementById('cButton');
			cgetButton.style.display = 'none';
		var cbdButton  = document.getElementById('dcButton');
			cbdButton.style.display = 'block';
		var astep2  = document.getElementById('astep2');
			astep2.style.display = 'none';
		var step2  = document.getElementById('pstep2');
			step2.style.display = 'block';
		var url = 'validateCanadaCampusZip.php?zip=' + zip +'&campus='+campusid +'&schoolId='+sid;
		http = getHttpRequestObj();
		waitResponse = 'Validating zip code ...';
		getProcess.innerHTML = "<img src='/ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseCanadaCampusZip;
		http.open('GET', url, true);
		http.send(null);
	}

}
/* only zip validated here */
function handleHttpResponseCanadaCampusZip(){
	if(http.readyState == 4){
	   var response = http.responseText;
	    var cgetButton  = document.getElementById('cButton');
			cgetButton.style.display = 'block';
		var cbdButton  = document.getElementById('dcButton');
			cbdButton.style.display = 'none';
		var astep2  = document.getElementById('astep2');
			astep2.style.display = 'block';
		var step2  = document.getElementById('pstep2');
			step2.style.display = 'none';
		var getProcess = document.getElementById('pContinue');
		getProcess.innerHTML = '';
		waitResponse = '';
			 if(response == 1) {
				CampusZipError = '';
			 }else if(response == 0){
				CampusZipError = 'Please Enter a Valid Postal Code for the Campus selected.';
			 }else if(response == 2){
				CampusZipError = 'Please Enter a Valid Postal Code for the Campus Burnaby.';
			 }
   }
}

function validateCanadaCampusZipDT(sid){

    if(sid == '330') {
        var campus = document.request_form.campus ;
        var zip = document.request_form.postal_code.value ;
    } else {
        var campus = document.request_form.CampusID ;
        var zip = document.request_form.PostalZipCode.value ;
    }
    if(sid == '325') {
        campusid = campus.value ;
    } else {
        campusid = campus.options[campus.selectedIndex].value ;
    }

    // SETTING THE TIME GAP USING setTimeout() function BETWEEN THE TWO AJAX FUNCTIONS

    if (zip != '' && campusid != '' && campusid != 'select' ) {

		var getProcess = document.getElementById('pSubmit');
		var cgetButton  = document.getElementById('sButton');
			cgetButton.style.display = 'none';
		var cbdButton  = document.getElementById('dButton');
			cbdButton.style.display = 'block';
		var url = 'validateCanadaCampusZip.php?zip=' + zip +'&campus='+campusid +'&schoolId='+sid;
		http = getHttpRequestObj();
		waitResponse = 'Validating zip code ...';
		getProcess.innerHTML = "<img src='/ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseCanadaCampusZipDT;
		http.open('GET', url, true);
		http.send(null);
	}

}

function handleHttpResponseCanadaCampusZipDT(){
	if(http.readyState == 4){
	   var response = http.responseText;
	   var cgetButton  = document.getElementById('sButton');
			cgetButton.style.display = 'block';
		var cbdButton  = document.getElementById('dButton');
			cbdButton.style.display = 'none';
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		waitResponse = '';
			 if(response == 1) {
				CampusZipError = '';
			 }else if(response == 0){
				CampusZipError = 'Please Enter a Valid Postal Code for the Campus selected.';
			 }else if(response == 2){
				CampusZipError = 'Please Enter a Valid Postal Code for the Campus Burnaby.';
			 }
   }
}
//CHR688 Schools for Canada Site END OF CODE FOR VALIDATING ZIP FOR GIVEN CAMPUS

//CHR745 Capella Zip Code Validation Start
function validateCapellaCWZip(){

    var zip = document.request_form.zip.value ;

	if (zip != '') {
		var getProcess = document.getElementById('pContinue');
		var cgetButton  = document.getElementById('cButton');
			cgetButton.style.display = 'none';
		var cbdButton  = document.getElementById('dcButton');
			cbdButton.style.display = 'block';
		var astep2  = document.getElementById('astep2');
			astep2.style.display = 'none';
		var step2  = document.getElementById('pstep2');
			step2.style.display = 'block';
		var url = 'validateCapellaCWZip.php?zip=' + zip ;
		http = getHttpRequestObj();
		waitResponse = 'Validating zip code ...';
		getProcess.innerHTML = "<img src='/ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseCapellaCWZip;
		http.open('GET', url, true);
		http.send(null);
	}

}
/* only zip validated here */
function handleHttpResponseCapellaCWZip(){
	if(http.readyState == 4){
	   var response = http.responseText;
	    var cgetButton  = document.getElementById('cButton');
			cgetButton.style.display = 'block';
		var cbdButton  = document.getElementById('dcButton');
			cbdButton.style.display = 'none';
		var astep2  = document.getElementById('astep2');
			astep2.style.display = 'block';
		var step2  = document.getElementById('pstep2');
			step2.style.display = 'none';
		var getProcess = document.getElementById('pContinue');
		getProcess.innerHTML = '';
		waitResponse = '';
			 if(response == 1) {
				CapellaZipError = '';
			 }else if(response == 0){
				CapellaZipError = 'Please Enter a Valid Zip/Postal Code.';
			 }
   }
}

function validateCapellaCWZipDT(){

    var zip = document.request_form.zip.value ;

	if (zip != '') {
		var getProcess = document.getElementById('pSubmit');
		var cgetButton  = document.getElementById('sButton');
			cgetButton.style.display = 'none';
		var cbdButton  = document.getElementById('dButton');
			cbdButton.style.display = 'block';
		var url = 'validateCapellaCWZip.php?zip=' + zip ;
		http = getHttpRequestObj();
		waitResponse = 'Validating zip code ...';
		getProcess.innerHTML = "<img src='/ces-images/loading.gif' /> Validating zip code ...";
		http.onreadystatechange = handleHttpResponseCapellaCWZipDT;
		http.open('GET', url, true);
		http.send(null);
	}

}

function handleHttpResponseCapellaCWZipDT(){
	if(http.readyState == 4){
	   var response = http.responseText;
	   var cgetButton  = document.getElementById('sButton');
			cgetButton.style.display = 'block';
		var cbdButton  = document.getElementById('dButton');
			cbdButton.style.display = 'none';
		var getProcess = document.getElementById('pSubmit');
		getProcess.innerHTML = '';
		waitResponse = '';
			 if(response == 1) {
				CapellaZipError = '';
			 }else if(response == 0){
				CapellaZipError = 'Please Enter a Valid Zip/Postal Code.';
			 }
   }
}

function onloadCapellaZip(){

	var zip = document.request_form.zip.value ;

	if ( zip != '' ) {
		var url = 'validateCapellaCWZip.php?zip=' + zip ;
		httponloadCapellaZip = getHttpRequestObj();
		httponloadCapellaZip.onreadystatechange = handleHttpResponseonloadCapellaZip;
		httponloadCapellaZip.open('GET', url, true);
		httponloadCapellaZip.send(null);
	}

}

function handleHttpResponseonloadCapellaZip(){
	if(httponloadCapellaZip.readyState == 4){
	    var response = httponloadCapellaZip.responseText;
			 if(response == 1) {
				CapellaZipError = '';
			 }else if(response == 0){
				CapellaZipError = 'Please Enter a Valid Zip/Postal Code.';
			 }
        }
}

//CHR745 Capella Zip Code Validation End


/* Walden video tracking */
function getResourceTrack(sId,rId,eId){
	var url = '/getResourceTrack.php?schoolId='+sId+'&resId='+rId+'&eventId='+eId;
	httpTrack = getHttpRequestObj();
	httpTrack.open('GET', url, true);
	httpTrack.send(null);

}
