function checking(theform)
{
var reason="";
reason += req(theform.req);
reason += org(theform.organization);
reason += nam(theform.username);
reason += yma(theform.ymail);
reason += cno(theform.cno);
reason += fax(theform.fax);
reason += add(theform.streetad);
reason += city(theform.cityad);
reason += pcode(theform.postcode);
//reason += nation(theform.nation);


	if (reason != "")
	{
	alert("Some fields need correction:\n" + reason);
	return false;
	}
	 return true;
}

// function to check required field
function req(txt)
{
var err="";
	if(txt.value.length < 3)
	{
	err="Please describe your requirement in more than 3 characters. \n";
	}
	return err;
}

// function to check organisation field
function org(txt)
{
var err="";
	if(txt.value.length < 3)
	{
	err="Organisation should be more than 3 characters. \n";
	}
	return err;
}

// function to check name field
function nam(txt)
{
var err="";

	if(txt.value.length < 3)
	{
	err="Name should be more than 3 characters. \n";
	}
	
	else if(/[^a-zA-Z\s]/.test(txt.value)) 
	{
        	        	err = "Name should only contain alphabets.\n";
    	}
	return err;
}

// function to check email field
function yma(txt)
{
var err="";
	if(txt.value.length == 0)
	{
	err="Email should not be empty. \n";
	}
	
	else if(!/^(\w+[\-\.])*\w+@(\w+\.)+[A-Za-z]{2,5}$/.test(txt.value)) 
	{
        	        	err = "Email should contain @ and '.' .\n";
    	}
	return err;
}

// function to phone field
function cno(txt)
{
var err="";
	if(txt.value.length == 0)
	{
	err="Phone No should not be empty. \n";
	}

	else if(!/^[\+\d*]*[\.\-\(\) \d]*\d*$/.test(txt.value)) 
	{
        	        	err = "Phone No can only contain 0-9 and + - () or space.\n";
    	}
	return err;
}

// function to check fax field
function fax(txt)
{
var err="";
	if(txt.value.length == 0)
	{
	err="Fax No should not be empty. \n";
	}

	else if(!/^[\+\d*]*[\.\-\(\) \d]*\d*$/.test(txt.value)) 
	{
        	        	err = "Fax No can only contain 0-9 and + - () or space.\n";
    	}

	return err;
}

// function to check address field
function add(txt)
{
var err="";
	if(txt.value.length < 3)
	{
	err="Address should be more than 3 characters. \n";
	}

else if(!/^(\w+[\d])*[\/\-\,\.\(\) \d\w]*\d*\w*$/.test(txt.value)) 
	{
        	        	err = "Address can only contain a-z, 0-9, -, (), / or space.\n";
    	}
	return err;
}

// function to check city field
function city(txt)
{
var err="";
	if(txt.value.length < 3)
	{
	err="City should be more than 3 characters. \n";
	}

	else if( /[^a-zA-Z\s]/.test(txt.value)) 
	{
        	        	err = "City should only contain alphabets.\n";
    	}
	return err;
	return err;
}

// function to check postcode field
function pcode(txt)
{
var err="";
	if(txt.value.length == 0)
	{
	err="Pincode should not be empty. \n";
	}
else if(!/^(\w+[\d])*[\-\ \d\w]*\d*\w*$/.test(txt.value)) 
	{
        	        	err = "Pincode can only contain a-z, 0-9,- or space.\n";
    	}
	return err;
}

// function to check country field
/*function nation(txt)
{
var err="";
	if(txt.value.length < 2)
	{
	err="Country should be more than 2 characters. \n";
	}

	else if( /[^a-zA-Z]/.test(txt.value)) 
	{
        	        	err = "Country should only contain alphabets.\n";
    	}
	return err;
}*/