function validateaa(formObj) {
	var t ="";
	t += checkEmpty(formObj.conum);
	t += checkEmpty(formObj.coname);
	t += checkEmpty(formObj.bldg);
	t += checkEmpty(formObj.street);
	t += checkEmpty(formObj.city);
	t += checkEmpty(formObj.county);
	t += checkEmpty(formObj.zip);
	t += checkEmpty(formObj.tele);

	if (formObj.ctry.value=="")
	{
		t += "Country Name is required.\r";
	}
	t += checkEmpty(formObj.concerned);
	t += checkEmpty(formObj.fromcompany);
	t += checkEmpty(formObj.contactemail);
	t += checkEmpty(formObj.contactphone);

	if (t=="")
	{
		return true;
	}
	alert("ERROR: These fields are empty or not valid: \r\r" + t);
	return false;
}

function checkEmpty(obj, name) {
	value = "";
	if (obj!=null) {
		if (obj.valid=="true") {
			if (obj.value=="")
			{
				value = (obj.title != "") ? obj.title + " is required." : name + " is required.";
				value += "\r";
			}
		}
	}
	return value;
}

function setCountryCurrency(code)
{
	if (document.forms[0].curr != null) {
		if (code =="GB") {
			document.forms[0].curr.selectedIndex = 1;
		} else if (code =="IN") {
			document.forms[0].curr.selectedIndex = 2;				
		} else {
			document.forms[0].curr.selectedIndex = 3;
		}
	}
}


function onlyAlpha(src)
{
	var regex = /^[a-z A-Z]+$/;
    return regex.test(src);
}

function onlyInteger(src)
{
	var regex = /^[0-9]+$/;
    return regex.test(src);
}
function onlyFloat(src)
{
	var regex = /^[0-9.]+$/;
    return regex.test(src);
}
function onlyNumber(src)
{
	var regex = /^[0-9.]+$/;
    return regex.test(src);
}



//validate email address
function checkEmailAddress(src)
{
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,5}$/;
    return regex.test(src);
}
function checkWEBSITE(src)
{
	var regex = /^[a-zA-Z0-9._-]+([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,5}$/;
    return regex.test(src);
}

function validate()
{ 
	alert('dd');
	conum=offline.conum;
	coname=offline.coname;
	bldg=offline.bldg;
	street=offline.street;
	city=offline.city;
	county=offline.county;
	zip=offline.zip;
	tele=offline.tele;
	ctry=offline.ctry;
	ref=offline.ref;
	attn=offline.attn;
	credit=offline.credit;
	amount=offline.amount;
	bankers=offline.bankers;
	remarks=offline.remarks;
	servtype=offline.servtype;
	fromcompany=offline.fromcompany;
	concerned=offline.concerned;
	contactemail=offline.contactemail;
	contactphone=offline.contactphone;


     if(coname.value=='')
		{
			alert('Please Enter Company name');
			coname.focus();
			coname.select();
			return false;
		}
     if(bldg.value=='')
		{
			alert('Please Enter Building');
			bldg.focus();
			bldg.select();
			return false;
		}
	
     if(city.value=='')
		{
			alert('Please Enter City ');
			city.focus();
			city.select();
			return false;
		}
	
	if(zip.value!='')
	{		
     
		if(!onlyInteger(zip.value))
		{
			alert('Invalid Zip Code');
			zip.focus();
			zip.select();
			return false;
		}
	}
	if(tele.value!='')
	{		
     
		if(!onlyInteger(tele.value))
		{
			alert('Invalid Telephone No');
			tele.focus();
			tele.select();
			return false;
		}
	}
	
		if(ctry.selectedIndex==0)
		{
			alert('Please Select Country');
			ctry.focus();
			ctry.select();
			return false;
		}
		if(fromcompany.value=='')
		{
			alert('Please Enter  Company Name');
			fromcompany.focus();
			fromcompany.select();
			return false;
		}
		if(concerned.value=='')
		{
			alert('Please Enter  Concerned Person  Name');
			concerned.focus();
			concerned.select();
			return false;
		}
		if(contactemail.value=='')
		{
			alert('Please Enter  Email');
			contactemail.focus();
			contactemail.select();
			return false;
		}
		if(!checkEmailAddress(contactemail.value))
		{
			alert('Invalid Email Address.');
			contactemail.focus();
			contactemail.select();
			return false;
		}
		if(contactphone.value!='')
	{		alert('Please Enter Telephone No');
			contactphone.focus();
			contactphone.select();
			return false;
	}
     
		if(!onlyInteger(contactphone.value))
		{
			alert('Invalid Telephone No');
			contactphone.focus();
			contactphone.select();
			return false;
		}
	
	

}