function resetPage(){		
	reValue();	
}


function subjectInvoke(obj, blckid){
	if(obj.checked){		
		showIt(blckid);
	}
	else{
		hideIt(blckid);
	}
}

function gotSubject(subid){
	var sel_area = document.UserForm.SUBJECT;	
	for(var i = 0; i<sel_area.length; i++){
		if(sel_area[i].checked){
			if(sel_area[i].value == subid){
				return true;
			}
		}
	}
	return false;
}


function setSubject(str){
	var sel_area = document.UserForm.SUBJECT;
	if(str != ""){
		str = ","+str+",";			
		for(var i = 0; i<sel_area.length; i++){
			if(str.indexOf(","+sel_area[i].value+",") != -1){
				sel_area[i].checked = true;
			}
		}
	}
}

function alertSelectEmpty(obj, msgtext){
	if(obj){
		if(obj.value ==''){
			alert(msgtext);
			obj.focus();
			return true;
		}
	}
	return false;
}

function validateForm1(){
	if(validateSubArea(document.UserForm.SUBJECT) == false){
		alert("Please pick one or more subject areas that you are interested in");
		return false;
	}

	if(alertSelectEmpty(document.UserForm.DEGREELEVEL,"What is your highest level of education?")){		
		return false;
	}
	if(alertSelectEmpty(document.UserForm.GPA,"What was your GPA?")){		
		return false;
	}	
	if(alertSelectEmpty(document.UserForm.YEARGRAD,"What year did you graduate?")){		
		return false;
	}
	if(alertSelectEmpty(document.UserForm.EXPERIENCE,"How many years of work experience do you have?")){		
		return false;
	}
	if(alertSelectEmpty(document.UserForm.CITIZEN,"Are you a U.S. Citizen?")){		
		return false;
	}
	if(alertSelectEmpty(document.UserForm.MILITARY,"Are you associated with the U.S. military?")){		
		return false;
	}
	if(alertSelectEmpty(document.UserForm.ENROLLAGE,"What year were you born?")){		
		return false;
	}
	if(alertSelectEmpty(document.UserForm.JOININGTIME,"When do you plan to start classes?")){		
		return false;
	}
	if(alertSelectEmpty(document.UserForm.ZIP,"Please enter a valid zip code")){		
		return false;
	}	
	if(checkzip(document.UserForm.ZIP.value) ==0){
		alert("Please enter a valid zip code");
		document.UserForm.ZIP.focus();
		return false;
	}
	
	document.UserForm.SUBJECTIDS.value = combineSubID(document.UserForm.SUBJECT);
	
	showIt("busyIcon");
	hideIt("nextButton");			
	document.UserForm.submit();
	startAnimation();		
	return true;	
}

function combineSubID(sel_area){
	var text = "";
	for( i = 0; i<sel_area.length; i++){
		if(sel_area[i].checked){
			text += ","+sel_area[i].value;
		}
	}
	
	if(text.length>0){
		text = text.substring(1);
	}
	
	return text;
}

function validateSubArea(sel_area){
	for( i = 0; i<sel_area.length; i++){
		if(sel_area[i].checked){
			return true;
		}
	}
	return false;
}


function checkDyZip(value){	
	
	if(value.length ==5){
		//alert("value = "+value);
		if(checkzip(value) == 0){				
			return false;
		}
	}
	return true;
}
