var quickcontent=new Object();
var qc=quickcontent;
quickcontent.sServerVersion=undefined;
quickcontent.sSessionKey=undefined;
quickcontent.requestLog=[];
quickcontent.bDebug=true;
if(quickcontent.bDebug){
Event.observe(window,"load",function(){
var _1=function(_2){
if(String.fromCharCode(_2.keyCode)=="D"&&_2.ctrlKey&&_2.altKey){
var _3=quickcontent.requestLog.length;
for(var i=0;i<_3;i++){
var _4=quickcontent.requestLog[i][1];
window.open(_4.sUrl.replace(/\/qc/,"/webtraderdb/quickframe/"+Config.sVersion+"/"+Config.iRelease+"/intranet/debug/qc_debug.asp")+"&"+_4.sData,SessionData.getWindowName(),"height=600,width=800,resizable=yes");
}
return false;
}
return null;
};
Event.observe(document,"keyup",_1);
Event.observe(document.body,"keyup",_1);
});
}
quickcontent.Client=function(){
if(!this.browserSupported()){
throw Error("Browser not supported by QuickContent");
}
this._oXmlHttpRequest=undefined;
this.bExecuting=false;
this._bParseRaw=false;
this._bExecScriptTags=false;
this._sLastError=undefined;
this.bCacheable=false;
this.bJsonFormat=false;
this._sLoadingText=undefined;
this.ondatacomplete=undefined;
this.ondataparsed=undefined;
this.ondataloadedoffscreen=undefined;
this.ondataloadedindom=undefined;
this.onbeforecleanup=undefined;
this.onaftercleanup=undefined;
this.onerror=undefined;
this.ontimeout=undefined;
this._iTimeout=-1;
this._bImmortal=false;
var _5=this;
Event.observe(window,"unload",function(){
_5._cleanup();
});
};
quickcontent.Client.prototype._onTimeout=function(){
if(this.bExecuting&&this.ontimeout!=null){
if(this.ontimeout(this)===false){
return;
}
}
this.abort();
};
quickcontent.Client.prototype.set_iTimeout=function(_6){
this._iTimeout=_6;
};
quickcontent.Client.prototype.set_bImmortal=function(_7){
this._bImmortal=_7;
};
quickcontent.Client.prototype._cleanup=function(){
if(this.onbeforecleanup!=undefined){
this.onbeforecleanup.call(this);
}
if(!this._bImmortal){
this.abort();
}
if(this.onaftercleanup!=undefined){
this.onaftercleanup.call(this);
}
};
quickcontent.Client.prototype.browserSupported=function(){
if(document.implementation&&document.implementation.hasFeature){
return true;
}else{
return false;
}
};
quickcontent.Client.prototype.set_sLoadingText=function(_8){
this._sLoadingText=_8;
};
quickcontent.Client.prototype.set_sServerFunction=function(_9){
this._sServerFunction=_9;
};
quickcontent.Client.prototype.set_oArgs=function(_a){
this._oArgs=_a;
};
quickcontent.Client.prototype.fetchValue=function(_b,_c,_d){
this.ondataparsed=_b;
this.fetch(_c,_d);
};
quickcontent.Client.prototype.fetchArray=function(_e,_f,_10){
this.ondataparsed=_e;
this.fetch(_f,_10);
};
quickcontent.Client.prototype.fetchRaw=function(_11,_12){
this.ondataparsed=_11;
this._bParseRaw=true;
this.fetchUrl(_12);
};
quickcontent.Client.prototype.fetchHash=function(_13,_14,_15){
this.ondataparsed=_13;
this.fetch(_14,_15);
};
quickcontent.Client.prototype.abort=function(){
if(this._oXmlHttpRequest){
var _16=this._oXmlHttpRequest;
_16.onreadystatechange=function(){
};
_16.abort();
this._oXmlHttpRequest=undefined;
this.bExecuting=false;
}
};
quickcontent.Client.prototype.fetchUrl=function(_17,_18){
this.abort();
var _19=this.get_oXmlHttpRequest();
if(_19==undefined){
return;
}
if(this._sLoadingText!=undefined){
var _1a=this._oLoadingMessageDomElement;
if(_1a==undefined){
_1a=this._oOutputDomElement;
}
if(_1a!=undefined){
_1a.innerHTML="<span class=\"quickcontentloading\">"+this._sLoadingText+"</span>";
}
}
if(this.requestMethod=="GET"||this.bCacheable){
this.requestMethod="GET";
if(_18!=null){
_17+="&"+_18;
}
}else{
this.requestMethod="POST";
}
var _1b=this;
this.bExecuting=true;
if(this._iTimeout>0){
this._iTimerHandle=setTimeout(function(){
_1b._onTimeout();
},this._iTimeout);
}
var _1c=this.bSynchronous===true?false:true;
_19.open(this.requestMethod,_17,_1c);
var _1d=function(){
_1b.bExecuting=false;
if(_1b._iTimerHandle!=null){
clearTimeout(_1b._iTimerHandle);
}
if(_1b.ondatacomplete!=undefined){
_1b.ondatacomplete.call(_1b);
}
_1b._onDataComplete();
if(_1b.ondataloaded!=undefined){
_1b.ondataloaded.call(_1b);
}
};
if(this.requestMethod=="POST"){
_19.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}
if(this.bSynchronous){
_19.send(_18);
_1d.call();
}else{
_19.onreadystatechange=function(){
if(_19.readyState==4){
if(_19.status==200){
_1d.call();
}
}
};
_19.send(_18);
}
};
quickcontent.Client.prototype.fetch=function(_1e,_1f){
if(_1e!=undefined){
this.set_sServerFunction(_1e);
this.set_oArgs(_1f);
}
var _20=this._buildRequest(this._sServerFunction,this._oArgs);
if(quickcontent.bDebug){
quickcontent.requestLog.push([new Date(),_20]);
}
this.fetchUrl(_20.sUrl,_20.sData);
};
quickcontent.Client.prototype.fetchIntoDom=function(_21,_22,_23){
this.set_oOutputDomElement($(_21));
this.set_sDefaultDomElementContent("");
this.fetch(_22,_23);
};
quickcontent.Client.prototype.set_sDefaultDomElementContent=function(_24){
this._sDefaultDomElementContent=_24;
};
quickcontent.Client.prototype.embedPage=function(_25,_26,_27){
this.set_oOutputDomElement(document.getElementById(_25));
this._bParseRaw=true;
this._bExecScriptTags=true;
this.set_sLoadingText(_27);
this.fetchUrl(_26);
};
quickcontent.Client.prototype._execScriptTags=function(_28){
var _29=this._extractScriptTags(_28);
for(var i=0;i<_29.length;i++){
eval(_29[i]);
}
};
quickcontent.Client.prototype._extractScriptTags=function(_2a){
var _2b="(?:<script.*?>)((\n|\r|.)*?)(?:</script>)";
var _2c=new RegExp(_2b,"img");
var _2d=new RegExp(_2b,"im");
var _2e=_2a.match(_2c)||[];
for(var i=0;i<_2e.length;i++){
_2e[i]=(_2e[i].match(_2d)||["",""])[1];
}
return _2e;
};
quickcontent.Client.prototype._onDataComplete=function(){
var _2f;
var _30=this.get_oXmlHttpRequest();
if(this._bParseRaw==true){
_2f=_30.responseText;
}else{
if(this.bJsonFormat===true){
try{
var _31=window.JSON&&window.JSON.parse?window.JSON.parse(_30.responseText):eval("x="+_30.responseText);
if(_31.rpc.error!=null){
var _32=_31.rpc.error;
throw new quickcontent.Error(_32.sType,_32.sUserFriendlyMessage,_32.sTechnicalDetails);
}
_2f=_31.rpc.result;
}
catch(_32){
if(this.onerror!=undefined){
this.onerror(_32);
}else{
if(quickcontent.Client.onerror!=null){
quickcontent.Client.onerror.call(this,_32);
}else{
this.defaultOnError(_32);
}
}
return;
}
}else{
var _33=this._getQCRootNode(_30.responseXML);
try{
var _34=_33.childNodes;
var _35=_34[_34.length-1];
_2f=(new quickcontent.result.Variant(_35)).parse();
}
catch(_32){
if(this.onerror!=undefined){
this.onerror(_32);
}else{
if(quickcontent.Client.onerror!=null){
quickcontent.Client.onerror.call(this,_32);
}else{
this.defaultOnError(_32);
}
}
return;
}
}
}
if(this.ondataparsed!=undefined){
this.ondataparsed.call(this,_2f);
}
if(this._oOutputDomElement!=undefined){
if(_2f==undefined){
_2f=this._sDefaultDomElementContent;
}
if(this.ondataloadedoffscreen!=undefined){
var _36=document.createElement("DIV");
_36.innerHTML=_2f;
this.ondataloadedoffscreen.call(this,_36);
_34=_36.childNodes;
var _37=_34.length;
var _38=document.createDocumentFragment();
for(var i=_37;i>0;i--){
_38.appendChild(_34[i-1]);
}
this._oOutputDomElement.innerHTML="";
this._oOutputDomElement.appendChild(_38);
}else{
this._oOutputDomElement.innerHTML=_2f;
}
}
if(this._bExecScriptTags==true){
this._execScriptTags(_2f);
}
if(this.ondataloadedindom!=undefined){
this.ondataloadedindom.call(this);
}
};
quickcontent.Client.prototype.set_oOutputDomElement=function(_39){
this._oOutputDomElement=_39;
};
quickcontent.Client.prototype.set_oLoadingMessageDomElement=function(_3a){
this._oLoadingMessageDomElement=_3a;
};
quickcontent.Client.prototype._evaluateXPath=function(_3b,_3c){
var _3d=_3b.ownerDocument==null?_3b.documentElement:_3b.ownerDocument.documentElement;
var xpe=window.XPathEvaluator?new XPathEvaluator():document;
var _3e=xpe.createNSResolver(_3d);
var _3f=xpe.evaluate(_3c,_3b,_3e,0,null);
var _40=[];
var res;
while((res=_3f.iterateNext())){
_40.push(res);
}
return _40;
};
quickcontent.Client.prototype._getQCRootNode=function(_41){
try{
if(window.XPathEvaluator!==undefined){
return this._evaluateXPath(_41,"//QuickContent")[0];
}else{
return _41.selectSingleNode("//QuickContent");
}
}
catch(oError){
var _42=_41.childNodes;
var i,_43;
for(i=0;i<_42.length;i++){
_43=_42[i];
if(_43.nodeType==1&&_43.nodeName=="QuickContent"){
return _43;
}
}
IntexAlert("Failed to find quickcontent node");
return null;
}
};
quickcontent.Client.prototype.get_sServerVersion=function(){
if(quickcontent.sServerVersion==undefined){
var _44=self;
while(true){
if(_44.Config!=null&&_44.Config.sVersion!=null){
quickcontent.sServerVersion=_44.Config.sVersion;
break;
}else{
if(_44.document.WebTraderFrm!=undefined&&_44.document.WebTraderFrm.VER!=undefined){
quickcontent.sServerVersion=_44.document.WebTraderFrm.VER.value.replace(/^debug/i,"");
break;
}else{
if(_44.parent==undefined||_44==top){
break;
}
_44=_44.parent;
}
}
}
}
return quickcontent.sServerVersion;
};
quickcontent.get_sSessionKey=function(){
if(quickcontent.sSessionKey==undefined){
var _45=self;
while(true){
if(_45.document.WebTraderFrm!=undefined&&_45.document.WebTraderFrm.SESSION_KEY!=undefined){
quickcontent.sSessionKey=_45.document.WebTraderFrm.SESSION_KEY.value;
break;
}else{
if(_45.parent==undefined||_45==top){
break;
}
_45=_45.parent;
}
}
}
return quickcontent.sSessionKey;
};
quickcontent.Client.prototype._buildRequest=function(_46,_47){
var _48=new Object();
_48.sUrl="/qc?function="+escape(_46);
var _49=this.get_sServerVersion();
var _4a=quickcontent.get_sSessionKey();
if(_4a==undefined){
_4a="";
}
_48.sData="version="+escape(_49)+"&SESSION_KEY="+escape(_4a)+"&cmid="+escape(SessionData.get("cmid"));
if(this.bJsonFormat===true){
_48.sData+="&sFormat=json";
}
if(_47!=undefined){
for(var _4b in _47){
if(_4b!=null&&_4b!=""&&_4b!="version"&&_4b!="SESSION_KEY"&&_4b!="cmid"&&_4b!="function"){
var _4c=_47[_4b];
if(typeof _4c=="object"&&(_4c==null||_4c.nodeName==null)){
_4b="_[object]"+_4b;
_4c=JsonParser.toJsonString(_4c);
}else{
if(typeof _4c=="boolean"){
_4c=_4c?1:0;
}
}
_48.sData+="&"+escape(_4b)+"="+escape(_4c);
}
}
}
_48.sData=_48.sData.replace(/\+/g,"%2B");
return _48;
};
quickcontent.Client.prototype.get_oXmlHttpRequest=function(){
if(this._oXmlHttpRequest==undefined){
try{
if(window.XMLHttpRequest){
this._oXmlHttpRequest=new XMLHttpRequest();
}else{
if(window.ActiveXObject){
this._oXmlHttpRequest=new ActiveXObject("Microsoft.XMLHTTP");
}
}
}
catch(oError){
IntexAlert("Your browser is missing a required feature for INTEXnet called \"XmlHttpRequest\".\nYou may enable this feature in IE by going to Tools | Internet Options.\nClick on the \"Security\" tab, and click the \"Custom Level\" button.\nUnder \"Script ActiveX controls marked safe for scripting\", select \"Enable\" and then click okay on all the dialog windows.\nIf you do not have access to these settings in IE, please talk to your IT department, or use Firefox instead.\nFirefox is available from http://www.getfirefox.com/");
}
}
return this._oXmlHttpRequest;
};
quickcontent.Client.prototype.defaultOnError=function(_4d){
if(_4d instanceof quickcontent.Error){
if(_4d.sUserFriendlyMessage==undefined){
if(this.sDefaultErrorMessage!=null){
IntexAlert(this.sDefaultErrorMessage);
}else{
IntexAlert("The server returned an unknown error.  Error Code: QC621");
}
}else{
IntexAlert(_4d.sUserFriendlyMessage);
}
if(Config.iDebugLevel>=Debug.LEVEL_ERROR){
IntexAlert("QuickContent Error: "+sTechnicalDetails);
}
}
};
quickcontent.result=new Object();
quickcontent.result.XMLPage=Class.create();
quickcontent.result.XMLPage.prototype={initialize:function(_4e){
this._oXMLPageNode=_4e;
},parse:function(){
var _4f=this._oXMLPageNode;
var _50=_4f.childNodes[0].nodeValue;
var _51=undefined;
var _52;
for(var i=0;i<_4f.attributes.length;i++){
if(_4f.attributes[i].name=="stylesheet"){
var _53=_4f.attributes[i].value;
if(document.implementation.hasFeature("XPath","3.0")){
var _54=new XSLTProcessor();
var _55=document.implementation.createDocument("","",null);
if(_55.load==null){
var _56=new window.XMLHttpRequest();
_56.open("GET",_53,false);
_56.send(null);
_55=_56.responseXML.documentElement;
}else{
_55.async=false;
_55.load(_53);
}
_54.importStylesheet(_55);
var _57=new DOMParser();
_52=_57.parseFromString(_50,"text/xml");
var _58=_54.transformToDocument(_52);
var _59=new XMLSerializer();
_51=_59.serializeToString(_58);
}else{
_52=new ActiveXObject("Microsoft.XMLDOM");
_52.async=false;
_52.loadXML(_50);
var _5a=new ActiveXObject("Microsoft.XMLDOM");
_5a.async=false;
_5a.load(_53);
_51=_52.transformNode(_5a);
}
}
}
if(_51==undefined){
return _50;
}else{
return _51;
}
}};
quickcontent.result.HTMLPage=Class.create();
quickcontent.result.HTMLPage.prototype={initialize:function(_5b){
this._oHTMLPageNode=_5b;
},parse:function(){
var _5c=this._oHTMLPageNode;
for(var i=1;_5c.childNodes[i];i++){
_5c.childNodes[0].nodeValue+=_5c.childNodes[i].nodeValue;
}
return _5c.childNodes[0].nodeValue;
}};
quickcontent.result.Array=Class.create();
quickcontent.result.Array.prototype={initialize:function(_5d){
this._oXMLNode=_5d;
},parse:function(){
var _5e=this._oXMLNode;
var _5f=new Array();
for(var i=0;i<_5e.childNodes.length;i++){
var _60=_5e.childNodes[i];
var _61=(new quickcontent.result.Variant(_60.childNodes[0])).parse();
_5f.push(_61);
}
return _5f;
}};
quickcontent.result.Hash=Class.create();
quickcontent.result.Hash.prototype={initialize:function(_62){
this._oXMLNode=_62;
},parse:function(){
var _63=this._oXMLNode;
var _64=new Object();
for(var i=0;i<_63.childNodes.length;i++){
var _65=_63.childNodes[i];
var _66=_65.getAttribute("key");
var _67=_65.childNodes;
if(_67.length>0){
_64[_66]=(new quickcontent.result.Variant(_65.childNodes[0])).parse();
}else{
_64[_66]=undefined;
}
}
return _64;
}};
quickcontent.result.String=Class.create();
quickcontent.result.String.prototype={initialize:function(_68){
this._oXMLNode=_68;
},parse:function(){
var _69=this._oXMLNode;
var _6a=XB.xmlNodeInnerText(_69);
if(_6a==null){
return "";
}
return _6a;
}};
quickcontent.result.Boolean=Class.create();
quickcontent.result.Boolean.prototype={initialize:function(_6b){
this._oXMLNode=_6b;
},parse:function(){
return (this._oXMLNode.firstChild.nodeName=="true")?true:false;
}};
quickcontent.result.Number=Class.create();
quickcontent.result.Number.prototype={initialize:function(_6c){
this._oXMLNode=_6c;
},parse:function(){
var _6d=this._oXMLNode;
return XB.xmlNodeInnerText(_6d);
}};
quickcontent.result.Variant=Class.create();
quickcontent.result.Variant.prototype={initialize:function(_6e){
this._oXMLNode=_6e;
},parse:function(){
var _6f=this._oXMLNode;
switch(_6f.nodeName){
case "HTMLPage":
return (new quickcontent.result.HTMLPage(_6f)).parse();
break;
case "XMLPage":
return (new quickcontent.result.XMLPage(_6f)).parse();
break;
case "Array":
return (new quickcontent.result.Array(_6f)).parse();
break;
case "Hash":
return (new quickcontent.result.Hash(_6f)).parse();
break;
case "String":
return (new quickcontent.result.String(_6f)).parse();
break;
case "Boolean":
return (new quickcontent.result.Boolean(_6f)).parse();
break;
case "Number":
return (new quickcontent.result.Number(_6f)).parse();
break;
case "Null":
return undefined;
break;
case "Error":
var _70=(new quickcontent.result.Error(_6f)).parse();
var _71=XB.xmlNodeInnerText(_6f.text);
throw _70;
default:
return null;
}
return null;
}};
quickcontent.result.Error=Class.create();
quickcontent.result.Error.prototype={initialize:function(_72){
this._oErrorNode=_72;
},parse:function(){
var _73=this._oErrorNode;
var _74=_73.getAttribute("type");
var _75;
var _76;
for(var i=0;i<_73.childNodes.length;i++){
var _77=_73.childNodes[i];
if(_77.nodeName=="UserFriendlyMessage"){
_75=XB.xmlNodeInnerText(_77);
}else{
if(_77.nodeName=="TechnicalDetails"){
_76=XB.xmlNodeInnerText(_77);
}
}
}
return new quickcontent.Error(_74,_75,_76);
}};
quickcontent.Error=Class.create();
quickcontent.Error.prototype={initialize:function(_78,_79,_7a){
this.sType=this.name=_78;
this.sUserFriendlyMessage=_79;
this.sTechnicalDetails=_7a;
}};


