function trim(s) 
{
  if (s.value>0)
  {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  }
  return s;
}

function isValidEmail(str) {

   return (str.indexOf(".") > 0) && (str.indexOf("@") > 0);
}


function process_formsearch()
{
   if (trim(document.frmsearch.searchcriteria.value==''))
   {
      alert('Please enter search criteria!');
	  return false;
   }
   return true;
}


function process_form()
{
   myerror=0;
   myerrormsg="";
   myerrormsg='Please provide the following information\n';
   if (trim(document.frm.f_yourname.value==''))
   {
      myerrormsg=myerrormsg+' -Your Name\n';
	  myerror=1;
   }
   if (trim(document.frm.f_email.value==''))
   {
      myerrormsg=myerrormsg+' -Your Email\n';
	  myerror=1;
   }
   else
   {
      if ((isValidEmail(document.frm.f_email.value))==false)
	  {
	    myerrormsg=myerrormsg+' -Your Email (a valid address)\n';
	    myerror=1;
	  }
   }
   
   if (trim(document.frm.f_telephone.value==''))
   {
      myerrormsg=myerrormsg+' -Your Telephone\n';
	  myerror=1;
   }
    if (trim(document.frm.f_enquiry.value==''))
   {
      myerrormsg=myerrormsg+' -Your Enquiry\n';
	  myerror=1;
   }
   if (myerror==1)
   {
      alert(myerrormsg);
      return false;
   }
   else
   {
      return true;
   }

}
function process_report()
{
   myerror=0;
   myerrormsg="";
   myerrormsg='Please provide the following information\n';	
   if (trim(document.frmreport.r_firstname.value==''))
   {
      myerrormsg=myerrormsg+' -Your First Name\n';
	  myerror=1;
   }   
   if (trim(document.frmreport.r_email.value==''))
   {
      myerrormsg=myerrormsg+' -Your Email\n';
	  myerror=1;
   }  
   else
   {
	   if ((isValidEmail(document.frmreport.r_email.value))==false)
	  {
	    myerrormsg=myerrormsg+' -Your Email (a valid address)\n';
	    myerror=1;
	  }
   }
      if (myerror==1)
   {
      alert(myerrormsg);
      return false;
   }
   else
   {
      return true;
   }

   
   
}

function process_callback()
{
   myerror=0;
   myerrormsg="";
   myerrormsg='Please provide the following information\n';
   
   if (trim(document.frmcallback.c_firstname.value==''))
   {
      myerrormsg=myerrormsg+' -Your First Name\n';
	  myerror=1;
   }
   if (trim(document.frmcallback.c_lastname.value==''))
   {
      myerrormsg=myerrormsg+' -Your Last Name\n';
	  myerror=1;
   }
      if (trim(document.frmcallback.c_telephone.value==''))
   {
      myerrormsg=myerrormsg+' -Your Telephone\n';
	  myerror=1;
   }
   if (document.frmcallback.f_howdid[0].selected)
   {
      myerrormsg=myerrormsg+' -How did you hear about us?\n';
	  myerror=1;
   }
   if (myerror==1)
   {
      alert(myerrormsg);
      return false;
   }
   else
   {
      return true;
   }
}


function process_frmlogin()
{
   myerror=0;
   myerrormsg="";
   myerrormsg='Please provide the following information\n';
   
   if (trim(document.frmlogin.l_username.value==''))
   {
      myerrormsg=myerrormsg+' -Your Username\n';
	  myerror=1;
   }
   if (trim(document.frmlogin.l_password.value==''))
   {
      myerrormsg=myerrormsg+' -Your Password\n';
	  myerror=1;
   }
   if (myerror==1)
   {
      alert(myerrormsg);
      return false;
   }
   else
   {
      return true;
   }
}
function process_frmlogin2()
{
   myerror=0;
   myerrormsg="";
   myerrormsg='Please provide the following information\n';
   
   if (trim(document.frmlogin2.l_username.value==''))
   {
      myerrormsg=myerrormsg+' -Your Username\n';
	  myerror=1;
   }
   if (trim(document.frmlogin2.l_password.value==''))
   {
      myerrormsg=myerrormsg+' -Your Password\n';
	  myerror=1;
   }
   if (myerror==1)
   {
      alert(myerrormsg);
      return false;
   }
   else
   {
      return true;
   }
}
function process_sendpwd()
{
	myerror=0;
    myerrormsg="";
    myerrormsg='Please provide the following information\n';
	if (trim(document.frmpwd.f_email.value==''))
	{
      myerrormsg=myerrormsg+' -Your email for the password reminder\n';
	  myerror=1;
    }
	else
    {
       if ((isValidEmail(document.frmpwd.f_email.value))==false)
	   {
	     myerrormsg=myerrormsg+' -Your Email for the password reminder (a valid address)\n';
	     myerror=1;
	   }
    }
    if (myerror==1)
    {
      alert(myerrormsg);
      return false;
    }
    else
    {
      return true;
    }	
}

function showsub(n)
{
   if (n==0) 
   {
      document.getElementById('topsubmenu').innerHTML='';
   }
   if (n==1) 
   {
      document.getElementById('topsubmenu').innerHTML='&raquo;&nbsp;<a href="/File/about_us.asp">About us</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/meet_the_team.asp">Meet The Team</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/callback.asp">Request a Call</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/contact.asp">Send Us An Email</a>';
   }
   if (n==2) 
   {
      document.getElementById('topsubmenu').innerHTML='&raquo;&nbsp;<a href="/File/faqs.asp#main1">Services</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/faqs.asp#main2">Prices</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/faqs.asp#main3">Call Handling</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/faqs.asp#main4">Free Trial</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/faqs.asp#main5">Operations</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/faqs.asp#main6">About Us</a>&nbsp;&nbsp;&nbsp;';
   }
   if (n==3) 
   {
      document.getElementById('topsubmenu').innerHTML='&raquo;&nbsp;<a href="/File/free_trial_info.asp">Free Trial Info</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/free_trial.asp">Free Trial</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/signup.asp">Sign Up</a>';
   }
   if (n==4) 
   {
      document.getElementById('topsubmenu').innerHTML='&raquo;&nbsp;<a href="/File/callback.asp">Request a Call</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/contact.asp">Send Us An Email</a>&nbsp;&nbsp;&nbsp;&raquo;&nbsp;<a href="/File/askquestion.asp">Ask a Question</a>';
   }
	   
}


function process_contact()
{
   myerror=0;
   myerrormsg="";
   myerrormsg='Please provide the following information\n';
   
   if (trim(document.frmcontact.f_firstname.value==''))
   {
      myerrormsg=myerrormsg+' -Your First Name\n';
	  myerror=1;
   }
   if (trim(document.frmcontact.f_lastname.value==''))
   {
      myerrormsg=myerrormsg+' -Your Last Name\n';
	  myerror=1;
   }
   if (trim(document.frmcontact.f_email.value==''))
   {
      myerrormsg=myerrormsg+' -Your Email\n';
	  myerror=1;
   }  
   else
   {
	   if ((isValidEmail(document.frmcontact.f_email.value))==false)
	  {
	    myerrormsg=myerrormsg+' -Your Email (a valid address)\n';
	    myerror=1;
	  }
   }
      if (trim(document.frmcontact.f_enquiry.value==''))
   {
      myerrormsg=myerrormsg+' -Your Enquiry\n';
	  myerror=1;
   }
   if (document.frmcontact.f_howdid[0].selected)
   {
	  myerrormsg=myerrormsg+' -Tell us how you heard of us\n';
	  myerror=1; 
   }
   if (myerror==1)
   {
      alert(myerrormsg);
      return false;
   }
   else
   {
      return true;
   }
}
function process_trial()
{
   myerror=0;
   myerrormsg="";
   myerrormsg='Please provide the following information\n';
   
   if (trim(document.frmtrial.f_firstname.value==''))
   {
      myerrormsg=myerrormsg+' -Your First Name\n';
	  myerror=1;
   }
   if (trim(document.frmtrial.f_lastname.value==''))
   {
      myerrormsg=myerrormsg+' -Your Last Name\n';
	  myerror=1;
   }
   if (trim(document.frmtrial.f_email.value==''))
   {
      myerrormsg=myerrormsg+' -Your Email\n';
	  myerror=1;
   }  
   if (trim(document.frmtrial.f_telephone1.value==''))
   {
      myerrormsg=myerrormsg+' -Your Telephone\n';
	  myerror=1;
   }  
   if (document.frmtrial.f_howdid[0].selected)
   {
	  myerrormsg=myerrormsg+' -Tell us how you heard of us\n';
	  myerror=1; 
   }
   if (document.frmtrial.f_howdid[7].selected)
   {
	  if (trim(document.frmtrial.f_howdidother.value==''))
      {
         myerrormsg=myerrormsg+' -Tell us how you heard of us\n';
  	     myerror=1;
      }  
   }
   
   else
   {
	   if ((isValidEmail(document.frmtrial.f_email.value))==false)
	  {
	    myerrormsg=myerrormsg+' -Your Email (a valid address)\n';
	    myerror=1;
	  }
   }
   if (myerror==1)
   {
      alert(myerrormsg);
      return false;
   }
   else
   {
      return true;
   }
}

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_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_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];}
}
function process_info_request ()
{
   myerror=0;
   myerrormsg="";
   myerrormsg='Please provide the following information\n';	
   if (trim(document.frmpack.f_firstname.value==''))
   {
      myerrormsg=myerrormsg+' -Your First Name\n';
	  myerror=1;
   }   
   if (trim(document.frmpack.f_lastname.value==''))
   {
      myerrormsg=myerrormsg+' -Your Last Name\n';
	  myerror=1;
   } 
   if (trim(document.frmpack.f_email.value==''))
   {
      myerrormsg=myerrormsg+' -Your Email\n';
	  myerror=1;
   }  
   else
   {
	   if ((isValidEmail(document.frmpack.f_email.value))==false)
	  {
	    myerrormsg=myerrormsg+' -Your Email (a valid address)\n';
	    myerror=1;
	  }
   }
   if (trim(document.frmpack.f_telephone.value==''))
   {
      myerrormsg=myerrormsg+' -Your Telephone\n';
	  myerror=1;
   } 
   if (document.frmpack.chkpost.checked)
   {
      if (trim(document.frmpack.f_address.value==''))
      {
         myerrormsg=myerrormsg+' -Your Address (you requested a copy by post)\n';
	     myerror=1;
      } 
   }
   if (document.frmpack.f_howdid[0].selected)
   {
	  myerrormsg=myerrormsg+' -Tell us how you heard of us\n';
	  myerror=1; 
   }
   if (document.frmpack.f_howdid[7].selected)
   {
	  if (trim(document.frmpack.f_howdidother.value==''))
      {
         myerrormsg=myerrormsg+' -Tell us how you heard of us\n';
  	     myerror=1;
      }  
   }
   
      if (myerror==1)
   {
      alert(myerrormsg);
      return false;
   }
}