function header(){
	document.write('<IMG SRC="/emavens-dir/images/sankalp-b1.gif" WIDTH="468" HEIGHT="60" BORDER="0" ALT="">');
}
function left(){
	//document.write('<IMG SRC="/emavens-dir/images/silk-exporter-p1.gif" WIDTH="120" HEIGHT="90" BORDER="0" ALT=""><p><a href=#>You Can Advertise Here</a></p>');
}
////////THIS FUNCTION TRIMS THE TRAILING WHITE SPACES IN A GIVEN STRING.
function trim(str1){
// This function trims any given field value for blank spaces.
        var intCtr=0
        for(intCtr=0;str1.charAt(intCtr)==" ";intCtr++);
        str1=str1.substring(intCtr,str1.length);
        return str1;    
}
//validate email
function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

//check form
function listForm(frm){


  //check for category 
 frm=document.list;
//check for title
if ( trim(frm.u_id.value)== "" ){
			alert("Please Enter Your E-mail ID!.");
			frm.u_id.focus();
			return false;
	}
apos=frm.u_id.value.indexOf("@");
dotpos=frm.u_id.value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
				 {
            alert("Not a Valid E-mail Id!.");
			frm.u_id.focus();
			return false;
				 }
if ( trim(frm.pwd.value)== "" ){
			alert("Please Enter Your Password!.");
			frm.pwd.focus();
			return false;
	}
if ( trim(frm.re_pwd.value)== "" ){
			alert("Please Re-type Your Password!.");
			frm.re_pwd.focus();
			return false;
	}
if(trim(frm.pwd.value)!=trim(frm.re_pwd.value))
	{
		alert("Password did not match");
		frm.pwd.focus();
		return false;
	}
if ( trim(frm.category.value)== 0 ){
			alert("Please Select Category!.");
			frm.category.focus();
			return false;
	}
if ( trim(frm.subcat.value)== 0 ){
			alert("Please Select Sub-Category!.");
			frm.subcat.focus();
			return false;
	}
if ( trim(frm.title.value).length <= 0 ){
			alert("Title of Site is missing!.");
			frm.title.focus();
			return false;
	}

//check for Site Description
if ( trim(frm.desc.value).length <= 0 ){
			alert("Site Description is missing!.");
			frm.desc.focus();
			return false;
	}

	if(frm.linktype[0].checked)
	{
	if ( trim(frm.txirecprocal.value).length <= 0 ){
			alert("Reciprocal Link URL is missing!.");
			frm.txirecprocal.focus();
			return false;
	}
	}
//check for email
	if ( trim(frm.txiEmail.value).length <= 0 ){
			alert("Email is missing!");
			frm.txiEmail.focus();
			return false;
	}

//check for address
	if ( trim(frm.address.value).length <= 0 ){
			alert("Address is missing!");
			frm.address.focus();
			return false;
	}

//check for city
	if ( frm.country.value.length <= 0 ){
			alert("Country is missing!");
			frm.country.focus();
			return true;
	}

//check for state
	if ( frm.state.value.length <= 0 ){
			alert("State is missing!");
			frm.state.focus();
			return false;
	}

//check for ZipCOde
	if ( frm.zip.value.length <= 0 ){
			alert("Zip code is missing!");
			frm.zip.focus();
			return false;
	}

if ( frm.ph_country.value.length <= 0 ){
			alert("Country Code is missing!");
			frm.ph_country.focus();
			return false;
	}

if ( frm.ph_area.value.length <= 0 ){
			alert("Area Code is missing!");
			frm.ph_area.focus();
			return false;
	}

if ( frm.ph_no.value.length <= 0 ){
			alert("Phone is missing!");
			frm.ph_no.focus();
			return false;
	}
if ( frm.code_field.value.length <= 0 ){
			alert("Please enter given code!");
			frm.code_field.focus();
			return false;
	}
}

/////////////
function listForm_edit(frm){


  //check for category 
 frm=document.list;
//check for title
if ( trim(frm.category.value)== 0 ){
			alert("Please Select Category!.");
			frm.category.focus();
			return false;
	}
if ( trim(frm.subcat.value)== 0 ){
			alert("Please Select Sub-Category!.");
			frm.subcat.focus();
			return false;
	}
if ( trim(frm.title.value).length <= 0 ){
			alert("Title of Site is missing!.");
			frm.title.focus();
			return false;
	}

//check for Site Description
if ( trim(frm.desc.value).length <= 0 ){
			alert("Site Description is missing!.");
			frm.desc.focus();
			return false;
	}

	if(frm.linktype[0].checked)
	{
	if ( trim(frm.txirecprocal.value).length <= 0 ){
			alert("Reciprocal Link URL is missing!.");
			frm.txirecprocal.focus();
			return false;
	}
	}
//check for email
	if ( trim(frm.txiEmail.value).length <= 0 ){
			alert("Email is missing!");
			frm.txiEmail.focus();
			return false;
	}

//check for address
	if ( trim(frm.address.value).length <= 0 ){
			alert("Address is missing!");
			frm.address.focus();
			return false;
	}

//check for city
	if ( frm.country.value.length <= 0 ){
			alert("Country is missing!");
			frm.country.focus();
			return true;
	}

//check for state
	if ( frm.state.value.length <= 0 ){
			alert("State is missing!");
			frm.state.focus();
			return false;
	}

//check for ZipCOde
	if ( frm.zip.value.length <= 0 ){
			alert("Zip code is missing!");
			frm.zip.focus();
			return false;
	}


if ( frm.ph_no.value.length <= 0 ){
			alert("Phone is missing!");
			frm.ph_no.focus();
			return false;
	}
if ( frm.code_field.value.length <= 0 ){
			alert("Please enter given code!");
			frm.code_field.focus();
			return false;
	}
}
/////////////////////

function set(){
    if ((document.dataform.realname.value == "")|| (document.dataform.email.value == "")|| (document.dataform.feedback.value == "") ){
        alert ("Please enter all the required fields");
        return (false);
}
//radiobutton
if( (document.dataform.Feedback_Type[0].checked)||(document.dataform.Feedback_Type[1].checked)||(document.dataform.Feedback_Type[2].checked))
{
}
else
{
	alert ("Please select the radio fields");
	return (false);
}

//email validation
if (document.dataform.email.value.indexOf("@") < 0) {
    alert("Entry in email field is invalid");
	document.dataform.email.focus();
	return (false);
}
emailarr = document.dataform.email.value.split("@");
if (emailarr[0].length == 0) {
    alert("Entry in  email field is invalid");
	document.dataform.email.focus();
	return false;
}
if (emailarr[1].length == 0) {
    alert("Entry in email field is invalid");
	document.dataform.email.focus();
	return false;
}
if (emailarr[1].length !=0) {
    if (emailarr[1].indexOf(".") == -1) {
	    alert("Entry in email field is invalid");
		document.dataform.email.focus();
		return false;
	}
    emailarrnext=emailarr[1].split(".");
	if (emailarrnext[0].length == 0) {
        alert("Entry in email field is invalid");
		document.dataform.email.focus();
		return false;
	}
					
    if (emailarrnext[1].length == 0) {
        alert("Entry in email field is invalid");
		document.dataform.email.focus();
		return false;
	}
}
// end of email validation
 
}
function catseg(){
    if ((document.dataform.realname.value == "")|| (document.dataform.email.value == "")|| (document.dataform.suggest.value == "") ){
        alert ("Please enter all the required fields");
        return (false);
}

//email validation
if (document.dataform.email.value.indexOf("@") < 0) {
    alert("Entry in email field is invalid");
	document.dataform.email.focus();
	return (false);
}
emailarr = document.dataform.email.value.split("@");
if (emailarr[0].length == 0) {
    alert("Entry in  email field is invalid");
	document.dataform.email.focus();
	return false;
}
if (emailarr[1].length == 0) {
    alert("Entry in email field is invalid");
	document.dataform.email.focus();
	return false;
}
if (emailarr[1].length !=0) {
    if (emailarr[1].indexOf(".") == -1) {
	    alert("Entry in email field is invalid");
		document.dataform.email.focus();
		return false;
	}
    emailarrnext=emailarr[1].split(".");
	if (emailarrnext[0].length == 0) {
        alert("Entry in email field is invalid");
		document.dataform.email.focus();
		return false;
	}
					
    if (emailarrnext[1].length == 0) {
        alert("Entry in email field is invalid");
		document.dataform.email.focus();
		return false;
	}
}
// end of email validation
 
}

function enquiry(){
    if ((document.dataform.realname.value == "")|| (document.dataform.email.value == "")|| (document.dataform.Description.value == "") ){
        alert ("Please enter all the required fields");
        return (false);
}

//email validation
if (document.dataform.email.value.indexOf("@") < 0) {
    alert("Entry in email field is invalid");
	document.dataform.email.focus();
	return (false);
}
emailarr = document.dataform.email.value.split("@");
if (emailarr[0].length == 0) {
    alert("Entry in  email field is invalid");
	document.dataform.email.focus();
	return false;
}
if (emailarr[1].length == 0) {
    alert("Entry in email field is invalid");
	document.dataform.email.focus();
	return false;
}
if (emailarr[1].length !=0) {
    if (emailarr[1].indexOf(".") == -1) {
	    alert("Entry in email field is invalid");
		document.dataform.email.focus();
		return false;
	}
    emailarrnext=emailarr[1].split(".");
	if (emailarrnext[0].length == 0) {
        alert("Entry in email field is invalid");
		document.dataform.email.focus();
		return false;
	}
					
    if (emailarrnext[1].length == 0) {
        alert("Entry in email field is invalid");
		document.dataform.email.focus();
		return false;
	}
}


// end of email validation
 
}

function checkfrm()
	{
	
	docf=document.getElementById("frm");
	if(docf.username.value=='')
	{
		alert("Please Enter Username");
		docf.username.focus();
		return false;
	}
		
	if(docf.password.value=='')
	{
		alert("Please enter your Password");
		docf.password.focus();
		return false;
	}
	return validate_form(docf);
	
}

function check_enquiryform()
{
	
	docf=document.getElementById("frm");
	
	if(docf.name.value=='')
	{
		alert("Please enter your Name");
		docf.name.focus();
		return false;
	}
	
	if(docf.email.value=='')
	{
		alert("Please enter your Email ID");
		docf.email.focus();
		return false;
	}

	if(docf.query.value=='')
	{
		alert("Please enter your Query in Brief");
		docf.query.focus();
		return false;
	}

	
   
   return validate_form(docf);
	
}

function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
  		{
  			alert(alerttxt);
  			return false;
  		}
		else 
		{
			return true;
		}
	}
	
}


function validate_form(thisform)
{
	with (thisform)
	{
		if (validate_email(email,"Not a valid e-mail address!")==false)
  		{
  			email.focus();
  			return false;
  		}
	}
	
}
function reciprocal(val)
{
	
	if(val=="Y")
	{
document.getElementById("reciprocal").style.display='';
	}
	else
	{
		
document.getElementById("reciprocal").style.display='none';
	}
}

function isNumberKey(evt,enabledot)
{
	if(!enabledot) enabledot=0;
 var charCode = (evt.which) ? evt.which : event.keyCode
	 //alert(charCode)
 if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=46 && enabledot==1)
	return false;
 else if (charCode > 31 && (charCode < 48 || charCode > 57) && enabledot==0)
	return false;

 return true;
}