
function freeanalysis_Validator(theForm)
{
if (theForm.Contact_Name.value == "")
  {
    alert("Please enter a your name for the \"First_Name\" field.");
    theForm.Contact_Name.focus();
    return (false);
  }
  if (theForm.Contact_Name.value == "First Name")
  {
    alert("Please enter a name for the \"First_Name\" field.");
    theForm.Contact_Name.focus();
    return (false);
  }
  
if (theForm.Contact_LName.value == "")
  {
    alert("Please enter a your name for the \"Last_Name\" field.");
    theForm.Contact_LName.focus();
    return (false);
  }
  if (theForm.Contact_LName.value == "Last Name")
  {
    alert("Please enter a name for the \"Last_Name\" field.");
    theForm.Contact_LName.focus();
    return (false);
  }

  if (theForm.Email.value == "" )
  {
    alert("Please enter an Email address for the \"Your_Email\" field.");
    theForm.Email.focus();
    return (false);
  }
  if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.Email.value)){
	alert('Please enter a valid email address for the \"Your_Email\" field.');
	theForm.Email.focus();
	return false;
  }
/*
  if (theForm.CkEmail.value == "" )
  {
    alert("Please enter an Email address for the \"Re-Enter Email\" field.");
    theForm.CkEmail.focus();
    return (false);
  }
  if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.CkEmail.value)){
	alert('Please enter a valid email address for the \"Re-Enter Email\" field.');
	theForm.CkEmail.focus();
	return false;
  }
  if (theForm.Email.value!=theForm.CkEmail.value){
	alert("The two Email address fields do not match")
	theForm.CkEmail.focus();
  	return false;
  }
  
  if (theForm.YPhone.value==""){
	 alert('Please enter a Phone #');
	 theForm.YPhone.focus();
	 return false;
	}
	if(theForm.YPhone.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)
   {
	alert("The home phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.");
	 theForm.YPhone.focus();
    return false;
   }
   
   if (theForm.State.value == "0")
  {
    alert("Please enter a selection for the \"State\" field.");
    theForm.State.focus();
    return (false);
  }
  if (theForm.State.value == "")
  {
    alert("Please enter a selection for the \"State\" field.");
    theForm.State.focus();
    return (false);
  }
    
  if (theForm.Availability.value == "0")
  {
    alert("Please enter a selection for the \"Best Time to Call\" field.");
    theForm.Availability.focus();
    return (false);
  }
  if (theForm.Availability.value == "")
  {
    alert("Please enter a selection for the \"Best Time to Call\" field.");
    theForm.Availability.focus();
    return (false);
  }

  if (theForm.totalDebt.value == "0")
  {
    alert("Please enter a selection for the \"total Debt\" field.");
    theForm.totalDebt.focus();
    return (false);
  }
  if (theForm.totalDebt.value == "")
  {
    alert("Please enter a selection for the \"total Debt\" field.");
    theForm.totalDebt.focus();
    return (false);
  }

  if (theForm.HomeOwner.value == "0")
  {
    alert("Please enter a selection for the \"Home Owner\" field.");
    theForm.HomeOwner.focus();
    return (false);
  }
  if (theForm.HomeOwner.value == "")
  {
    alert("Please enter a selection for the \"Home Owner\" field.");
    theForm.HomeOwner.focus();
    return (false);
  }
 */  return (true); 
}

function contactus_Validator(theForm)
{
if (theForm.Contact_Name.value == "")
  {
    alert("Please enter a your name for the \"First_Name\" field.");
    theForm.Contact_Name.focus();
    return (false);
  }
  if (theForm.Contact_Name.value == "First Name")
  {
    alert("Please enter a name for the \"Your_Name\" field.");
    theForm.Contact_Name.focus();
    return (false);
  }
  
if (theForm.Contact_LName.value == "")
  {
    alert("Please enter a your name for the \"Last_Name\" field.");
    theForm.Contact_LName.focus();
    return (false);
  }
  if (theForm.Contact_LName.value == "Last Name")
  {
    alert("Please enter a name for the \"Your_Name\" field.");
    theForm.Contact_LName.focus();
    return (false);
  }

  if (theForm.Email.value == "" )
  {
    alert("Please enter an Email address for the \"Your_Email\" field.");
    theForm.Email.focus();
    return (false);
  }
  if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.Email.value)){
		alert('Please enter a valid email address for the \"Your_Email\" field.');
    		theForm.Email.focus();
			return false;
  }
/*  
  if (theForm.Fnumber.value == "")
  {
    alert("Please enter a your File number for the \"File_Number\" field.");
    theForm.Fnumber.focus();
    return (false);
  }
  if (theForm.Fnumber.value == "File Number")
  {
    alert("Please enter a your File number for the \"File_Number\" field.");
    theForm.Fnumber.focus();
    return (false);
  }
*/
  if (theForm.Message.value == "")
  {
    alert("Please enter a your message for the \"Message\" field.");
    theForm.Message.focus();
    return (false);
  }
  if (theForm.Message.value == "Message")
  {
    alert("Please enter a your message for the \"Message\" field.");
    theForm.Message.focus();
    return (false);
  }
  
  return (true);
}

function autotab(original,destination){
if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
destination.focus()
}

function feedb_Validator(theForm)
{
if (theForm.Contact_Name.value == "")
  {
    alert("Please enter a name for the \"Your_Name\" field.");
    theForm.Contact_Name.focus();
    return (false);
  }
  if (theForm.Contact_Name.value == "Your Name")
  {
    alert("Please enter a name for the \"Your_Name\" field.");
    theForm.Contact_Name.focus();
    return (false);
  }

  if (theForm.Email.value == "" )
  {
    alert("Please enter an Email address for the \"Your_Email\" field.");
    theForm.Email.focus();
    return (false);
  }
  if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.Email.value)){
		alert('Please enter a valid email address for the \"Your_Email\" field.');
    		theForm.Email.focus();
			return false;
  }
  return (true);
}


function referal_Validator(theForm)
{

  if (theForm.Contact_Name.value == "")
  {
    alert("Please enter a name for the \"Your_Name\" field.");
    theForm.Contact_Name.focus();
    return (false);
  }
  if (theForm.Contact_Name.value == "Your Name")
  {
    alert("Please enter a name for the \"Your_Name\" field.");
    theForm.Contact_Name.focus();
    return (false);
  }

  if (theForm.Email.value == "" )
  {
    alert("Please enter an Email address for the \"Your_Email\" field.");
    theForm.Email.focus();
    return (false);
  }
  if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.Email.value)){
		alert('Please enter a valid email address for the \"Your_Email\" field.');
    		theForm.Email.focus();
			return false;
  }
 if (theForm.Contact_FName.value == "")
  {
    alert("Please enter a name for the \"Friend_Name\" field.");
    theForm.Contact_FName.focus();
    return (false);
  }
 if (theForm.Contact_FName.value == "Friend's Name")
  {
    alert("Please enter a name for the \"Friend_Name\" field.");
    theForm.Contact_FName.focus();
    return (false);
  }
  if (theForm.FEmail.value == "")
  {
    alert("Please enter an Email address for the \"Friend_Email\" field.");
    theForm.FEmail.focus();
    return (false);
  }
 if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.FEmail.value)){
	alert("Please enter a valid email address for the \"Friend_Email\" field.");
	theForm.FEmail.focus();
	return false;
}
	if (theForm.FPhone.value==""){
	 alert('Please enter a Phone #');
	 theForm.FPhone.focus();
	 return false;
	}
	if(theForm.FPhone.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)
   {
	alert("The home phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.");
	 theForm.FPhone.focus();
    return false;
   }

  return (true);
}
//*********************************************************************************/
function Validator1(theQuote)
{

  if (theQuote.Name.value == "")
  {
    alert("Please enter a name for the \"Your_Name\" field.");
    theQuote.Name.focus();
    return (false);
  }
  if (theQuote.Name.value == "Your Name")
  {
    alert("Please enter a name for the \"Your_Name\" field.");
    theQuote.Name.focus();
    return (false);
  }

if (theQuote.Last_Name.value == "")
  {
    alert("Please enter a name for the \"Last_Name\" field.");
    theQuote.Last_Name.focus();
    return (false);
  }
  if (theQuote.Last_Name.value == "Your Last Name")
  {
    alert("Please enter a name for the \"Last_Name\" field.");
    theQuote.Last_Name.focus();
    return (false);
  }

  if (theQuote.Email.value == "" )
  {
    alert("Please enter an Email address for the \"Your_Email\" field.");
    theQuote.Email.focus();
    return (false);
  }
  if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theQuote.Email.value)){
		alert('Please enter a valid email address for the \"Your_Email\" field.');
    		theQuote.Email.focus();
			return false;
  }
  if (theQuote.CkEmail.value == "")
  {
    alert("Please enter an Email address for the \"Re-Enter_Email\" field.");
    theQuote.CkEmail.focus();
    return (false);
  }
 if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theQuote.CkEmail.value)){
	alert("Please enter a valid email address for the \"Re-Enter_Email\" field.");
	theQuote.CkEmail.focus();
	return false;
}
	if (theQuote.YPhone.value == ""){
	 alert('Please enter a Phone #');
	 theQuote.YPhone.focus();
	 return false;
	}
	if(theQuote.YPhone.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)
   {
	alert("The home phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.");
	 theQuote.YPhone.focus();
    return false;
   }

/*	if (theQuote.CPhone.value==""){
	 alert('Please enter a Phone #');
	 theQuote.CPhone.focus();
	 return false;
	}
	if(theQuote.CPhone.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)
   {
	alert("The home phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.");
	 theQuote.CPhone.focus();
    return false;
   }*/

	if (theQuote.State.value == "00"){
	 alert('Please enter a State');
	 theQuote.State.focus();
	 return false;
	}
	if (theQuote.Availability.value == "0"){
	 alert('Please enter a Best Time to Call');
	 theQuote.Availability.focus();
	 return false;
	}
	if (theQuote.totalDebt.value == "0"){
	 alert('Please enter Total Debt:');
	 theQuote.totalDebt.focus();
	 return false;
	}
	if (theQuote.HomeOwner.value == "0"){
	 alert('Please enter Home Owner:');
	 theQuote.HomeOwner.focus();
	 return false;
	}

  return (true);
}

//*****************************************************************************************/

var fieldalias="Email address field"

function verify(element1, element2){
var passed=false
if (element1.value==''){
alert("Please fill out the "+fieldalias+"!")
element1.focus()
}
else if (element2.value==''){
alert("Please verify the "+fieldalias+"!")
element2.focus()
}
else if (element1.value!=element2.value){
alert("The two "+fieldalias+"s do not match")
element1.select()
}
else
passed=true

return passed

}



//*****************************************************************************************/

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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 MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}





function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function validate(){

		if (document.collegis.program.value=="00"){
			alert('Please select a Program of Interest.');
			document.collegis.program.focus();
			return false;
		}
		
		
		if (document.collegis.startTime.value=="0"){
			alert('Please tell us when you want to begin your classes');
			document.collegis.startTime.focus();
			return false;
		}
		
		if (document.collegis.gradyear.value=="0"){
			alert('Please enter your Graduation Year.');
			document.collegis.gradyear.focus();
			return false;
		}
		if (document.collegis.gradyear.value > "2006"){
			alert('In order to apply for Rasmussen College you must have already graduated from high school.');
			document.collegis.gradyear.focus();
			return false;
		}
	
		if (document.collegis.firstname.value==""){
			alert('Please enter your First Name');
			document.collegis.firstname.focus();
			return false;
		}

		if (document.collegis.lastname.value==""){
			alert('Please enter your Last Name');
			document.collegis.lastname.focus();
			return false;
		}
		if (document.collegis.gender.value==""){
			alert('Please select a Gender');
			document.collegis.gender.focus();
			return false;
		}

		if (document.collegis.address.value==""){
			alert('Please type in your Address');
			document.collegis.address.focus();
			return false;
		}
		if (document.collegis.city.value==""){
			alert('Please tell us your City');
			document.collegis.city.focus();
			return false;
		}
		if (document.collegis.state.value=="0"){
			alert('Please select your State');
			document.collegis.state.focus();
			return false;
		}
		if (document.collegis.state.value=="XX"){
			alert('We apologize, but at this time we are only accepting US residents for admission.');
			document.collegis.state.focus();
			return false;
		}
		if (document.collegis.zip.value==""){
			alert('Please enter your Zip Code');
			document.collegis.zip.focus();
			return false;
		}
		
		if(document.collegis.zip.value.search(/^\d{5}([\-]\d{4})?$/)==-1)
   {
      alert("The zip code you entered is not valid.\r\nPlease enter a 5 digit or a 10 digit zip code.");
	  document.collegis.zip.focus();
      return false;
   }
		
		if (document.collegis.evephone.value==""){
			alert('Please enter a Home Phone');
			document.collegis.evephone.focus();
			return false;
		}
		if(document.collegis.evephone.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)
   {
      alert("The home phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.");
	  document.collegis.evephone.focus();
      return false;
   }
		if (document.collegis.dayphone.value==""){
			alert('Please enter a Work Phone');
			document.collegis.dayphone.focus();
			return false;
		}
		if(document.collegis.dayphone.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)
   {
      alert("The work phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.");
      document.collegis.dayphone.focus();
	  return false;
   }
 
		if (document.collegis.preferredphone.value=="0"){
			alert('Please select a Preferred Contact Time');
			document.collegis.preferredphone.focus();
			return false;
		}
		  if (document.collegis.email.value==""){
			alert('Please enter your Email');
			document.collegis.email.focus();
			return false;
		}
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.collegis.email.value)){
		alert('Please enter a valid email address');
			document.collegis.email.focus();
			return false;
}

	 if (document.collegis.HearAboutUs.value==""){
			alert('Please select how you heard about us');
			document.collegis.HearAboutUs.focus();
			return false;
		}
	return true;
	

	}
	
function autoMask(field, event, sMask) {
        

        var KeyTyped = String.fromCharCode(getKeyCode(event));
        var targ = getTarget(event);
        keyCount = targ.value.length;

	if(keyCount == sMask.length)
	{
		return false;
	}
      if ((sMask.charAt(keyCount+1) != '#') && (sMask.charAt(keyCount+1) != 'A' ) )
      {
         field.value = field.value + KeyTyped + sMask.charAt(keyCount+1);
         return false;
      }

        if (sMask.charAt(keyCount) == '*')
                return true;

        if (sMask.charAt(keyCount) == KeyTyped)
        {
                return true;
        }

        if ((sMask.charAt(keyCount) == '#') && isNumeric(KeyTyped))
           return true;

        if ((sMask.charAt(keyCount) == 'A') && isAlpha(KeyTyped))
         return true;

      if ((sMask.charAt(keyCount+1) == '?') )
      {
         field.value = field.value + KeyTyped + sMask.charAt(keyCount+1);
         return true;
      }
      if (KeyTyped.charCodeAt(0) < 32) return true;
    return false;
}
 function getTarget(e) {
  // IE5
   if (e.srcElement) {
        return e.srcElement;
   }
    if (e.target) {
        return e.target;
   }
 }

  function getKeyCode(e) {
 //IE5
 if (e.srcElement) {
        return e.keyCode
 }
  // NC5
  if (e.target) {
   return e.which
  }
 }

 function isNumeric(c)
{
        var sNumbers = "01234567890";
        if (sNumbers.indexOf(c) == -1)
                return false;
        else return true;

}

function isAlpha(c)
{
        var lCode = c.charCodeAt(0);
        if (lCode >= 65 && lCode <= 122 )
          {
                return true;
         }
        else
        return false;
}

function isPunct(c)
{
        var lCode = c.charCodeAt(0);
        if (lCode >= 32 && lCode <= 47 )
          {
                return true;
         }
        else
        return false;

}
