// JScript source code

<!--

var agt=navigator.userAgent.toLowerCase();
var is_gecko = (agt.indexOf('gecko') != -1);
var is_ie    = (agt.indexOf("msie") != -1);
//var dotcomhost = "http://www.eagent.com/";
//var dotcomhost = "http://e-agent-staging:89/";
var dotcomhost = "http://dev-serv:89/";

var livedotcomhost = "eagent.com";
if ((document.domain.indexOf(livedotcomhost)) != -1) {
	dotcomhost = document.domain;
	dotcomhost = "http://" + dotcomhost + "/";
}	

function getCurrentURL(){
	return dotcomhost;
}	

function getDiscussionForumURL(){
	var dfurl = getCurrentURL();
	if (dfurl.indexOf("dev-serv") > 0){
		dfurl	=	"http://dev-serv:8008/forums/";
	}	
	else if (dfurl.indexOf("e-agent-staging") > 0){
		dfurl	=	"http://e-agent-staging:8080/forums/";
	}	
	else if (dfurl.indexOf("eagent.com") > 0){
		dfurl	=	"http://forum.eagent.com/forums/";
	}
	
	return dfurl;	
}

function onloads() {
	var h3List=document.getElementsByTagName('h4');
	var ulList=document.getElementsByTagName('form');
	for(var i=0; i<ulList.length; i++) {
		h3List[i].style.cursor='pointer';
		h3List[i].onclick=function() {toggle(this);}
		ulList[i].style.display='none';
	}
}

function toggle(obj) {
	var ulList=document.getElementsByTagName('form');
	for(var i=0; i<ulList.length; i++) {
		ulList[i].style.display='none';
	}
	var sibling;
	if(obj.nextSibling.nodeType==3) {
		sibling=obj.nextSibling.nextSibling;
	}
	else {
		sibling=obj.nextSibling;
	}
	sibling.style.display=(sibling.style.display=='block')? 'none' : 'block';
}

function loadform(){
	document.form1.firstname.focus();
}

// Returns true if character c is a digit // (0 .. 9).
function isDigit (c){   
	return ((c >= "0") && (c <= "9"))
}

function isInteger_old (s){   
	var i;
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if ((!isDigit(c)) && c != "-") return false;
    }
    return true;
}

function submitPhoneform(frm){


	if (frm.firstname.value == ""){
		alert("Please enter your first name");
		frm.firstname.focus();
		return false;
	}
	if (frm.Phone.value == ""){
		alert("Please enter your phone number");
		frm.Phone.focus();
		return false;
	}
	
	/*else{
		if (!isInteger(frm.Phone.value)){
			alert("Please enter valid phone number");
			frm.Phone.focus();
			return false;
		}	
	}*/
	
	//added on 8/25/2006 - GV
	if (checkInternationalPhone(frm.Phone.value)==false){
		alert("Please Enter a Valid Phone Number")
		frm.Phone.focus()
		return false
	}
	
	//added on 9/5/2006 - GV
	if (newphonevalidate(frm) == false){
		//alert("Please Enter valid Phone Number-gv");
		return false;
	}
	
	var hiddummy = document.ddform.hiddummy.value;

	if (hiddummy == "1")
		frm.action = "/ack.asp";
	else
		frm.action = "../ack.asp";

	
	frm.submit();

}

function submitMortgageForm(frm,consumerActivity)
{
	var redirectfile,productid,parameters;
	
	productid = frm.productid.value;
	
	if (productid == "10")
		productname = "Mortgage";
	else if (productid == "12")
		productname = "HomeInsurance";
	else if (productid == "14")
		productname = "TitleInsurance";
	else if (productid == "16")
		productname = "Movers";

	parameters = "?agentid=" + frm.agentid.value + "&territoryid="+frm.territoryid.value+"&productid="+productid;

	//Random Advertiser Balloon Get this Deal Click(6)
	if (consumerActivity == "6") {
		ajaxFunction(frm.agentid.value,frm.territoryid.value,productid,consumerActivity,1);//05/15/2007
		opener.location.href = productname + "PhoneVerification.asp" + parameters;
		self.close();
	}
	else{
		//Map Balloon Get This Deal Click (2)
		//Random Advertiser Get This Deal Click (3)
		//Video Get This Deal (8)
		if ((consumerActivity == "2") || (consumerActivity == "3") || (consumerActivity == "8")){
			//alert("inside check=" + consumerActivity);
			ajaxFunction(frm.agentid.value,frm.territoryid.value,productid,consumerActivity,1);//05/07/2007	
		}
		
		//redirectfile = "Mortgage/MortgagePhoneVerification.asp";
		redirectfile = productname + "/" + productname + "PhoneVerification.asp" ;
		redirectfile = dotcomhost + redirectfile;
		frm.action = redirectfile;
		frm.submit(); 
	}
}

function oldsubmitRandomizerFormold(frm)
{
	alert(territoryid.value + ' ' + agentid.value);
	//alert(eval(frm.territoryid.value));
	
	//alert(eval(document.formname));
	//formname = eval("form"+territoryid);
	
	//frm,agentid, territoryid,consumerActivity
	//alert(document.territoryid);
	//alert(agentid + ' ' + territoryid + ' ' + consumerActivity);

	//alert(frm);
	//alert(document.frm);
	//formname = "form"+territoryid;
	//alert(eval(formname));
	//document.forms[territoryid].action = "MortgagePhoneVerification.asp";
	//document.forms[territoryid].submit();
	frm.action = "MortgagePhoneVerification.asp";
	frm.submit(); 
	
	//opener.location.href = "MortgagePhoneVerification.asp?agentid=" + agentid + "&territoryid="+territoryid;
}

//this function is calling from GetRandomizer.asp to redirect to phone verification and track get this deal click.
function MortgageRandomizerForm(frm,productid)
{	
	//alert(productid);
	var parameters = "?agentid="+frm.agentid.value+"&territoryid="+frm.territoryid.value+"&productid="+productid;

	//consumeractivity=3=getthisdeal button clicked
	ajaxFunction(frm.agentid.value,frm.territoryid.value,productid,3,1);
	
	if (productid == "10")
		frm.action = "MortgagePhoneVerification.asp"+parameters;
	else if (productid == "12")
		frm.action = "HomeInsurancePhoneVerification.asp"+parameters;
	else if (productid == "14")
		frm.action = "TitleInsurancePhoneVerification.asp"+parameters;
	else if (productid == "16")
		frm.action = "MoversPhoneVerification.asp"+parameters;

	frm.submit(); 
	
}

function submitform(frm){

	finame = frm.firstname.value;
	laname = frm.lastname.value;
	
	//----start first name validation---------------------------
	if (finame == ""){
		alert("Please enter first name");
		frm.firstname.focus();
		return false;
	}
	if (finame.length < 2){
		alert("Please enter valid first name.");
		frm.firstname.focus();frm.firstname.select();
		return false;
	}
	if (!(isAlphanumeric(finame)))
	{
		alert("Please enter only alphabets for First Name");
		frm.firstname.focus();frm.firstname.select();
		return false;
	}
	if (!checkRepeatingChars(finame,2))
	{
		alert ("Please enter your valid first name");
		frm.firstname.focus();frm.firstname.select();
		return false;
	}
	//----end first name validation----------------------------
	//----start last name validation---------------------------
	if (laname == ""){
		alert("Please enter last name");
		frm.lastname.focus();
		return false;
	}
	if (laname.length < 2){
		alert("Please enter valid last name.");
		frm.lastname.focus();frm.lastname.select();
		return false;
	}
	if (!(isAlphanumeric(laname)))
	{
		alert("Please enter only alphabets for last Name");
		frm.lastname.focus();frm.lastname.select();
		return false;
	}
	if (!checkRepeatingChars(laname,2))
	{
		alert ("Please enter your valid last name");
		frm.lastname.focus();frm.lastname.select();
		return false;
	}
	//----end last name validation---------------------------
	
		
	if (frm.address.value == ""){
		alert("Please enter address");
		frm.address.focus();
		return false;
	}
	if (frm.zipcode.value == ""){
		alert("Please enter valid zip-code");
		frm.zipcode.focus();
		frm.zipcode.select();
		return false;
	}
	if (frm.zipcode.value != ""){
		/*if (frm.zipcode.value.length < 5){
			alert("Please enter valid zip-code");
			frm.zipcode.focus();
			frm.zipcode.select();
			return false;
		} */
		//GV added on 9/20/2006 for validating US zip or canada postal code
		if (! zipvalidate(frm.zipcode.value)){
			alert("Please enter your valid Zip/Postal Code");
			frm.zipcode.focus();
			frm.zipcode.select();
			return false;
		}
	}

	if (!validateEmail(frm)){
		return false;
	}
	
	if (frm.Phone.value == ""){
		alert("Please enter phone number");
		frm.Phone.focus();
		return false;
	}
	
	//added on 8/24/2006 - GV
	if (checkInternationalPhone(frm.Phone.value)==false){
		alert("Please Enter a Valid Phone Number")
		frm.Phone.focus();
		return false;
	}
	
	//added on 9/5/2006 - GV
	if (newphonevalidate(frm) == false){
		//alert("Please Enter valid Phone Number-gv");
		return false;
	}

	//----s t a r t----08/20/2007---movetoeAgent2 Radio button validation-------------------------------------
	var movetoeAgent2Flag = false;

	if (frm.movetoeAgent2 != undefined){
		for (i=0;i<frm.movetoeAgent2.length;i++){
			
			switch(frm.movetoeAgent2[i].type){
				case "radio":
				{
					if (frm.movetoeAgent2[i].checked == true) {
						movetoeAgent2Flag = true;
					}
					break;
				}
			}
		}
		if (movetoeAgent2Flag == false){
			alert("Please answer Yes/No to the Question No. 2");
			return false;
		}
	}
	//----e n d---08/20/2007---movetoeAgent2 Radio button validation-------------------------------------------
		
	var hiddummy = document.ddform.hiddummy.value;
	//alert(hiddummy);
	//***********begin in staging box, code should be as follows:******************	
	/*
	if (hiddummy == "1")
		frm.action = "/Googlemap.com/ack.asp";
	else
		frm.action = "../Googlemap.com/ack.asp";
	*/	
	frm.action	= "/ack.asp";
	//***********end in staging box, code should be as follows:******************
	
	//***********begin in production box, code should be as follows:******************	
	//frm.action = "http://www.eagent.com/ack.asp"; 
	//***********end in production box, code should be as follows:******************

	frm.submit();
}

function submit_IMVOIP(frm){
	finame = frm.firstname.value;
	//----start first name validation---------------------------
	if (finame == ""){
		alert("Please enter your Name");
		frm.firstname.focus();
		return false;
	}
	if (finame.length < 2){
		alert("Please enter your valid Name.");
		frm.firstname.focus();frm.firstname.select();
		return false;
	}
	if (!(isAlphanumeric(finame)))
	{
		alert("Please enter only alphabets for Name");
		frm.firstname.focus();frm.firstname.select();
		return false;
	}
	if (!checkRepeatingChars(finame,2))
	{
		alert ("Please enter your valid Name");
		frm.firstname.focus();frm.firstname.select();
		return false;
	}
	//----end first name validation----------------------------
	
	if (frm.imvoip.value == ""){
		alert("Please enter IM/VOIP ID");
		frm.imvoip.focus();
		return false;
	}
	
	var hiddummy = document.ddform.hiddummy.value;

	if (hiddummy == "1")
		frm.action = "/ack.asp";
	else
		frm.action = "../ack.asp";
	
	frm.submit();
	
}

function changecombobox(frm){

	var id				= frm.statelist.selectedIndex;
	var v				= frm.statelist.options[id].value;	
	var xmlFiles		= "xmlFiles";
	var productid		= frm.productid.value;
	var StateLevel		= frm.StateLevel.value;
	var initialMessage	= "Click ONCE on any state/province or use Drop-Down.";
	
	if (productid == "10")
	{
		xmlFiles = "xmlFiles_Mortgage";
		//alert(StateLevel);
		if (StateLevel == "true") {
			xmlFiles = "Mortgage/xmlFiles_Mortgage";	
		}
		initialMessage = "Click on any of the balloons to select offers from lenders";
	}
	else if (productid == "12"){
		xmlFiles = "xmlFiles_HomeInsurance";
		if (StateLevel == "true") {
			xmlFiles = "HomeInsurance/xmlFiles_HomeInsurance";	
		}
		initialMessage = "Click on any of the balloons to select offers from lenders";		
	}
	else if (productid == "14"){
		xmlFiles = "xmlFiles_TitleInsurance";
		if (StateLevel == "true") {
			xmlFiles = "TitleInsurance/xmlFiles_TitleInsurance";	
		}
		initialMessage = "Click on any of the balloons to select offers from lenders";		
	}	
	else if (productid == "16"){
		xmlFiles = "xmlFiles_Movers";
		if (StateLevel == "true") {
			xmlFiles = "Movers/xmlFiles_Movers";	
		}
		initialMessage = "Click on any of the balloons to select offers from lenders";		
	}
	else if (productid == "0"){
		xmlFiles = "XmlFiles_Forum";
		if (StateLevel == "true") {
			xmlFiles = "Forum/XmlFiles_Forum";	
		}
	}
	
	if ((id=="0") || (id=="52")) {
		//alert(initialMessage);
		//makeAlert('www.eAgent.com','click once on any state or use dropdown box');
		return;
	}
	
	if (v != ""){
		xmlData = xmlFiles + "/" + "xmlData_" + v + ".xml" ;
		//alert(xmlData);
		readMap(xmlData);
	}
	return;

}

function open_popup(url) {
	var hWnd = window.open(url,"flash","width=550,height=520,resizable=yes,scrollbars=yes,top=50,left=125");
	if (hWnd.focus != null) hWnd.focus();
}

function validateEmail(frm){
	email = frm.email.value;
	
	if (cutSpaces(email) == "")
		{
			alert("Please enter your Email Address.");
			frm.email.focus();
			flaga = false;
			return;
		}

	if (cutSpaces(email) != "")
		{
			flag=special_email(email);
				if(flag==false)
					{
					frm.email.focus();
					flaga = false;
					return;
					}
			var x;
			x = email.indexOf("@");
			if (email.indexOf("@") <= 0)
			{
				alert("Please enter a valid Email address.\nFormat yourname@yourcompany.com.");
				frm.email.value = ""
				frm.email.focus();
			flaga = false;
			return;
			}

	if (email.substr(email.indexOf("@") - 1, 1) == ".")
		{
			alert("Please enter a valid Email address.\nFormat yourname@yourcompany.com.");
			frm.email.value = ""
			frm.email.focus();
		flaga = false;
		return;
		}
	if (email.indexOf(".") <= 0)
		{
			alert("Please enter a valid Email address.\nFormat yourname@yourcompany.com.");
			frm.email.value = ""
			frm.email.focus();
		flaga = false;
		return;
		}
	if (email.substr(email.length - 2, 1) == "." || email.substr(email.length - 1, 1) == ".")
		{
			alert("Please enter a valid Email address.\nFormat yourname@yourcompany.com.");
			frm.email.value = ""
			frm.email.focus();
		flaga = false;
		return;
		}

	if (email.indexOf(".", email.indexOf("@")) - email.indexOf("@") < 3)
		{
			alert("Please enter a valid Email address.\nFormat yourname@yourcompany.com.");
			frm.email.value = ""
			frm.email.focus();
		flaga = false;
		return;
		}

	if (cutats(email).length < email.length - 1)
		{
			alert("Please enter a valid Email address.\nFormat yourname@yourcompany.com.");
			frm.email.value = ""
			frm.email.focus();
		flaga = false;
		return;
		}
	if ((email.indexOf('.com')<5) && (email.indexOf('.org')<5) && (email.indexOf('.biz')<5) && (email.indexOf('.net')<5) && (email.indexOf('.edu')<5) && (email.indexOf('.gov')<5) &&(email.indexOf('.mil')<5) && (email.indexOf('.co')<5) && (email.indexOf('.cc')<5) && (email.indexOf('.ca') < 5) )
		{
			alert("Please enter a valid Email address.\nFormat yourname@yourcompany.com.");
			frm.email.value = ""
			frm.email.focus();
		flaga = false;
		return;
		}
	}
	
	//checks for min of 3 characters - GV 9/12/2006
	var myregexp = new RegExp(email);
	var reg2 = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]{2}@[a-zA-Z][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/ ;
	if (!reg2.test(email)) {
		alert("Please enter a valid email address");
		frm.email.focus();
		return false;
	}	
	
	//checks for repeating characters - GV 9/12/2006
	var leftname = "";
	var leftpart = email.indexOf('@');
	if (leftpart > 0){
		leftname = email.substr(0,leftpart);
		rightname = email.substr(leftpart+1,email.length)
	}	
	if (!checkRepeatingChars(leftname,2))
	{
		alert ("Please enter a valid email address");
		frm.email.focus();
		return false;
	}
	
	if (!checkRepeatingChars(rightname,2))
	{
		alert ("Please enter a valid email address");
		frm.email.focus();
		return false;
	}
	//-----------------------end of email validation-------------------------------------	
	
	
	return true;
}

function toggleDiv(id,flagit) {
	if (flagit=="1"){
		if (document.layers) {
			document.layers[''+id+''].visibility = "show";
		}	
		else if (document.all) {
			document.all[''+id+''].style.visibility = "visible" ;
		}	
		else if (document.getElementById) {
			document.getElementById(''+id+'').style.visibility = "visible" ;
		}	
	}
	else
		if (flagit=="0"){
			if (document.layers) document.layers[''+id+''].visibility = "hide"
			else if (document.all) document.all[''+id+''].style.visibility = "hidden"
			else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
		}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function getZoomValue(strState){
	var lastOccu = strState.lastIndexOf("_");
	var str = strState.substr(lastOccu+1,2);

	if (str == "AL") return 6;
	else if(str == "AK") return 4;	
	else if(str == "AZ") return 6;		
	else if(str == "AR") return 6;
	else if(str == "CA") return 5;
	else if(str == "CO") return 6;
	else if(str == "CT") return 8;
	else if(str == "DE") return 7;
	else if(str == "DC") return 7;
	else if(str == "FL") return 6;
	else if(str == "GA") return 6;
	else if(str == "HI") return 7;
	else if(str == "ID") return 6;	
	else if(str == "IL") return 6;												
	else if(str == "IN") return 6;
	else if(str == "IA") return 6;
	else if(str == "KS") return 5;
	else if(str == "KY") return 6;
	else if(str == "LA") return 6;
	else if(str == "ME") return 4;
	else if(str == "MD") return 7;
	else if(str == "MA") return 7;
	else if(str == "MI") return 6;
	else if(str == "MN") return 5;
	else if(str == "MS") return 7;
	else if(str == "MO") return 5;
	else if(str == "MT") return 4;
	else if(str == "NC") return 6;
	else if(str == "NE") return 5;						
	else if(str == "NV") return 5;
	else if(str == "NH") return 4;
	else if(str == "NJ") return 7;
	else if(str == "NM") return 7;
	else if(str == "NY") return 6;
	else if(str == "NC") return 4;
	else if(str == "ND") return 4;
	else if(str == "OH") return 6;
	else if(str == "OK") return 6;
	else if(str == "OR") return 6;
	else if(str == "PA") return 7;					
	else if(str == "RI") return 4;
	else if(str == "SC") return 7;
	else if(str == "SD") return 4;
	else if(str == "TN") return 6;
	else if(str == "TX") return 5;
	else if(str == "UT") return 6;
	else if(str == "VT") return 6;
	else if(str == "VA") return 6;
	else if(str == "WA") return 6;
	else if(str == "WV") return 7;
	else if(str == "WI") return 6;
	else if(str == "WY") return 4;

	else if(str == "AB") return 4;
	else if(str == "BC") return 6;
	else if(str == "MB") return 4;
	else if(str == "NB") return 4;
	else if(str == "NL") return 4;
	else if(str == "NS") return 4;
	else if(str == "NT") return 4;
	else if(str == "NU") return 4;
	else if(str == "ON") return 4;
	else if(str == "PE") return 4;
	else if(str == "QC") return 4;
	else if(str == "SK") return 4;
	else if(str == "YT") return 4;
	else return 4;
}


//PHONE VALIDATION STARTS-------//added on 8/24/2006 - GV-------------
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
	s=stripCharsInBag(strPhone,validWorldPhoneChars);
	
	//added on 10/4/2006
	if (s.length > minDigitsInIPhoneNumber)
		return false;
	
	return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
	
}

function newphonevalidate(frm)
{
	var s = frm.Phone.value;
	//alert(s);
	for (i = 0; i <= s.length; i++)
    {   
        var c = s.charAt(i);
        if (c == " ") {
			alert ("Please enter phone number (Format: XXX-XXX-XXXX)");
			return false;
        }
    }
	for (i = 0; i <= 2; i++)
    {   
        var c = s.charAt(i);
        if (c == "-") {
			alert ("dash is not at correct position");
			return false;
        }
    }
    for (i = 4; i <= 6; i++)
    {   
        var c = s.charAt(i);
        if (c == "-") {
			alert ("Dash is not at correct position");
			return false;
        }
    }

	var phonenumber = s;
	var areacode = phonenumber.substring(0,3);
	var prefix = phonenumber.substring(3,6);
	var phoneno = phonenumber.substring(6,10);
	var a = phonenumber.charAt(3);
	var b = phonenumber.charAt(7);
	var c = phonenumber.charAt(6);
	
	
	if ((a == "-") && (b != "-")){
		phoneno = phonenumber.substring(7,11);
		prefix = phonenumber.substring(4,7);
	}
	else if ((a == "-") && (b == "-")){
		phoneno = phonenumber.substring(8,12);
		prefix = phonenumber.substring(4,7);
	}	
	else if ((a != "-") && (c == "-")){
		prefix = phonenumber.substring(3,6);
		phoneno = phonenumber.substring(7,11);
	}

	//added on 08/13/2007
	if (!isInteger(areacode)){
		alert("Please enter valid phone number - only digits")
		return false;
	}
		
	if (!CheckAreaCode(areacode))
	{
		alert("Please enter valid phone number - AREACODE");
		frm.Phone.focus();
		frm.Phone.select();
		return false;
	}

	//added on 08/13/2007	
	if (!isInteger(prefix)){
		alert("Please enter valid phone number - only digits")
		return false;
	}
	
	if (!CheckPrefix(prefix))
	{
		alert("Please enter valid phone number - PREFIX");
		frm.Phone.focus();
		frm.Phone.select();
		return false;	
	}
	
	//added on 08/13/2007	
	if (!isInteger(phoneno)){
		alert("Please enter valid phone number - only digits")
		return false;
	}
		
	if (!CheckPhoneNos(phoneno))
	{
		alert("Please enter valid PHONE NUMBER");
		frm.Phone.focus();
		frm.Phone.select();
		return false;	
	}
	
	//- GV - 9/5/2006 - checking for combo of prefix and phone nos.
	if (!ComboPrefixePhone(prefix,phoneno))
	{
		alert("Please enter valid PHONE NUMBER");
		frm.Phone.focus();
		frm.Phone.select();
		return false;	
	}
}

//area codes which needs to be not allowed - GV - 9/5/2006
function CheckAreaCode(s)
{
	var areaCodes = new Array("111", "222", "333", "444", "555", "666", "777", "999", "000", "123", "800", "866", "877", "888", "900" );

	//check starting ditit in areacode		
	var startingdigit = s.charAt(0);
	if (startingdigit == "0" || startingdigit == "1")
		return false;
		
	for (i=0;i<areaCodes.length;i++){
		if ((areaCodes[i].indexOf(s)) == 0)
			return false;
	}
	return true;
}

//prefixes which needs restrict to allow - GV - 9/5/2006
function CheckPrefix(s)
{
	var prefix = new Array("111", "000", "123","555" );
	
	//check starting ditit in prefix
	var startingdigit = s.charAt(0);
	if (startingdigit == "0" || startingdigit == "1")
		return false;
		
	for (i=0;i<prefix.length;i++){
		if ((prefix[i].indexOf(s)) == 0)
			return false;
	}
	return true;
}

//Phone nos which needs restrict to allow - GV - 9/5/2006
function CheckPhoneNos(s)
{
	var PhoneNo = new Array("1111", "0000", "1234", "4567" );
	
	for (i=0;i<PhoneNo.length;i++){
		if ((PhoneNo[i].indexOf(s)) == 0)
			return false;
	}
	return true;
}

//Combination of prefixe and Phone nos which needs restrict to allow - GV - 9/5/2006
function ComboPrefixePhone(pf,pn)
{
	var pfix = new Array("222", "333", "666", "888", "777","444", "999");
	var PNo = new Array("2222", "3333", "6666", "8888", "7777","4444", "9999");
	var pfbool = false;
	
	for (i=0;i<pfix.length;i++){
		if ((pfix[i].indexOf(pf)) == 0)
			pfbool = true;
	}
	if (pfbool)
	{
		for (i=0;i<PNo.length;i++){
			if ((PNo[i].indexOf(pn)) == 0)
				if ((PNo[i].indexOf(pn)) == (pfix[i].indexOf(pf)))
					return false;
		}
	}
	return true;
}

//PHONE VALIDATION ENDS-----------------------------------

//for email validation
function checkRepeatingChars(word,count)
{
	var letter = "";
	var newletter  = "";
	var returnString = "";
	var j = 0;
	for (i = 0; i < word.length; i++)
	{   
		letter = word.charAt(i);
		if (i > 0){
			if (isLetter (letter)){ //if only it is alphabet
				if (letter.toUpperCase() == newletter.toUpperCase()){
					j = j + 1;
				}else{
					if (j < count)
						j = 0;
				}
			}	
		}
		newletter = letter;
	}
	if (j >= count)
		return false
	else
		return true	
}

//GV- added on 9/20/2006 for validating US zip or canada postal code
function zipvalidate(zip)
{
	var reg = /(^\d{5}$)|(^[a-zA-Z][0-9][a-zA-Z] [0-9][a-zA-Z][0-9]$)/ ;
	if (!reg.test(zip))
		return false;
	else 
		return true;	
}

//------------names validation------------------------------
// Check whether char is only alphabets or not..
function isLetter (c){   
	return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
}
	
// Check whether string s is empty.
function isEmpty(s){  
	return ((s == null) || (s.length == 0))
}
	
function NamestripCharsInBag (s, bag)
{   
	var i;
	var returnString = "";

	// Search through string's characters one by one.
	// If character is not in bag, append to returnString.
	for (i = 0; i < s.length; i++)
	{   
		// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) returnString += c;
	}
	return returnString;
}
	
// isAlphanumeric (STRING s [, BOOLEAN emptyOK])
// 
// Returns true if string s is English letters 
// (A .. Z, a..z) and characters like (dash, hypen,dot,space ) only.
//

function isAlphanumeric (s)
{   
	var i;
	var allowedchars;
	allowedchars="-_. ";
	s=NamestripCharsInBag(s,allowedchars);

	if (isEmpty(s)) {
		if (isAlphanumeric.arguments.length == 1) return defaultEmptyOK;
		else return (isAlphanumeric.arguments[1] == true);
	}
	// Search through string's characters one by one
	// until we find a non-alphanumeric character.
	// When we do, return false; if we don't, return true.
	
	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (! (isLetter(c)) )
			return false;
	}

	// All characters letters.
	return true;
}

function ReplaceCarat(name){
	var r;                    //Declare variables.
	r = name.replace("^^", "'");    //Replace "^" with "'".
	return(r);                   //Return string with replacement made.
}

function ReplaceCarat07(name){
	var r;                    //Declare variables.
	r = name.replace("^^", "'");    //Replace "^" with "'".
	return(r);                   //Return string with replacement made.
}

function NewReplaceCarat(name){
	var r;
	myString = new String(name)
	rExp = /^^/g;
	newString = "'";
	r = myString.replace(rExp, newString);
	return(r);
}

function ReplaceCaratwithSlash(name){
	var r;                    //Declare variables.
	r = name.replace("\^^", "'");    //Replace "^" with "'".
	return(r);                   //Return string with replacement made.
}

function ReplaceQuote(name){
	var r;                    //Declare variables.
	r = name.replace("'", "^^");    //Replace "'" with "^^".
	return(r);                   //Return string with replacement made.
}

function Replacespace(jpgfilename){
	var r;
	//r = jpgfilename.replace(" ","%20");
	//return(r);
	myString = new String(jpgfilename)
	rExp = / /gi;
	newString = "%20";
	r = myString.replace(rExp, newString);
	return(r);
}

function ReplacespaceBack(strname){
	var r;
	myString = new String(strname)
	rExp = /%20/gi;
	newString = " ";
	r = myString.replace(rExp, newString);
	return(r);
}

function splitstr(str){
	var newstr = " ";
	var words=str.split(" ") //split using blank space as delimiter
	for (i=0; i<words.length; i++){
		newstr = newstr + "%20" + words[i] ;  //alerts "Welcome", "to", "JavaScript", and "Kit"
	}
	newstr = newstr.substring(4,newstr.length);

	return((newstr));
}

function replaceHTMLSpace(str){
	if (str != null){
		var newstr = str.replace(/ /g,'&nbsp;');
		return(newstr);
	}
}

function html2entities(str){
//	alert(str);
	var re=/[(<>"'&]/g
	str = str.replace(re, function(m){return replacechar(m)})
//	alert("replaced=" + str);
	return str;
}

function replacechar(match){
	if (match=="<")
		return "&lt;"
	else if (match==">")
		return "&gt;"
	else if (match=="\"")
		return "&quot;"
	else if (match=="'")
		return "&#039;"
		//return " "
	else if (match=="&")
		return "&amp;"
		
	
}

function repNUll(str){
	if (str != null){
		var newstr = str.replace(/ /g,'%20');
		return(newstr);
	}
}

function checkdot(str)
{
	if (str != "")
	{
		var lastchar = str.substring(str.length-1, str.length);
		if (lastchar == ".")
		{
			str = str.substring(0,str.length-1);
		}
	}	
	return str;
}

function leftTrim(sString){
	while (sString.substring(0,1) == ' '){
		sString = sString.substring(1, sString.length);
	}
	return sString;
}
	
function open_popup(url) 
{
	var hWnd = window.open(url,"flash","width=600,height=400,resizable=yes,scrollbars=yes,top=50,left=125");
	if (hWnd.focus != null) hWnd.focus();
}

function chooseBusiness(id) 
{

	if (id == 0)
		bus = "eAgents3.asp";
	else if (id == 1)
		bus  = "http://k.kiutho.com/cgi/r?;n=203;c=226593;s=5210;x=7936;f=200609291429270;u=j;z=TIMESTAMP;";
	else if (id == 2)
		bus  = "http://s.supiyl.com/cgi/r?;n=203;c=226599;s=5210;x=7936;f=200609291429330;u=j;z=TIMESTAMP;";
			
	document.ddform.business.value=bus;
	document.ddform.id.value=id;
	document.ddform.submit();
	
}
// A function to hide the loading message
function hideLoad()
{
	var loaddiv = document.getElementById("loaddiv");
	if (loaddiv == null)
	{
		alert("Sorry can't find the loaddiv hide");
		return;
	}
	//div found
	loaddiv.style.visibility="hidden";
	loaddiv.style.display = "none";
}

var x = 0;
var speed = 200;

// A function to hide the loading message
function showLoad()
{
	
	tex = "Please wait...Loading..";
	document.getElementById("loaddiv").innerHTML = tex;
	
	var loaddiv = document.getElementById("loaddiv");
	if (loaddiv == null)
	{
		alert("Sorry can't find your loaddiv - show");
		return;
	}
	//div found
	loaddiv.style.visibility="visible";
	loaddiv.style.display = "block";

	Blinky();

}

function Blinky() {
	tex = "Please wait... Loading !";
	document.getElementById("loaddiv").innerHTML = tex;
	setTimeout("Blinky2()", speed);
}


function Blinky2(){ 
	tex = " ";
	document.getElementById("loaddiv").innerHTML = tex;
	setTimeout("Blinky()", speed);
} 

function ValidateName(frmName,name)
{
	if (frmName.value == ""){
		alert("Please enter your " + name);
		frmName.focus();
		return false;
	}
	if (frmName.value.length < 2){
		alert("Please enter your valid " + name);
		frmName.focus();frmName.select();
		return false;
	}
	if (!(isAlphanumeric(frmName.value)))
	{
		alert("Please enter only alphabets for " + name);
		frmName.focus();frmName.select();
		return false;
	}
	if (!checkRepeatingChars(frmName.value,2))
	{
		alert ("Please enter your valid " + name);
		frmName.focus();frmName.select();
		return false;
	}
		
	return true;
}

function BrowserCheck() {
	var b = navigator.appName;
	if (b == "Netscape") this.b = "NS";
	else if (b == "Microsoft Internet Explorer") this.b = "IE";
	else this.b = b;
	this.v = parseInt(navigator.appVersion);
	this.NS = (this.b == "NS" && this.v>=4);
	this.NS4 = (this.b == "NS" && this.v == 4);
	this.NS5 = (this.b == "NS" && this.v == 5);
	this.IE = (this.b == "IE" && this.v>=4);
	this.IE4 = (navigator.userAgent.indexOf('MSIE 4')>0);
	this.IE5 = (navigator.userAgent.indexOf('MSIE 5')>0);
	if (this.IE5 || this.NS5) this.VER5 = true;
	if (this.IE4 || this.NS4) this.VER4 = true;
	this.OLD = (! this.VER5 && ! this.VER4) ? true : false;
	this.min = (this.NS||this.IE);
}

is = new BrowserCheck();
//alertBox = (is.VER5) ? document.getElementById("alertLayer").style : (is.NS) ? document.layers["alertLayer"] : document.all["alertLayer"].style;

function hideAlert(){
	alertBox.visibility = "hidden";
}

function makeAlert(aTitle,aMessage){
//	alertBox = document.getElementById("alertLayer").style;
	//alertBox = (is.VER5) ? document.getElementById("alertLayer").style : (is.NS) ? document.layers["alertLayer"] : document.all["alertLayer"].style;

//	document.all.alertLayer.innerHTML = "<table border=0 width=100% height=100%>" +
	"<tr height=5><td colspan=4 class=alertTitle>" + " " + aTitle + "</td></tr>" +
	"<tr height=5><td width=5></td></tr>" +
	"<tr><td width=5></td><td width=20 align=left><img src='http://www.eagent.com/images/e.jpg'></td><td align=center class=alertMessage>" + aMessage + "<BR></td><td width=5></td></tr>" + 
	"<tr height=5><td width=5></td></tr>" +
	"<tr><td width=5></td><td colspan=2 align=center><input type=button value='OK' onClick='hideAlert()' class=okButton><BR></td><td width=5></td></tr>" +
	"<tr height=5><td width=5></td></tr></table>";
	thisText = aMessage.length;
	if (aTitle.length > aMessage.length)
	{ thisText = aTitle.length; }

	aWidth = (thisText * 5) + 80;
	aHeight = 100;
	if (aWidth < 150){ aWidth = 200; }
	if (aWidth > 350){ aWidth = 350; }
	if (thisText > 60){ aHeight = 110; }
	if (thisText > 120){ aHeight = 130; }
	if (thisText > 180){ aHeight = 150; }
	if (thisText > 240){ aHeight = 170; }
	if (thisText > 300){ aHeight = 190; }
	if (thisText > 360){ aHeight = 210; }
	if (thisText > 420){ aHeight = 230; }
	if (thisText > 490){ aHeight = 250; }
	if (thisText > 550){ aHeight = 270; }
	if (thisText > 610){ aHeight = 290; }

/*	alertBox.width = aWidth;
	alertBox.height = aHeight;
	alertBox.left = (document.body.clientWidth - aWidth)/2;
	alertBox.top = (document.body.clientHeight - aHeight)/2;
*/
	alertBox.width = aWidth;
	alertBox.height = aHeight;
	alertBox.left = (document.body.clientWidth - aWidth)/2;
	alertBox.top = 200;

	alertBox.visibility = "visible";

}

function deal_click (currentAgentID, currentTerritoryID,currentConsumerActivity)
{

	var xmlObj = new ActiveXObject("Msxml2.DOMDocument") ;

        var sXml  = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" ;
                
        sXml += "<soap:Envelope "

        sXml += "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " ;

        sXml += "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " ;

	sXml += "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" ;

	sXml += "<soap:Body>" ;

	sXml += "<Update xmlns=\"http://www.eagent.com\">" ;

	sXml = sXml + "<currentAgentID>" + currentAgentID  + "</currentAgentID>" ;

	sXml = sXml + "<currentTerritoryID>" + currentTerritoryID  + "</currentTerritoryID>" ;  

	sXml = sXml + "<currentProductID>10</currentProductID>" ;      

	sXml = sXml + "<currentConsumerActivity>" + currentConsumerActivity + "</currentConsumerActivity>" ;                           

	sXml += "</Update></soap:Body></soap:Envelope>"

                
	// Try to parse the XML string into DOM object 
        xmlObj.loadXML(sXml) ;

	var xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP") ;

	xmlHTTP.Open ( "Post", "http://www.eagent.com:86/ConsumerActivityTracker.asmx", false) ;

	xmlHTTP.setRequestHeader("SOAPAction", "http://www.eagent.com/Update") ;

	xmlHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8" ) ;

	xmlHTTP.Send(xmlObj.xml) ;


}

function ajaxFunction(agentid,territoryid,productid,activityid,increment)
{  
	var xmlHttp;
	var xmlHttpResponse;
	try
    {    // Firefox, Opera 8.0+, Safari    
		xmlHttp=new XMLHttpRequest();    
	}
	catch (e)
    {    // Internet Explorer    
		try
		{      
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			}
			catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
			}      
		}    
	}
	xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				xmlHttpResponse=xmlHttp.responseText;
				//alert(xmlHttpResponse);
			}
		}
	
	//alert("insie ajax");
	url = "UpdateConsumerActivity.asp?agentid="+agentid+"&territoryid="+territoryid+"&productid="+productid+"&activityid="+activityid+"&increment="+increment;
    
    url = dotcomhost + url;
    //alert(url);
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
      
}


// Removes leading whitespaces
function LTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	return LTrim(RTrim(value));
	
}

function DisplayVideo(pid, aid, tid,consumerActivity){

	//consumerActivity click count for Random Video Click  is (7)
	//consumerActivity click count for Balloon Video Click is (5)
	var videoURL;
	var VideoParameters = "ProductID="+pid+"&AgentID="+aid+"&TerritoryID="+tid;

	//10 is for product mortgage
	ajaxFunction(aid,tid,pid,consumerActivity,1);//05/24/2007

	var _console = null;
	videoURL = "DisplayVideo.asp?"+VideoParameters ;
	videoURL = dotcomhost + videoURL;
    _console = window.open(videoURL,'videoURL', 'menubar=yes,height=650,width=850,resizable=yes,scrollbars=yes,toolbar=yes,status=yes,location=yes',true);

}

function submitPreAckForm(frm)
{
	var ok = false;
	for (i=0;i<frm.elements.length;i++){
		switch(frm.elements[i].type){
			case "checkbox":
			{
				if (frm.elements[i].checked == true) {
					ok = true;
				}
				break;
			}
			case "hidden":
			{
				break;
			}
		}
	}
	
	if (ok == false){
		alert("Please select at least one additional town of interest or click 'No, Thanks' to continue.");
		return false;
	}
	//alert("submit clicked");
	frm.preack.value="true";
	frm.action = "preAck.asp";
	frm.submit();
}

function cancelPreAckForm(frm,host) {
	var parameters;
	parameters = "req=1&customerId="+frm.customerid.value+"&agentid="+frm.agentid.value;
	parameters = parameters + "&territory="+frm.TerritoryID.value+"&agentState="+frm.agentState.value+"&from="+frm.from.value;
	
	frm.action = host + "customer/customerAcknowledgement.asp?" +parameters;
	
	frm.submit();
}

function checkAll(field){
	if (field.length == undefined){
		document.preackForm.AgentTerritoryID.checked = true;
	}
	else {
	
		for (i = 0; i < field.length; i++)
			field[i].checked = true ;
	}	
}

function uncheckAll(field){
	if (field.length == undefined){
		document.preackForm.AgentTerritoryID.checked = false;
	}else {
		for (i = 0; i < field.length; i++)
			field[i].checked = false ;
	}	
}

function submitProductsForm(frm,consumerActivity)
{

	var redirectfile= "";
	var agentid		= frm.agentid.value;
	var territoryid = frm.territoryid.value;
	var productid	= frm.productid.value;
	
	if (productid == "10"){
		productname = "Mortgage";
	}
	else if (productid == "12"){
		productname = "HomeInsurance";	
	}
	else if (productid == "14"){
		productname = "TitleInsurance";	
	}
	else if (productid == "16"){
		productname = "Movers";	
	}

//alert(consumerActivity);
		
	//Random Advertiser Balloon Get this Deal Click(6)
	if (consumerActivity == "6") {
		ajaxFunction(agentid,territoryid,productid,consumerActivity,1);
		redirectfile = productname + "PhoneVerification.asp?agentid=" + agentid + "&territoryid="+territoryid + "&productid="+productid;
		//opener.location.href = "MortgagePhoneVerification.asp?agentid=" + agentid + "&territoryid="+territoryid;
		opener.location.href = redirectfile;
		self.close();
	}
	else{
		//Map Balloon Get This Deal Click (2)
		//Random Advertiser Get This Deal Click (3)
		//Video Get This Deal (8)
		if ((consumerActivity == "2") || (consumerActivity == "3") || (consumerActivity == "8")){
			//alert("inside check=" + consumerActivity);
			ajaxFunction(agentid,territoryid,productid,consumerActivity,1);
		}
		
		redirectfile = productname + "/" + productname + "PhoneVerification.asp";
		//redirectfile = "Mortgage/MortgagePhoneVerification.asp";
		//redirectfile = "Mortgage/MortgagePhoneVerification.asp";
		
		redirectfile = dotcomhost + redirectfile;
		frm.action = redirectfile;
		frm.submit(); 
	}
}

//09/19/2007 (called from GoogleMap_Functions_<Products>.js)
function ReplacehtmlQuote(name){
	var r;
	myString = new String(name)
	rExp = /'&quot;/g;
	newString = "";
	r = myString.replace(rExp, newString);
	return(r);
}

//09/20/2007 (called from GoogleMap_Functions_<Products>.js)
function ReplaceGlobalSingleCaretToSingleQuote(name){
	var r;
	myString = new String(name)
	rExp = /singlecaret/g;
	newString = "'";
	r = myString.replace(rExp, newString);
	return(r); 
}	

//09/20/2007 (called from GoogleMap_Functions_<Products>.js)
//current no function is calling this
function Replacesinglequot(name){
	var r;                    
	r = name.replace(/'/g, "");
	return(r); 
}

//09/21/2007 (called from GoogleMap_Functions_<Products>.js)
function ReplacehtmlSingleQuote(name){
	var r;
	myString = new String(name)
	rExp = /&quot;'/g;
	newString = "";
	r = myString.replace(rExp, newString);
	return(r);
}

//10/03/2007 (called from GoogleMap_Functions_<Products>.js)
function RemoveSpace(name){
	var r;                    
	r = name.replace(/ /g, "");
	return(r); 
}

//09/27/2007 called from GoogleMap_Functions_RealEstate.js
//new balloon eagent2.0 validations function 
//05/21/2008 - remove some validation

function submitnewform2(frm){

	name	= frm.firstname.value;
	email	= frm.email.value;
	phone	= frm.Phone.value;
	
	//----start name validation---------------------------
	if (name == ""){
		alert("Please enter your name");
		frm.firstname.focus();
		return;
	}
	if (name.length < 2){
		alert("Please enter valid name.");
		frm.firstname.focus();frm.firstname.select();
		return;
	}
	if (!(isAlphanumeric(name)))
	{
		alert("Please enter only alphabets for name");
		frm.firstname.focus();frm.firstname.select();
		return;
	}
	if (!checkRepeatingChars(name,2))
	{
		alert ("Please enter your valid name");
		frm.firstname.focus();frm.firstname.select();
		return;
	}
	//----end name validation----------------------------

/*	if (!validateEmail(frm)){
		return;
	}*/

		if (cutSpaces(email) == "")
		{
			alert("Please enter your Email Address.");
			frm.email.focus();
			flaga = false;
			return;
		}

	if (phone != ""){
/*		alert("Please enter phone number");
		frm.Phone.focus();
		return;
*/
/*
		if (checkInternationalPhone(phone)==false){
			alert("Please Enter a Valid Phone Number")
			frm.Phone.focus();
			return;
		}
*/
		/*
		if (newphonevalidate(frm) == false){
			return;
		}
*/		
	}
	
	frm.action	= "/ack.asp";
	frm.submit();
}

//09/28/2007 called from GoogleMap_Functions_RealEstate.js and ack.asp
//function to redirects to mlslink.asp with parameters.
function SubmitMLSLink(frm){
	//alert("insides bumit mlslink");
	hidTown			= frm.hidTown.value;
	hidStateAbbr	= frm.hidStateAbbr.value;
	hidhidMLSURL	= frm.hidMLSURL.value;

	frm.action	= "/MLSLink.asp";
	frm.submit();
	
}

function ajaxErrorNotification(stateurl)
{  
	var xmlHttp;
	var xmlHttpResponse;
	try
    {    // Firefox, Opera 8.0+, Safari    
		xmlHttp=new XMLHttpRequest();    
	}
	catch (e)
    {    // Internet Explorer    
		try
		{      
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			}
			catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
			}      
		}    
	}
	xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				xmlHttpResponse=xmlHttp.responseText;
			}
		}
	
	url = "SendEmail.asp?stateurl="+stateurl;
    url = dotcomhost + url;
    //alert(url);
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
      
}

//-->