// JavaScript Document
formsent = false;
function validateForm(){
	thisform = document.form;
	if(thisform.zip.value == ""){
		alert("Please fill out zip code.")
		return false;
	}
	isvalid = false;

	for(i = 0; i < 13; i++)
	
	if(!formsent){
		formsent = true
		return true;
	}else{
		window.status = "Search Running";
		return false;
	}
}

function ResetDropDowns(thisdropdown){
	rExp1 = /&/gi;
	rExp2 = /\//gi;
	rExp3 = / /gi;

	for(i = 0; i < document.form2.elements["degree[]"].length;i++){
		if(thisdropdown != document.form2.elements["degree[]"][i]){
			document.form2.elements["degree[]"][i].selectedIndex=0;
		}
	}

	temp = thisdropdown[thisdropdown.selectedIndex].text.replace(rExp1, "and");
	title = temp.replace(rExp2, "-");
	page = title.replace(rExp3, "_");
}

function validateForm2()
{
	thisform = document.form2;
	
	if(thisform.zip.value == "")
	{
		alert("Please fill out zip code and choose your career interest.")
		return false;
	}
	isvalid = false;

	isSelected = false;

	/** If more than 1 drop down
	 * Meng Yang
	 * 03/25/09
	 **/
	if( thisform.elements['degree[]'].value == undefined )
	{
		for(i = 0; i < thisform.elements["degree[]"].length; i++)
		{
			if(thisform.elements["degree[]"][i].value != '')
			{
				isSelected = true;
			}
		}
	}
	else
	{
		if( thisform.elements['degree[]'].value != '' )
		{
			isSelected = true;
		}
	}
	/** end (If more than 1 drop down) **/

	if(!isSelected)
	{
		alert("Please select a program.")
		return false;
	}

	if(!formsent)
	{
		formsent = true
		setTimeout("resetiframeformsent()",3000); 
		return true;
	}
	else
	{
		window.status = "Search Running";
		return false;
	}
}

function resetiframeformsent()
{
	formsent = false;
}

function validateCareerDropDownForm(){
	thisform = document.form;
	if(thisform.zip.value == ""){
		alert("Please fill out zip code.")
		return false;
	}
	if( thisform.elements["career"].value == '' ){
		alert("Please choose your career interest.")
		return false;
	}
	if(!formsent){
		formsent = true
		return true;
	}else{
		window.status = "Search Running";
		return false;
	}
}

function validateFormNewsletter(){
	thisform = document.newsletter;

	reg = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/; // valid
	if(!reg.test(thisform.email.value)){
		alert("Please fill out a valid email address.")
		return false;
	}
	
	return true;
}

function clearText(){
	thisform = document.newsletter;
	
	if(thisform.email.value == "Please enter your email"){
		thisform.email.value = "";
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function flvFTSS4(){//v1.02
this.style.filter="";}

function flvFTSS3(){//v1.02
var v1=arguments,v2=v1[0],v3=MM_findObj(v2);if (v3&&v3.TSS2!=null){clearTimeout(v3.TSS2);}}

function flvFTSS2(){//v1.02
var v1=arguments,v2=v1[0],v3=MM_findObj(v2),v4=v1[1],v5=v1[2],v6,v7,v8,v9,v10,v11,v12=document;if (v3&&v3.TSS7){flvFTSS3(v2);v9="flvFTSS2('"+v2+"',"+v4+","+v5+")";if (v4==1){if (!v3.TSS5.complete){v3.TSS2=setTimeout(v9,50);return;}v6=v3.TSS9+1;if (v6>v3.TSS7.length-1){if (v3.TSS10==0){return;}else {v6=0;}}else if (v6+1<v3.TSS7.length){v3.TSS5.src=v3.TSS7[v6+1][0];}}else {if (!v3.TSS3.complete){v3.TSS2=setTimeout(v9,50);return;}v6=v3.TSS9-1;if (v6<0){if (v3.TSS10==0){return;}else {v6=v3.TSS7.length-1;}}else if (v6-1>0){v3.TSS3.src=v3.TSS7[v6-1][0];}}v3.TSS9=v6;v10=v3.TSS7[v6][0];v11=v3.TSS7[v6][1];v7=(v3.filters&&!v12.TSS6&&v11<25);if (v7){if (v3.filters[0]&&v3.filters[0].status==2){v3.filters[0].Stop();}if (v11==0){v8="blendTrans(Duration="+v3.TSS8+")";}else {v8="revealTrans(Duration="+v3.TSS8+",Transition="+(v11-1)+")";}v3.style.filter=v8;v3.onfilterchange=flvFTSS4;v3.filters[0].Apply();}v3.src=v10;if (v7){v3.filters[0].Play();}if (v5==1){v3.TSS2=setTimeout(v9,v3.TSS4);}}}

function flvFTSS1(){//v1.02
// Copyright 2003, Marja Ribbers-de Vroed, FlevOOware (www.TSS1.nl/dreamweaver/)
var v1=arguments,v2=document,v3=v1[0],v4=MM_findObj(v3),v5,v6;if (v4){v2.TSS6=(navigator.userAgent.toLowerCase().indexOf("mac")!=-1);v4.TSS8=v1[1]/1000;v4.TSS4=v1[2]+v1[1];v6=v1[3];v4.TSS10=v1[4];v4.TSS7=new Array();for (var v7=5;v7<v1.length;v7+=2){v4.TSS7[v4.TSS7.length]=new Array(v1[v7],v1[v7+1]);}v4.TSS9=0;v4.TSS5=new Image();v4.TSS5.src=v1[7];v4.TSS3=new Image();v4.TSS3.src=v1[v1.length-2];if (v6==1){v5="flvFTSS2('"+v3+"',1,"+v6+")";v4.TSS2=setTimeout(v5,v4.TSS4);}}}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
