﻿function Exception(b,a){if(b)this.name=b;if(a)this.message=a}Exception.prototype.setName=function(a){this.name=a};Exception.prototype.getName=function(){return this.name};Exception.prototype.setMessage=function(a){this.message=a};Exception.prototype.getMessage=function(){return this.message};function FlashTag(e,b,a,c,d){this.src=e;this.width=b;this.height=a;this.version="7,0,14,0";this.id=null;this.wmode=c;this.loop=d;this.flashVars=null}FlashTag.prototype.setVersion=function(a){this.version=a};FlashTag.prototype.setId=function(a){this.id=a};FlashTag.prototype.setWmode=function(a){this.wmode=a};FlashTag.prototype.setLoop=function(a){this.loop=a};FlashTag.prototype.setBgcolor=function(a){this.bgcolor=a};FlashTag.prototype.setFlashvars=function(a){this.flashVars=a};FlashTag.prototype.toString=function(){var b=navigator.appName.indexOf("Microsoft")!=-1?1:0,a=new String;if(b){a+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';if(this.id!=null)a+='id="'+this.id+'" ';a+='codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.version+'" ';a+='width="'+this.width+'" ';a+='height="'+this.height+'">';a+='<param name="movie" value="'+this.src+'"/>';a+='<param name="quality" value="high"/>';a+='<param name="wmode" value="'+this.wmode+'"/>';a+='<param name="loop" value="'+this.loop+'"/>';if(this.flashVars!=null)a+='<param name="flashvars" value="'+this.flashVars+'"/>';a+="</object>"}else{a+='<embed src="'+this.src+'" ';a+='quality="high" ';a+='wmode="'+this.wmode+'" ';a+='loop="'+this.loop+'" ';a+='width="'+this.width+'" ';a+='height="'+this.height+'" ';a+='type="application/x-shockwave-flash" ';if(this.flashVars!=null)a+='flashvars="'+this.flashVars+'" ';if(this.id!=null)a+='name="'+this.id+'" ';a+='pluginspage="http://www.macromedia.com/go/getflashplayer">';a+="</embed>"}return a};FlashTag.prototype.write=function(a){a.write(this.toString())};function FlashSerializer(a){this.useCdata=a}FlashSerializer.prototype.serialize=function(b){var c=new String;for(var a=0;a<b.length;++a){switch(typeof b[a]){case "undefined":c+="t"+a+"=undf";break;case "string":c+="t"+a+"=str&d"+a+"="+escape(b[a]);break;case "number":c+="t"+a+"=num&d"+a+"="+escape(b[a]);break;case "boolean":c+="t"+a+"=bool&d"+a+"="+escape(b[a]);break;case "object":if(b[a]==null)c+="t"+a+"=null";else if(b[a]instanceof Date)c+="t"+a+"=date&d"+a+"="+escape(b[a].getTime());else try{c+="t"+a+"=xser&d"+a+"="+escape(this._serializeXML(b[a]))}catch(d){throw new Exception("FlashSerializationException","The following error occurred during complex object serialization: "+d.getMessage())}break;default:throw new Exception("FlashSerializationException","You can only serialize strings, numbers, booleans, dates, objects, arrays, nulls, and undefined.")}if(a!=b.length-1)c+="&"}return c};FlashSerializer.prototype._serializeXML=function(b){var a={};a.xml="<fp>";this._serializeNode(b,a,null);a.xml+="</fp>";return a.xml};FlashSerializer.prototype._serializeNode=function(a,b,c){switch(typeof a){case "undefined":b.xml+="<undf"+this._addName(c)+"/>";break;case "string":b.xml+="<str"+this._addName(c)+">"+this._escapeXml(a)+"</str>";break;case "number":b.xml+="<num"+this._addName(c)+">"+a+"</num>";break;case "boolean":b.xml+="<bool"+this._addName(c)+' val="'+a+'"/>';break;case "object":if(a==null)b.xml+="<null"+this._addName(c)+"/>";else if(a instanceof Date)b.xml+="<date"+this._addName(c)+">"+a.getTime()+"</date>";else if(a instanceof Array){b.xml+="<array"+this._addName(c)+">";for(var d=0;d<a.length;++d)this._serializeNode(a[d],b,null);b.xml+="</array>"}else{b.xml+="<obj"+this._addName(c)+">";for(var e in a){if(typeof a[e]=="function")continue;this._serializeNode(a[e],b,e)}b.xml+="</obj>"}break;default:throw new Exception("FlashSerializationException","You can only serialize strings, numbers, booleans, objects, dates, arrays, nulls and undefined")}};FlashSerializer.prototype._addName=function(a){if(a!=null)return ' name="'+a+'"';return ""};FlashSerializer.prototype._escapeXml=function(a){if(this.useCdata)return "<![CDATA["+a+"]]>";else return a.replace(/&/g,"&amp;").replace(/</g,"&lt;")};function FlashProxy(b,a){this.uid=b;this.proxySwfName=a;this.flashSerializer=new FlashSerializer(false)}FlashProxy.prototype.call=function(){if(arguments.length==0)throw new Exception("Flash Proxy Exception","The first argument should be the function name followed by any number of additional arguments.");var f="lcId="+escape(this.uid)+"&functionName="+escape(arguments[0]);if(arguments.length>1){var e=[];for(var c=1;c<arguments.length;++c)e.push(arguments[c]);f+="&"+this.flashSerializer.serialize(e)}var a="_flash_proxy_"+this.uid;if(!document.getElementById(a)){var d=document.createElement("div");d.id=a;document.body.appendChild(d)}var g=document.getElementById(a),b=new FlashTag(this.proxySwfName,1,1);b.setVersion("6,0,65,0");b.setFlashvars(f);g.innerHTML=b.toString()};FlashProxy.callJS=function(){var functionToCall=eval(arguments[0]),argArray=[];for(var i=1;i<arguments.length;++i)argArray.push(arguments[i]);functionToCall.apply(functionToCall,argArray)}
