/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

if (document.cookie.length>0) {
	c_start=document.cookie.indexOf("banner=");
	if (c_start!=-1) {
		c_start=c_start+7;
		c_end=document.cookie.indexOf(";",c_start);
		if (c_end==-1) c_end=document.cookie.length;
		var promocode = unescape(document.cookie.substring(c_start,c_end));
	}
}

function scripclr(abj) {
	var yep = document.getElementById(abj);
	if (yep.value=="First" || yep.value=="Last") {
		yep.value = "";
	}
}
function scripkeys(e) {
	if(window.event) {
		key = window.event.keyCode;
	} else {
		key = e.which;
	}
	if(key == 13) {
		scripsend();
	}
}
function scripsend() {
	var fname = document.getElementById("fname").value;
	var lname = document.getElementById("lname").value;
	var ph = document.getElementById("ph1").value+"-"+document.getElementById("ph2").value+"-"+document.getElementById("ph3").value;
	if (ph.length<12) {
		document.getElementById("supp").innerHTML = "Please enter a valid phone number.";
		document.getElementById("supp").style.color = "#c33";
		document.getElementById("supp").style.fontWeight = "bold";
	} else {
		var url = "/leadgen/redirector.asp";
		var parameters = "Campaign=HindiWeb&FirstName=" + encodeURI(fname) + "&LastName="+encodeURI(lname)+"&Phone1="+encodeURI(ph)+"&PromoCode="+encodeURI(promocode)+"";
		xmlHttp.open("POST",url,true);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", parameters.length);
		xmlHttp.setRequestHeader("Connection", "close");
		xmlHttp.onreadystatechange = scripreturn;
		xmlHttp.send(parameters);
	}
}
function scripreturn() {
	if (xmlHttp.readyState == 2) {
	}

	if (xmlHttp.readyState == 4) {
		var retur = xmlHttp.responseText;
		document.getElementById("supp").style.display = "none";
		document.getElementById("formy").innerHTML = "<h2 class=\"hinditwo\"><span style=\"color:#c33;\">Thank you for your interest in DISH Network Hindi programming.  We'll be in touch momentarily.</span></h2>";
	}
}

	document.write("<h2 id=\"supp\" class=\"hinditwo\">Or have us call you.  Enter your contact information below and our Hindi programming experts will call you right away.</h2>\n");
	document.write("<form id=\"formy\" style=\"width:540px;text-align:left;font-size:16px;font-family:arial,helvetica,sans-serif;\"> <label for=\"fname\">Name:</label><input type=\"text\" name=\"fname\" id=\"fname\" value=\"First\" style=\"width:80px;margin-left:8px;\" onfocus=\"scripclr('fname');\" onkeypress=\"scripkeys(event);\" /> <input type=\"text\" name=\"lname\" id=\"lname\" value=\"Last\" style=\"width:80px;\" onfocus=\"scripclr('lname');\" onkeypress=\"scripkeys(event);\" /> <label for=\"ph1\" style=\"margin-left:10px;\">Phone:</label><input type=\"text\" name=\"ph1\" id=\"ph1\" size=\"3\" maxlength=\"3\" style=\"width:34px;margin-left:8px;\" onkeypress=\"scripkeys(event);\" /> <input type=\"text\" name=\"ph2\" id=\"ph2\" size=\"3\" maxlength=\"3\" style=\"width:34px;\" onkeypress=\"scripkeys(event);\" /> <input type=\"text\" name=\"ph3\" id=\"ph3\" maxlength=\"4\" size=\"4\" style=\"width:44px;\" onkeypress=\"scripkeys(event);\" /><div style=\"display:inline;width:36px;font-size:12px;padding:3px;border:1px solid #000;margin-left:20px;cursor:pointer;cursor:hand;background-color:#c33;color:#fff;font-weight:bold;\" onclick=\"scripsend();\">Call me</div>");
	document.write("</form>");