String.prototype.trim = function() {
  return this.replace(/^\s*/,"").replace(/\s*$/,"")
}

function GetChecked(oName)
{
  obj=document.getElementsByName(oName).item(0).checked;
  return obj;
}


function getValue(oName)
{
  obj=document.getElementsByName(oName).item(0);
  temps=new String();
  temps=obj.value;
  temps=temps.trim().replace(/>/g,'&gt;').replace(/</g,'&lt;');
  if(obj.value!=temps)obj.value=temps;
  return temps;
}

function CheckEmail(str){
  var filter=/^([\w\-]+(\.[\w\-]+)*)@(([\w\-]+\.)*\w[\w\-]{0,66})\.([a-z]{2,6}(\.[a-z]{2})?)$/i;
  var testresults=true;
  if (filter.test(str))
    testresults=true;
    else{
      testresults=false;
    }
  return (testresults);
}

function CheckContact()
{
  s="";
  if ((GetChecked('interest1')=="")&&(GetChecked('interest2')=="")&&(GetChecked('interest3')=="")&&(GetChecked('interest4')==""))s+='\nPlease select Area of Interest';
  if (getValue('firstname')=="")s+='\nPlease enter First name';
  if (getValue('lastname')=="")s+='\nPlease enter Last name';
  if (getValue('address1')=="")s+='\nPlease enter Address 1';
  if (getValue('city')=="")s+='\nPlease enter City';
  if (getValue('state')=="")s+='\nPlease enter State/Province';
  if (getValue('zip')=="")s+='\nPlease enter Zip Code';
  if (getValue('phone')=="")s+='\nPlease enter Telephone';

  if(s=='')
  {
    alert ('Thank you');
    return true;
  }
  else
  {
    alert(s);
    return false;
  }
}

function CheckQuote()
{
 s="";
 
 if (getValue('name')=="")s+='\nPlease enter Name of Company';
 if (getValue('address')=="")s+='\nPlease enter Address';
 if (getValue('state')=="")s+='\nPlease enter State';
 if (getValue('zip')=="")s+='\nPlease enter Zip';
 if (getValue('country')=="")s+='\nPlease enter Country';
 
 if (getValue('contact')=="")s+='\nPlease enter Contact';
 if (getValue('title')=="")s+='\nPlease enter Title';
 if (getValue('phone')=="")s+='\nPlease enter Phone';
 if (getValue('fax')=="")s+='\nPlease enter Fax';
 if (!CheckEmail(getValue('email')))s+='\nEmail is invalid';
 if (getValue('description')=="")s+='\nPlease enter Project Description';
 if (getValue('number')=="")s+='\nPlease enter Number of Records/Images';
 if (getValue('length')=="")s+='\nPlease enter Length of Project';
 if (getValue('pstart')=="")s+='\nPlease enter Start Date of Project';
 if (getValue('pdue')=="")s+='\nPlease enter RFP Due Date';

  if(s=='')
  {
    alert ('Thank you');
    return true;
  }
  else
  {
    alert(s);
    return false;
  }
}