// ---------------------// AJAX HTTP REQUEST// ---------------------// global flagsvar isIE = false;var xmlaction = "";// global request and XML document objectsvar req;// retrieve XML document (reusable generic function);// parameter is URL string (relative or complete) to// an .xml file whose Content-Type is a valid XML// type, such as text/xml; XML source must be from// same domain as HTML filefunction loadXMLDoc(url) {    // branch for native XMLHttpRequest object    if (window.XMLHttpRequest) {        req = new XMLHttpRequest();        req.onreadystatechange = processReqChange;        req.open("GET", url, true);        req.send(null);    // branch for IE/Windows ActiveX version    } else if (window.ActiveXObject) {        isIE = true;        req = new ActiveXObject("Microsoft.XMLHTTP");        if (req) {            req.onreadystatechange = processReqChange;            req.open("GET", url, true);            req.send();        }    }}function loadXMLDocPost(url,content) {      if (window.XMLHttpRequest) {        req = new XMLHttpRequest();        req.onreadystatechange = processReqChange;		req.open("POST", url, true);		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");        req.send(content);    // branch for IE/Windows ActiveX version    } else if (window.ActiveXObject) {        isIE = true;        req = new ActiveXObject("Microsoft.XMLHTTP");        if (req) {            req.onreadystatechange = processReqChange;			req.open("POST", url, true);			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");            req.send(content);        }    }}function processReqChange() {	if (req.readyState == 4) {        // only if "OK"        if (req.status == 200) {			// What to do on successful return of data			results = req.responseText            xml_response_do(results)        		 } else {           // alert("There was a problem retrieving the XML data:\n" +           //    req.responseText);         }    }}function xml_response_do(results){		// Nothing...	//alert(results);	}function record_visit(pipid){		if(pipid){		// Load the Content		var urlis = "http://www.jpking.com/inc/rec_pip.asp?pip_id="+pipid;		var contentis = "pip_id="+URLEncode(pipid);		//loadXMLDocPost(urlis,contentis);		loadXMLDoc(urlis);	}}function URLEncode(valueis){	// The Javascript escape and unescape functions do not correspond	// with what browsers actually do...	var SAFECHARS = "0123456789" +					// Numeric					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic					"abcdefghijklmnopqrstuvwxyz" +					"-_.!~*'()";					// RFC2396 Mark characters	var HEX = "0123456789ABCDEF";	var plaintext = valueis;	var encoded = "";	for (var i = 0; i < plaintext.length; i++ ) {		var ch = plaintext.charAt(i);	    if (ch == " ") {		    encoded += "+";				// x-www-urlencoded, rather than %20		} else if (SAFECHARS.indexOf(ch) != -1) {		    encoded += ch;		} else {		    var charCode = ch.charCodeAt(0);			if (charCode > 255) {			    alert( "Unicode Character '"                         + ch                         + "' cannot be encoded using standard URL encoding.\n" +				          "(URL encoding only supports 8-bit characters.)\n" +						  "A space (+) will be substituted." );				encoded += "+";			} else {				encoded += "%";				encoded += HEX.charAt((charCode >> 4) & 0xF);				encoded += HEX.charAt(charCode & 0xF);			}		}	} // for	return encoded;};// Run the Record Visit//window.onload = record_visit(111);
