// JavaScript Document
function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}

function validate_email(field,alerttxt)
{
//alert('ME CALLED');
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
  }
}


function validate_form(thisform)
{

with (thisform)
  {
  /*  */ 
  if (validate_required(fName,"Full Name must be filled out!")==false)
  {fName.focus();return false;}
  
  if (validate_required(company,"Company must be filled out!")==false)
  {company.focus();return false;}
  
  if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false;}

  if (validate_required(security_code,"Security code must be filled out!")==false)
  {security_code.focus();return false;}
 
  }
}
//Ecame form_c - validation

function validate_form_c(thisform)
{

with (thisform)
  {
  /*  */ 
  if (validate_required(fName,"Full Name must be filled out!")==false)
  {fName.focus();return false;}
 
  if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false;}

  if (validate_required(security_code,"Security code must be filled out!")==false)
  {security_code.focus();return false;}
 
  }
}


// Call Bsck Validation --

function validate_required_callback(field,alerttxt)
{
with (field)
  {
  if (value==null||value==""||value==defaultValue)
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}

function validate_callback_form(thisform)
{

with (thisform)
  {
  /*  */ 
  if (validate_required_callback(fName,"Full Name must be filled out!")==false)
  {fName.focus();return false;}
  
  if (validate_required_callback(company,"Company must be filled out!")==false)
  {company.focus();return false;}
  
  if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false;}
 
 if(phone.value==phone.defaultValue){
		//alert('You know i am still phone');
		phone.value = "";
 }
 
  }
}

function clearMe(formfield){
  if (formfield.defaultValue==formfield.value){
   formfield.value = "";
  // document.getElementById('w_comment').style.visibility = "visible";
   
   }
 }
 
 function onBlurCalled(formfield){
	 if (formfield.value==""){
		 //alert("in If");
   		formfield.value = formfield.defaultValue;
		//document.getElementById('w_comment').style.visibility = "hidden";
		}else{
			//alert(formfield.value);
			}
	 }

