/* block pages */
if (document.referrer.indexOf("insider.com/search/")>=0) document.location.href="http://www.online-education.net/block.html";
if (document.referrer.match("education.ru.com/administration-business-can-degree-i-in.html") !=  null)
	document.location.href = "http://www.online-education.net/block.html";
if (document.referrer.match("sunshinepolicy.net/free-online-education-and-diploma-in-computer-technology.html") !=  null)
	document.location.href = "http://www.online-education.net/block.html";

/* redirect to form */
function school_info(school) {window.location.href='/school_info.php?abbrv='+school;}

// Pop-Up Window for GE ADS
function GE_popUp(page) {
	posTop = 0;
	if (screen) {
		posLeft = ((screen.width-850)/2);
		posTop = ((screen.height-600)/2);
	}
	window.open('http://www.online-education.net/ge.php?abbrv=' + page, 'GE', 'scrollbars=yes,width=850,height=600,left='+posLeft+',top='+posTop+'')
}

function process(form) {
   var key1 = form.subject.value;
   if (key1 == '' || key1 == 'Subject') {
      alert("Subject Required");
      form.subject.select();
      return false;}
   var key2 = form.question.value;
   if (key2 == '' || key2 == 'Question') {
      alert("Question Required");
      form.question.select();
      return false;}
   var key3 = form.email.value;
   if (key3 == '' || key3 == 'Email Address') {
      alert("Email Required");
      form.email.select();
      return false;}
	var email_ID = form.email.value;
	if (echeck(email_ID)==false) {
		form.email.value = "";
		form.email.select();
		return false;}
	alert("Thank you.\n\nWe get lots of questions, so keep checking back to see your answer!\n\nPlease note that some questions may be edited for grammar and\/or clarity.");
}

function echeck(str) {
  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
  if (str.indexOf(at)==-1){
     alert("Invalid E-mail")
     return false}
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Invalid E-mail")
     return false}
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Invalid E-mail")
      return false}
   if (str.indexOf(at,(lat+1))!=-1){
      alert("Invalid E-mail")
      return false}
   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("Invalid E-mail")
      return false}
   if (str.indexOf(dot,(lat+2))==-1){
      alert("Invalid E-mail")
      return false}
   if (str.indexOf(" ")!=-1){
      alert("Invalid E-mail")
      return false}
   return true
}