HxG_6.prototype.HTTPBackchannel=function(id, callback, post, async, iframename, onerror, tryHTTP, inPortal) {
this._Id=id;
this._AppCallback=(typeof callback == 'function')? callback : hX_6.getElementById(callback);
if (onerror) {
this._Onerror=(typeof onerror == 'function')? onerror : hX_6.getElementById(onerror);
} else {
this._Onerror=this.defaultOnError;
}
this._Post=(post == true) ? true : false;
this._Async=(async == true) ? true : false;
this._XmlHttp=null;
this._UseXmlHttp=(tryHTTP!=null && tryHTTP) ? true : (iframename == null);
this._retryXmlHTTP=(tryHTTP!=null && tryHTTP) ? true : false;
this._Iframe=null;
this._IframeName=iframename;
this._AllowCrossDomain=false;
this._Username=this._Password=null;
this._SoapRequest=this._SoapAction=null;
this._extraParam=this._this=null;
this._portal=(inPortal!=null && inPortal)?true:false;
this._timer=this._contentCount=null;
}
HxG_6.prototype.HTTPBackchannel.prototype.setCallback=function(callback) {
this._AppCallback=callback;
}
HxG_6.prototype.HTTPBackchannel.prototype.setPost=function(post) {
this._Post=(post!=null && post) ? true : false;
}
HxG_6.prototype.HTTPBackchannel.prototype.setOnerror=function(onerror) {
this._Onerror=onerror ? onerror : defaultOnError;
}
HxG_6.prototype.HTTPBackchannel.prototype.getXmlHttpRequest=function() {
return this._XmlHttp;
}
HxG_6.prototype.HTTPBackchannel.prototype.setUser=function(user, pwd) {
this._Username=user;
this._Password=pwd;
}
HxG_6.prototype.HTTPBackchannel.prototype.enableCrossDomain=function(allow) {
this._AllowCrossDomain=(allow == true) ? true : false;
}
HxG_6.prototype.HTTPBackchannel.prototype.reset=function() {
if (this._UseXmlHttp && this._XmlHttp) {
if (hX_6.brw.isIE() || (this._XmlHttp.readyState != null && this._XmlHttp.readyState != 0 && this._XmlHttp.readyState != 4)) this._XmlHttp.abort();
}
if (this._timer) {
hX_6.i.killTimerTimed(this._timer);
this._timer=null;
}
}
HxG_6.prototype.HTTPBackchannel.prototype.destroy=function () {
this.reset();
if (this._Iframe) {
this._Iframe.parentNode.removeChild(this.DOMParser);
delete this._Iframe;
}
if (this._XmlHttp) delete this._XmlHttp;
}
HxG_6.prototype.HTTPBackchannel.prototype.LoadEx=function(Url, thisP, ajaxid, ajaxtype, paramN, paramF, FisValue, tgt, sName) {
var i,j,k,l,n,p,v,x, f=null, url=Url, obj=hX_6.getElementById(ajaxid), fl=[], fl1=[], fl2=[];
if (paramN) {
var hit,suff,_AR="$$AJAXROW$$";
for (i=0; i<paramN.length; i++) {
if (FisValue!=null) {
fl.push([paramN[i],paramF[i]]);
} else {
x=(paramF[i]) ? paramF[i] : paramN[i];
if (paramN[i].indexOf(_AR)>=0) {
hit=false;
n=hX_6.replaceAll(paramN[i], _AR, hX_6._E);
x=hX_6.replaceAll(x, _AR, hX_6._E);
while (tgt!=null && tgt.tagName!=undefined && tgt.tagName != hX_6._TR) tgt=tgt.parentNode;
if (tgt!=null && tgt.tagName!=undefined && tgt.tagName==hX_6._TR && tgt.parentNode.tagName==hX_6._TBDY) {
k=x.lastIndexOf(hX_6._CL);
if (k>=0) {
suff=x.substr(k+1);
l=tgt.cells.length;
for (k=0; !hit && k<l; k++) hit=this.checkCell(fl, tgt.cells[k].firstChild, x, suff);
}
}
} else if (hX_6.isValuable(x,true)) {
v=hX_6.getValuableValue(x,true,true);
if (v!=null) {
if (hX_6.isString(v))
fl.push([paramN[i],v]);
else
 for (j=0; j<v.length; j++) fl.push([paramN[i],v[j]]);
}
}
}
}
}
if (ajaxtype && ajaxtype!="axnone") {
if (url.indexOf("$$ajaxmode")<0 && url.indexOf("%24%24ajaxmode")<0) {
fl.push(["$$ajaxmode",ajaxtype]);
fl.push(["$$ajaxid",obj.id]);
}
if (!this._Post && !this._portal) {
var dt=new Date();
fl.push(["$$ajaxTS",dt.getTime()+hX_6._E]);
}
}
if (!this._portal) {
url=url + hX_6.encodeURIParams(url, fl);
delete fl;
fl=[];
}
if (this._Post && obj) {
if (obj.form!=undefined) f=obj.form;
else {
p=obj;
while (p!=null && p.tagName!=undefined && p.tagName!=hX_6._FRM) p=p.parentNode;
f=(p!=null && p.tagName!=undefined && p.tagName==hX_6._FRM)?p:null;
if (f==null) {
p=document.getElementsByTagName(hX_6._FRM);
f=(p && p.length>0) ? p[0] : null;
}
}
if (f) {
var str1="1", str2="Submit", hitSubmit=false;
for (i=0; i<f.elements.length; i++) {
if (i==(f.elements.length-1) || f.elements[i].name!=f.elements[i+1].name) {
p=(fl2[f.elements[i].name]!=null);
for (j=0; !p && j<fl.length; j++) if (fl[j][0].name==f.elements[i].name) p=true;
if (!p) {
v=hX_6.getValuableValue(f.elements[i], true, false);
if (sName!=null && v==null && sName==f.elements[i].name) {
v=str2;
hitSubmit=true;
}
if (v!=null) {
fl2[f.elements[i].name]=str1;
if (hX_6.isString(v))
fl1.push([f.elements[i].name,v]);
else
 for (j=0; j<v.length; j++) fl1.push([f.elements[i].name,v[j]]);
}
}
}
}
if (sName!=null && !hitSubmit) {
var imgs=f.getElementsByTagName(hX_6._INP);
imgs=(imgs.length==undefined)?[imgs]:imgs;
for (j=0; j<imgs.length; j++) {
if (imgs[j].type && imgs[j].type.toLowerCase()==hX_6._lIMG && imgs[j].name && imgs[j].name==sName) {
fl1.push([sName,str2]);
break;
}
}
}
if (fl1.length>0) fl=fl.concat(fl1);
}
}
this.Load(url, null, thisP, null, fl);
delete fl;
delete fl1;
delete fl2;
}
HxG_6.prototype.HTTPBackchannel.prototype.checkCell=function (fl, firstChild, full, suff) {
var hit=false, k, n, shortId, splitId, c=firstChild;
while (!hit && c!=null) {
shortId=hX_6._E;
if (c.id!=undefined) {
splitId=c.id.split(hX_6._CL);
for (k=0; k<splitId.length; k++) {
n=parseInt(splitId[k],10);
if (isNaN(n) || n==null || (splitId[k]!=(n+hX_6._E)))
shortId=shortId + ((shortId.length>0)?hX_6._CL:hX_6._E)+splitId[k];
}
}
if (shortId.length>0 && (shortId==full))  {
fl.push([suff,c.value]);
hit=true;
} else {
if (c.firstChild!=null) hit=this.checkCell(fl, c.firstChild, full, suff);
if (!hit) c=c.nextSibling;
}
}
return hit;
}
HxG_6.prototype.HTTPBackchannel.prototype.Load=function(Url, param, thisp, fieldlist, fieldlistEx) {
this._extraParam=param;
this._this=thisp;
var retry=false, txt, reqString, i, l, v;
if (this._UseXmlHttp) {
if (this._XmlHttp != null) {
if (this._XmlHttp.readyState != 0 && this._XmlHttp.readyState != 4)
this._XmlHttp.abort();
} else {
if (window.XMLHttpRequest) {
try {
if (this._AllowCrossDomain && netscape && netscape.security.PrivilegeManager.enablePrivilege) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (e) {  }
}
this._XmlHttp=new XMLHttpRequest();
} catch(e) {
this._XmlHttp=null;
}
} else if (window.ActiveXObject) {
try {
this._XmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
this._XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
this._XmlHttp=null;
}
}
}
}
if (this._XmlHttp == null) retry=true;
else {
try {
this._XmlHttp.open(((this._Post || this._portal)? "POST" : "GET"), Url, this._Async,
this._Username, this._Username ? this._Password : null);
if (this._Async) {
var localThis=this;
this._XmlHttp.onreadystatechange=function() { localThis.Callback(); };
}
if (this._SoapAction) {
reqString=this._SoapRequest.join(hX_6._E);
this._XmlHttp.setRequestHeader("SOAPAction", this._SoapAction);
this._XmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
this._XmlHttp.send(reqString);
} else {
reqString=hX_6._E;
if (this._Post) {
this._XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
if (fieldlist!=null) {
l=fieldlist.length;
for (i=0; i<l; i++) {
if (fieldlist[i]!=null && fieldlist[i].name!=undefined && fieldlist[i].name.length>0) {
v=hX_6.getValuableValue(fieldlist[i], true, false);
if (v) reqString=reqString + ((reqString.length>0)?hX_6._AMP:hX_6._E) + hX_6.encode(fieldlist[i].name) + hX_6._EQ +  hX_6.encode(v);
}
}
} else if (fieldlistEx!=null) {
l=fieldlistEx.length;
for (i=0; i<l; i++) if (fieldlistEx[i]!=null) reqString=reqString + ((reqString.length>0)?hX_6._AMP:hX_6._E) + hX_6.encode(fieldlistEx[i][0]) + hX_6._EQ +  hX_6.encode(fieldlistEx[i][1]);
}
} else if (this._portal && fieldlistEx!=null) {
this._XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
l=fieldlistEx.length;
for (i=0; i<l; i++) if (fieldlistEx[i]!=null) reqString=reqString + ((reqString.length>0)?hX_6._AMP:hX_6._E) + hX_6.encode(fieldlistEx[i][0]) + hX_6._EQ +  hX_6.encode(fieldlistEx[i][1]);
}
this._XmlHttp.setRequestHeader("Pragma","no-cache");
this._XmlHttp.setRequestHeader("Cache-control","no-cache");
this._XmlHttp.send(reqString);
}
if (this._Async == false) {
this.Callback();
}
} catch (e) {
this._Onerror.call(((this._this!=null)?this._this:this), (e.message == undefined) ? e : e.message);
}
}
}
if (((retry && this._retryXmlHTTP) || (!this._UseXmlHttp))) {
if (this._Iframe==null && null!=this._IframeName) this._Iframe=hX_6.ifr.create(document, this._IframeName, true, false);
if (this._Iframe) { if (this._Post) this.PostIframe(Url); else this.GetIframe(Url) };
}
}
HxG_6.prototype.HTTPBackchannel.prototype.setSoapInfo=function() {
var foo=arguments;
if (arguments.length < 1) {
this._SoapRequest=null;
this._SoapAction=null;
} else {
var nArgs=arguments.length;
if (nArgs % 2 > 0)
nArgs--;
this._SoapAction=arguments[0] + "/" + arguments[1];
var params=" xmlns=\"" + arguments[0] + "\">";
for (var iX=2; iX<nArgs; iX+=2) {
params+=hX_6._LT + arguments[iX] + hX_6._GT
 + arguments[iX+1].toString().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")
+ this._TAGEND + arguments[iX] + hX_6._GT;
}
this._SoapRequest=[this._SOAPSTART, arguments[1], params, this._TAGEND, arguments[1], this._SOAPEND];
this.setPost(true);
}
}
HxG_6.prototype.HTTPBackchannel.prototype.PostIframe=function(Url) {
var myFrameDoc=hX_6.ifr.getDoc(this._Iframe);
var ifrmForm=myFrameDoc.forms[0];
if (null == ifrmForm) {
var myForm=myFrameDoc.createElement("form");
var myBodies=myFrameDoc.getElementsByTagName("body");
ifrmForm=myBodies[0].appendChild(myForm);
}
if (myFrameDoc && ifrmForm) {
var kidcnt=ifrmForm.childNodes.length;
for (var iX=kidcnt-1; iX >= 0; iX--) {
ifrmForm.removeChild(ifrmForm.childNodes[iX]);
}
var urlBase=Url.split('?');
ifrmForm.name="f";
ifrmForm.action=urlBase[0];
ifrmForm.target=this._Iframe.name;
var fldNode=null;
if (urlBase.length > 1) {
var nvPair=null;
var urlParams=urlBase[1].split('&');
for (iX=0; iX < urlParams.length; iX++) {
nvPair=urlParams[iX].split("=");
fldNode=myFrameDoc.createElement(hX_6._INP);
fldNode.type="text";
fldNode.name=nvPair[0];
fldNode.id=nvPair[0];
if (nvPair.length > 1) {
fldNode.value=nvPair[1];
}
ifrmForm.appendChild(fldNode);
}
}
fldNode=myFrameDoc.createElement(hX_6._INP);
fldNode.type="text";
fldNode.name="callback";
fldNode.value=this._Id+".Callback";
ifrmForm.appendChild(fldNode);
var fldBtn=myFrameDoc.createElement(hX_6._INP);
fldBtn.type="submit";
fldBtn.name="submit";
fldBtn.id="submit";
fldBtn.value="input";
ifrmForm.appendChild(fldBtn);
try {
fldBtn.click();
} catch (e) {
alert("ERROR callback URL: "+ ((e.message == undefined) ? e : e.message));
}
}
}
HxG_6.prototype.HTTPBackchannel.prototype.GetIframe=function(Url) {
if (this._timer) {
hX_6.i.killTimerTimed(this._timer);
this._timer=null;
}
try {
this._Iframe.src=Url;
this._contentCount=0;
this._timer=hX_6.i.startObjTimerTimed(this, 0, 25);
} catch (e) {
this._Onerror.call(((this._this!=null)?this._this:this), (e.message == undefined) ? e : e.message);
}
}
HxG_6.prototype.HTTPBackchannel.prototype.dispatchTimer=function(param) {
var ack=false, x=0, v=parseInt(param,10)+1, doc=hX_6.ifr.getDoc(this._Iframe), textContent=null;
this._timer=null;
if (doc) {
if (doc.readyState!=undefined) {
if (doc.readyState.toUpperCase()=="COMPLETE") {
textContent=hX_6.getIHTML(doc.documentElement);
if (textContent.length > 0) ack=true;
}
} else {
if (this._contentCount == 0) {
if (doc.documentElement!=undefined && doc.documentElement.childNodes!=undefined) x+=doc.documentElement.childNodes.length;
if (doc.body!=undefined && doc.body.childNodes!=undefined && doc.body.childNodes.length>0) {
x+=doc.body.childNodes.length;
var q=doc.body.firstChild;
while (q!=null) {
if (q.childNodes!=undefined) x+=q.childNodes.length;
q=q.nextSibling;
}
} else x=0;
this._contentCount=x;
} else {
if (doc.documentElement!=undefined && doc.documentElement.childNodes!=undefined) x+=doc.documentElement.childNodes.length;
if (doc.body!=undefined && doc.body.childNodes!=undefined && doc.body.childNodes.length>0) {
x+=doc.body.childNodes.length;
var q=doc.body.firstChild;
while (q!=null) {
if (q.childNodes!=undefined) x+=q.childNodes.length;
q=q.nextSibling;
}
} else x=0;
if (x==0 || x!=this._contentCount) {
this._contentCount=x;
} else {
textContent=hX_6.getIHTML(doc.documentElement);
if (textContent.length > 0) ack=true;
}
}
}
}
if (ack) {
this._AppCallback.call(((this._this!=null)?this._this:this), null, textContent, this._extraParam);
} else {
if (v < 5)
this._timer=hX_6.i.startObjTimerTimed(this, (v+hX_6._E), 100);
else
 this._Onerror.call(((this._this!=null)?this._this:this), hX_6.INTERR_bc_timeout);
}
}
HxG_6.prototype.HTTPBackchannel.prototype.Callback=function(Success, Data) {
if (this && this._XmlHttp) {
if (this._XmlHttp.readyState != 4 && this._XmlHttp.readyState != 0)
return;
if (this._XmlHttp.readyState == 4 && (this._XmlHttp.status == 200 || this._XmlHttp.status == 0)) {
if (this._AllowCrossDomain && netscape && netscape.security.PrivilegeManager.enablePrivilege) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (e) {};
}
try {
this._AppCallback.call(((this._this!=null)?this._this:this),this._XmlHttp.responseXML, this._XmlHttp.responseText, this._extraParam);
} catch (e) {
this._Onerror.call(((this._this!=null)?this._this:this), (e.message == undefined) ? e : e.message);
}
} else if (this._XmlHttp.status != 0)  {
this._Onerror.call(((this._this!=null)?this._this:this), this._XmlHttp.statusText);
}
}
}
HxG_6.prototype.HTTPBackchannel.prototype.defaultOnError=function(msg) {
window.status=msg;
}
HxG_6.prototype.HTTPBackchannel.prototype._WINDOW="window.";
HxG_6.prototype.HTTPBackchannel.prototype._TAGEND="</";
HxG_6.prototype.HTTPBackchannel.prototype._SOAPSTART="<soap:Envelope \
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' \
xmlns:xsd='http://www.w3.org/2001/XMLSchema' \
xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
<soap:Body><";
HxG_6.prototype.HTTPBackchannel.prototype._SOAPEND="></soap:Body></soap:Envelope>";
