function callLater(f,obj){return(function(){return f(obj);});}function FLHub(){this.zis=this;this.pixel=1;this.debug="0";this.messagePrefix="vw:";this.flHub={};this.initialized=false;this.retryCount=0;this.executeRunning=false;this.commands=[];this.flashvars={};this._params={};this.busy=false;this._attributes={};
this.requestCallback=function(){};this.flHubId="FLHub"+Math.floor(Math.random()*99999);this.fallback=(window.postMessage)?true:false;this.subscribers={};this.registered={};this.pending={};this.pendingSubscribe=[];this.pendingClientService={};this.serverFound=false;this.clients={};}FLHub.getWindow=function(){if(window.opener==null||window.opener==window){return top;
}return window.opener.top;};FLHub.prototype.swfInit=function(e,zis){if(zis.initialized){return true;}if(e!=null&&e.success){zis.flHub=e.ref;}else{++zis.retryCount;if(navigator.appName.indexOf("Microsoft")!=-1){zis.flHub=window[zis.flHubId];}else{zis.flHub=document[zis.flHubId];}}if(typeof(zis.flHub)!="undefined"&&(zis.flHub.publish!=null)&&(typeof(zis.flHub.publish)=="function")){zis.initialized=true;
}return true;};FLHub.prototype.handleJSCalls=function(params){var retval=false;try{this.busy=true;if(this.debug=="1"&&typeof(console)!="undefined"){console.log(this.flHubId+" JS Call to "+params);}retval=this.requestCallback(params);this.busy=false;}catch(e){if(this.debug=="1"&&typeof(console)!="undefined"){console.log("handleJSCall"+e.toString());
}this.busy=false;}return retval;};FLHub.prototype.embedServer=function(site,objectName,requestCallback,elementId,serverId){this.flashvars={server:"1",serverId:serverId,requestCallback:objectName+".handleJSCalls",debug:this.debug};this._params={allowscriptaccess:"always",wmode:"transparent",menu:"false"};
this._attributes={id:this.flHubId,name:this.flHubId,styleclass:"flHub2"};this.site=site;this.elementId=elementId;this.requestCallback=requestCallback;this.doEmbed();this.serverFound=true;if(this.fallback){var obj=this;var onMessageFunc=function(e){var request;if(obj.debug=="1"&&typeof(console)!="undefined"){console.log("Got server listener request::",e.data);
}if(e.data!=""&&e.data.indexOf(obj.messagePrefix)==0){request=eval("("+e.data.substring(obj.messagePrefix.length)+")");var pingBack=false;var href=request.origin;if(typeof(obj.clients[href])=="undefined"&&typeof(href)!="undefined"){pingBack=true;obj.clients[href]=true;var frameId="VIRTUALWEB_"+request.panel+"_FRAME";
if(typeof(obj.pendingClientService[frameId])!="undefined"&&obj.pendingClientService[frameId]!=null){var pending_requests=obj.pendingClientService[frameId];for(var p=0,total=pending_requests.length;p<total;++p){if(obj.debug=="1"&&typeof(console)!="undefined"){console.log("About to request:",arguments);
}obj.requestFrom.apply(obj,obj.pendingClientService[frameId][p]);}obj.pendingClientService[frameId]=null;}}if(request.action=="subscribe"){if(obj.debug=="1"&&typeof(console)!="undefined"){console.log("Requesting subscribe for",request.topic,e.source);}if(typeof(obj.subscribers[request.topic])=="undefined"){obj.subscribers[request.topic]=[];
}obj.subscribers[request.topic].push(e.source);if(obj.pending[request.topic]){if(this.debug=="1"&&typeof(console)!="undefined"){console.log("About to execute pending publish requests:",e);}onMessageFunc(e);obj.pending[request.topic]=null;}}else{if(request.action=="publish"){if(obj.debug=="1"&&typeof(console)!="undefined"){console.log("Requesting publish for",request.topic);
}if(typeof(obj.subscribers[request.topic])!="undefined"){var total_sub_windows=obj.subscribers[request.topic].length;if(total_sub_windows==0){obj.pending[request.topic]=e;}for(var s=0;s<total_sub_windows;++s){var win=obj.subscribers[request.topic][s];if(obj.debug=="1"&&typeof(console)!="undefined"){console.log("posting message on topic::",request.topic," to window::",win);
}try{if(request.data.indexOf("action=")!=-1&&request.data.indexOf("method")==-1){request.data="action=execute&"+request.data.replace("action=","method=");}win.postMessage(obj.messagePrefix+'{action: "service", data: "'+request.data+'"}',"*");}catch(e){if(obj.debug=="1"&&typeof(console)!="undefined"){console.log("There was a problem publishing the request::",e,win);
}}}}}else{if(request.action=="service"){try{obj.requestCallback(request.data);}catch(e){if(obj.debug=="1"&&typeof(console)!="undefined"){console.debug(e);}}}}}if(pingBack){var cmd='{action: "registered", topic: "'+request.topic+'"}';e.source.postMessage(obj.messagePrefix+cmd,"*");}}};if(window.addEventListener){window.addEventListener("message",onMessageFunc,false);
}else{if(window.attachEvent){window.attachEvent("onmessage",onMessageFunc);}}}};FLHub.prototype.embedClient=function(site,objectName,requestCallback,elementId,serverId,clientId){this.flashvars={server:"0",serverId:serverId,clientId:clientId,requestCallback:objectName+".handleJSCalls",debug:this.debug};
this._params={allowscriptaccess:"always",wmode:"transparent",menu:"false"};this._attributes={id:this.flHubId,name:this.flHubId,styleclass:"flHub2"};this.site=site;this.elementId=elementId;this.requestCallback=requestCallback;this.doEmbed();if(this.fallback){var obj=this;var onMessageFunc=function(e){var request;
if(e.data!=""&&e.data.indexOf(obj.messagePrefix)==0){request=eval("("+e.data.substring(obj.messagePrefix.length)+")");if(obj.debug=="1"&&typeof(console)!="undefined"){console.log("client listener event got the data:",e.data);}if(request.action=="service"){obj.requestCallback(request.data);}if(request.action=="registered"||!obj.serverFound&&request.action=="service"){obj.serverFound=true;
for(var p=0,total=obj.pendingSubscribe.length;p<total;++p){try{FLHub.getWindow().postMessage(obj.messagePrefix+obj.pendingSubscribe[p],"*");}catch(e){if(top==self){top.postMessage(obj.messagePrefix+obj.pendingSubscribe[p],"*");}}}obj.pendingSubscribe.legnth=0;}}};if(window.addEventListener){window.addEventListener("message",onMessageFunc,false);
}else{if(window.attachEvent){window.attachEvent("onmessage",onMessageFunc);}}}};FLHub.prototype.doEmbed=function(){var x={zis:this,go:function(e){return this.zis.swfInit(e,this.zis);}};var initFunct=function(e){return x.go(e);};if(!this.fallback){swfobject.embedSWF(this.site+"/static/js/flHub/FlHub.swf",this.elementId,this.pixel,this.pixel,"9.0.0",this.site+"/static/js/flHub/expressInstall.swf",this.flashvars,this._params,this._attributes,initFunct);
}};FLHub.prototype.executeAllPendingCommands=function(zis){while(zis.commands.length>0){var command=zis.commands.shift();if(command&&command.action){try{if(command.params.length==0){if(zis.debug=="1"&&typeof(console)!="undefined"){console.log(this.flHubId+" executing "+command.action);}zis.flHub[command.action]();
}else{if(command.params.length==1){if(zis.debug=="1"&&typeof(console)!="undefined"){console.log(this.flHubId+" executing "+command.action+" ["+command.params[0]+"]");}zis.flHub[command.action](command.params[0]);}else{if(command.params.length==2){if(zis.debug=="1"&&typeof(console)!="undefined"){console.log(this.flHubId+" executing "+command.action+" ["+command.params[0]+", "+command.params[1]+"]");
}zis.flHub[command.action](command.params[0],command.params[1]);}}}}catch(e){if(zis.debug=="1"&&typeof(console)!="undefined"){console.log("executeAllPendingCommands "+e.toString());}}}}};FLHub.prototype.executeCommands2=function(zis){if(typeof(zis.flHub)!="undefined"&&typeof(zis.flHub.publish)=="function"&&!zis.busy){zis.executeRunning=true;
zis.executeAllPendingCommands(zis);zis.executeRunning=false;}else{if(typeof(zis.flHub)=="undefined"||!zis.flHub.publish||typeof(zis.flHub.publish)=="undefined"){zis.swfInit(null,zis);}var functRef=callLater(zis.executeCommands2,zis);setTimeout(functRef,1000);}};FLHub.prototype.executeCommands=function(zis){if(zis==null){zis=this;
}if(zis.commands.length>1&&zis.executeRunning){return;}this.executeCommands2(zis);};FLHub.prototype.publish=function(topic,msg){if(!this.fallback){this.commands.push({action:"publish",params:[topic,msg]});this.executeCommands();}else{var cmd='{action: "publish", panel: "'+window.panelId+'", origin: "'+document.location.href+'", topic: "'+topic+'", data: "'+msg+'"}';
try{FLHub.getWindow().postMessage(this.messagePrefix+cmd,"*");}catch(e){if(top==self){self.postMessage(this.messagePrefix+cmd,"*");}}if(!this.serverFound){this.pendingSubscribe.push(cmd);}}};FLHub.prototype.subscribe=function(topic,callback){if(typeof(callback)!="undefined"){hash_callbacks[topic]=callback;
}if(!this.fallback){this.commands.push({action:"subscribe",params:[topic]});this.executeCommands();}else{var cmd='{action: "subscribe", panel: "'+window.panelId+'", origin: "'+document.location.href+'", topic: "'+topic+'"}';try{FLHub.getWindow().postMessage(this.messagePrefix+cmd,"*");}catch(e){if(top==self){self.postMessage(this.messagePrefix+cmd,"*");
}}if(!this.serverFound){this.pendingSubscribe.push(cmd);}}};FLHub.prototype.requestFrom=function(clientId,params,frameId){if(this.debug=="1"&&typeof(console)!="undefined"){console.log("Requesting from::",clientId,params);}if(!this.fallback){this.commands.push({action:"requestFrom",params:[clientId,params]});
this.executeCommands();}else{if(this.debug=="1"&&typeof(console)!="undefined"){console.log("The iframe is with id::",frameId);}var frame_el=document.getElementById(frameId);var cmd='{action: "service", origin: "'+document.location.href+'", data: "'+params+'"}';if(frame_el!=null){frame_el.contentWindow.postMessage(this.messagePrefix+cmd,"*");
}else{if(typeof(this.pendingClientService[frameId])=="undefined"||this.pendingClientService[frameId]==null){this.pendingClientService[frameId]=[];}this.pendingClientService[frameId].push(arguments);}}};FLHub.prototype.requestService=function(msg){if(this.debug=="1"&&typeof(console)!="undefined"){console.log("Requesting Service::",msg);
}if(!this.fallback){this.commands.push({action:"requestService",params:[msg]});this.executeCommands();}else{try{FLHub.getWindow().postMessage(this.messagePrefix+'{action: "service", origin: "'+document.location.href+'", data: "'+msg+'"}',"*");}catch(e){if(top==self){self.postMessage(this.messagePrefix+'{action: "service", origin: "'+document.location.href+'", data: "'+msg+'"}',"*");
}}}};