
function warn_age() {
	var age = document.ACMEForm.age.options[document.ACMEForm.age.selectedIndex].value;
	if (age == "Under 21") {
		alert("You must be age 21 or older to request information.");
		document.ACMEForm.age.value="-1";
	}else if (age == "Under 22") {
		alert("You must be age 22 or older to request information.");
		document.ACMEForm.age.value="-1";
	}else if (age == "Under 23") {
		alert("You must be age 23 or older to request information.");
		document.ACMEForm.age.value="-1";
	}	
	return;
}

function warn_prg() {
	var w = document.ACMEForm.program.options[document.ACMEForm.program.selectedIndex].value;
	if (w == "-1" || w == "" || w == "-2") {
		alert("You selected a category. Please select a Program of Interest.");
		document.ACMEForm.program.value="-1";
	}
	return;
}


function warn_education() {
	var edu = document.ACMEForm.education.options[document.ACMEForm.education.selectedIndex].value;
	var prg = document.ACMEForm.program.options[document.ACMEForm.program.selectedIndex].value;
	prg = prg.split('.');
	prg = prg[0];

	var assoc_prgs = new Array("AA","AAB","AABA","AAGS","AALA","AALS","AOD","ASA","ASAO","ASB","ASBM","ASBO","ASCIT","ASCJ","ASCJO","ASE","ASMS","AES","CHRM","CPM","CSM","CSMO");
	var bach_prgs = new Array("BSBAO","BAB","BAM","BASS","BBA","BHA","BHS","BSAC","BSACO","BSAM","BSBA","BSBIS","BSBISO","BSBM","BSCM","BSEE","BSHD","BS-HSM","BSM","BSMIS","BSMK","BSML","BSMO","BSMS","BSN","BS-SMIS","RNBS");
	var mast_prgs = new Array("MBAOX-ACCT","MBA-MGT","MBAOX-MGT","MBAOX-HLTH","MBAOX","MAED","MAOL","MAT","MBA","MBA-ACC","MBA-HC","MBAO","MBAO-ACC","MBAO-MGT","MBAO-HC","MED","MEDC","MEDO","MEDR","MEDT","ML","MMOL","MSM","MSMO","MPH - HE","MPH - HP");

	Array.prototype.indexOf=function(n){for(var i=0;i<this.length;i++){if(this[i]===n){return i;}}return -1;}

	if (edu == "-1" || edu == "6" || edu == "7") {
		
	} else if (edu == "1") {
		alert("Sorry, you must have higher Education Level to request information.");
		document.ACMEForm.education.value="-1";
	} else if ((edu == "2" || edu == "3" || edu == "4" || edu == "5") && (mast_prgs.indexOf(prg) != -1)) {
		alert("Sorry, you must have higher Education Level to request information.");
		document.ACMEForm.education.value="-1";
	}
	return;
}

function warn_contactMethod() {
	var cm = document.ACMEForm.contactMethod.options[document.ACMEForm.contactMethod.selectedIndex].value;
	var dphone1 = document.ACMEForm.dphone1.value;
	var dphone2 = document.ACMEForm.dphone2.value;
	var dphone3 = document.ACMEForm.dphone3.value;

	var wphone1 = document.ACMEForm.wphone1.value;
	var wphone2 = document.ACMEForm.wphone2.value;
	var wphone3 = document.ACMEForm.wphone3.value;

	var homephone = dphone1 + dphone2 + dphone3;
	var workphone = wphone1 + wphone2 + wphone3;

	if (cm == "-1" || cm == "e") {
	}
	else {
		if (cm == "hp" && (homephone.length != 10)) {
			alert("Please enter home phone number or change contact method.");
			document.ACMEForm.contactMethod.value="-1";
		}
		else if (cm == "wp" && (workphone.length != 10)) {
			alert("Please enter work phone number or change contact method.");
			document.ACMEForm.contactMethod.value="-1";
		}
	}
	return;
}

function show(n) {
	document.getElementById(n).style.display = "block";
}

function hide(n) {
	document.getElementById(n).style.display = "none";
}

function showSubLocationOld() {
	var schoolId = document.ACMEForm.location.options[document.ACMEForm.location.selectedIndex].value;

	if (schoolsWithSubs[schoolId] == "") {
	}
	else {
		//document.getElementById("subLocationOptions").style.display = "block";
		document.getElementById("subLocation").style.display = "block";

		var objSelect = document.getElementById("subLocation");
		var objOption;
		for(var idx = 0; idx < schoolsWithSubs[schoolId].length; idx++) {
			objOption = document.createElement("option");
			objOption.text = schoolsWithSubs[schoolId][idx][1];
			objOption.value = schoolsWithSubs[schoolId][idx][0];
			objSelect.appendChild(objOption);
			//options += '<option value="' + schoolsWithSubs[schoolId][idx][0] + '">' + schoolsWithSubs[schoolId][idx][1] + '</option>';
		}
		//alert("opt"+options);
		//document.getElementById("subLocationOptions").innerHTML = options;
	}
	return;
}


function showSubLocation() {
	var schoolId = document.ACMEForm.location.options[document.ACMEForm.location.selectedIndex].value;


	Array.prototype.indexOf=function(n){for(var i=0;i<this.length;i++){if(this[i]===n){return i;}}return -1;}

	if (schoolsWithSubs.indexOf(schoolId) == -1) {
		document.getElementById("subLocationDiv").style.display = "none";
	}
	else {
		document.getElementById("subLocationDiv").style.display = "block";
		updateSubLocations(schoolId);
	}


	return;
}

function updateSubLocations(z) {
	var i,s,b,selected_value;
	var l=MM_findObj('subLocation');

	l.length=0;l.options[0]=new Option('-1','');
	b=(z!='nill')?eval('C'+z+'_subLocations'):0;

	for(i=0;i<b.length;i++){ 
		s=b[i].split("|");
		l.options[i]=new Option(s[1],s[0]);
	} 

	if(selected_value != "") {
		l.selectedIndex=selected_value;
	} else {
		l.selectedIndex=0;
	}
	return;
}


function openPopup(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >=4) { win.window.focus(); }
}
