function FABridge(B,A){this.target=B;this.remoteTypeCache={};this.remoteInstanceCache={};this.remoteFunctionCache={};this.localFunctionCache={};this.bridgeID=FABridge.nextBridgeID++;this.name=A;this.nextLocalFuncID=0;FABridge.instances[this.name]=this;FABridge.idMap[this.bridgeID]=this;return this}FABridge.TYPE_ASINSTANCE=1;FABridge.TYPE_ASFUNCTION=2;FABridge.TYPE_JSFUNCTION=3;FABridge.TYPE_ANONYMOUS=4;FABridge.initCallbacks={};FABridge.argsToArray=function(B){var A=[];for(var C=0;C<B.length;C++){A[C]=B[C]}return A};function instanceFactory(A){this.fb_instance_id=A;return this}function FABridge__invokeJSFunction(A){var C=A[0];var B=A.concat();B.shift();var D=FABridge.extractBridgeFromID(C);return D.invokeLocalFunction(C,B)}FABridge.addInitializationCallback=function(B,D){var C=FABridge.instances[B];if(C!=undefined){D.call(C);return }var A=FABridge.initCallbacks[B];if(A==null){FABridge.initCallbacks[B]=A=[]}A.push(D)};function FABridge__bridgeInitialized(D){var A="bridgeName="+D;if(/Explorer/.test(navigator.appName)||/Konqueror|Safari|KHTML/.test(navigator.appVersion)){var J=document.getElementsByTagName("object");if(J.length==1){FABridge.attachBridge(J[0],D)}else{for(var F=0;F<J.length;F++){var H=J[F];var C=H.childNodes;var G=false;for(var E=0;E<C.length;E++){var B=C[E];if(B.nodeType==1&&B.tagName.toLowerCase()=="param"){if(B["name"].toLowerCase()=="flashvars"&&B["value"].indexOf(A)>=0){FABridge.attachBridge(H,D);G=true;break}}}if(G){break}}}}else{var J=document.getElementsByTagName("embed");if(J.length==1){FABridge.attachBridge(J[0],D)}else{for(var F=0;F<J.length;F++){var H=J[F];var I=H.attributes.getNamedItem("flashVars").nodeValue;if(I.indexOf(A)>=0){FABridge.attachBridge(H,D)}}}}return true}FABridge.nextBridgeID=0;FABridge.instances={};FABridge.idMap={};FABridge.refCount=0;FABridge.extractBridgeFromID=function(B){var A=(B>>16);return FABridge.idMap[A]};FABridge.attachBridge=function(A,C){var B=new FABridge(A,C);FABridge[C]=B;var E=FABridge.initCallbacks[C];if(E==null){return }for(var D=0;D<E.length;D++){E[D].call(B)}delete FABridge.initCallbacks[C]};FABridge.blockedMethods={toString:true,get:true,set:true,call:true};FABridge.prototype={root:function(){return this.deserialize(this.target.getRoot())},releaseASObjects:function(){return this.target.releaseASObjects()},releaseNamedASObject:function(B){if(typeof (B)!="object"){return false}else{var A=this.target.releaseNamedASObject(B.fb_instance_id);return A}},create:function(A){return this.deserialize(this.target.create(A))},makeID:function(A){return(this.bridgeID<<16)+A},getPropertyFromAS:function(B,A){if(FABridge.refCount>0){throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.")}else{FABridge.refCount++;retVal=this.target.getPropFromAS(B,A);retVal=this.handleError(retVal);FABridge.refCount--;return retVal}},setPropertyInAS:function(C,B,A){if(FABridge.refCount>0){throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.")}else{FABridge.refCount++;retVal=this.target.setPropInAS(C,B,this.serialize(A));retVal=this.handleError(retVal);FABridge.refCount--;return retVal}},callASFunction:function(B,A){if(FABridge.refCount>0){throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.")}else{FABridge.refCount++;retVal=this.target.invokeASFunction(B,this.serialize(A));retVal=this.handleError(retVal);FABridge.refCount--;return retVal}},callASMethod:function(B,C,A){if(FABridge.refCount>0){throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.")}else{FABridge.refCount++;A=this.serialize(A);retVal=this.target.invokeASMethod(B,C,A);retVal=this.handleError(retVal);FABridge.refCount--;return retVal}},invokeLocalFunction:function(D,B){var A;var C=this.localFunctionCache[D];if(C!=undefined){A=this.serialize(C.apply(null,this.deserialize(B)))}return A},getTypeFromName:function(A){return this.remoteTypeCache[A]},createProxy:function(C,B){var D=this.getTypeFromName(B);instanceFactory.prototype=D;var A=new instanceFactory(C);this.remoteInstanceCache[C]=A;return A},getProxy:function(A){return this.remoteInstanceCache[A]},addTypeDataToCache:function(D){newType=new ASProxy(this,D.name);var B=D.accessors;for(var C=0;C<B.length;C++){this.addPropertyToType(newType,B[C])}var A=D.methods;for(var C=0;C<A.length;C++){if(FABridge.blockedMethods[A[C]]==undefined){this.addMethodToType(newType,A[C])}}this.remoteTypeCache[newType.typeName]=newType;return newType},addPropertyToType:function(A,D){var E=D.charAt(0);var B;var C;if(E>="a"&&E<="z"){C="get"+E.toUpperCase()+D.substr(1);B="set"+E.toUpperCase()+D.substr(1)}else{C="get"+D;B="set"+D}A[B]=function(F){this.bridge.setPropertyInAS(this.fb_instance_id,D,F)};A[C]=function(){return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id,D))}},addMethodToType:function(A,B){A[B]=function(){return this.bridge.deserialize(this.bridge.callASMethod(this.fb_instance_id,B,FABridge.argsToArray(arguments)))}},getFunctionProxy:function(A){var B=this;if(this.remoteFunctionCache[A]==null){this.remoteFunctionCache[A]=function(){B.callASFunction(A,FABridge.argsToArray(arguments))}}return this.remoteFunctionCache[A]},getFunctionID:function(A){if(A.__bridge_id__==undefined){A.__bridge_id__=this.makeID(this.nextLocalFuncID++);this.localFunctionCache[A.__bridge_id__]=A}return A.__bridge_id__},serialize:function(D){var A={};var C=typeof (D);if(C=="number"||C=="string"||C=="boolean"||C==null||C==undefined){A=D}else{if(D instanceof Array){A=[];for(var B=0;B<D.length;B++){A[B]=this.serialize(D[B])}}else{if(C=="function"){A.type=FABridge.TYPE_JSFUNCTION;A.value=this.getFunctionID(D)}else{if(D instanceof ASProxy){A.type=FABridge.TYPE_ASINSTANCE;A.value=D.fb_instance_id}else{A.type=FABridge.TYPE_ANONYMOUS;A.value=D}}}}return A},deserialize:function(E){var A;var C=typeof (E);if(C=="number"||C=="string"||C=="boolean"||E==null||E==undefined){A=this.handleError(E)}else{if(E instanceof Array){A=[];for(var B=0;B<E.length;B++){A[B]=this.deserialize(E[B])}}else{if(C=="object"){for(var B=0;B<E.newTypes.length;B++){this.addTypeDataToCache(E.newTypes[B])}for(var D in E.newRefs){this.createProxy(D,E.newRefs[D])}if(E.type==FABridge.TYPE_PRIMITIVE){A=E.value}else{if(E.type==FABridge.TYPE_ASFUNCTION){A=this.getFunctionProxy(E.value)}else{if(E.type==FABridge.TYPE_ASINSTANCE){A=this.getProxy(E.value)}else{if(E.type==FABridge.TYPE_ANONYMOUS){A=E.value}}}}}}}return A},addRef:function(A){this.target.incRef(A.fb_instance_id)},release:function(A){this.target.releaseRef(A.fb_instance_id)},handleError:function(B){if(typeof (B)=="string"&&B.indexOf("__FLASHERROR")==0){var A=B.split("||");if(FABridge.refCount>0){FABridge.refCount--}throw new Error(A[1]);return B}else{return B}}};ASProxy=function(B,A){this.bridge=B;this.typeName=A;return this};ASProxy.prototype={get:function(A){return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id,A))},set:function(B,A){this.bridge.setPropertyInAS(this.fb_instance_id,B,A)},call:function(B,A){this.bridge.callASMethod(this.fb_instance_id,B,A)},addRef:function(){this.bridge.addRef(this)},release:function(){this.bridge.release(this)}}