var qcDetectorInstalled=0;var isIE="false";var qcInstalled=0;var redirectTo="";var m_installDiv=false;var divGenerated=false;function init(){qcDetector.init()}function initConsoleForSafari(){var a=/Safari/}function getQCDetector(){initConsoleForSafari();console.log("BrowserDetect.OS="+BrowserDetect.OS+" Identity="+BrowserDetect.browser);if(BrowserDetect.OS=="Windows"&&BrowserDetect.browser=="Explorer"){return new ActiveXDetector(redirectTo)}else{return new JavaDetector(redirectTo)}}function IDetectorListener(){this.onDetectionComplete=function(a){};this.onDetectionFailed=function(a){};this.onInstallStart=function(){};this.onInstallSuccess=function(){};this.onInstallFailed=function(){}}function mergeObjects(c,b){for(var a in b){c[a]=b[a]}}function DefaultDetectorListener(){}DefaultDetectorListener.prototype=new IDetectorListener();mergeObjects(DefaultDetectorListener.prototype,{onDetectionFailed:function(a){},onDetectionComplete:function(a){if(a){hideDiv("divContents")}},onInstallSuccess:function(){console.log("on install success");hideDiv("divContents");if(qcDetector.redirectURL){window.location.href=qcDetector.redirectURL}},onInstallFailed:function(){console.log("DefaultDetectorListener.onInstallFailed");document.getElementById("divStatus").innerHTML="<span class='errMsg'>There were an error trying to install the quickconnect</span><a href='"+qcDetector.downloadLocation+"'><br/> Click here</a> to manually download and install then click refresh."}});function QCDetector(a){this.redirectURL=a;this.detectorInstalled=0;this.qcDetector=null}QCDetector.prototype.isDetectorInstalled=function(){return false};var EVENT_DETECTION_COMPLETE=1;var EVENT_DETECTION_FAILED=2;var EVENT_INSTALL_START=3;var EVENT_INSTALL_SUCCESS=4;var EVENT_INSTALL_FAIL=5;QCDetector.prototype.setupDetector=function(){};QCDetector.prototype.installDetector=function(){};QCDetector.prototype.isQCInstalled=function(){};QCDetector.prototype.install=function(){};QCDetector.prototype.launchBFX=function(a){};QCDetector.prototype.hasLaunchCapabilities=function(){};QCDetector.prototype.setupInstaller=function(){};QCDetector.prototype.init=function(){console.log("QCDetector.onload")};QCDetector.prototype.toString=function(){return"QCDetector"};QCDetector.prototype.listeners=[new DefaultDetectorListener()];QCDetector.prototype.notifyListeners=function(c,f){for(var b=0;b<this.listeners.length;b++){var a=this.listeners[b];try{switch(c){case EVENT_DETECTION_COMPLETE:a.onDetectionComplete(f);break;case EVENT_DETECTION_FAILED:a.onDetectionFailed(f);break;case EVENT_INSTALL_START:a.onInstallStart();break;case EVENT_INSTALL_SUCCESS:a.onInstallSuccess();break;case EVENT_INSTALL_FAIL:a.onInstallFailed();break}}catch(d){console.log("notification failed for listener "+a+" "+d,a,d)}}};QCDetector.prototype.onDetectionComplete=function(a){this.notifyListeners(EVENT_DETECTION_COMPLETE,a)};QCDetector.prototype.onDetectionFailed=function(a){this.notifyListeners(EVENT_DETECTION_FAILED,a)};QCDetector.prototype.onInstallStart=function(){this.notifyListeners(EVENT_INSTALL_START)};QCDetector.prototype.onInstallSuccess=function(){this.notifyListeners(EVENT_INSTALL_SUCCESS)};QCDetector.prototype.onInstallFailed=function(){this.notifyListeners(EVENT_INSTALL_FAIL)};function ActiveXDetector(a){this._parentConstructor=QCDetector;this._parentConstructor();this.objectTagIn=false;this.installStarted=false;this.base=null;this.detectorInstallerURL="/login/qcDetector2.asp"}var retryCount=0;ActiveXDetector.prototype=new QCDetector;function displayDIVInstructions(d,e,b){console.log("divGenerated "+divGenerated+" "+e+" "+b);if(!divGenerated){var a=false;if(b=="step3"){a=true}var f={fromStep:e,toStep:b};d+=(d.indexOf("?")+1)?"&":"?";d+="fromStep="+e+"&toStep="+b;console.log("loading with params "+f);var c=new AjaxRequest({url:d,onsuccess:function(g){var h=g.responseXML;populateDiv(h,a)},onerror:function(g){if(retryCount<3){retryCount++;window.setTimeout("displayDIVInstructions('"+d+"', '"+e+"', '"+b+"')",100);showStatus("retrying "+retryCount);return}console.error("HTTP status code: ",ioArgs.xhr.status);qcDetector.onDetectionFailed("HTTP request failed with status "+ioArgs.xhr.status);return response}});c.send()}}ActiveXDetector.prototype.toString=function(){return"ActiveXDetector"};function populateDiv(data,installDiv){console.log("in populateDiv");var childNodes=data.documentElement.childNodes;var div=getOrCreateDiv("divContents");for(var i=0;i<childNodes.length;i++){var node=childNodes[i];if(node.nodeType==1){console.log(node.nodeName);if(node.nodeName=="body"){var content=node.firstChild;var innerDiv=document.createElement("DIV");div.appendChild(innerDiv);innerDiv.innerHTML=content.nodeValue}else{if(node.nodeName=="script"){var scriptContent=node.firstChild.nodeValue;try{eval(scriptContent)}catch(e){console.log("error "+e,e)}}}}}var divInstStyle=div.style;with(divInstStyle){}qcDetector.base=document.getElementById("Base");divGenerated=true;m_installDiv=installDiv;window.setTimeout("qcDetector.detectQuickConnectAfterQCDetector(m_installDiv)",100)}function removeFromInsideOut(b){var a=0;if(b.hasChildNodes()){for(a=b.children.length;a>=0;a--){removeFromInsideOut(b.children[a])}b.parentNode.removeChild(b)}else{b.parentNode.removeChild(b)}}ActiveXDetector.prototype.detectQuickConnectAfterQCDetector=function(a){this.base=document.getElementById("Base");if(this.isDetectorInstalled(true)&&this.base){var b=this.isQCInstalled();console.log("qcInstalled "+b);this.onDetectionComplete(b);if(b){this.onInstallSuccess()}else{this.install()}}else{window.setTimeout("qcDetector.detectQuickConnectAfterQCDetector()",1000)}};ActiveXDetector.prototype.install=function(){var divQC=document.getElementById("qcDetector").style;try{console.log("install "+this.installStarted);if(!this.installStarted){with(divQC){width=356;height=50;overflow="visible";visibility="visible"}var divInstStyle=document.getElementById("divInstructions").style;with(divInstStyle){width=1;height=1;visibility="hidden";overflow="hidden"}var divStep3Style=document.getElementById("step3").style;with(divStep3Style){width=1;height=1;visibility="hidden";overflow="hidden"}var divQC=document.getElementById("qcDetector").style;with(divQC){width=456;height=300;overflow="visible";visibility="visible"}}this.base=document.getElementById("Base");var base=this.base;try{console.log("base object "+base);if(!this.installStarted){base.width=356;base.height=116;base.DownloadLocation=this.downloadLocation;this.onInstallStart();try{base.INSTALL()}catch(e){base.Install()}this.installStarted=true}}catch(e){this.onInstallFailed(e);console.log("error "+e.number+" "+e.description);return}var hasBfxMime=this.isQCInstalled();if(hasBfxMime){this.onInstallSuccess();return true}else{window.setTimeout("qcDetector.install()",1000);return false}}catch(e){console.log("error during install "+e.number+" "+e.description);this.onInstallFailed();window.setTimeout("qcDetector.install()",1000);return false}};ActiveXDetector.prototype.isDetectorInstalled=function(a){if(this.detectorInstalled==0||a){try{console.log("initializing activeX");this.qcDetector=new ActiveXObject("QCDetector.Base");if(this.base){this.base.HasBfxMime}console.log("initiazed");this.detectorInstalled=1}catch(b){console.log("error initializing ActiveX "+b);this.detectorInstalled=-1;this.onDetectionFailed(b)}}return this.detectorInstalled==1};ActiveXDetector.prototype.isSetupURL=function(){return(window.location.href.indexOf(this.detectorInstallerURL)>=0)};ActiveXDetector.prototype.setupDetector=function(a){if(!this.isSetupURL()){window.location.href=this.detectorInstallerURL+"?redirectUrl="+escape(window.location.href)}else{this.installDetector(a)}};ActiveXDetector.prototype.isQCInstalled=function(){if(this.isDetectorInstalled()){console.log("before hasBfxMime");var a=this.qcDetector.HasBfxMime;if(a){return true}else{return false}}else{throw"QCDetector not installed"}};ActiveXDetector.prototype.hasLaunchCapabilities=function(){if(this.isDetectorInstalled()){try{if(this.qcDetector.LAUNCH("str1","str2")){return true
}}catch(a){console.log("hasLaunch:"+a.description);if(a.description!=null&&a.description.toLowerCase().indexOf("wrong number of arguments")>=0){return true}}}else{return false}};ActiveXDetector.prototype.installDetector=function(a){if(window.location.href.indexOf("init=1")>0||a==2){console.log("calling divInstructions "+this.prototype+" ");displayDIVInstructions("/login/activeXDetectorDIV.asp","step1","step3")}else{displayDIVInstructions("/login/activeXDetectorDIV.asp")}};ActiveXDetector.prototype.launchBFX=function(a){this.qcDetector.LAUNCH(a)};ActiveXDetector.prototype.init=function(){if(!this.isDetectorInstalled(true)){this.setupDetector()}else{if(!this.isQCInstalled()){this.setupDetector(2)}else{this.onDetectionComplete(this.isQCInstalled());if(this.isSetupURL()){this.onInstallSuccess()}}}};function JavaDetector(a){this._parentConstructor=QCDetector;this._parentConstructor();this.objectTagIn=false;this.installStarted=false;this.base=null}JavaDetector.prototype=new QCDetector;JavaDetector.prototype.setupDetector=function(a){console.log("setupDetector");console.log("calling divInstructions "+this.prototype+" ");divGenerated=false;if(!a){a="step1"}displayDIVInstructions("/login/javaDetectorDIV.asp","step1",a)};JavaDetector.prototype.isQCInstalled=function(){if(this.isDetectorInstalled()){var a=this.base.hasQuickConnect();console.log("hasQuickConnect returned "+a);if(a==2){return true}else{if(a==3){return false}else{if(a<0){throw"Error reading machine settings."}}}}else{throw"Detector not installed"}};JavaDetector.prototype.isDetectorInstalled=function(){if(this.base&&this.base.getStatus){return true}else{return false}};JavaDetector.prototype.detectQuickConnectAfterQCDetector=function(a){this.base=document.getElementById("Base");console.log("detectQuickConnectAfterDetector "+this.isDetectorInstalled()+" installDiv= "+a);if(this.isDetectorInstalled(true)){try{var c=this.isQCInstalled();this.onDetectionComplete(c);console.log("qcInstalled "+c);if(this.isQCInstalled()){console.log("detectQuickConnectAfterQCDetector: QC is Installed")}else{if(!a){this.install()}else{if(a){this.install()}}}}catch(b){this.onDetectionFailed(b);console.log("error "+b.number+" "+b.description)}}else{window.setTimeout("qcDetector.detectQuickConnectAfterQCDetector(m_installDiv)",1000)}};JavaDetector.prototype.install=function(){try{console.log("install installStarted="+this.installStarted);safeInnerHTML("qcDetectorObjectProg","We have detected that you do not have the QuickConnect Online Classroom installed. We are now installing...<br/>");safeInnerHTML("divStatus","If the download process doesn't start automatically, please <a href=\""+this.downloadLocation+'">Click Here</a> to download.');var divQC=document.getElementById("divQcDetector").style;with(divQC){width=400;height=200;margin="20px auto"}this.base=document.getElementById("Base");var base=this.base;try{if(!this.installStarted){base.width="400px";base.height="136px";base.style.zIndex="1010";base=this.base=document.applets.appletQcDetector;this.onInstallStart();base.install();this.installStarted=true}}catch(e){console.log("error "+e)}console.log("checking for bfx ");var hasBfxMime=this.isQCInstalled();if(hasBfxMime){this.onInstallSuccess()}else{window.setTimeout("qcDetector.checkInstallStatus()",1000);return false}}catch(e){console.log("error during install "+e.number+" "+e.description);window.setTimeout("qcDetector.checkInstallStatus()",1000);return false}};JavaDetector.prototype.checkInstallStatus=function(){var f=this.base.getStatus();console.log("checkInstallStatus:installStatus="+f);if(f==1){window.setTimeout("qcDetector.checkInstallStatus()",1000)}else{if(f<0){console.log("checkInstallStatus:installStatus "+f);this.onInstallFailed()}else{var a=this.isQCInstalled();if(a){console.log("JavaDetector.checkInstallStatus:hasBfxMime is true");try{var c=this.base;if(this.installStarted){console.log("resizing... base");c.style.width=0;c.style.height=0}var b=getOrCreateDiv("divContents")}catch(d){console.log("error "+d)}this.onInstallSuccess();return true}else{this.onInstallFailed()}}}};function getOrCreateDiv(id){var qc,divQCStyle;qc=document.getElementById(id);if(!qc){var qc=document.createElement("div");qc.id=id;with(qc.style){width="100%";position="absolute";height="100%";top="0px";left="0px";visibility="visible";background="rgba(64, 64, 64, 0.6)";background="none\\9";filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#7F404040, endColorstr=#7F404040)";zIndex="1000"}document.body.appendChild(qc);divQCStyle=qc.style;console.log("qcDetector "+divQCStyle.width+" "+qc.innerHTML)}return qc}function hideDiv(id){console.log("hideDiv "+id);var qc=document.getElementById(id);if(!qc){return}with(qc.style){visibility="hidden";width="0px";height="0px"}}function safeProperty(d,c,a){var b=document.getElementById(d);if(b){b[c]=a}}function safeInnerHTML(b,a){safeProperty(b,"innerHTML",a)}function showStatus(a){document.getElementById("divStatus").innerHTML="<span class'errMsg'>"+a+"</span>"}JavaDetector.prototype.launchBFX=function(a){console.log("Launching ",a);this.base.launch(a)};JavaDetector.prototype.hasLaunchCapabilities=function(){return true};JavaDetector.prototype.setupInstaller=function(){};JavaDetector.prototype.init=function(){console.log("JavaDetector.init");this.setupDetector()};JavaDetector.prototype.toString=function(){return"JavaDetector"};JavaDetector.prototype.installDetector=function(){};var qcDetector=getQCDetector();
