//Coded by Sunita

/*******************************EMAIL VALIDATION*******************************/

function echeck(str)
{
  var at="@";
  var dot=".";
  var lat=str.indexOf(at);
  var lstr=str.length;
  var ldot=str.indexOf(dot);
  if (str.indexOf(at)==-1)
  {
      alert("Invalid E-mail ID");
      return false;
  }
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
  {
      alert("Invalid E-mail ID");
      return false;
  }
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
  {
      alert("Invalid E-mail ID");
      return false;
  }
  if (str.indexOf(at,(lat+1))!=-1)
  {
      alert("Invalid E-mail ID");
      return false;
  }
  if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
  {
      alert("Invalid E-mail ID");
      return false;
  }
  if (str.indexOf(dot,(lat+2))==-1)
  {
      alert("Invalid E-mail ID");
      return false;
  }
  if (str.indexOf(" ")!=-1)
  {
      alert("Invalid E-mail ID");
      return false;
  }
  return true;
}

/*******************************EMAIL VALIDATION*******************************/


//Get a quote
function submitQuote()
{
  if(document.frmQuote.txtCmp.value=="")
  {
      alert("Please enter Company Name");
      document.frmQuote.txtCmp.focus();
      return false;
  }	
  if(document.frmQuote.txtName.value=="")
  {
      alert("Please enter your Name");
      document.frmQuote.txtName.focus();
      return false;
  }  
  if(document.frmQuote.txtOrg.value=="")
  {
      alert("Please enter Origin");
      document.frmQuote.txtOrg.focus();
      return false;
  }  
  if(document.frmQuote.txtDest.value=="")
  {
      alert("Please enter Destination");
      document.frmQuote.txtDest.focus();
      return false;
  }  
  if(document.frmQuote.txtEmail.value=="")
  {
      alert("Please enter email");
      document.frmQuote.txtEmail.focus();
      return false;
  }
  var emailID=document.frmQuote.txtEmail;
  if (echeck(emailID.value)==false)
  {
      emailID.value="";
      emailID.focus();
      return false;
  }
  if(document.frmQuote.txtComm.value=="")
  {
      alert("Please enter  your Comments");
      document.frmQuote.txtComm.focus();
      return false;
  }
  document.frmQuote.submit();
}


//Feedback
function submitFB()
{
  if(document.frmFB.txtCmp.value=="")
  {
      alert("Please enter Company Name");
      document.frmFB.txtCmp.focus();
      return false;
  }	
  if(document.frmFB.txtName.value=="")
  {
      alert("Please enter your Name");
      document.frmFB.txtName.focus();
      return false;
  }  
  if(document.frmFB.txtEmail.value=="")
  {
      alert("Please enter email");
      document.frmFB.txtEmail.focus();
      return false;
  }
  var emailID=document.frmFB.txtEmail;
  if (echeck(emailID.value)==false)
  {
      emailID.value="";
      emailID.focus();
      return false;
  }
  if(document.frmFB.txtComm.value=="")
  {
      alert("Please enter  your Comments");
      document.frmFB.txtComm.focus();
      return false;
  }
  document.frmFB.submit();
}