
realEventHandler.attachEvent(document.mainForm.citizenship, "change", citizenship);

function citizenship(){
	
	/*
	0 US Citizen
	1 Puerto Rican National
	2 US Resident
	3 Other
	*/
	var el = document.mainForm.citizenship;
	if(!el)return;
	var selected = el.options[el.selectedIndex].value;
	
	/*
		Resident status for anyone that is a resident
		English proficiency for anyone that is not a citizen
		Permanent Resident of US for anyone that is not a citizen
		Ethnicity for anyone that is citizen or resident
	*/
	
	switch(selected){
	
		case "0": // US Citizen
				
			document.getElementById("residentStatus").setAttribute("display",0);
			document.getElementById("proficientEnglish").setAttribute("display",0);
			document.getElementById("ethnicity").setAttribute("display",1);
			document.getElementById("permResident").setAttribute("display",0);
						
		break;
		case "1": // Puerto Rican National
				
			document.getElementById("residentStatus").setAttribute("display",0);
			document.getElementById("proficientEnglish").setAttribute("display",1);
			document.getElementById("ethnicity").setAttribute("display",0);
			document.getElementById("permResident").setAttribute("display",1);
			
		break;
		case "2": // US Resident
						
			document.getElementById("residentStatus").setAttribute("display",1);
			document.getElementById("proficientEnglish").setAttribute("display",1);
			document.getElementById("ethnicity").setAttribute("display",1);
			document.getElementById("permResident").setAttribute("display",1);
						
		break;
		case "3": // Other
		
			document.getElementById("residentStatus").setAttribute("display",0);
			document.getElementById("proficientEnglish").setAttribute("display",1);
			document.getElementById("ethnicity").setAttribute("display",0);
			document.getElementById("permResident").setAttribute("display",1);
			
		break;
	}
	
	realEventHandler.fireEvent(document.mainForm.residentStatus,["change","click"]);
	realEventHandler.fireEvent(document.mainForm.proficientEnglish,["change","click"]);
	realEventHandler.fireEvent(document.mainForm.ethnicity,["change","click"]);
	realEventHandler.fireEvent(document.mainForm.permResident,["change","click"]);
	
	showAll();
}





if(!document.all)
	realEventHandler.attachEvent(document.mainForm.proficientEnglish, "change", proficientEnglish);
else	
	realEventHandler.attachEvent(document.mainForm.proficientEnglish, "click", proficientEnglish); // IE FIX

function proficientEnglish(){

	//alert('proficientEnglish');
	
	try{
	
		var holder = document.getElementById("proficientEnglish");
		if(!holder)return;
		if(holder.getAttribute("display")==0)
			throw null;
		
		var el = document.mainForm.proficientEnglish;
		
		// If no
		if((el[0].value=="0" && el[0].checked) || (el[1].value=="0" && el[1].checked)){
		
			document.getElementById("passedEnglish").setAttribute("display",1);
		
		}else{
		
			throw null;
			
		}

	}catch(e){
	
		document.getElementById("passedEnglish").setAttribute("display",0);
	
	}
	
	realEventHandler.fireEvent(document.mainForm.passedEnglish,["change","click"]);
	
	showAll();
}




if(!document.all)
	realEventHandler.attachEvent(document.mainForm.passedEnglish, "change", passedEnglish);
else
	realEventHandler.attachEvent(document.mainForm.passedEnglish, "click", passedEnglish); // IE FIX

function passedEnglish(){
	
	try{
	
		var holder = document.getElementById("passedEnglish");
		if(!holder)return;
		if(holder.getAttribute("display")==0)
			throw null;
						
		var el = document.mainForm.passedEnglish;
		
		// If no
		if((el[0].value=="0" && el[0].checked) || (el[1].value=="0" && el[1].checked)){
		
			window.location.href='notEligible.asp';
		
		}
	
	}catch(e){
	
	}
	
	showAll();	
}



realEventHandler.attachEvent(document.mainForm.residentStatus, "change", residentStatus);

function residentStatus(){
	
	try{
	
		var holder = document.getElementById("residentStatus");
		if(!holder)return;
		if(holder.getAttribute("display")==0)
			throw null;
				
		var el = document.mainForm.residentStatus;
		
		switch (el.options[el.selectedIndex].value){
			case "0":
			case "1":
			case "2":
			
				window.location.href='notEligible.asp';
				
			break;
		}
	
	}catch(e){
	
	
	}
	
	showAll();
}



realEventHandler.attachEvent(document.mainForm.ethnicity, "change", ethnicity);

function ethnicity(){
		
	try{	
	
		var holder = document.getElementById("ethnicity");
		if(!holder)return;
		if(holder.getAttribute("display")==0)
			throw null;
			
		var el = document.mainForm.ethnicity;
		
		if (el.options[el.selectedIndex].value=="3"){
			document.getElementById("tribeName").setAttribute("display",1);
		}else{	
			throw null;
		}
		
	}catch(e){
	
		document.getElementById("tribeName").setAttribute("display",0);
			
	}
	
	realEventHandler.fireEvent(document.mainForm.tribeName,["change","click"]);
	
	showAll();
}




if(!document.all)
	realEventHandler.attachEvent(document.mainForm.military, "change", military);
else
	realEventHandler.attachEvent(document.mainForm.military, "click", military); // IE Fix


function military(){
	
	try{
	
		var holder = document.getElementById("military");
		if(!holder)return;
		if(holder.getAttribute("display")==0)
			throw null;
				
		var el = document.mainForm.military;
		
		// If yes
		if((el[0].value=="1" && el[0].checked) || (el[1].value=="1" && el[1].checked)){
		
			document.getElementById("militaryAffiliation").setAttribute("display",1);
			document.getElementById("militaryStatus").setAttribute("display",1);
			document.getElementById("militaryEnlistedPost911").setAttribute("display",1);
			
		}else{
		
			throw null;
		
		}
		
	}catch(e){
	
		document.getElementById("militaryAffiliation").setAttribute("display",0);
		document.getElementById("militaryStatus").setAttribute("display",0);
		document.getElementById("militaryEnlistedPost911").setAttribute("display",0);
	
	}
	
	realEventHandler.fireEvent(document.mainForm.militaryAffiliation,["change","click"]);
	realEventHandler.fireEvent(document.mainForm.militaryStatus,["change","click"]);
	realEventHandler.fireEvent(document.mainForm.militaryEnlistedPost911,["change","click"]);
	
	showAll();
}




if(!document.all)
	realEventHandler.attachEvent(document.mainForm.employed, "change", employed);
else
	realEventHandler.attachEvent(document.mainForm.employed, "click", employed); // IE FIX

function employed(){
	
	try{
	
		var holder = document.getElementById("employed");
		if(!holder)return;
		if(holder.getAttribute("display")==0)
			throw null;
			
		var el = document.mainForm.employed;
		
		// If yes
		if((el[0].value=="1" && el[0].checked) || (el[1].value=="1" && el[1].checked)){
		
			document.getElementById("employerName").setAttribute("display",1);
			
		}else{
		
			throw null;
		
		}	
	
	}catch(e){
	
		document.getElementById("employerName").setAttribute("display",0);
	
	}
	
	realEventHandler.fireEvent(document.mainForm.employerName,["change","click"]);
	
	showAll();
}




realEventHandler.attachEvent(document.mainForm.citizenship, "change", highestLevelEdu);
realEventHandler.attachEvent(document.mainForm.highestLevelEdu, "change", highestLevelEdu);

function highestLevelEdu(){
		
	// if College or greater AND NOT US Citizen
	try{
	
		var holder1 = document.getElementById("citizenship");
		var holder2 = document.getElementById("highestLevelEdu");
		if(!holder1 || !holder2)return;
		if(holder1.getAttribute("display")==0 || holder2.getAttribute("display")==0)
			throw null;	
		
		var el = document.mainForm.citizenship;
		var selected = el.options[el.selectedIndex].value;
		
		if(selected=="" || selected=="0")
			throw null;
			
		var el = document.mainForm.highestLevelEdu;
		
		switch (el.options[el.selectedIndex].value){
			case "5":
			case "6":
			case "7":
			case "8":
			case "9":
			
				document.getElementById("creditsOutsideUS").setAttribute("display",1);
				
			break;
			default:
			
				throw null;
			
			break;
		}
		
		
	}catch(e){
	
		document.getElementById("creditsOutsideUS").setAttribute("display",0);
	
	}
	
	realEventHandler.fireEvent(document.mainForm.creditsOutsideUS,["change","click"]);
	
	showAll();
}






if(!document.all)
	realEventHandler.attachEvent(document.mainForm.creditsOutsideUS, "change", creditsOutsideUS);
else
	realEventHandler.attachEvent(document.mainForm.creditsOutsideUS, "click", creditsOutsideUS); // IE FIX

function creditsOutsideUS(){
	
	try{
	
		var holder = document.getElementById("creditsOutsideUS");
		if(!holder)return;
		if(holder.getAttribute("display")==0)
			throw null;
			
		var el = document.mainForm.creditsOutsideUS;
		
		// If yes
		if((el[0].value=="1" && el[0].checked) || (el[1].value=="1" && el[1].checked)){
		
			document.getElementById("degreeOutsideUS").setAttribute("display",1);
			
		}else{
		
			throw null;
		
		}	
	
	}catch(e){
	
		document.getElementById("degreeOutsideUS").setAttribute("display",0);
	
	}
	
	realEventHandler.fireEvent(document.mainForm.degreeOutsideUS,["change","click"]);
	
	showAll();
}





if(!document.all)
	realEventHandler.attachEvent(document.mainForm.degreeOutsideUS, "change", degreeOutsideUS);
else
	realEventHandler.attachEvent(document.mainForm.degreeOutsideUS, "click", degreeOutsideUS); // IE FIX

function degreeOutsideUS(){
	
	try{
	
		var holder = document.getElementById("degreeOutsideUS");
		if(!holder)return;
		if(holder.getAttribute("display")==0)
			throw null;
			
		var el = document.mainForm.degreeOutsideUS;
		
		// If yes
		if((el[0].value=="1" && el[0].checked) || (el[1].value=="1" && el[1].checked)){
		
			document.getElementById("degreeOutsideName").setAttribute("display",1);
			document.getElementById("degreeOutsideUniversity").setAttribute("display",1);
			document.getElementById("degreeOutsideDate").setAttribute("display",1);
			
		}else{
		
			throw null;
		
		}	
	
	}catch(e){
	
		document.getElementById("degreeOutsideName").setAttribute("display",0);
		document.getElementById("degreeOutsideUniversity").setAttribute("display",0);
		document.getElementById("degreeOutsideDate").setAttribute("display",0);
	
	}
	
	realEventHandler.fireEvent(document.mainForm.degreeOutsideName,["change","click"]);
	realEventHandler.fireEvent(document.mainForm.degreeOutsideUniversity,["change","click"]);
	realEventHandler.fireEvent(document.mainForm.degreeOutsideDate,["change","click"]);
	
	showAll();
}





realEventHandler.attachEvent(document.mainForm.areaOfInterest, "change", areaOfInterest);

function areaOfInterest(){
		
	try{
	
		var holder = document.getElementById("areaOfInterest");
		if(!holder)return;
		if(holder.getAttribute("display")==0)
			throw null;
			
		var el = document.mainForm.areaOfInterest;
		var opts = [{value:"",text:"Select One"}];
		
		switch(el.options[el.selectedIndex].value){
		
			case "0":
			
				opts.push({value:"0",text:"Associate of Arts in Communications"});
				opts.push({value:"1",text:"Associate of Arts in General Studies"});
				opts.push({value:"2",text:"Bachelor of Science in Communication"});
			
			break;
			
			case "1":
			
				opts.push({value:"3",text:"Associate of Arts in Accounting"});
				opts.push({value:"4",text:"Associate of Arts in Business"});
				opts.push({value:"5",text:"Associate of Arts in Financial Services"});
				opts.push({value:"6",text:"Associate of Arts in Hospitality, Travel, and Tourism"});
				opts.push({value:"7",text:"Associate of Arts in Sport Management"});
				opts.push({value:"8",text:"Bachelor of Science in Business/Accounting"});
				opts.push({value:"9",text:"Bachelor of Science in Business/Administration"});
				opts.push({value:"10",text:"Bachelor of Science in Business/Communications"});
				opts.push({value:"11",text:"Bachelor of Science in Business/e-Business"});
				opts.push({value:"12",text:"Bachelor of Science in Business/Finance"});
				opts.push({value:"13",text:"Bachelor of Science in Business/Global Business Management"});
				opts.push({value:"14",text:"Bachelor of Science in Business/Green and Sustainable Enterprise Management"});
				opts.push({value:"15",text:"Bachelor of Science in Business/Hospitality Management"});
				opts.push({value:"16",text:"Bachelor of Science in Business/Information Systems"});
				opts.push({value:"17",text:"Bachelor of Science in Business/Integrated Supply Chain and Operations Management"});
				opts.push({value:"18",text:"Bachelor of Science in Business/Management"});
				opts.push({value:"19",text:"Bachelor of Science in Business/Marketing"});
				opts.push({value:"20",text:"Bachelor of Science in Business/Organizational Innovation"});
				opts.push({value:"21",text:"Bachelor of Science in Business/Public Administration"});
				opts.push({value:"22",text:"Bachelor of Science in Business/Retail Management"});
				opts.push({value:"23",text:"Bachelor of Science in Business/Small Business Management and Entrepreneurship"});
				opts.push({value:"24",text:"Bachelor of Science in Management"});
				opts.push({value:"25",text:"Master of Business Administration"});
				opts.push({value:"26",text:"Master of Business Administration/Accounting"});
				opts.push({value:"27",text:"Master of Business Administration/Global Management"});
				opts.push({value:"28",text:"Master of Business Administration/Health Care Management"});
				opts.push({value:"29",text:"Master of Business Administration/Human Resources Management"});
				opts.push({value:"30",text:"Master of Business Administration/Marketing"});
				opts.push({value:"31",text:"Master of Business Administration/Public Administration"});
				opts.push({value:"32",text:"Master of Business Administration - Spanish"});
				opts.push({value:"33",text:"Master of Business Administration/Technology Management"});
				opts.push({value:"34",text:"Master of Management"});
				opts.push({value:"35",text:"Master of Management/Human Resources Management"});
				opts.push({value:"36",text:"Master of Management/Public Administration"});
				opts.push({value:"37",text:"Master of Science in Accountancy"});
				opts.push({value:"38",text:"Doctor of Business Administration"});
				opts.push({value:"39",text:"Doctor of Management in Organizational Leadership"});
			
			break;
			
			case "2":
			
				opts.push({value:"40",text:"Associate of Arts in Criminal Justice"});
				opts.push({value:"41",text:"Bachelor of Science in Criminal Justice Administration"});
				opts.push({value:"42",text:"Bachelor of Science in Organizational Security and Management"});
				opts.push({value:"43",text:"Master of Science/Administration of Justice and Security"});
			
			break;
			
			case "3":

				opts.push({value:"44",text:"Associate of Arts in Elementary Education"});
				opts.push({value:"45",text:"Associate of Arts in Paraprofessional Education"});
				opts.push({value:"46",text:"Bachelor of Science in Education/Elementary Education"});
				opts.push({value:"47",text:"Master of Arts in Education/Administration and Supervision"});
				opts.push({value:"48",text:"Master of Arts in Education/Adult Education and Training"});
				opts.push({value:"49",text:"Master of Arts in Education/Curriculum and Instruction"});
				opts.push({value:"50",text:"Master of Arts in Education/Curriculum and Instruction-Computer Education"});
				opts.push({value:"51",text:"Master of Arts in Education/Curriculum and Instruction-English and Language Arts Education"});
				opts.push({value:"52",text:"Master of Arts in Education/Curriculum and Instruction-English as a Second Language"});
				opts.push({value:"53",text:"Master of Arts in Education/Curriculum and Instruction-Mathematics Education"});
				opts.push({value:"54",text:"Master of Arts in Education/Early Childhood Education"});
				opts.push({value:"55",text:"Master of Arts in Education/Early Childhood Education (Non-Certification)"});
				opts.push({value:"56",text:"Master of Arts in Education/Elementary Education/Early Childhood Specialization"});
				opts.push({value:"57",text:"Master of Arts in Education/Elementary Education/Middle Level Specialization"});
				opts.push({value:"58",text:"Master of Arts in Education/Elementary Teacher Education"});
				opts.push({value:"59",text:"Master of Arts in Education/Secondary Education/Middle Level Specialization"});
				opts.push({value:"60",text:"Master of Arts in Education/Secondary Teacher Education"});
				opts.push({value:"61",text:"Doctor of Education in Educational Leadership"});
				opts.push({value:"62",text:"Doctor of Education in Educational Leadership/Curriculum and Instruction"});
				opts.push({value:"63",text:"Doctor of Education in Educational Leadership/Educational Technology"});
				opts.push({value:"64",text:"Doctor of Philosophy in Higher Education Administration"});
				opts.push({value:"65",text:"Other non listed degree"});

			break;
			
			case "4":

				opts.push({value:"66",text:"Associate of Arts in Human Services Management"});
				opts.push({value:"67",text:"Bachelor of Science in Human Services"});
				opts.push({value:"68",text:"Bachelor of Science in Human Services/Management"});

			break;
			
			case "5":

				opts.push({value:"69",text:"Associate of Arts in Health Care Administration"});
				opts.push({value:"70",text:"Associate of Arts in Health Care Administration-Medical Records"});
				opts.push({value:"71",text:"Associate of Arts in Health Care Administration-Pharmacy Practice"});
				opts.push({value:"72",text:"Bachelor of Science in Health Administration"});
				opts.push({value:"73",text:"Bachelor of Science in Health Administration/Health Information Systems"});
				opts.push({value:"74",text:"Bachelor of Science in Health Administration/Long Term Care"});
				opts.push({value:"75",text:"RN to Bachelor of Science in Nursing"});
				opts.push({value:"76",text:"Master of Health Administration"});
				opts.push({value:"77",text:"Master of Health Administration/Education"});
				opts.push({value:"78",text:"Master of Health Administration/Gerontology"});
				opts.push({value:"79",text:"Master of Health Administration/Informatics"});
				opts.push({value:"80",text:"Master of Science in Nursing"});
				opts.push({value:"81",text:"Master of Science in Nursing/Informatics"});
				opts.push({value:"82",text:"Master of Science in Nursing/Master of Business Administration/Health Care Management"});
				opts.push({value:"83",text:"Master of Science in Nursing/Master of Health Administration"});
				opts.push({value:"84",text:"Master of Science in Nursing for Nurse Practitioners"});
				opts.push({value:"85",text:"Master of Science in Nursing/Nursing/Health Care Education"});
				opts.push({value:"86",text:"Doctor of Health Administration"});
				opts.push({value:"87",text:"Other non listed degree"});

			break;
			
			case "6":

				opts.push({value:"88",text:"Associate of Arts in Psychology"});
				opts.push({value:"89",text:"Bachelor of Science in Psychology"});
				opts.push({value:"90",text:"Master of Science in Psychology"});
				opts.push({value:"91",text:"Doctor of Philosophy in Industrial/Organizational Psychology"});
				opts.push({value:"92",text:"Other non listed degree"});

			break;
			
			case "7":

				opts.push({value:"93",text:"Associate of Arts in Information Technology"});
				opts.push({value:"94",text:"Associate of Arts in Information Technology/Information Technology Support"});
				opts.push({value:"95",text:"Associate of Arts in Information Technology/Networking"});
				opts.push({value:"96",text:"Associate of Arts in Information Technology/Web Design"});
				opts.push({value:"97",text:"Bachelor of Science in Information Technology-Business Systems Analysis"});
				opts.push({value:"98",text:"Bachelor of Science in Information Technology-Information Systems Security"});
				opts.push({value:"99",text:"Bachelor of Science in Information Technology-Information Technology Support"});
				opts.push({value:"100",text:"Bachelor of Science in Information Technology-Multimedia and Visual Communication"});
				opts.push({value:"101",text:"Bachelor of Science in Information Technology-Networking and Telecommunications"});
				opts.push({value:"102",text:"Bachelor of Science in Information Technology-Software Engineering"});
				opts.push({value:"103",text:"Bachelor of Science in Information Technology-Web Development"});
				opts.push({value:"104",text:"Master of Information Systems"});
				opts.push({value:"105",text:"Doctor of Management in Organizational Leadership/Information Systems and Technology"});
				opts.push({value:"106",text:"Other non listed degree"});

			break;
			
			
			default:
			
				throw null;
		}
		
		var el2 = document.mainForm.programOfInterest;
		el2.innerHTML="";
		
		var defaultValue = el2.getAttribute("defaultSelect");
		var selectedIndex = 0;
		
		for(var i=0;i<opts.length;i++){
			if(opts[i].value==defaultValue)
				selectedIndex=i;
			el2.options[i] = new Option(opts[i].text,opts[i].value);
		}
		el2.selectedIndex = selectedIndex;

		(new YAHOO.Hack.FixIESelectWidth(el2));
		document.getElementById("programOfInterest").setAttribute("display",1);
		
	}catch(e){
	
		document.getElementById("programOfInterest").setAttribute("display",0);
			
	}
	
	realEventHandler.fireEvent(document.mainForm.programOfInterest,["change","click"]);
	
	showAll();
}





realEventHandler.attachEvent(document.mainForm.programOfInterest, "change", programOfInterest);

function programOfInterest(){
		
	try{
	
		var holder = document.getElementById("programOfInterest");
		if(!holder)return;
		if(holder.getAttribute("display")==0)
			throw null;
			
		var el = document.mainForm.programOfInterest;
		
		switch (el.options[el.selectedIndex].value){
			case "75":
			case "80":
			case "81":
			case "82":
			case "83":
			case "84":
			case "85":
			
				document.getElementById("RNLicense").setAttribute("display",1);
				
			break;			
			default:
			
				throw null;
				
		}
		
	}catch(e){
	
		document.getElementById("RNLicense").setAttribute("display",0);
			
	}
	
	realEventHandler.fireEvent(document.mainForm.RNLicense,["change","click"]);
	
	showAll();
}





function initializeQuestionQueue(){

	var queue = document.getElementById("quesQueue");
	
	for(var i=0;i<queue.childNodes.length;i++)
		if(queue.childNodes[i].tagName=="DIV"){
			questionQueue.push(queue.childNodes[i]);
			queue.childNodes[i].number=questionQueue.length-1;
			queue.childNodes[i].setAttribute("display",1);
			queue.childNodes[i].style.display="none";
		}
		
}


function quesChange(offset,decrement){
	
	decrement = decrement || false;
	offset = offset || 1;
	
	var queue = document.getElementById("quesQueue");
	var current = null;
	var next = null;
	
	for(var i=0;i<questionQueue.length;i++){
		if(questionQueue[i].style.display!="none"){ // It should be shown
			current=questionQueue[i];
			break;
		}
	}
			
	// Look for the currently visible one
	for(var i=current.number+(decrement?-offset:offset);i<questionQueue.length && i>=0;(decrement?i--:i++)){
		if(questionQueue[i].getAttribute("display")==1){
		
			removeListeners(current);
			current.style.display="none";
			
			next = questionQueue[i];
			displayQuestion(next);
				
			return;
		}
	}
	
	// If we got here, none left to show, beginning or end of questions
	if(!decrement)
		document.mainForm.submit();
	
}


function displayQuestion(next){

	addListeners(next);
	next.style.display="block";			
	toggleBackButton(next);
	
}


function toggleBackButton(next){

	for(var i=next.number-1;i>=0;i--)	
		if(questionQueue[i].getAttribute("display")==1){			
			document.getElementById("backButton").style.display="inline"
			return;
		}
		
	document.getElementById("backButton").style.display="none"

}


function addListeners(question){
	
	var inputDOM = question.getElementsByTagName("INPUT");
	for(var j=0;j<inputDOM.length;j++){
		if(inputDOM[j].getAttribute("type")=="text"){
			realEventHandler.attachEvent(inputDOM[j], "change", nextQuestionText);
		}else if(inputDOM[j].getAttribute("type")=="radio"){
			var eType=(document.all?"click":"change");
			realEventHandler.attachEvent(inputDOM[j], eType, nextQuestionRadio);
		}
	}
	
	var selectDOM = question.getElementsByTagName("SELECT");
	for(var j=0;j<selectDOM.length;j++){
		realEventHandler.attachEvent(selectDOM[j], "change", nextQuestionSelect);
	}

}




function removeListeners(question){

	var inputDOM = question.getElementsByTagName("INPUT");
	for(var j=0;j<inputDOM.length;j++)
		if(inputDOM[j].getAttribute("type")=="text")
			realEventHandler.removeEvent(inputDOM[j], "change", nextQuestionText);
		else if(inputDOM[j].getAttribute("type")=="radio"){
			var eType=(document.all?"click":"change");
			realEventHandler.removeEvent(inputDOM[j], eType, nextQuestionRadio);
		}
	
	var selectDOM = question.getElementsByTagName("SELECT");
	for(var j=0;j<selectDOM.length;j++)
		realEventHandler.removeEvent(selectDOM[j], "change", nextQuestionSelect);

}


function nextQuestionText(){

	if(this.value==this.getAttribute("maxLength"))
		quesChange();

}

function nextQuestionRadio(e){
	
	if(this.checked)
		quesChange();
		
	for(var i=0;i<this.length;i++)
		if(this[i].checked){
			quesChange();
			return;
		}

}

function nextQuestionSelect(){
	
	if(this.options[this.selectedIndex].value!="")
		quesChange();

}


function showAll(){
	if(_showAll)
		for(var i=0;i<questionQueue.length;i++)
			if(questionQueue[i].getAttribute("display")==1)
				questionQueue[i].style.display="block";
			else
				questionQueue[i].style.display="none";				
}


// Fix IE problem
if(document.all){
	(new YAHOO.Hack.FixIESelectWidth(document.getElementById("areaOfInterest").getElementsByTagName("SELECT")[0]));
/*
	var selects = document.getElementsByTagName("SELECT");
	for(var i=0;i<selects.length;i++){
		(new YAHOO.Hack.FixIESelectWidth(selects[i]));
	}
*/
}




function verify(){

	if(!_showAll)
		return true;

	var byRef= (new function(){this.passed=true});
	
	checkSelect(byRef,"citizenship","Citizenship must be filled in.");
	checkSelect(byRef,"residentStatus","Resident Status must be filled in.");
	checkRadio(byRef,"proficientEnglish","English Proficiency must be filled in."); // RADIO
	checkRadio(byRef,"passedEnglish","Passed English exam must be filled in."); // RADIO
	checkSelect(byRef,"ethnicity","Please fill in your ethnic background.");
	checkInput(byRef,"tribeName","Please fill in your tribe name."); // INPUT
	checkRadio(byRef,"military","Please fill in if you are/have enlisted in the United States Military."); // Radio
	checkSelect(byRef,"militaryAffiliation","Please fill in your military affiliation."); 
	checkSelect(byRef,"militaryStatus","Please fill in your current military status.");
	checkRadio(byRef,"militaryEnlistedPost911","Please fill in when you were serving the military."); // Radio
	checkSelect(byRef,"highestLevelEdu","Please fill in your highest level of education");
	checkRadio(byRef,"creditsOutsideUS","Please tell us if any credits were earned outside the US."); // Radio
	checkRadio(byRef,"degreeOutsideUS","Please tell us if you completed your degree outside of the US."); // Radio
	checkInput(byRef,"degreeOutsideName","Please tell us the name of the degree you earned outside of the US."); // Input
	checkInput(byRef,"degreeOutsideUniversity","Please tell us the name of the University where you earned your degree."); // Input
	checkSelect(byRef,"degreeOutsideDate","Please tell us the date you completed your degree outside of the US.");
	checkRadio(byRef,"permResident","Please tell us if you are a permanent resident of the US."); // Radio
	checkRadio(byRef,"onlineOrCampus","Please tell us if you are interested in online or campus-based learning."); // Radio
	checkSelect(byRef,"areaOfInterest","Please fill in your Area of Interest.");
	checkSelect(byRef,"programOfInterest","Please fill in your Program of Interest.");
	checkRadio(byRef,"RNLicense","Please tell us if you have your RN license."); // RADIO
		
	checkCustom(byRef,"firstName","Please fill in your First Name.",function(x){
		if(x.value=="")
			return false;
		else
			return true;
	});
	
	checkCustom(byRef,"lastName","Please fill in your Last Name.",function(x){
		if(x.value=="")
			return false;
		else
			return true;
	});
	
	checkCustom(byRef,"email","Please fill in your Email.",function(x){
		if(x.value=="")
			return false;
		else
			return true;
	});
		
	if(document.mainForm.country_id.options[document.mainForm.country_id.selectedIndex].value=="US" || document.mainForm.country_id.options[document.mainForm.country_id.selectedIndex].value=="CA")
		checkSelect(byRef,"state_or_province","Please fill in your State or Province.");
		
	checkCustom(byRef,"city","Please fill in your City.",function(x){
		if(x.value=="")
			return false;
		else
			return true;
	});
	
	checkCustom(byRef,"postal","Please fill in your Postal Code.",function(x){
		if(x.value=="")
			return false;
		else
			return true;
	});
	
	checkSelect(byRef,"country_id","Please fill in your Country.");		
	checkSelect(byRef,"mob","Please select your Preferred Phone.");
	
	checkCustom(byRef,"country_code","Please fill in your Area Code.",function(x){
		if(x.value.length!=3)
			return false;
		else
			return true;
	});
	
	checkCustom(byRef,"area_code","Please fill in your Phone Prefix.",function(x){
		if(x.value.length!=3)
			return false;
		else
			return true;
	});
	
	checkCustom(byRef,"phone_number","Please fill in your Phone Suffix.",function(x){
		if(x.value.length!=4)
			return false;
		else
			return true;
	});
			
	checkRadio(byRef,"employed","Please tell us if you are employed."); // RADIO
	checkInput(byRef,"employerName","Please tell us your employer."); // INPUT
	checkSelect(byRef,"preferredStartDate","Please fill in your preferred enrollment date.");
			
	if(!byRef.passed)
		return false;
	
	return true;
}


function checkSelect(byRef,toCheck,errorMsg)
{
	if(!byRef.passed)
		return;
		
	if(document.getElementById(toCheck).getAttribute("display")==1){	
		if(document.mainForm[toCheck].selectedIndex==0){
			byRef.passed=false;
			alert(errorMsg);
			document.mainForm[toCheck].focus();
		}		
	}
}


function checkInput(byRef,toCheck,errorMsg)
{
	if(!byRef.passed)
		return;
		
	if(document.getElementById(toCheck).getAttribute("display")==1){	
		if(document.mainForm[toCheck].value==""){
			byRef.passed=false;
			alert(errorMsg);
			document.mainForm[toCheck].focus();
		}		
	}
}


function checkRadio(byRef,toCheck,errorMsg)
{
	if(!byRef.passed)
		return;
		
	if(document.getElementById(toCheck).getAttribute("display")==1){
	
		var checked=false;
		for(var i=0;i<document.mainForm[toCheck].length;i++){
			if(document.mainForm[toCheck][i].checked){
				checked=true;
				break;
			}
		}
		
		if(!checked){
			byRef.passed=false;
			alert(errorMsg);
			document.mainForm[toCheck][0].focus();
		}
		
	}
}


function checkCustom(byRef,toCheck,errorMsg,customHandler)
{
	if(!byRef.passed)
		return;
		
	var x = document.mainForm[toCheck];
		
	if(!customHandler(x)){
		byRef.passed=false;
		alert(errorMsg);
		x.focus();		
	}
}



























var questionQueue = new Array();
initializeQuestionQueue();
