function validateTellUs () {
		if(checkEmptyString(document.frmTell.email)) {
		alert('Please enter a valid email address that we can use to contact you, e.g., user@yourisp.com');
		return false;
	}
	
	if(!checkValidEmail(document.frmTell.email)) {						
		alert('Please enter a valid email address that we can use to contact you, e.g., user@yourisp.com');
		return false;
	}
	
	return true;
}

function validateForm () {
	if(document.frmCBR.title.selectedIndex == 0) {
		alert('Please select your Title');
		return false;
	}
	
	if(checkEmptyString(document.frmCBR.firstName)) {
		alert('Please enter a first name');
		return false;
	}
	
	if(checkEmptyString(document.frmCBR.lastName)) {
		alert('Please enter a last name');
		return false;
	}
	
	if(!validatePhone(document.frmCBR.wAreaCode, document.frmCBR.wPhone)) {
		alert('Please provide a valid daytime phone number that we may use to contact you.\nRemember to include the area code for US phone numbers.');
		return false;
	}
	
	if(!checkEmptyString(document.frmCBR.areaCode) || !checkEmptyString(document.frmCBR.phone)){
		if(!validatePhone(document.frmCBR.areaCode, document.frmCBR.phone)) {
			alert('Please provide a valid evening phone number that we may use to contact you.\nRemember to include the area code for US phone numbers.');
			return false;
		}
	}
	
	if(checkEmptyString(document.frmCBR.email)) {
		alert('Please enter a valid email address that we can use to contact you, e.g., user@yourisp.com');
		return false;
	}
	
	if(!checkValidEmail(document.frmCBR.email)) {						
		alert('Please enter a valid email address that we can use to contact you, e.g., user@yourisp.com');
		return false;
	}
	
	if(checkEmptyString(document.frmCBR.verifyemail)) {
		alert('Please verify your e-mail address by entering it in the "Verify E-mail Address" box.');
		return false;
	}
	
	if(document.frmCBR.verifyemail.value != document.frmCBR.email.value) {
		alert('Your verification e-mail address doesn\'t match your e-mail address. Please enter your e-mail address again.');
		return false;
	}
	
	if(document.frmCBR.numAdults.selectedIndex == 0 && checkEmptyString(document.frmCBR.deal)) {
		alert('Please specify the number of adults traveling');
		return false;
	}
	
	if(document.frmCBR.tickets.selectedIndex == 1 && checkEmptyString(document.frmCBR.airport)) {
		alert('Please enter the airport from which you will be traveling');
		return false;
	}
	
	if(checkEmptyString(document.frmCBR.comments) && checkEmptyString(document.frmCBR.deal)) {
		alert('Please provide a description of the vacation you are looking for.\nScroll down to the comments section below and give us as much information about\nwhat you are looking for (region, hotel or resort name, etc.) as you can.');
		return false;
	}							
}

function checkEmptyString(fieldToCheck) {	
	var goodChars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
	var fieldValue = fieldToCheck.value;	

	if (fieldValue == '') {
		return true;	
	}
	
	for (i=0; i<=fieldValue.length-1; i++) {
		if (goodChars.indexOf(fieldValue.charAt(i)) >= 1) {		
			return false;
		}
	}	
	return true;
}

function checkValidEmail(fieldToCheck) {
	var str = fieldToCheck.value;
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}

	if (str.indexOf(at,(lat+1))!=-1){
		return false
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	}

	if (str.indexOf(dot,(lat+2))==-1){
		return false
	}
	
	if (str.indexOf(' ')!=-1){
		return false
	}

	return true					
}
	
function validatePhone(areaCode, phone) {
  var sAreaCode = areaCode.value;
  var sPhone = phone.value;
  var numCount = 0; 
  
  for (i = 0; i < sAreaCode.length; i++) {
	c = sAreaCode.charAt(i);					
	if(c >= '0' && c <= '9') {
		numCount++;
	}
  }
  
  for (i = 0; i < sPhone.length; i++) {
	c = sPhone.charAt(i);					
	if(c >= '0' && c <= '9') {
		numCount++;
	}
  }
  
  if (numCount < 7) {
	return false;
  }
  
  return true;
}
