function textValidate(incomingString, defaultValue)
{
  if(trimSpace(incomingString).length == 0 || incomingString.search(/[^a-zA-Z ]/g) != -1 || incomingString==defaultValue)
  {
    return false;
  }
  else
    return true;
}

function trimSpace(x)
{

  var emptySpace = / /g;
  var trimAfter = x.replace(emptySpace,"");
  return(trimAfter);

}

function alphanumeric(incomingString, defaultValue)
{
  if(trimSpace(incomingString).length == 0 || incomingString.search(/[^0-9a-zA-Z]/g) != -1 || incomingString==defaultValue)
  {
    return false;
  }
  else
    return true;
}
function numberValidate(incomingString, defaultValue)
{
  if(trimSpace(incomingString).length == 0 || incomingString.search(/[^0-9\.]/g) != -1 || incomingString==defaultValue || parseInt(incomingString, 10) <= 0 )
  {
    return false;
  }
  else
    return true;
}
function numberValidate2(incomingString)
{
  if(trimSpace(incomingString).length == 0 || incomingString.search(/[^0-9\.]/g) != -1 || parseInt(incomingString, 10) < 0 )
  {
    return false;
  }
  else
    return true;
}
function emailValidate(incomingString, defaultValue)
{
  if(trimSpace(incomingString).length == 0 || incomingString.search(/[\_\-\d]*[A-Za-z]+[\w\_\-]*[\@][\d]*[A-Za-z]+[\w\-]*[\.][A-Za-z]+/g) == -1 || incomingString==defaultValue)
  {
    return false;
  }
  else
    return true;
}



function zipenable() {
	
          if(!(document.frmSwades.City.options[document.frmSwades.City.selectedIndex].text=="USA") && (document.frmSwades.City.options[document.frmSwades.City.selectedIndex].text!="United Kingdom"))
          {
            document.frmSwades.Zip_Code.disabled=true;
          }
          else
          {
            document.frmSwades.Zip_Code.disabled=false;
          }
		  return true;
}

var flagCoun;
showCounCode.flagCoun = 1;
function showCounCode()
{
		 if(numberValidate(document.frmSwades.Office_Country_Code.value, 'Country'))
		 {
//			 	alert("Presssss "+showCounCode.flagCoun);
			 	if(showCounCode.flagCoun == 1)
				{
				document.frmSwades.Home_Country_Code.value=document.frmSwades.Office_Country_Code.value;
				showCounCode.flagCoun++;
				}
		 }
}

function validateForm()
{
  if(document.frmSwades.First_Name.value=='Name' || trimSpace(document.frmSwades.First_Name.value)=="")
  {
    alert("Please Enter Your Name");
    document.frmSwades.First_Name.focus();
    document.frmSwades.First_Name.select();
    return false;
  }
  if((!textValidate(document.frmSwades.First_Name.value, '')))
  {
    alert("Please Enter Alphabets Only");
    document.frmSwades.First_Name.focus();
    document.frmSwades.First_Name.select();
    return false;
  }

  if(document.frmSwades.Address.value=='Address' || trimSpace(document.frmSwades.Address.value)=="")
  {
    alert("Please Enter Address");
    document.frmSwades.Address.focus();
    document.frmSwades.Address.select();
    return false;
  }
  if(document.frmSwades.Email_Id.value=='E-Mail Address' || trimSpace(document.frmSwades.Email_Id.value)=="")
  {
    alert("Please Enter Your Email Id");
    document.frmSwades.Email_Id.focus();
    document.frmSwades.Email_Id.select();
    return false;
  }
  if(!emailValidate(document.frmSwades.Email_Id.value,'E-Mail Address'))
  {
    alert("Please Enter the Correct Email Id");
    document.frmSwades.Email_Id.focus();
    document.frmSwades.Email_Id.select();
    return false;
  }

  if(trimSpace(document.frmSwades.Telephone.value)=="")
  {
    alert("Please Enter the Telephone/Mobile");
    document.frmSwades.Telephone.focus();
    document.frmSwades.Telephone.select();
    return false;
  }
  if(!numberValidate(document.frmSwades.Telephone.value, 'Telephone'))
  {
    alert("Please Enter Numbers Only");
    document.frmSwades.Telephone.focus();
    document.frmSwades.Telephone.select();
    return false;
  }
  if(document.frmSwades.Telephone.length<4)
  {
    alert("Please Enter a Valid Phone Number (Minimum 4 Digits)");
    document.frmSwades.Telephone.focus();
    document.frmSwades.Telephone.select();
    return false;
  }

if(trimSpace(document.frmSwades.from.value)=="")
  {
    alert("Please Enter Date");
    document.frmSwades.from.focus();
    document.frmSwades.from.select();
    return false;
  }
if(trimSpace(document.frmSwades.to.value)=="")
  {
    alert("Please Enter Date");
    document.frmSwades.to.focus();
    document.frmSwades.to.select();
    return false;
  }
	document.frmSwades.phone1.value=document.frmSwades.Telephone.value;
    return true;
}

function validateFeedback()
{
  if(document.frmSwades.First_Name.value=='Name' || trimSpace(document.frmSwades.First_Name.value)=="")
  {
    alert("Please Enter Your Name");
    document.frmSwades.First_Name.focus();
    document.frmSwades.First_Name.select();
    return false;
  }
  if((!textValidate(document.frmSwades.First_Name.value, '')))
  {
    alert("Please Enter Alphabets Only");
    document.frmSwades.First_Name.focus();
    document.frmSwades.First_Name.select();
    return false;
  }

  if(document.frmSwades.Email_Id.value=='E-Mail Address' || trimSpace(document.frmSwades.Email_Id.value)=="")
  {
    alert("Please Enter Your Email Id");
    document.frmSwades.Email_Id.focus();
    document.frmSwades.Email_Id.select();
    return false;
  }
  if(!emailValidate(document.frmSwades.Email_Id.value,'E-Mail Address'))
  {
    alert("Please Enter the Correct Email Id");
    document.frmSwades.Email_Id.focus();
    document.frmSwades.Email_Id.select();
    return false;
  }

  if(document.frmSwades.feedback.value=="" || trimSpace(document.frmSwades.feedback.value)=="")
  {
    alert("Please Enter Your Feedback");
    document.frmSwades.feedback.focus();
    document.frmSwades.feedback.select();
    return false;
  }

    return true;
}

var urlAddress = "http://www.luxurytravel.com/home.jsp"; 
function addToFavorites() 
	{ 
	if (window.external) 
		{ 
		window.external.AddFavorite(urlAddress,pageName)
		} 
	else 
		{ 
		alert("Sorry! Your browser doesn't support this function."); 
		} 
	}