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 _5=quickcontent.requestLog[i][1];
window.open(_5.sUrl.replace(/\/qc/,"/webtraderdb/quickframe/"+Config.sVersion+"/"+Config.iRelease+"/intranet/debug/qc_debug.asp")+"&"+_5.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 _6=this;
Event.observe(window,"unload",function(){
_6._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(_7){
this._iTimeout=_7;
};
quickcontent.Client.prototype.set_bImmortal=function(_8){
this._bImmortal=_8;
};
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(_9){
this._sLoadingText=_9;
};
quickcontent.Client.prototype.set_sServerFunction=function(_a){
this._sServerFunction=_a;
};
quickcontent.Client.prototype.set_oArgs=function(_b){
this._oArgs=_b;
};
quickcontent.Client.prototype.fetchValue=function(_c,_d,_e){
this.ondataparsed=_c;
this.fetch(_d,_e);
};
quickcontent.Client.prototype.fetchArray=function(_f,_10,_11){
this.ondataparsed=_f;
this.fetch(_10,_11);
};
quickcontent.Client.prototype.fetchRaw=function(_12,_13){
this.ondataparsed=_12;
this._bParseRaw=true;
this.fetchUrl(_13);
};
quickcontent.Client.prototype.fetchHash=function(_14,_15,_16){
this.ondataparsed=_14;
this.fetch(_15,_16);
};
quickcontent.Client.prototype.abort=function(){
if(this._oXmlHttpRequest){
var _17=this._oXmlHttpRequest;
_17.onreadystatechange=function(){
};
_17.abort();
this._oXmlHttpRequest=undefined;
this.bExecuting=false;
}
};
quickcontent.Client.prototype.fetchUrl=function(_18,_19){
this.abort();
var _1a=this.get_oXmlHttpRequest();
if(_1a==undefined){
return;
}
if(this._sLoadingText!=undefined){
var _1b=this._oLoadingMessageDomElement;
if(_1b==undefined){
_1b=this._oOutputDomElement;
}
if(_1b!=undefined){
_1b.innerHTML="<span class=\"quickcontentloading\">"+this._sLoadingText+"</span>";
}
}
if(this.requestMethod=="GET"||this.bCacheable){
this.requestMethod="GET";
if(_19!=null){
_18+="&"+_19;
}
}else{
this.requestMethod="POST";
}
var _1c=this;
this.bExecuting=true;
if(this._iTimeout>0){
this._iTimerHandle=setTimeout(function(){
_1c._onTimeout();
},this._iTimeout);
}
var _1d=this.bSynchronous===true?false:true;
_1a.open(this.requestMethod,_18,_1d);
var _1e=function(){
_1c.bExecuting=false;
if(_1c._iTimerHandle!=null){
clearTimeout(_1c._iTimerHandle);
}
if(_1c.ondatacomplete!=undefined){
_1c.ondatacomplete.call(_1c);
}
_1c._onDataComplete();
if(_1c.ondataloaded!=undefined){
_1c.ondataloaded.call(_1c);
}
};
if(this.requestMethod=="POST"){
_1a.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}
if(this.bSynchronous){
_1a.send(_19);
_1e.call();
}else{
_1a.onreadystatechange=function(){
if(_1a.readyState==4){
if(_1a.status==200){
_1e.call();
}
}
};
_1a.send(_19);
}
};
quickcontent.Client.prototype.fetch=function(_1f,_20){
if(_1f!=undefined){
this.set_sServerFunction(_1f);
this.set_oArgs(_20);
}
var _21=this._buildRequest(this._sServerFunction,this._oArgs);
if(quickcontent.bDebug){
quickcontent.requestLog.push([new Date(),_21]);
}
this.fetchUrl(_21.sUrl,_21.sData);
};
quickcontent.Client.prototype.fetchIntoDom=function(_22,_23,_24){
this.set_oOutputDomElement($(_22));
this.set_sDefaultDomElementContent("");
this.fetch(_23,_24);
};
quickcontent.Client.prototype.set_sDefaultDomElementContent=function(_25){
this._sDefaultDomElementContent=_25;
};
quickcontent.Client.prototype.embedPage=function(_26,_27,_28){
this.set_oOutputDomElement(document.getElementById(_26));
this._bParseRaw=true;
this._bExecScriptTags=true;
this.set_sLoadingText(_28);
this.fetchUrl(_27);
};
quickcontent.Client.prototype._execScriptTags=function(_29){
var _2a=this._extractScriptTags(_29);
for(var i=0;i<_2a.length;i++){
eval(_2a[i]);
}
};
quickcontent.Client.prototype._extractScriptTags=function(_2c){
var _2d="(?:<script.*?>)((\n|\r|.)*?)(?:</script>)";
var _2e=new RegExp(_2d,"img");
var _2f=new RegExp(_2d,"im");
var _30=_2c.match(_2e)||[];
for(var i=0;i<_30.length;i++){
_30[i]=(_30[i].match(_2f)||["",""])[1];
}
return _30;
};
quickcontent.Client.prototype._onDataComplete=function(){
var _32;
var _33=this.get_oXmlHttpRequest();
if(this._bParseRaw==true){
_32=_33.responseText;
}else{
if(this.bJsonFormat===true){
try{
var _34=window.JSON&&window.JSON.parse?window.JSON.parse(_33.responseText):eval("x="+_33.responseText);
if(_34.rpc.error!=null){
var _35=_34.rpc.error;
throw new quickcontent.Error(_35.sType,_35.sUserFriendlyMessage,_35.sTechnicalDetails);
}
_32=_34.rpc.result;
}
catch(_35){
if(this.onerror!=undefined){
this.onerror(_35);
}else{
if(quickcontent.Client.onerror!=null){
quickcontent.Client.onerror.call(this,_35);
}else{
this.defaultOnError(_35);
}
}
return;
}
}else{
var _36=this._getQCRootNode(_33.responseXML);
try{
var _37=_36.childNodes;
var _38=_37[_37.length-1];
_32=(new quickcontent.result.Variant(_38)).parse();
}
catch(_35){
if(this.onerror!=undefined){
this.onerror(_35);
}else{
if(quickcontent.Client.onerror!=null){
quickcontent.Client.onerror.call(this,_35);
}else{
this.defaultOnError(_35);
}
}
return;
}
}
}
if(this.ondataparsed!=undefined){
this.ondataparsed.call(this,_32);
}
if(this._oOutputDomElement!=undefined){
if(_32==undefined){
_32=this._sDefaultDomElementContent;
}
if(this.ondataloadedoffscreen!=undefined){
var _39=document.createElement("DIV");
_39.innerHTML=_32;
this.ondataloadedoffscreen.call(this,_39);
_37=_39.childNodes;
var _3a=_37.length;
var _3b=document.createDocumentFragment();
for(var i=_3a;i>0;i--){
_3b.appendChild(_37[i-1]);
}
this._oOutputDomElement.innerHTML="";
this._oOutputDomElement.appendChild(_3b);
}else{
this._oOutputDomElement.innerHTML=_32;
}
}
if(this._bExecScriptTags==true){
this._execScriptTags(_32);
}
if(this.ondataloadedindom!=undefined){
this.ondataloadedindom.call(this);
}
};
quickcontent.Client.prototype.set_oOutputDomElement=function(_3d){
this._oOutputDomElement=_3d;
};
quickcontent.Client.prototype.set_oLoadingMessageDomElement=function(_3e){
this._oLoadingMessageDomElement=_3e;
};
quickcontent.Client.prototype._evaluateXPath=function(_3f,_40){
var _41=_3f.ownerDocument==null?_3f.documentElement:_3f.ownerDocument.documentElement;
var xpe=window.XPathEvaluator?new XPathEvaluator():document;
var _43=xpe.createNSResolver(_41);
var _44=xpe.evaluate(_40,_3f,_43,0,null);
var _45=[];
var res;
while((res=_44.iterateNext())){
_45.push(res);
}
return _45;
};
quickcontent.Client.prototype._getQCRootNode=function(_47){
try{
if(window.XPathEvaluator!==undefined){
return this._evaluateXPath(_47,"//QuickContent")[0];
}else{
return _47.selectSingleNode("//QuickContent");
}
}
catch(oError){
var _48=_47.childNodes;
var i,_4a;
for(i=0;i<_48.length;i++){
_4a=_48[i];
if(_4a.nodeType==1&&_4a.nodeName=="QuickContent"){
return _4a;
}
}
IntexAlert("Failed to find quickcontent node");
return null;
}
};
quickcontent.Client.prototype.get_sServerVersion=function(){
if(quickcontent.sServerVersion==undefined){
var _4b=self;
while(true){
if(_4b.Config!=null&&_4b.Config.sVersion!=null){
quickcontent.sServerVersion=_4b.Config.sVersion;
break;
}else{
if(_4b.document.WebTraderFrm!=undefined&&_4b.document.WebTraderFrm.VER!=undefined){
quickcontent.sServerVersion=_4b.document.WebTraderFrm.VER.value.replace(/^debug/i,"");
break;
}else{
if(_4b.parent==undefined||_4b==top){
break;
}
_4b=_4b.parent;
}
}
}
}
return quickcontent.sServerVersion;
};
quickcontent.get_sSessionKey=function(){
if(quickcontent.sSessionKey==undefined){
var _4c=self;
while(true){
if(_4c.document.WebTraderFrm!=undefined&&_4c.document.WebTraderFrm.SESSION_KEY!=undefined){
quickcontent.sSessionKey=_4c.document.WebTraderFrm.SESSION_KEY.value;
break;
}else{
if(_4c.parent==undefined||_4c==top){
break;
}
_4c=_4c.parent;
}
}
}
return quickcontent.sSessionKey;
};
quickcontent.Client.prototype._buildRequest=function(_4d,_4e){
var _4f=new Object();
_4f.sUrl="/qc?function="+escape(_4d);
var _50=this.get_sServerVersion();
var _51=quickcontent.get_sSessionKey();
if(_51==undefined){
_51="";
}
_4f.sData="version="+escape(_50)+"&SESSION_KEY="+escape(_51)+"&cmid="+escape(SessionData.get("cmid"));
if(this.bJsonFormat===true){
_4f.sData+="&sFormat=json";
}
if(_4e!=undefined){
for(var _52 in _4e){
if(_52!=null&&_52!=""&&_52!="version"&&_52!="SESSION_KEY"&&_52!="cmid"&&_52!="function"){
var _53=_4e[_52];
if(typeof _53=="object"&&(_53==null||_53.nodeName==null)){
_52="_[object]"+_52;
_53=JsonParser.toJsonString(_53);
}else{
if(typeof _53=="boolean"){
_53=_53?1:0;
}
}
_4f.sData+="&"+escape(_52)+"="+escape(_53);
}
}
}
_4f.sData=_4f.sData.replace(/\+/g,"%2B");
return _4f;
};
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(_54){
if(_54 instanceof quickcontent.Error){
if(_54.sUserFriendlyMessage==undefined){
if(this.sDefaultErrorMessage!=null){
IntexAlert(this.sDefaultErrorMessage);
}else{
IntexAlert("The server returned an unknown error.  Error Code: QC621");
}
}else{
IntexAlert(_54.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(_55){
this._oXMLPageNode=_55;
},parse:function(){
var _56=this._oXMLPageNode;
var _57=_56.childNodes[0].nodeValue;
var _58=undefined;
var _59;
for(var i=0;i<_56.attributes.length;i++){
if(_56.attributes[i].name=="stylesheet"){
var _5b=_56.attributes[i].value;
if(document.implementation.hasFeature("XPath","3.0")){
var _5c=new XSLTProcessor();
var _5d=document.implementation.createDocument("","",null);
if(_5d.load==null){
var _5e=new window.XMLHttpRequest();
_5e.open("GET",_5b,false);
_5e.send(null);
_5d=_5e.responseXML.documentElement;
}else{
_5d.async=false;
_5d.load(_5b);
}
_5c.importStylesheet(_5d);
var _5f=new DOMParser();
_59=_5f.parseFromString(_57,"text/xml");
var _60=_5c.transformToDocument(_59);
var _61=new XMLSerializer();
_58=_61.serializeToString(_60);
}else{
_59=new ActiveXObject("Microsoft.XMLDOM");
_59.async=false;
_59.loadXML(_57);
var _62=new ActiveXObject("Microsoft.XMLDOM");
_62.async=false;
_62.load(_5b);
_58=_59.transformNode(_62);
}
}
}
if(_58==undefined){
return _57;
}else{
return _58;
}
}};
quickcontent.result.HTMLPage=Class.create();
quickcontent.result.HTMLPage.prototype={initialize:function(_63){
this._oHTMLPageNode=_63;
},parse:function(){
var _64=this._oHTMLPageNode;
for(var i=1;_64.childNodes[i];i++){
_64.childNodes[0].nodeValue+=_64.childNodes[i].nodeValue;
}
return _64.childNodes[0].nodeValue;
}};
quickcontent.result.Array=Class.create();
quickcontent.result.Array.prototype={initialize:function(_66){
this._oXMLNode=_66;
},parse:function(){
var _67=this._oXMLNode;
var _68=new Array();
for(var i=0;i<_67.childNodes.length;i++){
var _6a=_67.childNodes[i];
var _6b=(new quickcontent.result.Variant(_6a.childNodes[0])).parse();
_68.push(_6b);
}
return _68;
}};
quickcontent.result.Hash=Class.create();
quickcontent.result.Hash.prototype={initialize:function(_6c){
this._oXMLNode=_6c;
},parse:function(){
var _6d=this._oXMLNode;
var _6e=new Object();
for(var i=0;i<_6d.childNodes.length;i++){
var _70=_6d.childNodes[i];
var _71=_70.getAttribute("key");
var _72=_70.childNodes;
if(_72.length>0){
_6e[_71]=(new quickcontent.result.Variant(_70.childNodes[0])).parse();
}else{
_6e[_71]=undefined;
}
}
return _6e;
}};
quickcontent.result.String=Class.create();
quickcontent.result.String.prototype={initialize:function(_73){
this._oXMLNode=_73;
},parse:function(){
var _74=this._oXMLNode;
var _75=XB.xmlNodeInnerText(_74);
if(_75==null){
return "";
}
return _75;
}};
quickcontent.result.Boolean=Class.create();
quickcontent.result.Boolean.prototype={initialize:function(_76){
this._oXMLNode=_76;
},parse:function(){
return (this._oXMLNode.firstChild.nodeName=="true")?true:false;
}};
quickcontent.result.Number=Class.create();
quickcontent.result.Number.prototype={initialize:function(_77){
this._oXMLNode=_77;
},parse:function(){
var _78=this._oXMLNode;
return XB.xmlNodeInnerText(_78);
}};
quickcontent.result.Variant=Class.create();
quickcontent.result.Variant.prototype={initialize:function(_79){
this._oXMLNode=_79;
},parse:function(){
var _7a=this._oXMLNode;
switch(_7a.nodeName){
case "HTMLPage":
return (new quickcontent.result.HTMLPage(_7a)).parse();
break;
case "XMLPage":
return (new quickcontent.result.XMLPage(_7a)).parse();
break;
case "Array":
return (new quickcontent.result.Array(_7a)).parse();
break;
case "Hash":
return (new quickcontent.result.Hash(_7a)).parse();
break;
case "String":
return (new quickcontent.result.String(_7a)).parse();
break;
case "Boolean":
return (new quickcontent.result.Boolean(_7a)).parse();
break;
case "Number":
return (new quickcontent.result.Number(_7a)).parse();
break;
case "Null":
return undefined;
break;
case "Error":
var _7b=(new quickcontent.result.Error(_7a)).parse();
var _7c=XB.xmlNodeInnerText(_7a.text);
throw _7b;
default:
return null;
}
return null;
}};
quickcontent.result.Error=Class.create();
quickcontent.result.Error.prototype={initialize:function(_7d){
this._oErrorNode=_7d;
},parse:function(){
var _7e=this._oErrorNode;
var _7f=_7e.getAttribute("type");
var _80;
var _81;
for(var i=0;i<_7e.childNodes.length;i++){
var _83=_7e.childNodes[i];
if(_83.nodeName=="UserFriendlyMessage"){
_80=XB.xmlNodeInnerText(_83);
}else{
if(_83.nodeName=="TechnicalDetails"){
_81=XB.xmlNodeInnerText(_83);
}
}
}
return new quickcontent.Error(_7f,_80,_81);
}};
quickcontent.Error=Class.create();
quickcontent.Error.prototype={initialize:function(_84,_85,_86){
this.sType=this.name=_84;
this.sUserFriendlyMessage=_85;
this.sTechnicalDetails=_86;
}};

