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.search.focus();
    return false;
  } 
  if (error == 2) {
    alert(error_message);
    document.quick_find.search.focus();
    return false;
  } 
  else {
    return true;
  }
} 

function openchild_nl()
{
	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.digitivity.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');
	}
}
function addBookmark(title,url) {

	if (window.sidebar) {
		window.sidebar.addPanel("Digitivity", url,"");
		//return false;
	}
	else if( document.all ) {
		window.external.AddFavorite( url, "Digitivity");
		//return false;
	}
	else if(navigator.appName == 'Netscape') {
		alert('Press (CTRL-D) to bookmark this page.');
		//return false;
	}
	return false;
}
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;

function openchild(thisurl){
	if ( CanAnimate ){
			msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=510,left=0,top=0');
			msgWindow.focus();
			msgWindow.location.href = thisurl;
	}
	else {
			msgWindow=window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=510,left=0,top=0');
	}
}


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_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.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.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 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='DIGITVTY';
		document.myform.comp.value=id3;
		document.myform.country.value=id4;
		document.myform.from.value='search';
		
		document.myform.submit();
	}

	
