function ValidateEmail(Obj) {

var EmailID=Obj.value;
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if(reg.test(EmailID) == false) {
alert('Enter an Valid Email Address');
Obj.value="";
Obj.focus();
return false;
}
return true;
}

function isUrl(s) {
	var URL=s.value;
 	var regexp = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/;
	if(regexp.test(URL) == false) {
 	alert('Enter an Valid URL (http://www.sitename.com)');
	Obj.value="";
	Obj.focus();
	return false;
}
return true;
}

function Name (strng) {
if (strng == "")
{
alert("Please enter Your Name\n");
return false;
}

return true;
}

function Phone (strng) {
if (strng == "")
{
alert("Please enter the Telephone Number\n");
return false;
}
var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]a-zA-Z]/; // allow letters, numbers, and underscores space
if (illegalChars.test(strng))
{
alert("Phone field contains illegal characters\n");
return false;
}
return true;
}

function CompanyName (strng) {
if (strng == "")
{
alert("Please Enter The Company Name\n");
return false;
}

return true;
}



function Comments (strng) {
if (strng == "")
{
alert("Please enter the Comments\n");
return false;
}

return true;
}


function ValidateContactForm(){


if(!Name(document.getElementById('contactname').value))
{
document.getElementById('contactname').focus();
return false;
}
if(!CompanyName(document.getElementById('cmpname')))
{
document.getElementById('cmpname').focus();
return false;
}

if(!ValidateEmail(document.getElementById('contactemail')))
{
document.getElementById('contactemail').focus();
return false;
}

if(!Phone(document.getElementById('contactphone').value))
{
document.getElementById('contactphone').focus();
return false;
}

if(!Comments(document.getElementById('addinfo').value))
{
document.getElementById('addinfo').focus();
return false;
}


document.contact_form.submit();
alert('Thanks For Your Submission! We Will get back to you Shortly');	
/*var url="show.php?uname="+document.getElementById('uname').value+"&email="+document.getElementById('email').value;
window.open(url,"Window1",
"menubar=no,width=430,height=360,toolbar=no");*/
return true;
	
}

