
/*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 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() {
	var pop = false;
	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;
			}
			else
			{
				pop=true;
			}
	
			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;
				
				/*if(LinkPostFlag == 1)
				{
					document.forms[i].submit();	
				}*/
				document.location='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;
			
			}

			break;
			
		}
	}
}

function goToLink(location)
{
	for (var i in document.forms) 
	{
		
		if (formName == document.forms[i].name)
		{
			key=document.forms[i].key.value;
			fid=document.forms[i].fid.value;
			sid=document.forms[i].sid.value;
		}
	}
	
	if(location == "ba")
	{
		type_id=1;	

		url = 'http://www.earnmydegree.com/index.cfm?action=hom.degree&key='+key+'&landing=1&type_id='+type_id+'&fid='+fid+'&sid='+sid;
		window.open(url,'','target=_blank');
	}
	else if (location == "masters")
	{
		type_id=3;	

		url = 'http://www.earnmydegree.com/index.cfm?action=hom.degree&key='+key+'&landing=1&type_id='+type_id+'&fid='+fid+'&sid='+sid;
		window.open(url,'','target=_blank');
	}
	else if (location == "phd")
	{
		type_id=4;	

		url = 'http://www.earnmydegree.com/index.cfm?action=hom.degree&key='+key+'&landing=1&type_id='+type_id+'&fid='+fid+'&sid='+sid;
		window.open(url,'','target=_blank');
	}
	else if (location == "cert")
	{
		type_id=7;	

		url = 'http://www.earnmydegree.com/index.cfm?action=hom.degree&key='+key+'&landing=1&type_id='+type_id+'&fid='+fid+'&sid='+sid;
		window.open(url,'','target=_blank');
	}
	else if (location == "jss")
	{
		type_id=1;	

		url = 'http://www.jumpstartscholarship.com/index.cfm?key='+key+'&fid='+fid+'&sid='+sid;
		window.open(url,'','target=_blank');
	}
	//document.location='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;

}
	
function quizSubmit(type)
{
	if (type == "business")
	{
		document.Entry.cat_id.value="2";
		document.Entry.prepop.value="2-0";
		document.Entry.pmode.value="business";
		document.Entry.submit();
	}
	else if (type == "nursing")
	{
		document.Entry.cat_id.value="10";
		document.Entry.prepop.value="10-0";
		document.Entry.pmode.value="nursing";
		document.Entry.submit();
	}
	else if (type == "education")
	{
		document.Entry.cat_id.value="5";
		document.Entry.prepop.value="5-0";
		document.Entry.pmode.value="education";
		document.Entry.submit();
	}
	else if (type == "crimjust")
	{
		document.Entry.cat_id.value="3";
		document.Entry.prepop.value="3-0";
		document.Entry.pmode.value="criminaljustice";
		document.Entry.submit();
	}
	else if (type == "graphic")
	{
		document.Entry.cat_id.value="9";
		document.Entry.conc_id.value="49";
		document.Entry.prepop.value="9-49";
		document.Entry.pmode.value="graphicdesign";
		document.Entry.submit();
	}
	else if (type == "technology")
	{
		document.Entry.cat_id.value="4";
		document.Entry.prepop.value="4-0";
		document.Entry.pmode.value="technology";
		document.Entry.submit();
	}

}

function checkQuiz()
{
	var q1 = document.Entry.q1;
	var q2 = document.Entry.q2;
	var q3 = document.Entry.q3;
	var q4 = document.Entry.q4;
	var q5 = document.Entry.q5;
	var q1Chk = "no";
	var q2Chk = "no";
	var q3Chk = "no";
	var q4Chk = "no";
	var q5Chk = "no";
	
	for (i=0;i<q1.length;i++){
		if (q1[i].checked==true)
		{
			q1Chk=i;
			
		}
	}
	
	for (i=0;i<q2.length;i++){
		if (q2[i].checked==true)
		{
			q2Chk=i;
		}
	}
	for (i=0;i<q3.length;i++){
		if (q3[i].checked==true)
		{
			q3Chk=i;
		}
	}
	for (i=0;i<q4.length;i++){
		if (q4[i].checked==true)
		{
			q4Chk=i;
		}
	}
	for (i=0;i<q5.length;i++){
		if (q5[i].checked==true)
		{
			q5Chk=i;
		}
	}

	if (q1Chk == "no")
	{
		alert("You forgot to answer question 1. Please complete this question.");
		document.Entry.q1[0].focus();
		return false;
	}
	else if (q2Chk == "no")
	{
		alert("You forgot to answer question 2. Please complete this question.");
		document.Entry.q2[0].focus();
		return false;
	}
	else if (q3Chk == "no")
	{
		alert("You forgot to answer question 3. Please complete this question.");
		document.Entry.q3[0].focus();
		return false;
	}
	else if (q4Chk == "no")
	{
		alert("You forgot to answer question 4. Please complete this question.");
		document.Entry.q4[0].focus();
		return false;
	}
	else if (q5Chk == "no")
	{
		alert("You forgot to answer question 5. Please complete this question.");
		document.Entry.q5[0].focus();
		return false;
	}
	else 
	{
		return true;	
	}
	
}

function checkAssesmentInfo()
{
	var fname = document.Entry.first_name;
	var lname = document.Entry.last_name;
	var email = document.Entry.email;
	
	if (fname.value == "")
	{
		alert("Please provide your first name.");
		fname.focus();
		return false;
	}
	
	if (lname.value == "")
	{
		alert("Please provide your last name.");
		lname.focus();
		return false;
	}
	
	if (email.value == "")
	{
		alert("Please provide your email.");
		email.focus();
		return false;
	}
	
	if (email.value.indexOf("@") < 1)
	{
		alert("Please provide a valid email.");
		email.focus();
		return false;
	}
}