function set()
{
	if (document.dataform1.S_name.value.length == 0)  {
		alert ("Kindly enter your name.");
		document.dataform1.S_name.focus();
		return false;
	}
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.dataform1.S_email.value))) {
			alert("Invalid Email ID. Kindly enter the correct ID.");
			document.dataform1.S_email.focus();
			return (false);
	}

	var captcha_txt = document.getElementsByName("captcha_text");
	var captcha_txt_len = captcha_txt.length;
	if(captcha_txt_len == 1)
	{
		if (document.dataform1.captcha_text.value.length == 0)  {
				alert ("Kindly enter the code as appearing in the Image.");
				document.dataform1.captcha_text.focus();
				return false;
		}
	}

	newCookie = document.dataform1.S_name.value;
	newCookie +="|"+document.dataform1.S_email.value;
	setCookie("newImeshID",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()
{
	var captcha_txt = document.getElementsByName("captcha_text");
	var captcha_txt_len = captcha_txt.length;
	if(captcha_txt_len == 1)
	{
		document.dataform1.captcha_ref.value = ran_num;
	}


	if( (cookie = getCookie("newImeshID")) > "")
	{
		Values = cookie.split("|");
		if (Values.length >= 7)
		{
			if (Values[0]) document.dataform1.S_name.value  = Values[0];
			if (Values[1]) document.dataform1.S_email.value = Values[1];
		}
	}
}
