 function check(form)
{

var invalid6=new Array("!","@","#","$","%","^","&","*","(",")","+","=","'",'"',"`","?","/","|",".","{","}","[","]",";",":","~","<",">","0","1","2","3","4","5","6","7","8","9");
var invalidchar1= /\D/g;
var invalid5=new Array("!","@","#","$","%","^","&","*","=","'",'"',"`","?","|",".","{","}",";",":","~","<",">",",","q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","Q","W","E","R","T","Y","U","I","O","P","A","S","D","F","G","H","J","K","L","Z","X","C","V","B","N","M" );


//to check the name is not blank

var str56= document.form.name.value;

var len1=str56.length;
if (str56.substring(0,1)==" ")
 {
 alert("First character can't be a space");
  document.form.name.value="";
  document.form.name.focus();    
 return false;// used to check empty field name
 }
if(len1==0)
{
	
	alert("Please enter Your  Name");
	 document.form.name.focus();
	return false;
}

// to check the company name is not blank


str57= document.form.company.value;
var len2=str57.length;

if (str57.substring(0,1)==" ")
 {
 alert("First character can't be a space");
  document.form.company.value="";
  document.form.company.focus();    
 return false;
 }
if(len2==0)
{
	
	alert("Please enter the Company  Name");
	 document.form.company.focus();
	return ;
}

// to check the address is not blank

str58= document.form.address.value ; 
len3=str58.length;
if (str58.substring(0,1)==" ")
 {
 alert("First character can't be a space");
  document.form.address.value="";
  document.form.address.focus();    
 return false;
 }
if(len3==0)
{
	
	alert("Please enter the Address");
	 document.form.address.focus();
	return ;
}

// to check the city 

str59= document.form.city.value;
len4=str59.length;
if (str59.substring(0,1)==" ")
 {
 alert("First character can't be a space");
  document.form.city.value="";
  document.form.city.focus();    
 return false;// used to check empty field name
 }
 
if(len4==0)
{
	
	alert("Please enter city name");
	 document.form.city.focus();
	return false;
}

 if(len4!=0)
	{
	for(var i=0;i<=len4;i++)
	{	chr=str59.charAt(i);
		for(var j=0;j<38;j++)
		{
			if(invalid6[j]==chr)
			{
				alert("You have entered invalid characters");
				 document.form.city.value="";
				 document.form.city.focus();
				return false ;
			}//end of if	
		}//end of inner for		
	}//end of outer for
	
   }//end of outer if
   
 
 
 
//to check phone number

var str61=document.form.phone.value;
var len8=str61.length;
flag=true;
if (str61.substring(0,1)==" ")
 {
 alert("First character can't be a space");
  document.form.phone.value="";
  document.form.phone.focus();    
 return false;// used to check empty field name
 }
 if(len8 != 0)
{
	for(var i=0;i<=len8;i++)
	{
		chr=str61.charAt(i);
		for(var j=0;j<76;j++)
		{	
			if(invalid5[j]==chr)
			{
				alert("You have entered invalid characters");
				 document.form.phone.value="";
				 document.form.phone.focus();
				return ;
				
			}//end of if	
		}//end of inner for		
	}//end of outer for	
}//end of outer if


// to check fax 
var str62=document.form.fax.value;
var len9=str62.length;

if (str62.substring(0,1)==" ")
 {
 alert("First character can't be a space");
  document.form.fax.value="";
  document.form.fax.focus();    
 return false;// used to check empty field name
 }

	if(len9!=0)
	{
	for(var i=0;i<=len9;i++)
	{
		chr=str62.charAt(i);
		for(var j=0;j<76;j++)
		{	
			if(invalid5[j]==chr)
			{
				alert("You have entered invalid characters");
				 document.form.fax.value="";
				 document.form.fax.focus();
				return  ;
				
			}//end of if	
		}//end of inner for		
	}//end of outer for
	
}//end of outer if



// to check email address

str70=document.form.email.value;
len7=str70.length;
flag=true;
if (str70.substring(0,1)==" ")
 {
 alert("First character can't be a space");
 document.form.email.value="";
 document.form.email.focus();    
 return false;// used to check empty field name
 }

if(len7==0 && flag)
{
	alert("Please enter your E-Mail Address");
	document.form.email.focus();
	
	flag=false;
	return false;
}
else
{
	if((str70.indexOf("@",0)<=0) || (str70.indexOf(".",0)<=0))
	{
		alert(str70+"  is not a valid E-Mail Id");
		document.form.email.value="";
		document.form.email.focus();	 	
		return false;
	}//end of if
}//end of else	



// to check the desc is not blank


str77= document.form.profile.value;
var len15=str77.length;

if (str77.substring(0,1)==" ")
 {
 alert("First character can't be a space");
  document.form.profile.value="";
  document.form.profile.focus();    
 return false;
 }
if(len15==0)
{
	
	alert("Please enter the details of surplus stock for sale");
	 document.form.profile.focus();
	return ;
}

document.form.method="post";
document.form.action="../online-trading/surplus-stock-form.asp?insert=true";
document.form.submit();
}

