// JavaScript Document

//trim function 
function trimAll(sString) 
{
	
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
//alert(sString.length);

return sString;
}  

function valform()
{
  // window.categorytype = document.form1.category;    
        
        
 //       if(categorytype.options[categorytype.selectedIndex].text == 'Select Category' ) 
//        {
//         alert("Please select a category for your question");
//             return false;
//        }
       if (trimAll(document.form1.name.value).length == 0)
        {
          alert("Please enter your name"); 
           return false;  document.form1.name.setfocus();
				  
        } 
		else if (trimAll(document.form1.company.value).length == 0)
        {
          alert("Please enter your Company Name"); 
           //  document.form1.company.setfocus();
				  return false;
        } 
		else if (trimAll(document.form1.country.value).length == 0)
        {
          alert("Please enter your Country location"); 
            // document.form1.country.setfocus();
				  return false;
        } 
		else if (trimAll(document.form1.email1.value).length == 0)
        {
          alert("Please enter your email address"); 
            // document.form1.country.setfocus();
				  return false;
        } 
		else if (trimAll(document.form1.email2.value).length == 0)
        {
          alert("Please enter a value for the 'Confirm Email' field "); 
            // document.form1.country.setfocus();
				  return false;
        } 
		else if ((document.form1.email1.value) != (document.form1.email2.value))
        {
          alert("The two email addresses do not match, please verify! "); 
            // document.form1.country.setfocus();
				  return false;
        } 
		else if (trimAll(document.form1.telephone.value).length == 0)
        {
          alert("Please enter your Telephone number"); 
            // document.form1.country.setfocus();
				  return false;
        } 
		else if (trimAll(document.form1.nospam.value).length == 0)
        {
          alert("Please enter the No Spam verification text!"); 
            // document.form1.country.setfocus();
				  return false;
        } 
		else if (document.form1.nospam.value != "aalto08")
        {
          alert("The No Spam verification text is incorrect, please verify!"); 
            // document.form1.country.setfocus();
				  return false;
        } 
}
