
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_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

 //### Numeric Check #####
function ISnumeric(argNum)
{
 if(argNum=="")
 {
 	return false;
 }
 var valid = "0123456789X"
 var ok = "yes";
 var temp;
 for (var i=0; i<argNum.length; i++) 
	{
		temp = "" + argNum.substring(i, i+1);
		if (valid.indexOf(temp) == "-1")
		{ 
		
		 return false;
		  break; 
	    } 
	}
   return true;
}//end function 

//####### Email Syntex Check #######
function validateEmail(email)
{
	
	// This function is used to validate a given e-mail 
	// address for the proper syntax
	
	if (email == ""){
		return false;
	}
	badStuff = ";:/,' \"\\";
	for (i=0; i<badStuff.length; i++){
		badCheck = badStuff.charAt(i)
		if (email.indexOf(badCheck,0) != -1){
			return false;
		}
	}
	posOfAtSign = email.indexOf("@",1)
	if (posOfAtSign == -1){
		return false;
	}
	if (email.indexOf("@",posOfAtSign+1) != -1){
		return false;
	}
	posOfPeriod = email.indexOf(".", posOfAtSign)
	if (posOfPeriod == -1){
		return false;
	}
	if (posOfPeriod+2 > email.length){
		return false;
	}
	return true
}//end function

//### Email Check ###########
function emailCheck (emailStr)
{
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null)
	{
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	// Start by checking that only basic ASCII characters are in the strings (0-127).

	for (i=0; i<user.length; i++) 
	{
		if (user.charCodeAt(i)>127) 
		{
			//alert("Ths username contains invalid characters.");
			return false;
   		}
	}
	for (i=0; i<domain.length; i++) 
	{
		if (domain.charCodeAt(i)>127) 
		{
			//alert("Ths domain name contains invalid characters.");
			return false;
   		}
	}

	if (user.match(userPat)==null) 
	{
		return false;
	}
	
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) 
	{

		for (var i=1;i<=4;i++) 
		{
			if (IPArray[i]>255) 
			{
				return false;
   			}
		}
		return true;
	}
 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) 
	{
		if (domArr[i].search(atomPat)==-1) 
		{
			return false;
   		}
	}
	
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) 
	{
		return false;
	}

	// Make sure there's a host name preceding the domain.

	if (len<2) 
	{
		return false;
	}

// If we've gotten this far, everything's valid!
return true;
}//end function

function trimString(str)
{
	  while (str.charAt(0) == ' ')
	    str = str.substring(1);
	  while (str.charAt(str.length - 1) == ' ')
	    str = str.substring(0, str.length - 1);
	  return str;
}

//### Verify Action #####
function verify(msg)
{
	if(confirm(msg))
		return true;
	else
		return false;	
}//end function

//######### Pop Window ###########
function PopupPic(img_src)
{ 
  //window.open("large.php?imgsrc="+img_src,'','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,maximize=0,width='+width+',height='+height');
  window.open("large.php?imgsrc="+img_src,"mydoc","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,maximize=0");
}//end function 

function winBRopen(theURL,height,width) 
{ 
var winleft = (screen.width - 500) / 2;
var winUp = (screen.height - 500) / 4;


winProp = 'width='+width+',height='+height+',left='+winleft+',top='+winUp+',scrollbars=yes,resizable=yes,toolbar=0,menubar=0';

Win = window.open(theURL,'', winProp)
	if (parseInt(navigator.appVersion) >= 4) 
		{
 		Win.window.focus(); 
 		}
}
//##################################################################################


function chk_registration()
{
  frm=document.user_registration;	
  
  if(frm.username.value=='')
  {
    alert("Please specify your username!");
    frm.username.focus();
    return false;
  }
  if(frm.password.value=='')
  {
    alert("Please specify the password!");
    frm.password.focus();
    return false;
  }
  if(frm.firstname.value=='')
  {
    alert("Please specify the first name!");
    frm.firstname.focus();
    return false;
  }
  
  if(frm.lastname.value=='')
  {
    alert("Please specify the last name!");
    frm.lastname.focus();
    return false;
  }
  
  if(frm.company.value=='')
  {
    alert("Please specify the company name!");
    frm.company.focus();
    return false;
  }
  if(frm.bphone.value=='')
  {
    alert("Please specify the business phone!");
    frm.bphone.focus();
    return false;
  }
  if(frm.bphone.value!='')
  {
       if (!ISnumeric(frm.bphone.value))
	{
		alert("Please input a valid phone number.");
		frm.bphone.focus();
		return false;
	}
  }
 if(frm.email.value=='')
  {
    alert("Please specify the email!");
    frm.email.focus();
    return false;
  }
  if(!emailCheck(frm.email.value))
  {
     alert("Email is in an invalid format - Please RE-Enter");
     frm.email.focus();
     return false;
  }


  
}//end function  

function chk_loginVal(thisfrm)
{
  frm=document.frmlogin;	
  with(thisfrm)
  {
	  if(email.value=='')
	  {
	    alert("Please specify the email!");
	    email.focus();
	    return false;
	  }
	  if(!emailCheck(email.value))
	  {
	     alert("Email is in an invalid format - Please RE-Enter");
	     email.focus();
	     return false;
	  }
	  if(pword.value=='')
	  {
	    alert("Please specify the password!");
	    pword.focus();
	    return false;
	  }
	}
}//end function

function chk_forgotVal()
{
  frm=document.frmforgot;
  if(frm.email.value=='')
  {
    alert("Please specify the email!");
    frm.email.focus();
    return false;
  }
  if(!emailCheck(frm.email.value))
  {
     alert("Email is in an invalid format - Please RE-Enter");
     frm.email.focus();
     return false;
  } 	
}//end function

function clearField(frm)
{
   if((frm.value=="XXX")||(frm.value=="XXXX"))
   {
	frm.value="";
	frm.focus();
   }
}


function chk_myacount()
{
  frm=document.frmMyAccountEdit;	

 if(frm.email.value=='')
  {
    alert("Please specify the email!");
    frm.email.focus();
    return false;
  }
  if(!emailCheck(frm.email.value))
  {
     alert("Email is in an invalid format - Please RE-Enter");
     frm.email.focus();
     return false;
  }
  if(frm.password.value=='')
  {
    alert("Please specify the password!");
    frm.password.focus();
    return false;
  }
 if(frm.title.value=='')
  {
    alert("Please specify the title!");
    frm.title.focus();
    return false;
  }
  
  if(frm.company.value=='')
  {
    alert("Please specify the company name!");
    frm.company.focus();
    return false;
  }
  if(frm.company_address.value=='')
  {
    alert("Please specify the company address!");
    frm.company_address.focus();
    return false;
  }
  if(frm.city.value=='')
  {
    alert("Please specify the company city!");
    frm.city.focus();
    return false;
  }
  if(frm.zip.value=='')
  {
    alert("Please specify the zipcode!");
    frm.zip.focus();
    return false;
  }
  if(frm.country.value=='')
  {
    alert("Please specify the country!");
    frm.country.focus();
    return false;
  }
  if(frm.phone1.value!='')
  {
       if (!ISnumeric(frm.phone1.value))
	{
		alert("Please input a valid phone number.");
		frm.phone1.focus();
		return false;
	}
  }
  if(frm.phone2.value!='')
  {
       if (!ISnumeric(frm.phone2.value))
	{
		alert("Please input a valid phone number.");
		frm.phone2.focus();
		return false;
	}
  }
  if(frm.phone3.value!='')
  {
       if (!ISnumeric(frm.phone3.value))
	{
		alert("Please input a valid phone number.");
		frm.phone3.focus();
		return false;
	}
  }
  if(frm.phone4.value!='')
  {
       if (!ISnumeric(frm.phone4.value))
	{
		alert("Please input a valid phone number.");
		frm.phone4.focus();
		return false;
	}
  }
  if(frm.badge_name.value=='')
  {
    alert("Please specify the name on badge!");
    frm.badge_name.focus();
    return false;
  }
  if(frm.company_badge_name.value=='')
  {
    alert("Please specify the comapany on badge!");
    frm.company_badge_name.focus();
    return false;
  }
  /*
  if((frm.ccfname.value!="")||(frm.cclname.value!="")||(frm.ccnumber.value!="")||(frm.ccexpdate.value!="")||(frm.csv.value!=""))
  {
	  if(frm.ccfname.value=='')
	  {
	    alert("Please specify the credit card first name!");
	    frm.ccfname.focus();
	    return false;
	  }
	  if(frm.cclname.value=='')
	  {
	    alert("Please specify the credit card last name!");
	    frm.cclname.focus();
	    return false;
	  }
	  if(frm.ccnumber.value=='')
	  {
	    alert("Please specify the credit card number!");
	    frm.ccnumber.focus();
	    return false;
	  }
	  if(frm.ccexpdate.value=='')
	  {
	    alert("Please specify the credit card expiry date!");
	    frm.ccexpdate.focus();
	    return false;
	  }
	  if(frm.csv.value=='')
	  {
	    alert("Please specify the csv number!");
	    frm.csv.focus();
	    return false;
	  }
   }
   */	  
  	  
}//end function  	

function chk_EventRegis(val)
{
  frm=document.event_registtration;
  if(frm.email.value=='')
  {
    alert("Please specify the email!");
    frm.email.focus();
    return false;
  }
  if(!emailCheck(frm.email.value))
  {
     alert("Email is in an invalid format - Please RE-Enter");
     frm.email.focus();
     return false;
  }
  if(frm.fname.value=='')
  {
    alert("Please specify the first name!");
    frm.fname.focus();
    return false;
  }
  if(frm.lname.value=='')
  {
    alert("Please specify the last name!");
    frm.lname.focus();
    return false;
  }
  if(frm.phone1.value!='')
  {
       if (!ISnumeric(frm.phone1.value))
	{
		alert("Please input a valid phone number.");
		frm.phone1.focus();
		return false;
	}
  }
  if(frm.phone2.value!='')
  {
       if (!ISnumeric(frm.phone2.value))
	{
		alert("Please input a valid phone number.");
		frm.phone2.focus();
		return false;
	}
  }
  if(frm.phone3.value!='')
  {
       if (!ISnumeric(frm.phone3.value))
	{
		alert("Please input a valid phone number.");
		frm.phone3.focus();
		return false;
	}
  }
  if(frm.phone4.value!='')
  {
       if (!ISnumeric(frm.phone4.value))
	{
		alert("Please input a valid phone number.");
		frm.phone4.focus();
		return false;
	}
  }
  if(frm.badge_name.value=='')
  {
    alert("Please specify the name on badge!");
    frm.badge_name.focus();
    return false;
  }
  if(frm.company_badge_name.value=='')
  {
    alert("Please specify the comapany on badge!");
    frm.company_badge_name.focus();
    return false;
  }
  if(val==1)
  {
  	if(frm.ccfname.value=='')
	  {
	    alert("Please specify the credit card first name!");
	    frm.ccfname.focus();
	    return false;
	  }
	  if(frm.cclname.value=='')
	  {
	    alert("Please specify the credit card last name!");
	    frm.cclname.focus();
	    return false;
	  }
	  if(frm.ccnumber.value=='')
	  {
	    alert("Please specify the credit card number!");
	    frm.ccnumber.focus();
	    return false;
	  }
	  if(frm.ccexpdate.value=='')
	  {
	    alert("Please specify the credit card expiry date!");
	    frm.ccexpdate.focus();
	    return false;
	  }
	  if(frm.csv.value=='')
	  {
	    alert("Please specify the csv number!");
	    frm.csv.focus();
	    return false;
	  }
  }
  	  
}//end function 


//used in member_directory.php
function chk_searchuser()
{
	if(document.searchform.searchfor.value=='')
	{
		alert("Please specify the text for search.");
		document.searchform.searchfor.focus();
		return false;
	}
		
}

function showImage(nm)
{
	flag=nm;
	var str = document.getElementById("select1").value;
	var str2 = document.getElementById("selct2").value;
	var obj3=document.getElementById("welcome1area");
	var obj4=document.getElementById("welcome2area");
	
	if(flag == "1")
	{
	 	obj3.style.visibility="visible"; 
	 	obj3.style.display="block";
 	
	}
	if(flag == "2")
	{
		obj4.style.visibility="visible"; 
	 	obj4.style.display="block";
	}		
}		

function FormCheck(thisfrm)
{
	with(thisfrm)
	{
		if(trimString(fname.value)=="")
		{
			alert("Please Enter your First Name");
			fname.focus();
			return false;
		}
		if(trimString(lname.value)=="")
		{
			alert("Please Enter your Last Name");
			lname.focus();
			return false;
		}
		if(trimString(email.value)=="")
		{
			alert("Please Enter Your Email address");
			email.focus();
			return false;
		}
		if(!emailCheck(email.value))
		{
			alert("Email is in an invalid format - Please RE-Enter");
			email.focus();
			return false;
		}
		if(pword.value=="")
		{
			alert("Please Enter a Password");
			pword.focus();
			return false;
		}
		if(pword2.value=="")
		{
			alert("Please Re-Enter the Password");
			pword2.focus();
			return false;
		}
		if(pword2.value!=pword.value)
		{
			alert("Password and confirmation password are not same");
            		return false;
		}
		if(movedate_month.value=='0')
		{
			alert("Please Select Your Move Month");
			movedate_month.focus();
			return false;
		}
		if(movedate_day.value=="0")
		{
			alert("Please Select Your Move Day");
			movedate_day.focus();
			return false;
		}
		if(movedate_year.value=="0")
		{
			alert("Please Select Your Move Year");
			movedate_year.focus();
			return false;
		}
		if(metroarea.value=="0")
		{
			alert("Please Select Metro Area");
			metroarea.focus();
			return false;
		}
		if(!agree.checked)
		{
			alert("You have to Agree to LuckTruck.com Terms and Conditions in order to proceed");
			return false;
		}
	}	
}

function FormCheck_first(thisfrm)
{
	with(thisfrm)
	{
		if(trimString(fname.value)=="")
		{
			alert("Please Enter your First Name");
			fname.focus();
			return false;
		}
		if(trimString(lname.value)=="")
		{
			alert("Please Enter your Last Name");
			lname.focus();
			return false;
		}
		if(trimString(email.value)=="")
		{
			alert("Please Enter Your Email address");
			email.focus();
			return false;
		}
		if(!emailCheck(email.value))
		{
			alert("Email is in an invalid format - Please RE-Enter");
			email.focus();
			return false;
		}
		if(pword.value=="")
		{
			alert("Please Enter a Password");
			pword.focus();
			return false;
		}
		if(pword2.value=="")
		{
			alert("Please Re-Enter the Password");
			pword2.focus();
			return false;
		}
		if(pword2.value!=pword.value)
		{
			alert("Password and confirmation password are not same");
            		return false;
		}
	}
	
}

function FormCheck_alt(thisfrm)
{
	with(thisfrm)
	{
		if(trimString(fname.value)=="")
		{
			alert("Please enter your first name");
			fname.focus();
			return false;
		}
		
		if(trimString(lname.value)=="")
		{
			alert("Please enter your last name");	
			lname.focus();
			return false;
		}
		
		if(trimString(email.value)=="")
		{
			alert("Please enter your email address");
			email.focus();
			return false;
		}
		
		if(!emailCheck(email.value))
		{
			alert("Email is in an invalid format - please re-enter");
			email.focus();
			return false;
		}
		
		if(psw.value=="")
		{
			alert("Please enter password");	
			psw.focus();
			return false;
		}
		
		if(repsw.value=="")
		{
			alert("Please re-enter your password");
			repsw.focus();
			return false;
		}
		
		if(repsw.value!=psw.value)
		{
			alert("Passwords do not match");
			repsw.focus();
			return false;
		}
		
		if(movedate_month.value=='0')
		{
			alert("Please Select Your Move Month");
			movedate_month.focus();
			return false;
		}
		if(movedate_day.value=="0")
		{
			alert("Please Select Your Move Day");
			movedate_day.focus();
			return false;
		}
		if(movedate_year.value=="0")
		{
			alert("Please Select Your Move Year");
			movedate_year.focus();
			return false;
		}
		
		if(!agree.checked)
		{
			alert("You have to agree to LuckTruck.com terms and conditions in order to proceed");
			return false;
		}
	}
}
function chk_forgot(thisfrm)
{
	with(thisfrm)	
	{
		if(trimString(email.value)=="")
		{
			alert("Please Enter your email address");
			email.focus();
			return false;
		}
		if(!emailCheck(email.value))
		{
			alert("Email is in an invalid format - Please RE-Enter");
			email.focus();
			return false;
		}
	}
}


function chk_register_frm()
{
	
	var fname=document.getElementById("fname");
	var lname=document.getElementById("lname");
	var obj=document.getElementById("metroarea");
	
	index=obj.selectedIndex;
	var vl=obj.options[index].value;
	
	var min_price=document.getElementById("minprice");
	var minindex=min_price.selectedIndex;
	var minpriceval=min_price.options[minindex].value;
	
	var max_price=document.getElementById("maxprice");
	var max_index=max_price.selectedIndex;
	var maxpricevalue=max_price.options[max_index].value;
	
	var email=document.getElementById("email");
	
	var pword=document.getElementById("pword");
	var repword=document.getElementById("repword");
	
	var neb=document.getElementById("neighbourhood");
	var neb_selected=neb.selectedIndex;
	var neb_value=neb.options[neb_selected].value;
	
	
	if(trimString(fname.value)=="")	
	{
		alert("Please Enter your firstname");
		fname.focus();
		return false;
	}
	if(trimString(lname.value)=="")	
	{
		alert("Please Enter your lastname");
		lname.focus();
		return false;
	}
	
	if(vl==0)
	{
		alert("Please select a metro area");
		obj.focus();
		return false;
	}
	
	/*
	if(neb_value=="0")
	{
		alert("Please select a neighborhood area");
		neb.focus();
		return false;
	}
	*/
	
	if(maxpricevalue>0)
	{
		if(minpriceval >= maxpricevalue)
		{
			alert("The minimum price must be less than the maximum price");
			min_price.focus();
			return false;
		}
	}
	
	if(trimString(email.value)=="")
	{
		alert("Please enter your email address");
		email.focus();
		return false;
	}
	
	if(!emailCheck(email.value))
	{
		alert("Email is in an invalid format - Please RE-Enter");
		email.focus();
		return false;
	}
	
	if(pword.value=="")
	{
		alert("Please enter password");
		pword.focus();
		return false;
	}
	
	if(repword.value=="")
	{
		alert("Please re type your password");	
		repword.focus();
		return false;
	}
	
	if(repword.value!=pword.value)
	{
		alert("Both passwords do not match");
		repword.focus();
		return false;
			
	}
}

function chk_search(thisform)
{
	with(thisform)
	{
		if(metroarea.value=="0")
		{
			alert("Please select a metro area");
			metroarea.focus();
			return false;
		}
		
		if(maxprice.value > 0)
		{
			if(minprice.value==2000 && maxprice.value<2000 )
			{
				alert("sWrong selection for minimum/maximum price");
				minprice.focus();
				return false;
			}
			else if(parseFloat(minprice.value) > parseFloat(maxprice.value))
			{
				alert("The minimum price must be less than the maximum price");
				minprice.focus();
				return false;
			}
		}
		
		if(searchtype.value=="zip")
		{
			if(trimString(zip.value)=="")
			{
				alert("Please enter a zipcode to search for");
				zip.focus();
				return false;
			}
		}
		else if(searchtype.value=="propertyname")
		{
			if(trimString(propertyname.value)=="")
			{
				alert("Please enter the name of property to search for");
				propertyname.focus();
				return false;
			}
		}
		else if(searchtype.value=="streetname")
		{
			if(trimString(streetname.value)=="")
			{
				alert("Please enter the name of street to search for");
				streetname.focus();
				return false;
			}
		}
		
	}
}


function chk_nebor_search(thisform)
{
	with(thisform)
	{
		if(maxprice.value > 0)
		{
			if(minprice.value==2000 && maxprice.value<2000 )
			{
				alert("sWrong selection for minimum/maximum price");
				minprice.focus();
				return false;
			}
			else if(parseFloat(minprice.value) > parseFloat(maxprice.value))
			{
				alert("The minimum price must be less than the maximum price");
				minprice.focus();
				return false;
			}
		}
	}
}

function frmaccountchk(thisfrm)
{
	with(thisfrm)	
	{
		if(trimString(fname.value)=="")	
		{
			alert("Please enter your firstname");
			fname.focus();
			return false;
		}
		if(trimString(lname.value)=="")	
		{
			alert("Please enter your lastname");
			lname.focus();
			return false;
		}
		if(trimString(email.value)=="")
		{
			alert("Please enter the email address");
			email.focus();
			return false;
		}
		if(!emailCheck(email.value))
		{
			alert("Email is in an invalid format - Please RE-Enter");
			email.focus();
			return false;
		}
		
		if(psw.value=="")
		{
			alert("Please enter password");
			psw.focus();
			return false;	
		}
		
		if(repsw.value=="")
		{
			alert("Please confirm the password you entered");
			repsw.focus();
			return false;
		}
		
		if(repsw.value!=psw.value)
		{
			alert("Passwords do not match");
			repsw.focus();
			return false;	
		}
		
		if(metroarea.value=="0")
		{
			alert("Please select a metro area");
			metroarea.focus();
			return false;
		}
		
		if(document.locator.email.value!=original_mailid ||document.locator.psw.value!=original_psw)
		{
			return confirm("Changing Your Email or Password will change the email or password that you use to sign in with.  Continue?");	
		}
		else
			return true;
		
	}
}

function req_form(thisfrm)
{
	with(thisfrm)	
	{
		if(document.forms[0].elements['preffered_area[]'].value=="")	
		{
			alert("Please Enter a Preferred Area of Town");
			preffered_area.focus();
			return false;
		}
			if(pricerange.value=="0")
		{
			alert("Please Select a Price Range");
			pricerange.focus();
			return false;
		}
			if(bedrooms.value=="0")
		{
			alert("Please Select the Number of Bedrooms");
			bedrooms.focus();
			return false;
		}
			if(bathrooms.value=="0")
		{
			alert("Please Select the Number of Bathrooms");
			bathrooms.focus();
			return false;
		}

	}
}


function msg_email()
{
	var obj=document.getElementById('msg_id');
	obj.innerHTML="Changing your email will also change the log in email";
}

function chk_tell(thisfrm)
{	
	with(thisfrm)	
	{
		if(trimString(yourname.value)=="")
		{
			alert("Please Enter your Name");	
			yourname.focus();
			return false;
		}
		if(trimString(youremail.value)=="")
		{
			alert("Please Enter your Email address");	
			youremail.focus();
			return false;
		}
		if(!emailCheck(youremail.value))
		{
			alert("Your Email is in an invalid format - Please RE-Enter");
			youremail.focus();
			return false;
		}
		
		if(trimString(fname1.value)=="")
		{
			alert("Please Enter first name of at least one friend");	
			fname1.focus();
			return false;
		}
		
		if(trimString(lname1.value)=="")
		{
			alert("Please Enter last name of at least one friend");	
			lname1.focus();
			return false;
		}
		if(trimString(email1.value)=="")
		{
			alert("Please Enter email of at least one friend");	
			email1.focus();
			return false;
		}
		if(!emailCheck(email1.value))
		{
			alert("First Friends Email is in an invalid format - Please RE-Enter");
			email1.focus();
			return false;
		}
		if(trimString(yourmessage.value)=="")
		{
			alert("Please Enter the message text");	
			yourmessage.focus();
			return false;
		}
		
	}
	var j=2;
	for(j=2;j<=10;j++)
	{
		var fname=document.getElementById('fname'+j);

		var lname=document.getElementById('lname'+j);
		var email=document.getElementById('email'+j);
		if((trimString(fname.value)!="") || (trimString(lname.value)!="") || (trimString(email.value)!="") )
		{
			if(trimString(fname.value)=="")
			{
				alert("Please Enter first name of the friend");	
				fname.focus();
				return false;
			}
			
			if(trimString(lname.value)=="")
			{
				alert("Please Enter last name of friend");	
				lname.focus();
				return false;
			}
			if(trimString(email.value)=="")
			{
				alert("Please Enter email of the friend");	
				email.focus();
				return false;
			}
			if(!emailCheck(email.value))
			{
				alert("Friends Email is in an invalid format - Please RE-Enter");
				email.focus();
				return false;
			}
		}
	}
}

function frmchk_nitify(thisfrm)
{
	with(thisfrm)
	{
		if(pricerange.value=="0")
		{
			alert("Please Enter a Price Range");
			pricerange.focus();
			return false;	
		}
		if(trimString(community_1.value)=="")
		{
			alert("Please Enter a Community Name");	
			community_1.focus();
			return false;
		}
		if(trimString(street_1.value)=="")
		{
			alert("Please Enter first street name");	
			street_1.focus();
			return false;
		}
		
		if(trimString(cityzip_1.value)=="")
		{
			alert("Please Enter first city or zip");	
			cityzip_1.focus();
			return false;
		}
	}
	
	var j=2;
	for(j=2;j<=10;j++)
	{
		var cmt=document.getElementById('community_'+j);

		var str=document.getElementById('street_'+j);
		var cz=document.getElementById('cityzip_'+j);
		if((trimString(str.value)!="") || (trimString(str.value)!="") || (trimString(cz.value)!="") )
		{
			if(trimString(cmt.value)=="")
			{
				alert("Please Enter Community Name");	
				cmt.focus();
				return false;
			}
			
			if(trimString(str.value)=="")
			{
				alert("Please Enter Street Name");	
				lname.focus();
				return false;
			}
			if(trimString(cz.value)=="")
			{
				alert("Please Enter City or Zip");	
				cz.focus();
				return false;
			}
			
		}
	}
}

function frmchk_schedule(thisfrm)
{
	with(thisfrm)	
	{
		if(trimString(lease_name.value)=="")
		{
			alert("Please Enter name of lease");
			lease_name.focus();
			return false;
		}
		
		if(trimString(lease_term_name.value)=="")
		{
			alert("Please Enter the value for lease term textbox");	
			lease_term_name.focus();
			return false;
		}
		
		if(lease_term.value=="0")
		{
			alert("Please Enter Lease Term");
			lease_term.focus();
			return false;	
		}
		if(trimString(apt_rent.value)=="")
		{
			alert("Please Enter Monthly Rent");
			apt_rent.focus();
			return false;
		}
		if(trimString(wphone.value)=="")
		{
			alert("Please Enter Work Day Phone");	
			wphone.focus();
			return false;
		}
		if(trimString(cphone.value)=="")
		{
			alert("Please Enter Cell Phone");	
			cphone.focus();
			return false;
		}
		if(trimString(email.value)=="")
		{
			alert("Please Enter your email address");
			email.focus();
			return false;
		}
		if(movedate_month.value=="")
		{
			alert("Please select Move Date Month ");			
			movedate_month.focus();
			return false;
		}
		if(movedate_day.value=="0")
		{
			alert("Please select Move Day");
			movedate_day.focus();
			return false;
		}
		if(movedate_year.value=="0")
		{
			alert("Please select Move Year");
			movedate_year.focus();
			return false;
		}
		if(movetime.value=="0")
		{
			alert("Please select the Move Time");	
			movetime.focus();
			return false;
		}
		if(trimString(street.value)=="")
		{
			alert("Please Enter the origin street address");	
			street.focus();
			return false;
		}
		if(trimString(city.value)=="")
		{
			alert("Please Enter the origin city");	
			city.focus();
			return false;
		}
		if(trimString(state.value)=="")
		{
			alert("Please Enter the origin state");
			state.focus();
			return false;
		}
		if(trimString(zip.value)=="")
		{
			alert("Please Enter the origin zip");	
			zip.focus();
			return false;
		}
		
		if(bedrooms.value ==0)
		{
			alert("Please select the origin number of bedrooms");	
			bedrooms.focus();
			return false;
		}
		if(floorlevel.value == 0)
		{
			alert("Please select the origin Floor Level");
			floorlevel.focus();
			return false;
		}
		if(trimString(des_apartment.value)=="")
		{
			alert("Please Enter the Destination Apartment Community Name");	
			des_apartment.focus();
			return false;
		}
		if(trimString(des_street.value)=="")
		{
			alert("Please Enter the Destination Street Address");
			des_street.focus();
			return false;
		}
		if(trimString(dest_city.value)=="")
		{
			alert("Please Enter the Destination City");
			dest_city.focus();
			return false;
		}
		if(trimString(dest_state.value)=="")
		{
			alert("Please Enter the Destination State");
			dest_state.focus();
			return false;
		}
		if(trimString(dest_zip.value)=="")
		{
			alert("Please Enter the Destination zip");
			dest_zip.focus();
			return false;
		}
		if(dest_bedrroms.value=="0")
		{
			alert("Please Select the Destination number of bedrooms");
			dest_bedrroms.focus();
			return false;
		}
		if(dest_floorlevel.value=="0")
		{
			alert("Please Select the Destination floor level");
			dest_floorlevel.focus();
			return false;
		}
		if(addtlpickup.value=="0")
		{
			alert("Select an option from additional pick up locations");
			addtlpickup.focus();
			return false;
		}
		if(!agree.checked)
		{
			alert("You have to agree to the terms and conditions");
			agree.focus();
			return false;
		}
	}
}

function frmadvsearchcheck(thisform)
{
	with(thisform)	
	{
		if(trimString(fname.value)=="")
		{
			alert("Please enter your first name");
			fname.focus();
			return false;
		}
		
		if(trimString(lname.value)=="")
		{
			alert("Please enter your last name");
			lname.focus();
			return false;
		}
		
		if(trimString(email.value)=="")
		{
			alert("Please enter your email address");
			email.focus();
			return false;
		}
		
		if(!emailCheck(email.value))
		{
			alert("Please enter a valid email address");
			email.focus();
			return false;
		}
		
		if(pword.value=="")
		{
			alert("Please enter password");	
			pword.focus();
			return false;
		}
		
		if(metroarea.value=="0")
		{
			alert("Please select a metro area");
			metroarea.focus();
			return false;
		}
		
		if(neighbourhood.value=="0")
		{
			alert("Please select a neighbourhood area");
			neighbourhood.focus();
			return false;
		}
	}
}

function chk_advance(thisform,mode)
{
	with(thisform)
	{
		if(mode=="neb" || mode=="")
		{
			if(searchmetro.value=="0")
			{
				alert("Please select a metro area");
				searchmetro.focus();
				return false;
			}
			
		}
		else if(mode=="zip")
		{
			if(trimString(srchzip.value)=="")
			{
				alert("Please enter a zip code");
				srchzip.focus();
				return false;
			}
		}
		else if(mode=="street")
		{
			if(searchmetro.value=="0")
			{
				alert("Please select a metro area");
				searchmetro.focus();
				return false;
			}
			
			if(trimString(srchstreet.value)=="")
			{
				alert("Please enter a street name");
				srchstreet.focus();
				return false;
			}
			
		}
		else if(mode=="name")
		{
			if(trimString(srchprname.value)=="")
			{
				alert("Please enter a property name");
				srchprname.focus();
				return false;
			}
			
		}
		
		if(trimString(fname.value)=="")
		{
			alert("Please enter your first name");
			fname.focus();
			return false;
		}
		
		if(trimString(lname.value)=="")
		{
			alert("Please enter your last name");
			lname.focus();
			return false;
		}
		
		if(!emailCheck(email.value))
		{
			alert("Please enter a valid email address");
			email.focus();
			return false;
		}
		
		if(pword.value=="")
		{
			alert("Please enter your password");
			pword.focus();
			return false;	
		}
		
		if(repword.value=="")
		{
			alert("Please re enter your password");
			repword.focus();
			return false;
		}
		
		if(repword.value!=pword.value)
		{
			alert("Both passwords do not match");	
			repword.focus();
			return false;	
		}
		
	}
}


function chk_advance_search(thisform,mode)
{
	with(thisform)
	{
		if(mode=="neb" || mode=="")
		{
			if(searchmetro.value=="0")
			{
				alert("Please select a metro area");
				searchmetro.focus();
				return false;
			}
			
		}
		else if(mode=="zip")
		{
			if(trimString(srchzip.value)=="")
			{
				alert("Please enter a zip code");
				srchzip.focus();
				return false;
			}
		}
		else if(mode=="street")
		{
			if(searchmetro.value=="0")
			{
				alert("Please select a metro area");
				searchmetro.focus();
				return false;
			}
			
			if(trimString(srchstreet.value)=="")
			{
				alert("Please enter a street name");
				srchstreet.focus();
				return false;
			}
			
		}
		else if(mode=="name")
		{
			if(trimString(srchprname.value)=="")
			{
				alert("Please enter a property name");
				srchprname.focus();
				return false;
			}
			
		}
	}
}

function chk_schedule1(thisform)
{
	with(thisform)	
	{
		if(apartment_id.value==0)
		{
			alert("Please select your chosen apartment community");
			apartment_id.focus();
			return false;
		}
		
		if(bedrooms.value=="")
		{
			alert("Please select the number of bedrooms");
			bedrooms	.focus();
			return false;
		}
		
		if(!accept1.checked)
		{
			alert("LuckTruck must be listed on your Guest Card and/or Lease Application to qualify for your Free or Discounted Move.");	
			return false;
		}
	}
}

function chk_schedule2(thisform)
{
	with(thisform)
	{
		if(record_type.value=="0")
		{
			type_selected=false;
			
			for(i=0;i < move_type.length;i++)
			{
				if(move_type[i].checked)
				{
					type_selected=true;
					break;
				}
			}
			
			if(!type_selected)
			{
				alert("Please select an option out of LuckTruck FREE Move* or $200 LuckTruck Cash Rebate");
				return false;
			}
		}
	}
}

function show_hide_pickups()
{
	var additional_location=document.getElementById("additional_location");
	var additionalpickup=document.getElementById("additionalpickup");
	
	if(additional_location.value=="Yes")
	{
		additionalpickup.style.visibility="visible";
		additionalpickup.style.display="";
	}
	else
	{
		additionalpickup.style.visibility="hidden";
		additionalpickup.style.display="none";
	}
	
}

function chk_schedule3(thisform)
{
	with(thisform)	
	{
		if(trimString(lease_term.value)=="0")
		{
			alert("Please enter lease term");	
			lease_term.focus();
			return false;
		}
		
		if(trimString(monthly_lease.value)=="")
		{
			alert("Please enter monthly lease amount");	
			monthly_lease.focus();
			return false;
		}
		
		if(monthly_lease.value!="" && isNaN(monthly_lease.value))
		{
			alert("Only numbers are allowed for montly lease amount");	
			monthly_lease.focus();
			return false;
		}
		
		if(trimString(leasing_agent_name.value)=="")
		{
			alert("Please enter leasing agent name");	
			leasing_agent_name.focus();
			return false;
		}
		
		
		if(trimString(client_day_phone.value)=="")
		{
			alert("Please enter work(day) phone");	
			client_day_phone.focus();
			return false;
		}
		
		
		if((client_day_phone.value.length > 0) && ( !/(\d{3})-(\d{3})-(\d{4})/.test(client_day_phone.value)))
		{
			alert("Please enter the phone in the 000-000-0000 format");	
			client_day_phone.focus();
			return false;
		}
		
		
		if(trimString(client_cell_phone.value)=="")
		{
			alert("Please enter cell phone");	
			client_cell_phone.focus();
			return false;
		}
		
		
		if((client_cell_phone.value.length > 0) && ( !/(\d{3})-(\d{3})-(\d{4})/.test(client_cell_phone.value)))
		{
			alert("Please enter the cell phone in the 000-000-0000 format");	
			client_cell_phone.focus();
			return false;
		}
		
		if(trimString(client_email.value)=="")
		{
			alert("Please enter email address");
			client_email.focus();
			return false;
		}
		
		if(!emailCheck(client_email.value))
		{
			alert("Email is in invalid format - Please RE-Enter");
			client_email.focus();
			return false;
		}
		
		if(trimString(move_date.value)=="")
		{
			alert("Please enter requested move date");
			move_date.focus();
			return false;
		}
		
		if(!/(0[0-9]|1[0-2])\/([0-2][0-9]|3[0-1])\/(\d{4})/.test(move_date.value))
		{
			alert("Please enter requested move date in MM/DD/YYYY format");
			move_date.focus();
			return false;
		}
		
		if(trimString(move_time.value)=="0")
		{
			alert("Please enter preferred moving time");
			move_time.focus();
			return false;
		}
		
		if(trimString(origin_street_adrs.value)=="")
		{
			alert("Please enter origin street address");
			origin_street_adrs.focus();
			return false;
		}
		
		if(trimString(origin_unit_no.value)=="")
		{
			alert("Please enter origin apartment unit number");
			origin_unit_no.focus();
			return false;
		}
		
		if(trimString(origin_city.value)=="")
		{
			alert("Please enter origin city");
			origin_city.focus();
			return false;
		}
		
		if(trimString(origin_state.value)=="")
		{
			alert("Please enter origin state");
			origin_state.focus();
			return false;
		}
		
		if(trimString(origin_zip.value)=="")
		{
			alert("Please enter origin zipcode");
			origin_zip.focus();
			return false;
		}
		
		if(isNaN(origin_zip.value))
		{
			alert("Please enter origin zip in numbers only");	
			origin_zip.focus();
			return false;
		}
		
		if(trimString(origin_bedrooms.value)=="0")
		{
			alert("Please enter origin bedrooms");
			origin_bedrooms.focus();
			return false;
		}
		
		if(isNaN(origin_bedrooms.value))
		{
			alert("Please enter origin bedrooms in numbers only");	
			origin_bedrooms.focus();
			return false;
		}
		
		if(trimString(origin_floor_level.value)=="0")
		{
			alert("Please enter origin floor level");
			origin_floor_level.focus();
			return false;
			
		}
		
		if(trimString(dest_name.value)=="")
		{
			alert("Please enter destination apartment community name");
			dest_name.focus();
			return false;
		}
		
		if(trimString(dest_street_adrs.value)=="")
		{
			alert("Please enter destination street address");
			dest_street_adrs.focus();
			return false;
		}
		
		if(trimString(dest_unit_no.value)=="")
		{
			alert("Please enter destinatin apartment unit number");
			dest_unit_no.focus();
			return false;
		}
		
		if(trimString(dest_city.value)=="")
		{
			alert("Please enter destinatin city");
			dest_city.focus();
			return false;
		}
		
		if(trimString(dest_state.value)=="")
		{
			alert("Please enter destinatin state");
			dest_state.focus();
			return false;
		}
		
		if(trimString(dest_zip.value)=="")
		{
			alert("Please enter destinatin zip");
			dest_zip.focus();
			return false;
		}
		
		if(isNaN(dest_zip.value))
		{
			alert("Please enter destination zip in numbers only");	
			origin_zip.focus();
			return false;
		}
		
		
		if(trimString(dest_floor_level.value)=="0")
		{
			alert("Please enter destination floor level");
			dest_floor_level.focus();
			return false;
		}
		
		if(additional_location.value=="Yes")
		{
			if(trimString(additional_street_adrs.value)=="")
			{
				alert("Please enter street address for additional pickup location");
				additional_street_adrs.focus();
				return false;
			}
			
			if(trimString(additional_city_adrs.value)=="")
			{
				alert("Please enter city for additional pickup location");
				additional_city_adrs.focus();
				return false;
			}
			
			if(trimString(additional_state_adrs.value)=="")
			{
				alert("Please enter state for additional pickup location");
				additional_state_adrs.focus();
				return false;
			}
			
			if(trimString(additional_zip_adrs.value)=="")
			{
				alert("Please enter zipcode for additional pickup location");
				additional_zip_adrs.focus();
				return false;
			}
			
			if(isNaN(additional_zip_adrs.value))
			{
				alert("Please enter zipcode for additional pickup location in numbers only");	
				additional_zip_adrs.focus();
				return false;
			}
		}
		
		if(!terms.checked)
		{
			alert("You need to agree to the Lucktruck Disclaimers in order to continue");
			return false;
		}
	}
}

function chk_schedule4(thisform)
{	
	with(thisform)
	{
		if(trimString(lease_fname.value)=="")
		{
			alert("Please enter your first name");
			lease_fname.focus();
			return false;
		}
		
		if(trimString(lease_lname.value)=="")
		{
			alert("Please enter your last name");
			lease_lname.focus();
			return false;
		}
		
		if(trimString(dest_street_adrs.value)=="")
		{
			alert("Please enter destination street address");
			dest_street_adrs.focus();
			return false;
		}
		
		if(trimString(dest_unit_no.value)=="")
		{
			alert("Please enter destination unit number");
			dest_unit_no.focus();
			return false;
		}
		
		if(trimString(dest_city.value)=="")
		{
			alert("Please enter destination city");
			dest_city.focus();
			return false;
		}
		
		if(trimString(dest_state.value)=="")
		{
			alert("Please enter destination state");
			dest_state.focus();
			return false;
		}
		
		if(trimString(dest_zip.value)=="")
		{
			alert("Please enter destination zip");
			dest_zip.focus();
			return false;
		}
		
		if(trimString(lease_term.value)=="0")
		{
			alert("Please enter lease term");
			lease_term.focus();
			return false;
		}
		
		if(trimString(monthly_lease.value)=="")
		{
			alert("Please enter monthly lease");
			monthly_lease.focus();
			return false;
		}
		
		if(isNaN(monthly_lease.value))
		{
			alert("Monthly lease amount must be a number");
			monthly_lease.focus();
			return false;
		}
		
		if(trimString(leasing_agent_name.value)=="")
		{
			alert("Please enter leasing agent name");
			leasing_agent_name.focus();
			return false;
		}
		
		if(trimString(client_day_phone.value)=="")
		{
			alert("Please enter work (day) phone");
			client_day_phone.focus();
			return false;
		}
		
		
		if((client_day_phone.value.length > 0) && ( !/(\d{3})-(\d{3})-(\d{4})/.test(client_day_phone.value)))
		{
			alert("Please enter the phone in the 000-000-0000 format");	
			client_day_phone.focus();
			return false;
		}
		
		
		if(trimString(client_cell_phone.value)=="")
		{
			alert("Please enter your cell phone");
			client_cell_phone.focus();
			return false;
		}
		
		
		if((client_cell_phone.value.length > 0) && ( !/(\d{3})-(\d{3})-(\d{4})/.test(client_cell_phone.value)))
		{
			alert("Please enter the cell phone in the 000-000-0000 format");	
			client_cell_phone.focus();
			return false;
		}
		
		if(trimString(client_email.value)=="")
		{
			alert("Please enter your email");
			client_email.focus();
			return false;
		}
		
		if(!emailCheck(client_email.value))
		{
			alert("Email is in invalid format - Please RE-Enter");
			client_email.focus();
			return false;
		}
		
		if(!/(0[0-9]|1[0-2])\/([0-2][0-9]|3[0-1])\/(\d{4})/.test(move_date.value))
		{
			alert("Please enter requested move date in MM/DD/YYYY format");
			move_date.focus();
			return false;
		}
		
		if(!accept4.checked)
		{
			alert("Please indicate that you have read and understand the LuckTruck Disclaimers page.");
			return false;
		}
	}
}

function change_critirea(cntrl)
{
	var nebor=document.getElementById("searchbyneighborhood");
	var zipcode=document.getElementById("searchbyzip");
	var property=document.getElementById("searchbypropertyname");
	var street=document.getElementById("searchbystreetname");
	var metroarea=document.getElementById("metroarea");
	
	if(cntrl.value=="all")
	{
		nebor.style.visibility="hidden";
		nebor.style.display="none";
		
		zipcode.style.visibility="hidden";
		zipcode.style.display="none";
		
		property.style.visibility="hidden";
		property.style.display="none";
		
		street.style.visibility="hidden";
		street.style.display="none";
	}
	else 
	{
		if(metroarea.value!=0)
		{
			if(cntrl.value=="neighborhood")
			{
				nebor.style.visibility="visible";
				nebor.style.display="";
				
				zipcode.style.visibility="hidden";
				zipcode.style.display="none";
				
				property.style.visibility="hidden";
				property.style.display="none";
				
				street.style.visibility="hidden";
				street.style.display="none";
			}
			else if(cntrl.value=="zip")
			{
				nebor.style.visibility="hidden";
				nebor.style.display="none";
				
				zipcode.style.visibility="visible";
				zipcode.style.display="";
				
				property.style.visibility="hidden";
				property.style.display="none";
				
				street.style.visibility="hidden";
				street.style.display="none";
			}
			else if(cntrl.value=="propertyname")
			{
				nebor.style.visibility="hidden";
				nebor.style.display="none";
				
				zipcode.style.visibility="hidden";
				zipcode.style.display="none";
				
				property.style.visibility="visible";
				property.style.display="";
				
				street.style.visibility="hidden";
				street.style.display="none";
			}
			else if(cntrl.value=="streetname")
			{
				nebor.style.visibility="hidden";
				nebor.style.display="none";
				
				zipcode.style.visibility="hidden";
				zipcode.style.display="none";
				
				property.style.visibility="hidden";
				property.style.display="none";
				
				street.style.visibility="visible";
				street.style.display="";
			}
		}
		else
		{
			alert("Please select a metro area first");
			cntrl.selectedIndex=0;	
		}
	}
}

function chk_popup_register(thisfrm)
{
	with(thisfrm)
	{
		if(trimString(fname.value)=="")
		{
			alert("Please enter your first name");
			fname.focus();
			return false;
		}
		
		if(trimString(lname.value)=="")
		{
			alert("Please enter your last name");	
			lname.focus();
			return false;
		}
		
		if(trimString(email.value)=="")
		{
			alert("Please enter your email address");
			email.focus();
			return false;
		}
		
		if(!emailCheck(email.value))
		{
			alert("Email is in an invalid format - please re-enter");
			email.focus();
			return false;
		}
		
		if(metroarea.value=="0")
		{
			alert("Please select a metro area");
			metroarea.focus();
			return false;	
		}
		
		if(psw.value=="")
		{
			alert("Please enter password");	
			psw.focus();
			return false;
		}
		
		if(repsw.value=="")
		{
			alert("Please re-enter your password");
			repsw.focus();
			return false;
		}
		
		if(repsw.value!=psw.value)
		{
			alert("Passwords do not match");
			repsw.focus();
			return false;
		}
	}
}

function chk_popup_login(thisfrm)
{
	with(thisfrm)	
	{
		if(trimString(email.value)=="")	
		{
			alert("Please enter your email address");
			email.focus();
			return false;
		}
		
		if(!emailCheck(email.value))
		{
			alert("Email is in an invalid format - please re-enter");
			email.focus();
			return false;
		}
		
		if(psw.value=="")
		{
			alert("Please enter password");	
			psw.focus();
			return false;
		}
	}
}

function chk_index_form(thisfrm)
{
	with(thisfrm)
	{
		if(metroarea.value==0)	
		{
			alert("Please select a metro area");
			metroarea.focus();
			return false;
		}
	}	
}

function chk_register(thisfrm)
{
	with(thisfrm)
	{
		if(metro_area.value=="")	
		{
			alert("Please select a metro area");
			metro_area.focus();
			return false;
		}
				
		if(trimString(fname.value)=="")
		{
			alert("Please enter your first name");
			fname.focus();
			return false;
		}
				
		if(trimString(lname.value)=="")
		{
			alert("Please enter your last name");
			lname.focus();
			return false;
		}
				
		if(trimString(emaild.value)=="")
		{
			alert("Please enter your email address");
			emaild.focus();
			return false;
		}
		
		if(!emailCheck(emaild.value))
		{
			alert("Please enter email address in valid format e.g. name@test.com")
			emaild.focus();
			return false;
		}
				
		if(psw.value=="")
		{
			alert("Please enter password");
			psw.focus();
			return false;
		}
				
		if(repsw.value=="")
		{
			alert("Please confirm your password");	
			repsw.focus();
			return false;
		}
				
		if(repsw.value!=psw.value)
		{
			alert("Password entered does not match confirmation password");	
			repsw.focus();
			return false;
		}
				
		if(parseInt(maxprice.value) > 0)
		{
			if(parseInt(minprice.value) >= parseInt(maxprice.value))
			{
				alert("The minimum price must be less than the maximum price");
				minprice.focus();
				return false;
			}
		}
	}
}

function ValidateRequestPage(thisform)
{
	with(thisform)
	{
		if(movedate_month.value=="0")
		{
			alert("Please select the anticipated move month");
			movedate_month.focus();
			return false;
		}
		
		if(movedate_month.value=="0")
		{
			alert("Please select the anticipated move month");
			movedate_month.focus();
			return false;
		}
		
		if(movedate_day.value=="0")
		{
			alert("Please select the anticipated move date");
			movedate_day.focus();
			return false;
		}
		
		if(movedate_year.value=="0")
		{
			alert("Please select the anticipated move year");
			movedate_year.focus();
			return false;
		}
		
		if(metroarea.value=="0")
		{
			alert("Please select a metro area");
			metroarea.focus();
			return false;
		}
		
		if(parseInt(minprice.value) > parseInt(maxprice.value))
		{
			alert("Preferred minimum price can not be greater than preferred maximum price");
			minprice.focus();
			return false;
		}
		
		if(trimString(fname.value)=="")
		{
			alert("Please enter first name");	
			fname.focus();
			return false;
		}
		
		if(trimString(lname.value)=="")
		{
			alert("Please enter last name");	
			lname.focus();
			return false;
		}
		
		if(trimString(email.value)=="")
		{
			alert("Please enter email");	
			email.focus();
			return false;
		}
		
		if(!emailCheck(email.value))
		{
		     alert("Email is in an invalid format - Please RE-Enter");
		     email.focus();
		     return false;
		}
		
		
		if((phone.value.length > 0) && ( !/^(\d{3})-(\d{3})-(\d{4})$/.test(phone.value)))
		{
			alert("Please enter the phone in the 000-000-0000 format");	
			phone.focus();
			return false;
		}
		
		if(original_mailid.value!="")
		{
			if(email.value!=original_mailid.value)
			{
				return confirm("Changing Your Email will change the email that you use to sign in with.  Continue?");	
			}
			else
				return true;
		}
		
	}	
}