
function NewWindow(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(); }
	}

function checknum(numfieldArray,numfieldDisplayArray,form){
	var i = 0; 
	var strValidChars = "0123456789";
	var strChar;
	var blnResult = true;

for(i=0; i<numfieldArray.length; i++){
strString = eval("form." + numfieldArray[i] + ".value")

//  test strString consists of valid characters listed above
   for (a = 0; a < strString.length  && blnResult == true; a++)
      {
      strChar = strString.charAt(a);
      if (strValidChars.indexOf(strChar) == -1)
         {
			document.forms[i].df_zip.value="";
         }
      }
   return blnResult;
   }

}

//check email for valid email address
function email_check(s) {	
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(s))
	{
		//alert('email check true');
		return true;
	}
	else
	{
		//alert('email check false');
		return false;
	}
}

function e(s) {

	rex=true;

	if (window.RegExp) 
	{st="a";ex=new RegExp(st);
		if (st.match(ex)) {
		r1=new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		r2=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
		b=(!r1.test(s)&&r2.test(s));
		}
		else 
		{rex=false;
		}
	} 
	else
	{	rex=false;
	}
	if(!rex) b=(s.indexOf("@")>0 && s.indexOf(".")>0 && s!="" && s!="enter e-mail");
	return (b);
}

function checkForm(pop) {

		
	if (document.Entry.cat_id.options[document.Entry.cat_id.selectedIndex].value == "--")
	{
		alert("\nYou must select your area of study.");
		return false;
	}
	else
	{
		pop=true;
	}
	

	
	setBool();


	if(pop == true)
	{
		key=document.Entry.key.value;
		cat_id=document.Entry.cat_id.options[document.Entry.cat_id.selectedIndex].value;
		conc_id=document.Entry.conc_id.options[document.Entry.conc_id.selectedIndex].value;
		fid=document.Entry.fid.value;
		sid=document.Entry.sid.value;
		type_id=document.Entry.type_id.value;
		document.location='http://elearners2.topinternetschools.com/index.cfm?action=hom.degree&cat_id='+cat_id+'&key='+key+'&landing=1&conc_id='+conc_id+'&type_id='+type_id+'&fid='+fid+'&sid='+sid;
	}
		
		
}
	
	
	
function checkForm1(pop) {
	var doc = document.Entry1;
	var key = doc.key;
	var fid = doc.fid;
	var sid = doc.sid;
	var type_id = doc.type_id;
	var cat_id = doc.cat_id;
	var conc_id = doc.conc_id;
	var df_zip = doc.df_zip;
	var emid = doc.emid;
		
	if (doc.cat_id.options[doc.cat_id.selectedIndex].value == "--")
	{
		alert("\nYou must select your area of study.");
		return false;
	}
	else
	{
		pop=true;
	}
			
	//ZIPCODE CHECK
	if (df_zip.value != "")
	{
		//make sure it is all digits
		var numfieldDisplayArray = new Array("Zip Code");
		var numfieldArray = new Array("df_zip");
	
		if (!checknum(numfieldArray,numfieldDisplayArray,doc))
		{
			df_zip.value="";
		}
		
		//make sure it is 5 digits
		if (df_zip.value.length != 5)
		{
			df_zip.value="";
			
		}
	}
	
	//EMAIL ADDRESS CHECK
	if (emid.value != "")
	{
		//make sure it is valid
		if (!e(emid.value))
		{
			emid.value="";
		}
	}
	
	setBool();


	if(pop == true)
	{
		document.location='http://elearners2.topinternetschools.com/index.cfm?action=hom.degree&cat_id='+cat_id.value+'&conc_id='+conc_id.value+'&key='+key.value+'&landing=1&type_id='+type_id.value+'&fid='+fid.value+'&sid='+sid.value+'&zip='+df_zip.value+'&emid='+emid.value;
	}
	
	
}
	
	