var WebService={Loading:false,IDCounter:0,RequestObj:{},gateWay:"http://"+window.location.host+"/flashservices/gateway",Main:function(flashPath,loadCallback){AC_FL_RunContent('id','ws','name','ws','codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0','width','1','height','1','src',flashPath,'quality','high','FlashVars','onInit=WebService.LoadSuccess','allowScriptAccess','always','pluginspage','http://www.macromedia.com/go/getflashplayer','movie',flashPath);if(loadCallback){this.Callback=loadCallback;};},LoadSuccess:function(){this.Loading=true;if(this.Callback){this.Callback.call();};},ApplyID:function(){this.IDCounter++;return this.IDCounter;},Request:function(params){if(!this.Loading){alert("Flash Not Finished!");return;};params.ID=this.ApplyID();this.RequestObj[params.ID]=params;if(params.gateWay==undefined){params.gateWay=this.gateWay;};this.CallFlash('ws').callWebService({ID:params.ID,gateWay:params.gateWay,service:params.service,method:params.method,arguments:params.arguments,onResult:"WebService.onResult",onFault:"WebService.onFault"});},onResult:function(id,result){if(this.RequestObj[id].onResult){if(this.RequestObj[id].scope!=null){var fn=this.RequestObj[id].onResult.createDelegate(this.RequestObj[id].scope);fn(id,result);}else{this.RequestObj[id].onResult(id,result);}};delete this.RequestObj[id];},onFault:function(id){if(this.RequestObj[id].onFault){if(this.RequestObj[id].scope!=null){var fn=this.RequestObj[id].onFault.createDelegate(this.RequestObj[id].scope);fn(id);}else{this.RequestObj[id].onFault(id);}};delete this.RequestObj[id];},CallFlash:function(flashID){if(navigator.appName.indexOf("Microsoft")!=-1){return window[flashID];}else{return document[flashID];};}};
