var httpRequest = null;
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    httpRequest = new XMLHttpRequest();
	    if (httpRequest.overrideMimeType) { // start if
	    httpRequest.overrideMimeType('text/xml');
	    // See note below about this line
	   } // end if overrideMimeType
	} // end if XMLHttpRequest
	else if (window.ActiveXObject) { // IE
	try {
		httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} // end try Msxml2 ActiveXObject
		catch (e) {
				try {
					httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
					} // end try Microsoft ActiveXObject
					catch (e) {}
				  } // end catch
	} // end else if
	if (!httpRequest) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
	} // end if !httpRequest


function lookuprep()
   {

   		var sidval = document.getElementById("sid").selectedIndex;
   		var stateval = document.getElementById("state").value;

	if( (sidval>=1) && (stateval != "" )) {
        var url = "http://www.hero247.com/getRep.php?sid="+sidval+"&state="+stateval;
	// 	alert('sidval= '+sidval+'  stateval= '+stateval+'  url= '+url);
         httpRequest.open("GET", url, true);
         httpRequest.onreadystatechange = processOPTIONSfromXML;
         httpRequest.send(null);
	}
   }
function processOPTIONSfromXML()
   {
     if (httpRequest.readyState == 4) {
      if (httpRequest.status == 200) {
		var xmldoc = httpRequest.responseXML;
		var root_node = xmldoc.getElementsByTagName('root').item(0);
		var emailin = xmldoc.getElementsByTagName('email')[0].firstChild.nodeValue;
		//	alert('email= '+emailin);
		var showemail = '<a href="mailto:'+emailin+'?subject=Hero247 Logo Request&body=Hero247 New Logo Request %0A%0Ainclude the following information %0A   Company %0A   Contact %0A   Address %0A   City St Zip %0A   Phone %0A%0ARemember to attach your image to this email %0A">'+emailin+'</a>';
		document.getElementById("repemail").innerHTML = showemail;
		} else {
   		var message = httpRequest.getResponseHeader("Status");
   		if ((message.length == null) || (message.length <= 0)) {
   		alert("Error! Request status is " + httpRequest.status);
   	} else {
   	alert(message);
   	}
     }
    }
}