function ValidateEMail(name)
{
if (name=="")
{
alert("E-Mail should not be Empty.");
return false;
}
var badchars="<> ;,'!#$%^&*()+=/\\?";
for (var i=0; i < name.length; i++)
{
temp = "" +name.substring(i, i+1);
if (badchars.indexOf(temp) != -1)
{
alert("Sorry! Bad-characters are not allowed.Try again..");
return false;
}

}

var arr;

arr = name.split('@');

// check for 1 and only 1 @ sign
if (arr.length != 2)
{
alert("E-mail should contain only one @.");
return false;
}
// check for blank before or after @
if ((arr[0] == "") || (arr[1] == ""))
{
alert("sorry! something missing.Try again");
return false;
}
// check for dot at first or last position
if ((arr[1].charAt(0) == '.') ||
(arr[1].charAt(arr[1].length-1) == '.'))
{
alert("E-mail should be in proper format.Try again");
return false;
}
if ((arr[0].charAt(0) == '.') ||
(arr[0].charAt(arr[0].length-1) == '.'))
{
alert("E-mail should be in proper format. Try again.");
return false;
}
// check to make sure top level domain > 1 char
if ((arr[1].indexOf('.') > arr[1].length-3) || (arr[1].indexOf('.') == -1))
{
alert("E-mail should contain Top level Domain.");
return false;
}
// check for ..
if (name.indexOf("..") > 0)
{
alert("E-mail should more than one . .");
return false;
}
// check for valid top level domain or a 2 letter country code
var tld;
tld = arr[1].substring(arr[1].lastIndexOf('.'));

if ((tld.length != 3) &&
(tld != '.com') && (tld != '.edu') && (tld != '.gov') && (tld != '.int') && (tld != '.mil') && (tld != '.org') && (tld != '.net') && (tld !='.arpa') &&
(tld != '.COM') && (tld != '.EDU') && (tld != '.GOV') && (tld != '.INT') && (tld != '.MIL') && (tld != '.ORG') && (tld != '.NET') && (tld !='.ARPA'))
{
alert("E-mail should valid top level Domain.");

return false;
}
return true;
}



function ValidateName(name)
{
var badchars="0123456789/<>;:@#$%^&*()";
for (var i=0; i < name.length; i++)
{
temp = "" +name.substring(i, i+1);

if (badchars.indexOf(temp) != -1)
{
alert("Bad-characters not allowed in name");
return false;
}
}
 }

function ValidateNumber(name)
{
var badchars="/<>;:@#$%^&*";
for (var i=0; i < name.length; i++)
{
temp = "" +name.substring(i, i+1);

if (badchars.indexOf(temp) != -1)
{
alert("Bad-characters not allowed in Phone number");
return false;
}
}
 //var ch_sID = document.signup.your_name.value;
 var ch_num_sID = name.substr(0,1);

if((ch_num_sID >= "a" && ch_num_sID <= "z") || (ch_num_sID >= "A" && ch_num_sID <= "Z"))
 {
 alert("First letter should be Number here!Try Again!!");
 //document.signup.your_name.focus();
 return false; 
 }
return true;
}

 function checkData()
 {
 

// validate name
 if (document.signup.subj.value == "") {
 alert("Sorry! SUBJECT should not be empty.Please fill in SUBJECT properly.");
 document.signup.subj.focus()
 return false } 
 
 if (document.signup.typemsg.value == "") {
 alert("Sorry! MESSAGE  should not be empty.Please fill in your MESSAGE.");
 document.signup.typemsg.focus()
 return false }
 
 if (document.signup.name.value == "") {
 alert("Sorry! Your FULL NAME should not be empty.Please fill in your FULL NAME properly.");
 document.signup.name.focus()
 return false }
 
if (document.signup.taddress.value == "") {
 alert("Sorry! Your ADDRESS should not be empty.Please fill in your ADDRESS properly.");
 document.signup.taddress.focus()
 return false }

if (document.signup.cityname.value == "") {
 alert("Sorry! Your City Name should not be empty.Please fill in your City Name .");
 document.signup.cityname.focus()
 return false }



if (document.signup.state.value == "") {
 alert("Sorry! Your State Name should not be empty.Please fill in your State Name .");
 document.signup.state.focus()
 return false }

if (document.signup.zip.value == "") {
 alert("Sorry! Your ZIP CODE should not be empty.Please fill in your ZIP CODE .");
 document.signup.zip.focus()
 return false }

if(document.signup.phoner.value == ""){
 alert("Please insert your Phone Number of Work!");
 document.signup.phoner.focus()
return false }

if (document.signup.email_address.value == "") {
 alert("Please Insert Your E-mail Address here.")
 
 document.signup.email_address.focus()
return false } 

if (document.signup.email_address.value.length < 7) {
 alert(" Your E-mail Address is too much short")
 
 document.signup.email_address.focus()
return false } 

if (document.signup.email_address.value.indexOf("@") < 1) {
 alert("@ missing in Your E-mail Address.")
 
 document.signup.email_address.focus()
return false } 

if (document.signup.email_address.value.indexOf(".") < 1) {
 alert("Something missing in Your E-mail-Address. Please enter a valid E-Mail Address.")
 
 document.signup.email_address.focus()
return false }

document.signup.submit(); 
 return true; 
}

