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.userTypes={};FABridge.addToUserTypes=function(){for(var a=0;a<arguments.length;a++){FABridge.userTypes[arguments[a]]={typeName:arguments[a],enriched:false}}};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)||1){var l=document.getElementsByTagName("object");if(l.length==1){FABridge.attachBridge(l[0],d)}else{for(var f=0;f<l.length;f++){var h=l[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 l=document.getElementsByTagName("embed");if(l.length==1){FABridge.attachBridge(l[0],d)}else{for(var f=0;f<l.length;f++){var h=l[f];var k=h.attributes.getNamedItem("flashVars").nodeValue;if(k.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},getUserTypeDescriptor:function(b){var c=b.replace(/^([^:]*)\:\:([^:]*)$/,"$2");var e=((typeof window[c]=="function")&&(typeof FABridge.userTypes[c]!="undefined"));var d=false;if(e){d=FABridge.userTypes[c].enriched}var a={simpleType:c,isUserProto:e,protoEnriched:d};return a},getTypeFromName:function(b){var c=this.getUserTypeDescriptor(b);var a=this.remoteTypeCache[b];if(c.isUserProto){if(!c.protoEnriched){for(i in window[c.simpleType].prototype){a[i]=window[c.simpleType].prototype[i]}window[c.simpleType].prototype=a;this.remoteTypeCache[b]=a;FABridge.userTypes[c.simpleType].enriched=true}}return a},createProxy:function(c,b){var d=this.getUserTypeDescriptor(b);var f=this.getTypeFromName(b);if(d.isUserProto){var e=window[d.simpleType];var a=new e(this.name,c);a.fb_instance_id=c}else{instanceFactory.prototype=f;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,e){var f=e.charAt(0);var b;var d;if(f>="a"&&f<="z"){d="get"+f.toUpperCase()+e.substr(1);b="set"+f.toUpperCase()+e.substr(1)}else{d="get"+e;b="set"+e}a[b]=function(c){this.bridge.setPropertyInAS(this.fb_instance_id,e,c)};a[d]=function(){return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id,e))}},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)}};