function validateit(theForm)
{
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.email.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		theForm.email.focus();
		return (false);
	}
}

function getblank(this1)  {
	if (this1.value = "Your e-mail here") {
		this1.value = "";
	}
    return true;	
}


function check_advanced_search(kw)  {
  error = 0;
  if (kw.length < 3) {
    error_message = "Please enter atleast 3 characters for search";
    error = 1;
  }
  if (kw == "Enter Product / Company Name")
  {
 	error_message = "Please enter correct string for search";
    	error = 2;
  }
  

  if (error == 1) {
    alert(error_message);
    document.quick_find.ss.focus();
    return false;
  } 
  if (error == 2) {
    alert(error_message);
    document.quick_find.ss.focus();
    return false;
  } 
  else {
    return true;
  }
} 


function openchild_nl(thisurl) 
{
	browserName = navigator.appName;
	browserVer = parseInt(navigator.appVersion);
	condition = !(( (browserName.indexOf("Explorer") >=0 ) && (browserVer < 4) ) ||  ((browserName.indexOf("Netscape") >=0 ) && (browserVer < 2) ) ) ;
	if (condition == true  )
		CanAnimate = true;
	else
		CanAnimate = false;

	var email_val = document.theForm.email.value;
	var from_site_val = document.theForm.from_site.value;
	var is_window_val = document.theForm.is_window.value;
	var is_im_val = document.theForm.is_im.value;
	var thisurl="http://www.automotive-online.com/newsletter/newsletter.cgi";


	var thisurl_string = thisurl + "?email=" + email_val + "&from_site=" + from_site_val + "&is_window=" + is_window_val + "&is_im=" + is_im_val;

	if ( CanAnimate ) {
			msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=220');
			msgWindow.focus();
			msgWindow.location.href = thisurl_string;
	}
	else {
			msgWindow=window.open( thisurl_string,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=220');
	}
}


expires = new Date();
	expires.setTime (expires.getTime() + 24 * 60 * 60 * 150 * 1000);
	function set(){
		if(document.dataform.subject_other.value == "") {
			alert ("Kindly enter your subject.");
			document.dataform.subject_other.focus();
			return false;
		}
		if (document.dataform.S_name.value.length == 0)  {
			alert ("Kindly enter your name.");
			document.dataform.S_name.focus();
			return false;
		}
		if(document.dataform.S_email.value == "" ) {
				alert("Kindly enter your E-mail ID.");
				document.dataform.S_email.focus();
				return false;
		}
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.dataform.S_email.value))) {
				alert("Invalid Email ID. Kindly enter the correct ID.");
				document.dataform.S_email.focus();
				return (false);
		}
		
		if (document.dataform.S_country.selectedIndex == 0)  {
			alert ("Kindly select your country name.");
			document.dataform.S_country.focus();
			return false;
		}	

		if (document.dataform.S_ccode.value.length == 0)  {
			alert ("Kindly enter your country code.");
			document.dataform.S_ccode.focus();
			return false;
		}
		if (document.dataform.S_phone.value.length == 0)  {
			alert ("Kindly enter your phone number.");
			document.dataform.S_phone.focus();
			return false;
		}
		
		if(document.dataform.Description.value == "") {
			alert ("Kindly describe your requirement.");
			document.dataform.Description.focus();
			return false;
		}
		if (document.dataform.Description.value.length>1000) {
			alert("Kindly describe your requirement within the limit of 1000 characters.");
			document.dataform.Description.focus();
			return false;
		}
		if (document.dataform.captcha_text.value.length == 0)  {
			alert ("Kindly enter the code as appearing in the Image.");
			document.dataform.captcha_text.focus();
			return false;
		}

		newIILCookie = document.dataform.S_name.value;
		newIILCookie +="|"+document.dataform.S_email.value;
		newIILCookie +="|"+document.dataform.S_phone.value;
		newIILCookie +="|"+document.dataform.S_fax.value;
		newIILCookie +="|"+document.dataform.S_streetaddress.value;
		newIILCookie +="|"+document.dataform.S_city.value;
		newIILCookie +="|"+document.dataform.S_pin.value;
		newIILCookie +="|"+document.dataform.S_country.value;
		newIILCookie +="|"+document.dataform.S_organization.value;
		newIILCookie +="|";
		setCookie("newImeshID",newIILCookie);

		newACCookie = document.dataform.S_ccode.value;
		newACCookie +="|"+document.dataform.S_acode.value;
		newACCookie +="|"+document.dataform.S_ccode_fax.value;
		newACCookie +="|"+document.dataform.S_acode_fax.value;
		newACCookie +="|";
		setCookie("newACCodeID",newACCookie);

		// Expire desc cookie if exists
		if( (desccookie = getCookie("NewDescCookie")) > "") {
document.cookie = "NewDescCookie" + "=" + "" + ";" + "path=/;" ;
		}	} // end set


	function get() {
		if( (cookie = getCookie("newImeshID")) > "") {
			Values = cookie.split("|");
			if (Values.length >= 8) {
				if (document.dataform.S_name.value.length == 0)     document.dataform.S_name.value = Values[0];
				if (document.dataform.S_email.value.length == 0)    document.dataform.S_email.value = Values[1];
				if (document.dataform.S_phone.value.length == 0)   document.dataform.S_phone.value = Values[2];
				if (document.dataform.S_fax.value.length == 0)     document.dataform.S_fax.value = Values[3];
				if (document.dataform.S_streetaddress.value.length == 0) document.dataform.S_streetaddress.value=Values[4];
				if (document.dataform.S_city.value.length == 0)  document.dataform.S_city.value=Values[5];
				if (document.dataform.S_pin.value.length == 0)   document.dataform.S_pin.value=Values[6];
				if (document.dataform.S_country.value.length == 0) document.dataform.S_country.value=Values[7];
				if (document.dataform.S_organization.value.length == 0) document.dataform.S_organization.value=Values[8];
			}
		}

		if( (nextcookie = getCookie("newACCodeID")) > "") {
			NextValues = nextcookie.split("|");
			if (NextValues.length >= 3){
				if (document.dataform.S_ccode.value.length == 0)     document.dataform.S_ccode.value = NextValues[0];
				if (document.dataform.S_acode.value.length == 0)     document.dataform.S_acode.value = NextValues[1];
				if (document.dataform.S_ccode_fax.value.length == 0)     document.dataform.S_ccode_fax.value = NextValues[2];
				if (document.dataform.S_acode_fax.value.length == 0)     document.dataform.S_acode_fax.value = NextValues[3];
			}
		}

		if( (desccookie = getCookie("NewDescCookie")) > "") {
			document.dataform.Description.value = desccookie;
		}

		return true;
	}  // end get

	function setCookie(name, value) {
		if (value.length > 0) {
			document.cookie = name + "=" + escape(value)+ ";"+"expires=" + expires.toGMTString() + ";" + "path=/;" ;
                 }
	}
	function getCookie(Name) {
		var search = Name + "="
		if (document.cookie.length > 0) { // if there are any cookies
			offset = document.cookie.indexOf(search)
			//alert("Offset:"+offset);
			if (offset != -1) { // if cookie exists
				offset += search.length
				// set index of beginning of value
				end = document.cookie.indexOf(";", offset)
				// set index of end of cookie value
				if (end == -1) end = document.cookie.length
				return unescape(document.cookie.substring(offset, end))
			}
		}
		return "";
	}  // end getCookie

	function get_ccode() {
	if (document.dataform.S_ccode_fax.value.length==0) {
		document.dataform.S_ccode_fax.value = document.dataform.S_ccode.value;
		}
	}
	function get_acode() {
	if (document.dataform.S_acode_fax.value.length==0) {
		document.dataform.S_acode_fax.value = document.dataform.S_acode.value;
		return true;
		}
	}	
function openchild_tradefair(thisurl) 
{
	browserName = navigator.appName;
	browserVer = parseInt(navigator.appVersion);
	condition = !(( (browserName.indexOf("Explorer") >=0 ) && (browserVer < 4) ) ||  ((browserName.indexOf("Netscape") >=0 ) && (browserVer < 2) ) ) ;
	if (condition == true  )
		CanAnimate = true;
	else
		CanAnimate = false;


	if ( CanAnimate ) {
			msgWindow=window.open( '' ,'subwindow');
			msgWindow.focus();
			msgWindow.location.href = thisurl;
	}
	else {
			msgWindow=window.open( thisurl,'subwindow');
	}
}
function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
	for(var i=0; i < this.q.split("&").length; i++) {
	this.keyValuePairs[i] = this.q.split("&")[i];
	}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
	for(var j=0; j < this.keyValuePairs.length; j++) {
	if(this.keyValuePairs[j].split("=")[0] == s)
	return this.keyValuePairs[j].split("=")[1];
	}
	return false;
	}
	this.getParameters = function() {
	var a = new Array(this.getLength());
	for(var j=0; j < this.keyValuePairs.length; j++) {
	a[j] = this.keyValuePairs[j].split("=")[0];
	}
	return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; }
}
function queryString(key){
	var page = new PageQuery(window.location.search);
	return unescape(page.getValue(key));
}
	
function displayItem(key){
	if(queryString(key)=='false')
	{
	//document.write("you didn't enter a ?name=value querystring item.");
	}else{
	//document.write(queryString(key));
	document.quick_find.ss.value=unescape(queryString(key).replace(/\+/g, " "));
	//document.quick_find.ss.value = queryString(key);
	}
}

function searchsubmit(a)
{
		document.quick_find1.pg.value=a;
		document.quick_find1.submit();
		return true;
}

function sendquery(id1,id2,id3,id4)
{

document.myform.cid.value=id1;
document.myform.ss.value=id2;
document.myform.mod_id.value='AUTOONLI';
document.myform.comp.value=id3;
document.myform.country.value=id4;
document.myform.from.value='search';
document.myform.submit();
}



function set_article()
{

	if (document.dataform.Current_Designation.value == "")
	{
	alert("Kindly enter your Author Name.");
	document.dataform.Current_Designation.focus();
	return (false);
	}

	if(document.dataform.Experience.value == "")
	{
		alert("Kindly enter your Article Title.");
		document.dataform.Experience.focus();
		return (false);
	}

	if(document.dataform.Description.value == "")
	{
		alert("Kindly Enter the Article Summary.");
		document.dataform.Description.focus();
		return (false);
	}
	if(document.dataform.Description.value.length > 150)
	{
		alert("Article Summary allow only 150 character.");
		document.dataform.Description.focus();
		return (false);

	}
	if(document.dataform.Description1.value == "")
	{
	alert("Kindly Enter the Article Body.");
	document.dataform.Description1.focus();
	return (false);
	}
	if(document.dataform.Description1.value.length > 1500)
	{
		alert("Article Body allow only 1500 character.");
		document.dataform.Description1.focus();
		return (false);
	}

	
}



	