
function  call(Objectp)
{
         Objectp.value = cutspase(Objectp.value);
 }
function   cutspase(text)
{ 
   var tam ="";
   var tami ="";
   for (var i =0; i< text.length ; i++)
    {           
  		    tami = text.charAt(i);
			if (!((text.charAt(i) ==" ")&&(text.charAt(i+1) ==" ")))
			{
			     tam = tam + tami;
			}
      }
	if (tam.charAt(0) == " ")
	{
             tam  =  tam.substr(1,(tam.length -1));
	   }
  if (tam.charAt(tam.length -1) == " ")
	 {
	       tam = tam.substr(0,(tam.length - 1));
	  }
     text= tam;
	 return  text;
}


function   uppcase(Objectt)
{ 
   var   text  =  Objectt.value;
   var tam ="";
   var tami ="";
   text  = cutspase(text);
   for (var i =0; i< text.length ; i++)
   {           
                tami = text.charAt(i).toLowerCase();
    			if  (i ==0)
				{ 
				    tami = text.charAt(0).toUpperCase()
				}
				if  (text.charAt(i -1) == " ")
				{
				     tami =  text.charAt(i).toUpperCase();
				}
				tam = tam + tami;
	}		


		
	 Objectt.value = tam;
}

function   checkform()
{    
     var checktext21 =/[^a-z\/.,(){}\\\-\]\[" "\d]/i;
     var checktext1 =/[^a-z" "@]/i;
     var checktext  = /[^a-z@&\-.,\d" "\d]/i;
	 var checktext2 =/[^a-z" "\/.,(){}\\\-\]\[]/i;
	 var checktext3 =/[^" "\d]/i;
	 var checktext4 =/[^" ".,()\/\\{}\-\]\[\d]/i;
	 var checktext5 =/[^@]/i;
	 var  text   =  document.form1.cus.value ;
	 var  text1 =  document.form1.name.value;
	 var  text9 =  document.form1.address.value;
	 var  text2 =  document.form1.city.value;
	 var  text8 =  document.form1.web.value;
     var  text5 =  document.form1.tel.value;
     var  text6 =  document.form1.fax.value;
	 var  text7 =  document.form1.email.value;
	 var  text10  = document.form1.country.value;
	 var  text12  = document.form1.Comment.value;
	  
   if(checktext.test(text))
	   {  
	         alert(" You  have entered  an invalid customer. The customer can only contain letters and number ");
			 document.form1.cus.focus();
			 return false;
    	}
	   if (checktext1.test(text1))
      {  
	         alert(" You  have entered  an invalid  fullname.  Fullname  can only contain letters"  );
			 document.form1.name.focus();
			 return false;
	  }
	if (checktext21.test(text9))
      {  
	         alert(" You  have entered  an invalid  address. Address can only contain  number ,( ,) ,{ ,} ,\\ ,\-,  ,, ,.\], and \[ ."  );
			 document.form1.address.focus();
			 return false;
	  }
  if (checktext2.test(text2))
      {  
	         alert(" You  have entered  an invalid  the city. The city can only contain letters , number ,( ,) ,{ ,} ,\\ ,\-,  ,, ,.\], and \[ ."  );
			 document.form1.city.focus();
			 return false;
	  }
	   if (checktext2.test(text3))
      {  
	         alert(" You  have entered  an invalid  the province. The province can only contain letters , number ,( ,) ,{ ,} ,\\ ,\-,  ,, ,.\], and \[ .."  );
			 document.form1.pro.focus();
			 return false;
	  }
	  if (checktext3.test(text4))
      {  
	         alert(" You  have entered  an invalid  zip. Zip can only  number."  );
			 document.form1.zip.focus();
			 return false;
	  }
	 if (checktext4.test(text5))
      {  
	         alert("You  have entered  an invalid  tel.  Tel can only contain number ,( ,) ,{ ,} ,\\ ,\-,  ,, ,.\], and \[ "  );
			 document.form1.tel.focus();
			 return false;
	  }
	if (checktext4.test(text6))
      {  
	         alert(" You  have entered  an invalid  fax.  Fax can only contain number ,( ,) ,{ ,} ,\\ ,\-,  ,, ,.\], and \[ "  );
			 document.form1.fax.focus();
			 return false;
	  }
	  if  (text7.length > 0 ) 
	  {
			   if (text7.indexOf('@',0)== -1)
			  {  
					 alert(" Input  your  @domain.com, .org,.edu....  in  cell email"  );
					 document.form1.email.focus();
					 return false;
			  } 
			  else	  
			    {
			            if (text7.indexOf('@',0) == 0)
			            {
				           	alert(" Input   your  email name   ..."+ text7  );
				        	document.form1.email.focus();
				        	return false;
			             }	   
						if ((text7.indexOf('@',0) - (text7.length - 1)) == 0)
				       {
					       	alert(" Input "+ text7+"..domain.com , org,edu. .."  );
					  		document.form1.email.focus();
							return false;
						 }	   
					   if (text7. indexOf('.',0) == -1)
				 		 {
							alert(" Input "+ text7+"     ..., .com ,org,edu. ... "  );
							document.form1.email.focus();
							return false;
						 }	  
					 if (text7. indexOf('.',0) - (text7.length -1) == 0)
				 	 {
						alert(" Input "+ text7+"     ..., com ,org,edu. ... "  );
						document.form1.email.focus();
						return false;
					 }	  
		     }
  	  }	
	   if (text8.length > 0)
	   {
	   		if (text8.indexOf('.') == -1)
      		{  
	        	alert(" Input  " + text8 +"..domain.com,.org,.edu..ete   in cell  URL "  );
			 	document.form1.web.focus();
			    return false;
	         }
			 if (text8.indexOf('.') - (text8.length -1)   == 0)
      		{  
	        	alert(" Input  " + text8 +" domain.com  or .com,.org,.edu...     in cell  URL "  );
			 	document.form1.web.focus();
			    return false;
	         }
			  if (text8.indexOf('.')  == 0)
      		{  
	        	alert(" Input  www   or   www.domain " + text8 +"     in cell  URL "  );
			 	document.form1.web.focus();
			    return false;
			  			    
	         }
	  }	 
	if (text1.length == 0)
	{
	     alert ( " The   fullname  you entered was empty  ");
		 document.form1.name.focus();
		 return   false;
		   
   	}  
   if (text9.length == 0)
   {
         alert("  The   address  you entered was empty ");
		 document.form1.address.focus();
		 return  false;
   }   
   if  ((text2.length  == 0)&&(text3.length == 0))
   {
        alert("   The   city  or  the province   you entered was empty ");
		document .form1.city.focus();
		return  false;
   }
  }
  