// rawAjax.js - pull html from server and put it into an innerHTML

// open xmlhttp connection
// thanx to www.jibbering.com

var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
   try {
     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (E) {
     xmlhttp = false;
   }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}


// lookup - put result into innerHTML (typically span)
function rawAjax( p_id, p_url ) {
	//-alert( "url:" + p_url );
	xmlhttp.open("GET",p_url);
	xmlhttp.onreadystatechange=function() {
		if( xmlhttp.readyState==4 ) {
			v_result = xmlhttp.responseText;
			//-alert( "xmlhttp result: "+v_result );
			if( v_result.substr(0,6) == 'ERROR:' || v_result.substr(0,6) == 'ALERT:' ) {
				alert( v_result );
				document.getElementById(p_id).innerHTML = '';
			}
			else { 
				// into innerHTML
				document.getElementById(p_id).innerHTML = v_result;
			}
		}
	}
	xmlhttp.setRequestHeader('Accept','message/x-jl-formresult');
	xmlhttp.send(null);
}

