
var bookmarkurl="http://www.cheapbedfinder.com"
 var bookmarktitle="www.cheapbedfinder.com - Find Hotels Anywhere"
 function addbookmark()
 {
 	if (document.all)
    window.external.AddFavorite(bookmarkurl,bookmarktitle)
 }
 
function removeBlanks(s){
     s = s.replace(/(^\s*)|(\s*$)/gi,"");
     s = s.replace(/[ ]{2,}/gi," ");
     s = s.replace(/\n /,"\n");
     return s;
}
            
function FrontPage_Form1_Validator(theForm)
{
	if(theForm.select.value=='Travelagent'){
		alert("Travel Agent Accounts are coming soon! \n\nPlease visit us back soon.");
		theForm.select.focus();
		return false;
	}
	if (removeBlanks(theForm.compname.value).length == 0)
  	{
    	alert("Please enter your \"Company Name\".");
    	theForm.compname.focus();
    	return false;
  	}
  if (removeBlanks(theForm.name.value).length == 0)
  {
    alert("Please enter your \"Full Name\".");
    theForm.name.focus();
    return false;
  }

  if (removeBlanks(theForm.email.value).length == 0)
  {
    alert("Please enter your \"Email Address\".");
    theForm.email.focus();
    return false;
  }
  if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,5})+$/.test(theForm.email.value))){
	alert("Please enter Valid Email Address");
	theForm.email.focus();
	return false;
  }
  if(removeBlanks(theForm.phone.value).length==0){
  	alert("Please Enter your Phone number");
  	theForm.phone.focus();
  	return false;
  }
  if(isNaN(theForm.phone.value)){
  	alert("Please Enter a Valid Phone Number");
  	theForm.phone.focus();
  	return false;
  } 
   if (removeBlanks(theForm.address.value).length == 0)
  {
    alert("Please enter your \"Address\".");
    theForm.address.focus();
    return false;
  }
   if (removeBlanks(theForm.city.value) == 0)
  {
    alert("Please enter your \"city\".");
    theForm.city.focus();
    return false;
  }
  if(removeBlanks(theForm.zipcode.value).length == 0)
  {
  	alert("Please Enter the ZIP code");
  	theForm.zipcode.focus();
  	return false;
  }
  if (theForm.Country.value == 0)
  {
    alert("Please enter your \"Country\".");
    theForm.Country.focus();
    return false;
  }
  if(theForm.paymode.value == 0)
  {
  	alert("Please Select the type of Payment");
  	theForm.paymode.focus();
  	return false;
  }
  if(removeBlanks(theForm.paymentname.value)==0)
  {
  	alert("Please Enter the Name for the Payment to be made");
  	theForm.paymentname.focus();
  	return false;
  }
  return true;
}
