function ValidateInquiry()
{
	if(document.myform.company.value == "")
	{
		alert("Enter valid Company Name.");
		document.myform.company.focus();
		return false;
	}
	if(document.myform.contact.value == "")
	{
		alert("Enter valid Contact Person name.");
		document.myform.contact.focus();
		return false;
	}
	
	//email check starts
	txt=document.myform.email.value;
	if(document.myform.email.value==""){
		alert("Please specify your Email.");
		document.myform.email.focus();
		return false;
	}
	if(txt.indexOf("@")<1){
		alert("Please enter valid E-mail.");
		document.myform.email.focus();
		return false;
	}	
	if( txt.indexOf('@',0)==0 || txt.indexOf('.',0)<1 || txt.indexOf(".") == ( txt.indexOf("@") + 1 ) || txt.indexOf(".") == ( txt.length - 1 ) ){
		alert("Please enter valid E-mail.")
		document.myform.email.focus();
		return false;
	}		
	if ( !ValidateNo( document.myform.email.value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_@.-" )){
		alert("Invalid Email: " + document.myform.email.value );
		regdetail.email.focus();
		return false;
	}

	if (txt.indexOf("/")>1 || txt.indexOf(",")>1){
		alert("Please enter valid E-mail.");
		document.myform.email.focus();
		return false;
	}
	cnt = 0;
	instr = txt.toString()
	for(var i=0; i<instr.length; i++){
		var char1 = instr.charAt(i)
		if (char1 == "@"){
			cnt = cnt+1;
		}
	}					
	if(cnt > 1){
		alert("Please enter valid E-mail.");
		document.myform.email.focus();
		return false;
	}
	//email check ends
	if(document.myform.country.value == "0")
	{
		alert("Select the Country you belong to.");
		document.myform.country.focus();
		return false;
	}	
	if(document.myform.cphone.value == "" )
	{
		alert("Enter valid Country code.");
		document.myform.cphone.focus();
		return false;
	}
	if(document.myform.aphone.value == "" )
	{
		alert("Enter valid area code.");
		document.myform.aphone.focus();
		return false;
	}
	if(document.myform.pphone.value == "")
	{
		alert("Enter valid Telephone Number.");
		document.myform.pphone.focus();
		return false;
	}
	
	if(document.myform.inquiry.value == "")
	{
		alert("Enter valid Inquiry.");
		document.myform.inquiry.focus();
		return false;
	}
	var sInquiry = new String();
	sInquiry = document.myform.inquiry.value ;
	if(sInquiry.length > 1000)
	{
		alert("Inquiry exceeds 1000 characters limit.");
		document.myform.inquiry.focus();
		return false;
	}
	return true;
}

function handle(e)
{
	if(e.keyCode == 27)
	{
		self.close();
	}
}

function ValidateNo(NumStr, String)
{				
	for(var Idx=0; Idx<NumStr.length; Idx++){
		var Char = NumStr.charAt(Idx);
		var Match = false;

		for(var Idx1=0; Idx1<String.length; Idx1++){
			if(Char == String.charAt (Idx1))
				 Match = true;
		}

		if (!Match) 
			return false;
	}
	return true;
}