//xml object

function oXML(){
	var oMe = this; //get around the "this" issues
	oMe.xmlhttp = false;
	
	//initiatlize the XMLHttp object
	if( window.XMLHttpRequest ){ //mozilla
		oMe.xmlhttp = new XMLHttpRequest();
		if( typeof(oMe.xmlhttp.overrideMimeType) != 'undefined'){
	  		oMe.xmlhttp.overrideMimeType('text/xml');
		}
	}
	else if( window.ActiveXObject ){ //MS
		oMe.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		alert('Perhaps your browser does not support xmlhttprequests?');
		return;
	}
}
oXML.prototype.request = function(sType, sURL, sData){
	if( "GET"==sType ){ 
		sData = sData + "&IECACHE=" + new Date().getTime(); //add IECACHE=23524632623562534 to the data
		//above commented for now - current server config parses full param string--not RESPONSE object
		sURL = [sURL, sData].join("?"); // add the parameters to the URL -- REST param specifier is / not ?
		this.xmlhttp.open("GET", sURL, true);
		this.xmlhttp.send(null);
	}
	else{
		this.xmlhttp.open("POST", sURL, true);
		this.xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		//this.xmlhttp.setRequestHeader("Content-type", "application/xml");
		this.xmlhttp.setRequestHeader("Content-length", sData.length);
		this.xmlhttp.setRequestHeader("Connection", "close");
//		alert("oxml sending data: " + sData);
		this.xmlhttp.send(sData); //
	}
}

function jsnGET(src){
	var o = document.createElement("script");
	var id = new Date().getTime();
	o.setAttribute("id",id);
	document.body.appendChild(o);
	document.getElementById(id).src = src;
}

function localPOST(sURL, oPARAMS){
	var pf = document.getElementById("postForm");
	pf.innerHTML = ""; //get rid of everything!
	for(var e in o){
		k = document.createElement("<input id=\"" + e + "\" name=\"" + e + "\" value=\"" + o[e] + "\" type=\"hidden\">");
		pf.appendChild(k);
	}
	
	pf.action=sURL;//target is the iframe
	pf.submit();
}

