// JavaScript Document
function validate_email(suserid) {

document.body.style.cursor='wait';

// Create an instance of the XML HTTP Request object
var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" );
	
// Prepare the XMLHTTP object for a HTTP POST to our validation ASP page

var sURL = "/scripts/validate_email.asp?email_address=" + suserid
oXMLHTTP.open( "POST", sURL, false );

// Execute the request
oXMLHTTP.send();

if (oXMLHTTP.responseText == "exists") 
document.accountinfo.email_notice.value = "This email address is already in use.";
else if (oXMLHTTP.responseText == "required")
document.accountinfo.email_notice.value = "Email Address is a required field.";
else if (oXMLHTTP.responseText == "invalid")
document.accountinfo.email_notice.value = "This is an invalid email address format.";
else
document.accountinfo.email_notice.value = "(This will be your VRT Fitness user id.)";

document.body.style.cursor='auto';

}


function sf()
{
var theForm = document.forms[0].process.value;
switch (theForm) {
   case "accountinfo":
      document.accountinfo.email_address.focus();
      break
   case "profileinfo":
      document.questionnaire.emergency_contact_name.focus();
      break
   case "terms":
   	  document.terms.terms_agree.focus();
      break
   
   case "editaccountinfo":
      document.accountinfo.email_address.focus();
      break
   case "editprofileinfo_contactonly":
      document.questionnaire.emergency_contact_name.focus();
      break
   case "login":
      document.login.email_address.focus();
      break
   case "passwordreminder":
      document.password_reminder.email_address.focus();
      break
}
}

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];}}
}
