var xmlhttp = false;

//check for IE
try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
	  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
	  xmlhttp = false;
	}
}

if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
  xmlhttp = new XMLHttpRequest();
}

function makerequest(serverPage, objID) {
  var obj = document.getElementById(objID);
	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function() {
	  if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		  obj.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}

function getFourYearPage() {
  value = ajax.term.options[ajax.term.selectedIndex].value;
  page = "../../process/processRetrieveFourYear.php?y="+value;
  makerequest(page, "test");
  
  return false;
}


/** English Form Validation**/
function validateContact(form) {
  if (form.First_Name.value == "") {
	alert("Enter your First Name");
	form.First_Name.focus();
	
	return false;
  }	
  if (form.Last_Name.value == "") {
	alert("Enter your Last Name");
	form.Last_Name.focus();
	
	return false;
  }
  if (form.Mailing_Address.value == "") {
	alert("Enter your Mailing Address");
	form.Mailing_Address.focus();
	
	return false;
  }
  if (form.City.value == "") {
	alert("Enter you City");
	form.City.focus();
	
	return false;
  }
  if (form.state.options[form.state.selectedIndex].value == "") {
	alert("Select your State");
	form.state.focus();
	
	return false;
  }
  if (form.Zip.value == "") {
	alert("Enter your Zip Code");
	form.Zip.focus();
	
	return false;
  }
  if (form.Entering_Term.options[form.Entering_Term.selectedIndex].value == "") {
	alert("Select your Entering Term");
	form.Entering_Term.focus();
	
	return false;
  }
  if (form.Year_in_School.options[form.Year_in_School.selectedIndex].value == "") {
	alert("Select your School Year");
	form.Year_in_School.focus();
	
	return false;
  }
  if (form.security_code.value == '') {
	alert("Enter the Security Code");
	form.security_code.focus();
	
	return false;
  }
  return true;
}

function getWindow() {
  if (screen) {
    var size = screen.width+'x'+screen.height;
	var serverPage = '/process/logResolution.php?size='+size;
    xmlhttp.open("GET", serverPage);
	xmlhttp.send(null);
  }
}
