// JavaScript Document

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

function isValidEmail(field,alerttxt){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  with (field) {
   // search email text for regular exp matches
    if (value.search(validRegExp) == -1) 
   {
      alert(alerttxt);
      return false;
    } 
   else { return true }
  }
}

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

function validate_form(thisform)
{
with (thisform)
{
	if (validate_required(Name,"Your name must be filled out!")==false)
	  {Name.focus();return false;}
	if (validate_required(Company,"Company name must be filled out!")==false)
	  {Company.focus();return false;}
	if (validate_required(Country,"Country must be selected!")==false)
	  {Country.focus();return false;}
	if (validate_required(Telephone,"Telephone must be filled out!")==false)
	  {Telephone.focus();return false;}
	if (isValidEmail(_1_MailFrom,"A valid e-mail address is required.\nPlease amend and retry")==false)
	  {_1_MailFrom.focus();return false;}
	
	//platforms
	if ( ( document.productForm.p1.checked == true )
	&& ( document.productForm.p1v.value == '' ) )
    {
        alert ( "The version of AIX must be filled out!" );
		p1v.focus();
        return false;
    }
	if ( ( document.productForm.p2.checked == true )
	&& ( document.productForm.p2v.value == '' ) )
    {
        alert ( "The version of HP-UX must be filled out!" );
		p2v.focus();
        return false;
    }
	if ( ( document.productForm.p3.checked == true )
	&& ( document.productForm.p3v.value == '' ) )
    {
        alert ( "The version of LDAP must be filled out!" );
		p3v.focus();
        return false;
    }
	if ( ( document.productForm.p4.checked == true )
	&& ( document.productForm.p4v.value == '' ) )
    {
        alert ( "The version of Linux must be filled out!" );
		p4v.focus();
        return false;
    }
	if ( ( document.productForm.p5.checked == true )
	&& ( document.productForm.p5v.value == '' ) )
    {
        alert ( "The version of Open VMS must be filled out!" );
		p5v.focus();
        return false;
    }
	if ( ( document.productForm.p6.checked == true )
	&& ( document.productForm.p6v.value == '' ) )
    {
        alert ( "The version of OS/390 must be filled out!" );
		p6v.focus();
        return false;
    }
	if ( ( document.productForm.p7.checked == true )
	&& ( document.productForm.p7v.value == '' ) )
    {
        alert ( "The version of OS/400 must be filled out!" );
		p7v.focus();
        return false;
    }
	if ( ( document.productForm.p8.checked == true )
	&& ( document.productForm.p8v.value == '' ) )
    {
        alert ( "The version of SunSolaris must be filled out!" );
		p8v.focus();
        return false;
    }
	if ( ( document.productForm.p9.checked == true )
	&& ( document.productForm.p9v.value == '' ) )
    {
        alert ( "The version of Windows must be filled out!" );
		p9v.focus();
        return false;
    }
	
	
	//aplications
	
	if ( ( document.productForm.a1.checked == true )
	&& ( document.productForm.a1v.value == '' ) )
    {
        alert ( "The version of Lotus Notes/Domino must be filled out!" );
		a1v.focus();
        return false;
    }
	if ( ( document.productForm.a2.checked == true )
	&& ( document.productForm.a2v.value == '' ) )
    {
        alert ( "The version of MS Exchange must be filled out!" );
		a2v.focus();
        return false;
    }
	if ( ( document.productForm.a3.checked == true )
	&& ( document.productForm.a3v.value == '' ) )
    {
        alert ( "The version of Novell eDirectory must be filled out!" );
		a3v.focus();
        return false;
    }
	if ( ( document.productForm.a4.checked == true )
	&& ( document.productForm.a4v.value == '' ) )
    {
        alert ( "The version of Oracle must be filled out!" );
		a4v.focus();
        return false;
    }
	if ( ( document.productForm.a5.checked == true )
	&& ( document.productForm.a5v.value == '' ) )
    {
        alert ( "The version of SAP/S3 must be filled out!" );
		a5v.focus();
        return false;
    }
	if ( ( document.productForm.a6.checked == true )
	&& ( document.productForm.a6v.value == '' ) )
    {
        alert ( "The version of SQL Server must be filled out!" );
		a6v.focus();
        return false;
    }
	
	//products
	
	
	if ( ( document.productForm.pr1.checked == false )
	&& ( document.productForm.pr2.checked == false )
    && ( document.productForm.pr3.checked == false ) )
    {
        alert ( "One of the licence request must be selected!" );
		pr1.focus();
        return false;
    }
	
	if (validate_required(Number_of_Users,"Approx number of users must be filled out!")==false)
	  {Number_of_Users.focus();return false;}
	if (validate_required(security_code,"Security code must be filled out!")==false)
	  {security_code.focus();return false;}
}
}