function set()
{


	if (document.dataform.company.value.length == 0)  {
		alert ("Kindly enter the company name.");
		document.dataform.company.focus();
		return false;
	}
	if (document.dataform.S_name.value.length == 0)  {
		alert ("Kindly enter your name.");
		document.dataform.S_name.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 == "")  {
		alert ("Kindly select the country name.");
		document.dataform.S_country.focus();
		return false;
	}

	if (document.dataform.S_phone_country_code.value.length == 0)  {
		alert ("Kindly enter your country code.");
		document.dataform.S_phone_country_code.focus();
		return false;
	}
	 
	if (document.dataform.S_phone.value.length == 0)  {
		alert ("Kindly enter your phone no.");
		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>4000) {
		alert("Kindly describe your requirement within the limit of 4000 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;
		}


	newCookie = document.dataform.company.value;
	newCookie +="|"+document.dataform.S_name.value;
	newCookie +="|"+document.dataform.designation.value;
	newCookie +="|"+document.dataform.S_email.value;
	newCookie +="|"+document.dataform.S_streetaddress.value;
	newCookie +="|"+document.dataform.S_country.selectedIndex;
	newCookie +="|"+document.dataform.S_phone_country_code.value;
	newCookie +="|"+document.dataform.S_phone_area_code.value;
	newCookie +="|"+document.dataform.S_phone.value;
	newCookie +="|"+document.dataform.website.value;
	newCookie +="|"+document.dataform.Description.value;
	newCookie +="|"+document.dataform.Comments.value;
	setCookie("newImeshID1",newCookie);
	return true;
}

function setCookie(name, value)
{
	expires = new Date();
	expires.setTime (expires.getTime() + 24 * 60 * 60 * 150 * 1000);

	if (value.length > 0)
 	document.cookie = name + "=" + escape(value)+ ";"+"path=/;"+"expires=" + expires.toGMTString()+";"
}

function getCookie(Name)
{
	var search = Name + "="
	if (document.cookie.length > 0)
	{ // if there are any cookies
		offset = document.cookie.indexOf(search)
		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 "";
}

var d = new Date();
var epoch_time =(d.getTime()-d.getMilliseconds())/1000;
var randomnumber=Math.floor(Math.random()*9999);
var randomnumber1=Math.floor(Math.random()*9999);
var ran_num=randomnumber+"."+epoch_time+"."+randomnumber1;
var url="/cgi/get_captcha.cgi?cref="+ran_num+"&style=2";

function  get()
{

	if( (cookie = getCookie("newImeshID1")) > "")
	{
		Values = cookie.split("|");
		if (Values.length >= 7)
		{
			if (Values[0]) document.dataform.company.value  = Values[0];
			if (Values[1]) document.dataform.S_name.value = Values[1];
			if (Values[2]) document.dataform.designation.value = Values[2];
			if (Values[3]) document.dataform.S_email.value=Values[3];
			if (Values[4]) document.dataform.S_streetaddress.value=Values[4];
			if (Values[5]) document.dataform.S_country.options[Values[5]].selected=true;
			if (Values[6]) document.dataform.S_phone_country_code.value=Values[6];
			if (Values[7]) document.dataform.S_phone_area_code.value = Values[7];
			if (Values[8]) document.dataform.S_phone.value = Values[8];
			if (Values[9]) document.dataform.website.value = Values[9];
			if (Values[10]) document.dataform.Description.value = Values[10];
			if (Values[11]) document.dataform.Comments.value = Values[11];
		}
	}
}
