
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;
   }

}


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);
}


//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 checkForm(pop) {
	
	
	for (var i in document.forms) {
		
		if (formName == document.forms[i].name)
		{
			
			if (document.forms[i].cat_id.options[document.forms[i].cat_id.selectedIndex].value == "")
			{
				alert("\nYou must select your area of study.");
				return false;
			}
		
			if (document.forms[i].df_zip.value != "" && typeof document.forms[i].df_zip.value != "undefined")
			{

				//make sure it is all digits
				var numfieldDisplayArray = new Array("Zip Code");
				var numfieldArray = new Array("df_zip");
			
				if (typeof document.forms[i].df_zip != "undefined" && !checknum(numfieldArray,numfieldDisplayArray,document.forms[i]))
				{
					document.forms[i].df_zip.value="";
				}
				
				//make sure it is 5 digits
				if (typeof document.forms[i].df_zip != "undefined" && document.forms[i].df_zip.value.length != 5)
				{
					document.forms[i].df_zip.value="";
					
				}
			}
			
			//if emid is not valid email, clear field on submit
			if (!email_check(document.forms[i].emid.value))
			{
				document.forms[i].emid.value="";
				
			}


			
			
		setBool();


		if(pop == true)
		{
			key=document.forms[i].key.value;
			cat_id=document.forms[i].cat_id.options[document.forms[i].cat_id.selectedIndex].value;
			conc_id=document.forms[i].Concentration.options[document.forms[i].Concentration.selectedIndex].value;
			fid=document.forms[i].fid.value;
			sid=document.forms[i].sid.value;
			type_id=document.forms[i].type_id.value;
			theZip=document.forms[i].df_zip.value;
			emid=document.forms[i].emid.value;
			
			if(document.forms[i].goSFP[1].checked == true) 
			{ 
				window.location.href='http://www.earnmydegree.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+'&zip='+theZip+'&emid='+emid;
			}
			else
			{
				window.location.href='http://www.earnmydegree.com/act_landing3.cfm?action=hom.degree&cat_id='+cat_id+'&key='+key+'&landing=1&conc_id='+conc_id+'&type_id='+type_id+'&fid='+fid+'&sid='+sid+'&df_zip='+theZip+'&emid='+emid;
			}
		}
		
		
		break;
			
		}
	}				
}
	


function checkForm1(pop) {
	for (var i in document.forms) {
		
		if (formName == document.forms[i].name)
		{
			
			if (document.forms[i].cat_id.options[document.forms[i].cat_id.selectedIndex].value == "")
			{
				alert("\nYou must select your area of study.");
				return false;
			}
		
			if (document.forms[i].df_zip.value != "" && typeof document.forms[i].df_zip.value != "undefined")
			{

				//make sure it is all digits
				var numfieldDisplayArray = new Array("Zip Code");
				var numfieldArray = new Array("df_zip");
			
				if (typeof document.forms[i].df_zip != "undefined" && !checknum(numfieldArray,numfieldDisplayArray,document.forms[i]))
				{
					document.forms[i].df_zip.value="";
				}
				
				//make sure it is 5 digits
				if (typeof document.forms[i].df_zip != "undefined" && document.forms[i].df_zip.value.length != 5)
				{
					document.forms[i].df_zip.value="";
					
				}
			}

			//if emid is not valid email, clear field on submit
			if (!email_check(document.forms[i].emid.value))
			{
				document.forms[i].emid.value="";
				
			}


		setBool();


		if(pop == true)
		{
		
			key=document.forms[i].key.value;
			cat_id=document.forms[i].cat_id.options[document.forms[i].cat_id.selectedIndex].value;
			conc_id=document.forms[i].Concentration.options[document.forms[i].Concentration.selectedIndex].value;
			fid=document.forms[i].fid.value;
			sid=document.forms[i].sid.value;
			type_id=document.forms[i].type_id.value;
			theZip=document.forms[i].df_zip.value;
			emid=document.forms[i].emid.value;
			document.location='http://www.earnmydegree.com/act_landing3.cfm?action=hom.degree&cat_id='+cat_id+'&key='+key+'&landing=1&conc_id='+conc_id+'&type_id='+type_id+'&fid='+fid+'&sid='+sid+'&df_zip='+theZip+'&emid='+emid;
		}
		
		
		break;
			
		}
	}				
}




function checkForm2(pop) 
{
	var found_it = "";
	var x_counter = 0;
	var pop = false;
	
	for (var i=0; i<document.Entry1.cat_id.length; i++)  
	{ 
		if (document.Entry1.cat_id[i].checked)
		{
			x_counter = 1;
			found_it = document.Entry1.cat_id[i].value;
			setBool();
			pop = true;
			
			if(pop == true)
			{
			
				key=document.Entry1.key.value;
				fid=document.Entry1.fid.value;
				sid=document.Entry1.sid.value;
				document.location='http://www.earnmydegree.com/index.cfm?action=hom.degree&cat_id='+found_it+'&key='+key+'&landing=1&fid='+fid+'&sid='+sid;
			}
			
			
			break;
			
			return true;
		}
	
	}
	
	if (x_counter == 0) {
		alert("\nYou must select your area of study.");
		return false;
	}
	
}



function checkForm3(pop) {

			if (document.Entry1.cat_id.options[document.Entry1.cat_id.selectedIndex].value == "--")
			{
				alert("\nYou must select your area of study.");
				return false;
			}
	
		setBool();

				
}



	
	