
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->


var xmlhttp
var tag

function loadXMLDoc(url)
{

// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  xmlhttp.onreadystatechange=state_Change
  xmlhttp.open("GET",url,true)
  xmlhttp.send(null)
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttp)
    {
    xmlhttp.onreadystatechange=state_Change
    xmlhttp.open("GET",url,true)
    xmlhttp.send()
    }
  }
}

function state_Change()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
  {
  // if "OK"
  if (xmlhttp.status==200)
  {
  //alert("XML data OK")
  document.getElementById(tag).innerHTML=xmlhttp.responseText;
  }
  else
  {
  alert("Problem retrieving XML data:" + xmlhttp.statusText)
  }
  }
}

function ElemID(id)
{
tag = id;

//Load image
var element = document.getElementById(tag);
element.innerHTML = '<img src="http://www.gcu.edu/fulfillment/images/loading.gif" width="16" height="16">&nbsp;<label>Loading...</label>';
}





function formCheck(formobj){

if (formobj.fname.value == "80000001") {
return false;
}

 if(formobj.email.value != '') {
  if(formobj.con_email.value != formobj.email.value) {
   alert('Email Address Does Not Match!');
   return false;
  }
 }
 
 if((formobj.fname.value == 'check') && (formobj.lname.value == 'source')) {
  alert('Vendor - SDGA \n Source - INT');
  return false;
 
 } else {
 
 // Enter name of mandatory fields
 var fieldRequired = Array("fname", "lname", "email", "address", "country", "zipcode", "phone", "education", "interest","citizen");
 // Enter field description to appear in the dialog box
 var fieldDescription = Array("First Name", "Last Name", "Email", "Address", "Country", "ZipCode", "Phone", "Level of Education", "Program of Interest","U.S. Citizen");
 // dialog message
 var alertMsg = "Please complete the following fields:\n";
 
 var l_Msg = alertMsg.length;
 
 for (var i = 0; i < fieldRequired.length; i++){
  var obj = formobj.elements[fieldRequired[i]];
  if (obj){
   switch(obj.type){
   case "select-one":
    if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].value == ""){
     alertMsg += " - " + fieldDescription[i] + "\n";
    }
    break;
   case "select-multiple":
    if (obj.selectedIndex == -1){
     alertMsg += " - " + fieldDescription[i] + "\n";
    }
    break;
   case "text":
   case "textarea":
    if (obj.value == "" || obj.value == null){
     alertMsg += " - " + fieldDescription[i] + "\n";
    }
    break;
   default:
   }
   if (obj.type == undefined){
    var blnchecked = false;
    for (var j = 0; j < obj.length; j++){
     if (obj[j].checked){
      blnchecked = true;
     }
    }
    if (!blnchecked){
     alertMsg += " - " + fieldDescription[i] + "\n";
    }
   }
  }
 }

 if (alertMsg.length == l_Msg)
 {
  	if(formobj.gcuEvent.value == 'Select') 
	{
		alert('Please answer the question Did you hear about GCU from an event?!');
 	}
	else
	{
 		document.contact.submit();
	}
 }
 else
 {
	alert(alertMsg); 
 }
}

}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

function prog() {

var mod = 1;

var edu = document.contact.education.value;

var dest = 'http://tetra/onlinecms/req_info/prog.php?target=' + mod + '&target2=' + edu;

ElemID('prog');
loadXMLDoc(dest);
}

///////////////////////////////////////////////////////////////////////////////////////////

function qual() {

var rn = Math.random()*5;

var prog = document.contact.interest.options[document.contact.interest.selectedIndex].value; 

var dest = 'http://tetra/onlinecms/req_info/qual.php?target3=' + prog + '&rn=' + rn;

ElemID('qual');
loadXMLDoc(dest);
}

///////////////////////////////////////////////////////////////////////////////////////////

function ziplook() {

var zip = document.contact.zipcode.value;

var ziplen = document.contact.zipcode.value.length;

if(ziplen == 5) {

ElemID('zip_pad');

var dest = 'http://tetra/onlinecms/req_info/zip.php?zipcode=' + zip;

loadXMLDoc(dest);

//window.setTimeout('dupe(), ElemID("duped")', 3000);

}

}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function fc() {

document.getElementById('displayEducationQ').innerHTML = "<input type=\"hidden\" name=\"gcuEvent\" value=\"\" />";

var loc = document.contact.country.value;

if(loc == 'US' ) {

var dest = 'http://tetra/onlinecms/req_info/fc2.php';

} else {

var dest = 'http://tetra/onlinecms/req_info/fc.php';

}

ElemID('fc');
loadXMLDoc(dest);
}

function jumpto(x){

if (document.contact.modality.value != "null") {
 document.location.href = x
 }
}


function displayEducationQ()
{
	var mod = 1;
	var myForm = document.getElementById('contact');
	var country = myForm.country.value;
	var programName = myForm.interest.value;
	if (country == "US")
	{
		var zipcode = myForm.zipcode.value;
		var ziplen = myForm.zipcode.value.length;

		if(ziplen == 5 && programName)
		{
			var rn = Math.random()*5;
			var dest = "http://tetra/onlinecms/req_info/displayEducationQ.php?zipcode="+zipcode+"&programName="+programName+"&mod="+mod+"&rn="+rn;
			
//			alert(dest);
	//		document.getElementById('displayEducationQ').innerHTML = dest;
			ElemID('displayEducationQ');
			loadXMLDoc(dest);
		}
	}
}


