﻿(function(){_STJS={version:"0.2.0",$:function(str){return document.getElementById(str);},$F:function(element)
{return _STJS.$(element).value;},$Hide:function(element){if(arguments.length>1){for(var i=0,length=arguments.length;i<length;i++)
_STJS.$Hide(arguments[i]);return;}
_STJS.$(element).style.display="none";return;},$Show:function(element){if(arguments.length>1){for(var i=0,length=arguments.length;i<length;i++)
_STJS.$Show(arguments[i]);return;}
_STJS.$(element).style.display="";return;},$ShowHide:function(s)
{if(_STJS.$(s).style.display=="none")
{_STJS.$Show(s);}
else
{_STJS.$Hide(s);}},getAJAX:function()
{var r=false;try{r=new ActiveXObject("Msxml2.XMLHTTP");}
catch(trymicrosoft)
{try{r=new ActiveXObject("Microsoft.XMLHTTP");}
catch(othermicrosoft)
{try{r=new XMLHttpRequest();}
catch(failed){r=false;}}}
if(!r){alert("Init AJAX Error!");return false;}
else{return r;}},getResponse:function(r,f)
{if(r.readyState==4)
{if(r.status==200||r.status==0)
{var p=r.responseText.split("|");var s=p[0].toLowerCase();if(s=="error"){try{endWaiting();}catch(e){}alert("Error!Message"+p[1]);return false;}
if(s=="success"){return true;}
if(!f){return true;}
else{try{endWaiting();}catch(e){}alert("Error");}}
else
{try{endWaiting();}catch(e){}alert("Access Error,Code:"+r.status);}}
return false;},autoImg:function(i,MaxW,MaxH){var o=new Image();o.src=i.src;var w=o.width,h=o.height,t=w>MaxW?MaxW:w;if((h*t/w)>MaxH){i.height=MaxH;i.width=MaxH/h*w;}else{i.width=t;i.height=t/w*h;}},setStyle:function(o,s){for(a in s){if(a)o.style[a]=s[a];}},random:function(){return((new Date).getTime()+"_"+(""+Math.random()).substr(6)).replace(".","").substr(5);},randomColor:function(){var r=Math.floor(Math.random()*256).toString(16);r=r.length==1?"0"+r:r;var g=Math.floor(Math.random()*256).toString(16);g=g.length==1?"0"+g:g;var b=Math.floor(Math.random()*256).toString(16);b=b.length==1?"0"+b:b;return(r+g+b).toUpperCase();}};_STJS.Class={nameSpace:"GreyJS.lang.Class",className:"Class",create:function(className,nameSpace,staticProperties,properties,extendFrom){var c=staticProperties?(staticProperties.construct?staticProperties.construct:new Function()):new Function();function f(){c.apply(this,arguments);};f.prototype={instanceOf:nameSpace,_class:f,clone:function(){var a=new Object();for(var p in this.prototype){if(!a.prototype[p])a.prototype[p]=this.prototype[p];}
for(p in this){if(!a[p])a[p]=this[p];}
return a;},cloneTo:function(a){for(var p in this.prototype){a.prototype[p]=this.prototype[p];}
for(p in this){alert(p+":"+a)
a[p]=this[p];}
return a;}};if(extendFrom){for(var p in extendFrom.prototype){if(!f.prototype[p])f.prototype[p]=extendFrom.prototype[p];}
for(p in extendFrom){if(!f[p])f[p]=extendFrom[p];}}
for(a in staticProperties){f[a]=staticProperties[a];}
for(a in properties){f.prototype[a]=properties[a];}
f.className=className;f.nameSpace=nameSpace;f.extend=function(fatherClass,selfStaticProperties,selfProperties){if(fatherClass){for(var p in fatherClass.prototype){if(!this.prototype[p])this.prototype[p]=fatherClass.prototype[p];}
for(p in fatherClass){if(!this[p])this[p]=fatherClass[p];}}
for(var p in selfStaticProperties){this[p]=selfStaticProperties[p];}
for(p in selfProperties){this.prototype[p]=selfProperties[p];}}
return f;}};_STJS.NormalObject=_STJS.Class.create("NormalObject","GreyJS.lang.System",{construct:function(){}},{});_STJS.System=_STJS.Class.create("System","GreyJS.lang.System",{Console:_STJS.Class.create("Debug","GreyJS.lang.System.Console",{_pause:false,_autoClear:true,_obj:null,_errTimes:0,opened:false,id:_STJS.random(),open:function(){if(_STJS.System.Console.opened)return;document.write("<textarea cols=80 rows=16 name='_system_console_"+this.id+"' id='_system_console_"+this.id+"' style='color:#CCCCCC;background:#111111;font-weight:bold;font-size:15px;font-family:NSimSun,Arail,Lucida Console;border:#EEEEEE ridge 6px' readonly></textarea><br><button id='_system_console_pauseButton_"+this.id+"' onclick=\"_STJS.System.Console.pause();\">Pause</button>&nbsp;<button id='_system_console_clearButton_"+this.id+"' onclick=\"_STJS.System.Console.clear();\">Clear</button>&nbsp;<button id='_system_console_copyButton_"+this.id+"' onclick=\"_STJS.System.Console.copy();\">Copy</button>&nbsp;<button id='_system_console_autoClearButton_"+this.id+"' onclick=\"_STJS.System.Console.autoClear();\">Stop AutoClear</button>");this.opened=true;this._obj=_STJS.$("_system_console_"+this.id);this.clear();this.write("Console Opened at "+(new Date()).toLocaleString()+"!");},getContent:function(){return this._obj.value;},copy:function(){window.clipboardData.setData("Text",this.getContent());this.write("Copy Console Content to Clipboard Successful!");},write:function(str){if(!this._pause){var s=this._obj.value;if(this._autoClear&&s.length>2000){s=s.replace(/^(.*\n){10,10}/,"");}
var d=new Date();this._obj.value=s+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()+":"+d.getMilliseconds()+"\t"+str+"\n";this._obj.scrollTop=this._obj.scrollHeight;}},clear:function(){this._obj.value="";},pause:function(){if(!this._pause){this.write("Console Paused!");this._pause=true;_STJS.$("_system_console_pauseButton_"+this.id).innerHTML="Resume";}else{this._pause=false;this.write("Console Resume!");_STJS.$("_system_console_pauseButton_"+this.id).innerHTML="Pause";}},autoClear:function(){if(!this._autoClear){this.write("AutoClear Started!");this._autoClear=true;_STJS.$("_system_console_autoClearButton_"+this.id).innerHTML="Stop AutoClear";}else{this._autoClear=false;this.write("AutoClear Stoped!");_STJS.$("_system_console_autoClearButton_"+this.id).innerHTML="Start AutoClear";}}},{})},{});_STJS.Error=_STJS.Class.create("Error","GreyJS.lang.Error",{construct:function(str,code,source){this.description=str;this.code=code;this.source=source;}},{description:"",code:0,source:"",show:function(){if(!_STJS.DEBUG){_STJS.DEBUG=_STJS.System.Console;_STJS.DEBUG.open();}
_STJS.DEBUG.write("ERROR:"+this.description+" \t code:"+this.code+" \t source:"+this.source);},alert:function(){alert("ERROR:"+this.description+" \ncode:"+this.code+" \nsource:"+this.source);}});var userAgent=navigator.userAgent.toLowerCase();_STJS.Browser={userAgent:userAgent,version:(userAgent.match(/.+(:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};_STJS.DEBUG=_STJS.System.Console;})();(function(){com_sothink_slight={version:"0.1.0",$T:function(a){return a!=null&&a!=undefined},ReadType:function(){var tp="ajax";var l=self.location.toString();if(l.indexOf("http://")>-1||!_STJS.Browser.msie)tp="ajax";else tp="fso";tp="ajax";return tp;}(),$getFile:function(str,obj){var l=self.location.toString();str=str.replace(/\\/g,"/");var request=_STJS.getAJAX();request.open("GET",str,false);request.send(null);if(_STJS.getResponse(request,false)){var s=request.responseText;if(s=="")s="<Canvas></Canvas>";return s;}},QSPlayer:_STJS.Class.create("QSPlayer","GreyJS.SilverLight.QSPlayer",{version:"0.1.0",name:"Sothink Javascript SilverLight Player",players:[],index:0,construct:function(id,plugin){this.Events=[];if(id==null){id="SSLP_"+QSPlayer.index++;}
if(com_sothink_slight.QSPlayer.players[id]){(new _STJS.Error("Create player failed,the id \""+id+"\" is already exist.","101","QSPlayer")).alert();}
else{this.ID=id;this._Plugin=plugin;this._Container=plugin.content;this.QSImage.prototype._Player=this;this.QSMediaElement.prototype._Player=this;this.QSFrameEventArgs.prototype._Player=this;this.QSEvent.prototype._Player=this;this.QSEventList.prototype._Player=this;this.QSCommand.prototype._Player=this;this.QSCommandList.prototype._Player=this;this.QSCommandSound.prototype._Player=this;this.QSCommandPlace.prototype._Player=this;this.QSCommandPlace2.prototype._Player=this;this.QSCommandRemove.prototype._Player=this;this.QSCommandRename.prototype._Player=this;this.QSCommandTransform.prototype._Player=this;this.QSCommandOpacify.prototype._Player=this;this.QSCommandEvent.prototype._Player=this;this.QSFrame.prototype._Player=this;this.QSFrameList.prototype._Player=this;this.QSDisplay.prototype._Player=this;this.QSDisplayList.prototype._Player=this;this.QSSymbol.prototype._Player=this;this.QSSymbolList.prototype._Player=this;this.QSElement.prototype._Player=this;this.QSMovieClip.prototype._Player=this;this.QSMovieClipList.prototype._Player=this;this.QSButton.prototype._Player=this;this.SymbolList=new this.QSSymbolList();this.MainMovie=new this.QSMovieClip();com_sothink_slight.QSPlayer.players[id]=this;}}},{ID:"",Events:[],Symbol:null,SymbolList:null,RootGrid:null,MainMovie:null,Timer:null,Interval:100,_Container:null,_nowframe:0,getFrameRate:function(){return(1000.0/this.Interval);},setFrameRate:function(value){this.Interval=1000.0/value;},onLoadCompleted:function(){alert("LoadCompleted!");},AddToRootGrid:function(aSymbol){this.RootGrid.Children.Add(aSymbol._Canvas);return true;},TimerTickProc:function(sender,e)
{this._nowframe++;this.MainMovie.Show(false);this.MainMovie.Advance(1);this.MainMovie.Update();},StartTimer:function(aMainMovie){this.MainMovie=aMainMovie;this.Timer=setInterval("com_sothink_slight.QSPlayer.players['"+this.ID+"'].TimerTickProc();",this.Interval);return true;}})};with(com_sothink_slight){QSPlayer.prototype.QSImage=_STJS.Class.create("Image","GreyJS.SilverLight.QSPlayer.Image",{construct:function(strSource,sLabel){this._Image=this._Player._Container.createFromXaml("<Image/>");if($T(strSource))this.Open(strSource);this.Label=($T(sLabel)?sLabel:"SSLP_QSImage_"+QSPlayer.index++);}},{Label:"",_Player:null,_Image:null,IsEmpty:function(){return false;},Clone:function(){return(new this._Player.QSImage(this._Image.Source));},Open:function(strSource){this._Image.Source=strSource;}});QSPlayer.prototype.QSImage.prototype.toString=function(){return"Image";};QSPlayer.prototype.QSMediaElement=_STJS.Class.create("MediaElement","GreyJS.SilverLight.QSPlayer.MediaElement",{construct:function(strSource,nRepeatCount,bAddToRootGrid){this._ME=this._Player._Container.createFromXaml("<MediaElement/>");if($T(nRepeatCount))this.RepeatCount=nRepeatCount;if($T(bAddToRootGrid))m_bAddToRootGrid=bAddToRootGrid;if($T(strSource)){this.Open(strSource);}}},{_Player:null,_ME:null,RepeatCount:0,RepeatID:0,m_bAddToRootGrid:false,m_bPlaying:true,IsEmpty:function(){return false;},Clone:function()
{return(new this._Player.QSMediaElement(this._ME.Source,this.RepeatCount,this.m_bAddToRootGrid));},Open:function(strSource){this._ME.Source=strSource;this._ME.AutoPlay=false;this._ME.Stop();var _obj=this;this._ME.AddEventListener("MediaEnded",function(){_obj.MediaEndedProc(_obj)});this._ME.AddEventListener("MediaOpened",function(){_obj.MediaOpenedProc(_obj)});},Stop:function(){m_bPlaying=false;this._ME.Stop();},Play:function(){m_bPlaying=true;this._ME.Play();},Pause:function(){m_bPlaying=false;this._ME.Pause();},MediaEndedProc:function(obj){obj._ME.Stop();if(obj.RepeatID++<obj.RepeatCount){obj._ME.Play();}
else if(obj.m_bAddToRootGrid){obj._Player.RootGrid.Children.Remove(this._ME);}},MediaOpenedProc:function(obj){if(obj.m_bPlaying)
obj._ME.Play();}});QSPlayer.prototype.QSMediaElement.prototype.toString=function(){return"MediaElement";};QSPlayer.prototype.QSFrameEventArgs=_STJS.Class.create("FrameEventArgs","GreyJS.SilverLight.QSPlayer.FrameEventArgs",{construct:function(nFrame,strEvent){if($T(nFrame))this.Frame=nFrame;if($T(strEvent))this.Event=strEvent;}},{_Player:null,Frame:-1,Event:"",IsEmpty:function(){return false;},Clone:function(){return(new this._Player.QSFrameEventArgs(this.Frame,this.Event));}});QSPlayer.prototype.QSEvent=_STJS.Class.create("Event","GreyJS.SilverLight.QSPlayer.Event",{construct:function(strEvent,hHandler){if($T(strEvent))this.Event=strEvent;if($T(hHandler))this.Handler=hHandler;}},{_Player:null,Event:"",Handler:null,IsEmpty:function(){return!$T(this.Event)||this.Event==""||!$T(this.Handler);},Clone:function(){return(new this._Player.QSEvent(this.Event,this.Handler));}});QSPlayer.prototype.QSEventList=_STJS.Class.create("EventList","GreyJS.SilverLight.QSPlayer.EventList",{construct:function(){this.Events=[];}},{_Player:null,Events:[],Count:function(){return this.Events.length;},IsEmpty:function(){return!$T(this.Events);},Clone:function(){var aEventList=new this._Player.QSEventList();var nCount=this.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{aEventList.Append(this.Events[nIndex].Clone());}
return aEventList;},Clear:function(){this.Events=[];return true;},Append:function(aEvent){this.Events.push(aEvent);return true;},Insert:function(nIndex,aEvent){this.Events.splice(nIndex,0,aEvent);return true;},Erase:function(Index){if(typeof Index=="number"){this.Events.splice(Index,1);}
else{var nCount=this.Count();var index=-1;for(var nIndex=0;nIndex<nCount;nIndex++)
{if(this.Events[nIndex].Event==Index.Event&&this.Events[nIndex].Handler==Index.Handler)
{index=nIndex;break;}}
if(index>-1)this.Events.splice(index,1);}
return true;}});QSPlayer.prototype.QSCommand=_STJS.Class.create("Command","GreyJS.SilverLight.QSPlayer.Command",{construct:function(sLabel){this.Label=($T(sLabel)?sLabel:"SSLP_Command_"+QSPlayer.index++);}},{Label:"",_Player:null,IsCommandSound:function(){return this._class.className=="CommandSound";},IsCommandPlace:function(){return this._class.className=="CommandPlace";},IsCommandPlace2:function(){return this._class.className=="CommandPlace2";},IsCommandRemove:function(){return this._class.className=="CommandRemove";},IsCommandRename:function(){return this._class.className=="CommandRename";},IsCommandTransform:function(){return this._class.className=="CommandTransform";},IsCommandOpacify:function(){return this._class.className=="CommandOpacify";},IsCommandEvent:function(){return this._class.className=="CommandEvent";},IsCommandMediaElement:function(){return this._class.className=="CommandMediaElement";},IsCommandMedia:function(){return this._class.className=="CommandMedia";},IsEmpty:function(){return false;},Clone:function(){return(new this._Player.QSCommand(this.Label));}});QSPlayer.prototype.QSCommandList=_STJS.Class.create("CommandList","GreyJS.SilverLight.QSPlayer.CommandList",{construct:function(){this.Commands=[];}},{_Player:null,Commands:[],Count:function(){return this.Commands.length;},IsEmpty:function(){return!$T(this.Commands);},Clone:function(){var aCommandList=new this._Player.QSCommandList();var nCount=this.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{aCommandList.Append(this.Commands[nIndex].Clone());}
return aCommandList;},Clear:function(){this.Commands=[];return true;},Append:function(aCommand){this.Commands.push(aCommand);return true;},Insert:function(nIndex,aCommand){this.Commands.splice(nIndex,0,aCommand);return true;},Erase:function(Index){if(typeof Index=="number"){this.Commands.splice(Index,1);}
else{var nCount=this.Count();var index=-1;for(var nIndex=0;nIndex<nCount;nIndex++)
{if(this.Commands[nIndex].Label==Index.Label)
{index=nIndex;break;}}
if(index>-1)this.Commands.splice(index,1);}
return true;}});QSPlayer.prototype.QSCommandSound=_STJS.Class.create("CommandSound","GreyJS.SilverLight.QSPlayer.CommandSound",{construct:function(strSource,nRepeatCount,sLabel){if($T(strSource))this.Source=strSource;if($T(nRepeatCount))this.RepeatCount=nRepeatCount;this.Label=($T(sLabel)?sLabel:"SSLP_QSCommandPlace_"+QSPlayer.index++);}},{_Player:null,Label:"",Source:"",RepeatCount:0,IsEmpty:function(){return!$T(this.Source);},Clone:function(){return(new this._Player.QSCommandSound(this.Source,this.RepeatCount,this.Label));}},QSPlayer.prototype.QSCommand);QSPlayer.prototype.QSCommandPlace=_STJS.Class.create("CommandPlace","GreyJS.SilverLight.QSPlayer.CommandPlace",{construct:function(nSymbolID,sLabel){if($T(nSymbolID))this.SymbolID=nSymbolID;this.Label=($T(sLabel)?sLabel:"SSLP_QSCommandPlace_"+QSPlayer.index++);}},{_Player:null,Label:"",SymbolID:-1,IsEmpty:function(){return this.SymbolID<0;},Clone:function(){return(new this._Player.QSCommandPlace(this.SymbolID,this.Label));}},QSPlayer.prototype.QSCommand);QSPlayer.prototype.QSCommandPlace2=_STJS.Class.create("CommandPlace2","GreyJS.SilverLight.QSPlayer.CommandPlace2",{construct:function(nSymbolID,nDisplayID,sLabel){if($T(nSymbolID))this.SymbolID=nSymbolID;if($T(nDisplayID))this.DisplayID=nDisplayID;this.Label=($T(sLabel)?sLabel:"SSLP_QSCommandPlace2_"+QSPlayer.index++);}},{Label:"",_Player:null,SymbolID:-1,DisplayID:-1,IsEmpty:function(){return this.SymbolID<0||this.DisplayID<0;},Clone:function(){return(new this._Player.QSCommandPlace2(this.SymbolID,this.DisplayID,this.Label));}},QSPlayer.prototype.QSCommand);QSPlayer.prototype.QSCommandRemove=_STJS.Class.create("CommandRemove","GreyJS.SilverLight.QSPlayer.CommandRemove",{construct:function(nDisplayID,sLabel){if($T(nDisplayID))this.DisplayID=nDisplayID;this.Label=($T(sLabel)?sLabel:"SSLP_QSCommandEvent_"+QSPlayer.index++);}},{_Player:null,Label:"",DisplayID:-1,IsEmpty:function(){return this.DisplayID<0;},Clone:function(){return(new this._Player.QSCommandRemove(this.DisplayID,this.Label));}},QSPlayer.prototype.QSCommand);QSPlayer.prototype.QSCommandRename=_STJS.Class.create("CommandRename","GreyJS.SilverLight.QSPlayer.CommandRename",{construct:function(nDisplayID,sLabel){if($T(nDisplayID))this.DisplayID=nDisplayID;this.Label=($T(sLabel)?sLabel:"SSLP_QSCommandEvent_"+QSPlayer.index++);}},{_Player:null,Label:"",DisplayID:-1,IsEmpty:function(){return this.DisplayID<0;},Clone:function(){return(new this._Player.QSCommandRename(this.DisplayID,this.Label));}},QSPlayer.prototype.QSCommand);QSPlayer.prototype.QSCommandTransform=_STJS.Class.create("CommandTransform","GreyJS.SilverLight.QSPlayer.CommandTransform",{construct:function(nDisplayID,matTransform,sLabel){if($T(nDisplayID))this.DisplayID=nDisplayID;if($T(matTransform))this.Matrix=matTransform;this.Label=($T(sLabel)?sLabel:"SSLP_QSCommandTransform_"+QSPlayer.index++);}},{_Player:null,Label:"",DisplayID:-1,Matrix:null,IsEmpty:function(){return this.DisplayID<0;},Clone:function(){return(new this._Player.QSCommandTransform(this.DisplayID,this.Matrix,this.Label));}},QSPlayer.prototype.QSCommand);QSPlayer.prototype.QSCommandOpacify=_STJS.Class.create("CommandOpacify","GreyJS.SilverLight.QSPlayer.CommandOpacify",{construct:function(nDisplayID,fOpacity,sLabel){if($T(nDisplayID))this.DisplayID=nDisplayID;if($T(fOpacity))this.Opacity=fOpacity;this.Label=($T(sLabel)?sLabel:"SSLP_QSCommandOpacify_"+QSPlayer.index++);}},{_Player:null,Label:"",DisplayID:-1,Opacity:1,IsEmpty:function(){return this.DisplayID<0;},Clone:function(){return(new this._Player.QSCommandOpacify(this.DisplayID,this.Opacity,this.Label));}},QSPlayer.prototype.QSCommand);QSPlayer.prototype.QSCommandEvent=_STJS.Class.create("CommandEvent","GreyJS.SilverLight.QSPlayer.CommandEvent",{construct:function(nDisplayID,aEventList,sLabel){if($T(nDisplayID))this.DisplayID=nDisplayID;if(aEventList._class.className=="EventList"){this.EventList=aEventList;}
else if(aEventList._class.className=="Event"){this.EventList=new this._Player.QSEventList();this.EventList.Append(aEventList);}
else{this.EventList=new this._Player.QSEventList();}
this.Label=($T(sLabel)?sLabel:"SSLP_QSCommandEvent_"+QSPlayer.index++);}},{_Player:null,Label:"",EventList:null,DisplayID:-1,IsEmpty:function(){return(this.DisplayID<0||!$T(this.EventList));},Clone:function(){return(new this._Player.QSCommandEvent(this.DisplayID,this.EventList.Clone(),this.Label));}},QSPlayer.prototype.QSCommand);QSPlayer.prototype.QSFrame=_STJS.Class.create("Frame","GreyJS.SilverLight.QSPlayer.Frame",{construct:function(aCommandList,aEventList,sLabel){this.CommandList=($T(aCommandList)?aCommandList:new this._Player.QSCommandList());this.EventList=($T(aEventList)?aEventList:new this._Player.QSEventList());this.Label=($T(sLabel)?sLabel:"SSLP_QSFrame_"+QSPlayer.index++);}},{_Player:null,Label:"",CommandList:null,EventList:null,IsEmpty:function(){return(!$T(this.CommandList)||!$T(this.EventList));},Clone:function(){return(new this._Player.QSFrame(this.CommandList.Clone(),this.EventList.Clone(),this.Label));}});QSPlayer.prototype.QSFrameList=_STJS.Class.create("FrameList","GreyJS.SilverLight.QSPlayer.FrameList",{construct:function(){this.Frames=[];}},{_Player:null,Frames:[],Count:function(){return this.Frames.length;},IsEmpty:function(){return!$T(this.Frames);},Clone:function(){var aFrameList=new this._Player.QSFrameList();var nCount=this.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{aFrameList.Append(this.Frames[nIndex].Clone());}
return aFrameList;},Clear:function(){this.Frames=[];return true;},Append:function(aFrame){if(typeof aFrame=="number"){for(var nIndex=0;nIndex<aFrame;nIndex++){this.Frames.push(new this._Player.QSFrame());}
return true;}
else{this.Frames.push(aFrame);return true;}},Insert:function(nIndex,aFrame){this.Frames.splice(nIndex,0,aFrame);return true;},Erase:function(Index){if(typeof Index=="number"){this.Frames.splice(nIndex,1);}
else{var nCount=this.Count();var index=-1;for(var nIndex=0;nIndex<nCount;nIndex++)
{if(this.Frames[nIndex].Label==Index.Label)
{index=nIndex;break;}}
if(index>-1)this.Frames.splice(index,1);}
return true;}});QSPlayer.prototype.QSDisplay=_STJS.Class.create("Display","GreyJS.SilverLight.QSPlayer.Display",{construct:function(nSymbolID,aSymbol,sLabel){if($T(nSymbolID))this.SymbolID=nSymbolID;this.Symbol=($T(aSymbol)?aSymbol:new this._Player.QSSymbol());this.Label=($T(sLabel)?sLabel:"SSLP_QSDisplay_"+QSPlayer.index++);}},{_Player:null,Label:"",SymbolID:-1,Symbol:null,IsEmpty:function(){return!$T(this.Symbol);},Clone:function(){return(new this._Player.QSDisplay(this.SymbolID,this.Symbol.Clone(),this.Label));}});QSPlayer.prototype.QSDisplayList=_STJS.Class.create("DisplayList","GreyJS.SilverLight.QSPlayer.DisplayList",{construct:function(){this.Displays=[];}},{_Player:null,Displays:[],Count:function(){return this.Displays.length;},GetSymbol:function(Index){if(typeof Index=="number"){return this.Displays[Index].Symbol;}
else{var nCount=this.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{if(this.Displays[nIndex].Symbol.Label==Index)
return this.Displays[nIndex].Symbol;}
return null;}},GetIndex:function(SymbolID){var t=(typeof SymbolID=="number");var nCount=this.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{if(t)
{if(this.Displays[nIndex].SymbolID==SymbolID)return nIndex;}
else
{if(this.Displays[nIndex].Symbol.Label==SymbolID)return nIndex;}}
return-1;},IsEmpty:function(){return!$T(this.Displays);},Clone:function(aMovieClip){var aDisplayList=new this._Player.QSDisplayList();var nCount=this.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{aDisplayList.Append(this.Displays[nIndex].Clone(),aMovieClip);}
return aDisplayList;},Clear:function(aMovieClip){this.Displays=[];aMovieClip._Canvas.Children.Clear();return true;},Append:function(aDisplay,aMovieClip){this.Displays.push(aDisplay);aMovieClip._Canvas.Children.Add(aDisplay.Symbol._Canvas);return true;},Insert:function(nIndex,aDisplay,aMovieClip){this.Displays.splice(nIndex,0,aDisplay);aMovieClip._Canvas.Children.Insert(nIndex,aDisplay.Symbol._Canvas);return true;},Erase:function(Index,aMovieClip){if(typeof Index=="number"){this.Displays.splice(Index,1);aMovieClip._Canvas.Children.RemoveAt(Index);}
else{var nCount=this.Count();var index=-1;for(var nIndex=0;nIndex<nCount;nIndex++)
{if(this.Displays[nIndex].Label==Index.Label)
{index=nIndex;break;}}
if(index>-1){this.Displays.splice(index,1);aMovieClip._Canvas.Children.RemoveAt(index);}}
return true;}});QSPlayer.prototype.QSSymbol=_STJS.Class.create("Symbol","GreyJS.SilverLight.QSPlayer.Symbol",{construct:function(sLabel){this.Label=($T(sLabel)?sLabel:"SSLP_Symbol_"+QSPlayer.index++);this._Canvas=this._Player._Container.createFromXaml("<Canvas Background='#"+_STJS.randomColor()+"'></Canvas>");this._Canvas.RenderTransform=this._Player._Container.createFromXaml("<MatrixTransform></MatrixTransform>");this._Canvas.RenderTransform.Matrix=this._Player._Container.createFromXaml("<MatrixTransform></MatrixTransform>");}},{_Player:null,_Canvas:null,Label:"",IsElement:function(){return(this._class.className=="Element");},IsMovieClip:function(){return(this._class.className=="MovieClip");},IsButton:function(){return(this._class.className=="Button");},IsEmpty:function(){return false;},Clone:function(){return(new this._Player.QSSymbol(this.Label));},Update:function(){return true;},Reset:function(){return true;},Advance:function(nDeltaFrame){return false;},Show:function(bShow){this._Canvas.Visibility=bShow?("Visible"):("Collapsed");return true;},Transform:function(matTransform,bMultiply){if(bMultiply)
{matSrcTransform=this._Canvas.RenderTransform.Matrix;var mtx=this._Player._Container.createFromXaml("<Matrix/>");mtx.M11=matSrcTransform.M11*matTransform.M11+matSrcTransform.M12*matTransform.M21;mtx.M12=matSrcTransform.M11*matTransform.M12+matSrcTransform.M12*matTransform.M22;mtx.M21=matSrcTransform.M21*matTransform.M11+matSrcTransform.M22*matTransform.M21;mtx.M22=matSrcTransform.M21*matTransform.M12+matSrcTransform.M22*matTransform.M22;mtx.OffsetX=matSrcTransform.OffsetX*matTransform.M11+matSrcTransform.OffsetY*matTransform.M21+matTransform.OffsetX;mtx.OffsetY=matSrcTransform.OffsetX*matTransform.M12+matSrcTransform.OffsetY*matTransform.M22+matTransform.OffsetY;this._Canvas.RenderTransform=this._Player._Container.createFromXaml("<MatrixTransform></MatrixTransform>");this._Canvas.RenderTransform.Matrix=mtx;}
else
{this._Canvas.RenderTransform=this._Player._Container.createFromXaml("<MatrixTransform></MatrixTransform>");this._Canvas.RenderTransform.Matrix=this._Player._Container.createFromXaml("<Matrix M11='"+matTransform.M11+"' M12='"+matTransform.M12+"' M21='"+matTransform.M21+"' M22='"+matTransform.M22+"' OffsetX='"+matTransform.OffsetX+"' OffsetY='"+matTransform.OffsetY+"' />");}
return true;},Opacify:function(fOpacity,bMultiply){if(bMultiply)
{this._Canvas.Opacity*=fOpacity;}
else
{this._Canvas.Opacity=fOpacity;}
return true;},AddEvent:function(strEvent,hHandler,obj){if(arguments.length==1){var nCount=strEvent.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{var aEvent=strEvent.Events[nIndex];if(!this.AddEvent(aEvent.Event,aEvent.Handler))
return true;}
return true;}
else if(arguments.length==3||arguments.length==2){if(arguments.length==2)obj=this;var evt=this._Player.Events[strEvent+"->"+hHandler+"->"+obj]=function(sender,e){hHandler(sender,e,obj);};switch(strEvent){case"GotFocus":this._Canvas.AddEventListener("GotFocus",evt);break;case"LostFocus":this._Canvas.AddEventListener("LostFocus",evt);break;case"KeyDown":this._Canvas.AddEventListener("KeyDown",evt);break;case"KeyUp":this._Canvas.AddEventListener("KeyUp",evt);break;case"MouseEnter":this._Canvas.AddEventListener("MouseEnter",evt);break;case"MouseLeave":this._Canvas.AddEventListener("MouseLeave",evt);break;case"MouseLeftButtonDown":this._Canvas.AddEventListener("MouseLeftButtonDown",evt);break;case"MouseLeftButtonUp":this._Canvas.AddEventListener("MouseLeftButtonUp",evt);break;case"MouseMove":this._Canvas.AddEventListener("MouseMove",evt);break;case"Loaded":this._Canvas.AddEventListener("Loaded",evt);break;case"LayoutUpdated":this._Canvas.AddEventListener("LayoutUpdated",evt);break;case"SizeChanged":this._Canvas.AddEventListener("SizeChanged",evt);break;case"MediaOpened":if(this.IsElement()){var aElement=this;if(aElement.IsMediaElement()){aElement.MediaElement.AddEventListener("MediaOpened",evt);}}
break;case"MediaEnded":if(this.IsElement()){var aElement=this;if(aElement.IsMediaElement()){aElement.MediaElement.AddEventListener("MediaEnded",evt);}}
break;default:try{this._Canvas.AddEventListener(strEvent,evt);break;}catch(ee){}}
return true;}},DelEvent:function(strEvent,hHandler,obj){if(arguments.length==1){var nCount=strEvent.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{var aEvent=strEvent.Events[nIndex];if(!this.DelEvent(aEvent.Event,aEvent.Handler))
return true;}
return true;}
else if(arguments.length==3||arguments.length==2){if(arguments.length==2)obj=this;var evt=this._Player.Events[strEvent+"->"+hHandler+"->"+obj];switch(strEvent){case"GotFocus":this._Canvas.RemoveEventListener("GotFocus",evt);break;case"LostFocus":this._Canvas.RemoveEventListener("LostFocus",evt);break;case"KeyDown":this._Canvas.RemoveEventListener("KeyDown",evt);break;case"KeyUp":this._Canvas.RemoveEventListener("KeyUp",evt);break;case"MouseEnter":this._Canvas.RemoveEventListener("MouseEnter",evt);break;case"MouseLeave":this._Canvas.RemoveEventListener("MouseLeave",evt);break;case"MouseLeftButtonDown":this._Canvas.RemoveEventListener("MouseLeftButtonDown",evt);break;case"MouseLeftButtonUp":this._Canvas.RemoveEventListener("MouseLeftButtonUp",evt);break;case"MouseMove":this._Canvas.RemoveEventListener("MouseMove",evt);break;case"MouseDown":this._Canvas.RemoveEventListener("MouseDown",evt);break;case"Loaded":this._Canvas.RemoveEventListener("Loaded",evt);break;case"LayoutUpdated":this._Canvas.RemoveEventListener("LayoutUpdated",evt);break;case"SizeChanged":this._Canvas.RemoveEventListener("SizeChanged",evt);break;case"MediaOpened":if(this.IsElement()){var aElement=this;if(aElement.IsMediaElement()){aElement.MediaElement.RemoveEventListener("MediaOpened",evt);}}
break;case"MediaEnded":if(this.IsElement()){var aElement=this;if(aElement.IsMediaElement()){aElement.MediaElement.RemoveEventListener("MediaEnded",evt);}}
break;default:try{this._Canvas.RemoveEventListener(strEvent,evt);break;}catch(ee){}}
return true;}}});QSPlayer.prototype.QSSymbolList=_STJS.Class.create("SymbolList","GreyJS.SilverLight.QSPlayer.SymbolList",{construct:function(){this.Symbols=[];}},{_Player:null,Symbols:[],Count:function(){return this.Symbols.length},GetSymbol:function(Index){if(typeof Index=="number"){return this.Symbols[Index];}
else{var nCount=this.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{if(this.Symbols[nIndex].Label==Index)
return this.Symbols[nIndex];}
return null;}},IsEmpty:function(){return!$T(this.Symbols);},Clone:function(){var aSymbolList=new this._Player.QSSymbolList();var nCount=this.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{aSymbolList.Append(this.Symbols[nIndex].Clone());}
return aSymbolList;},Clear:function(){this.Symbols=[];return true;},Append:function(aSymbol){this.Symbols.push(aSymbol);return true;},Insert:function(nIndex,aSymbol){this.Symbols.splice(nIndex,0,aSymbol);return true;},Erase:function(Index){if(typeof Index=="number"){this.Symbols.splice(nIndex,1);}
else{var nCount=this.Count();var index=-1;for(var nIndex=0;nIndex<nCount;nIndex++)
{if(this.Symbols[nIndex].Label==Index.Label)
{index=nIndex;break;}}
if(index>-1)this.Symbols.splice(index,1);}
return true;}});QSPlayer.prototype.QSElement=_STJS.Class.create("Element","GreyJS.SilverLight.QSPlayer.Element",{construct:function(downloader,s1,s2){var al=arguments.length;this._Downloader=downloader;this.Label=(al==3?s1:"SSLP_Element_"+QSPlayer.index++);if(!$T(downloader)){if(al==2){if(typeof s1=="string"){this.File=s1;this._Downloader=$getFile(s1);this.UIElement=this._Player._Container.createFromXaml(this._Downloader);}
else if(s1._class.className=="Image"){this.UIElement=s1;}
else if(s1._class.className=="MediaElement"){this.UIElement=s1;}}
else if(al==3){if(typeof s2=="string"){this.File=s2;this._Downloader=$getFile(s2);this.UIElement=this._Player._Container.createFromXaml(this._Downloader);}
else if(s2._class.className=="Image"){this.UIElement=s2;}
else if(s2._class.className=="MediaElement"){this.UIElement=s2;}}}
else if(typeof downloader=="string"){this.UIElement=this._Player._Container.createFromXaml(downloader);}
else{if(al==2){this.UIElement=this._Player._Container.CreateFromXamlDownloader(downloader,s1);}
else{this.UIElement=this._Player._Container.CreateFromXamlDownloader(downloader,s2);}}
this._Canvas=this._Player._Container.createFromXaml("<Canvas></Canvas>");this._Canvas.RenderTransform=this._Player._Container.createFromXaml("<MatrixTransform></MatrixTransform>");this._Canvas.RenderTransform.Matrix=this._Player._Container.createFromXaml("<Matrix />")}},{_Player:null,_Canvas:null,File:"",_Downloader:null,UIElement:null,Canvas:function(){return(this.IsCanvas()?this.UIElement:null);},TextBlock:function(){return(this.IsTextBlock()?this.UIElement:null);},Image:function(){return(this.IsImage()?this.UIElement:null);},MediaElement:function(){return(this.IsMediaElement()?this.UIElement:null);},IsCanvas:function(){return this.UIElement.toString()=="Canvas";},IsTextBlock:function(){return this.UIElement.toString()=="TextBlock";},IsImage:function(){return this.UIElement.toString()=="Image";},IsMediaElement:function(){return this.UIElement.toString()=="MediaElement";},IsEmpty:function(){return!$T(this.UIElement)||(!this.IsCanvas()&&!this.IsTextBlock()&&!this.IsImage()&&!this.IsMediaElement());},Clone:function(){var aElement=null;if(this.IsImage())
{aElement=new this._Player.QSElement(this._Downloader,this.Label,this.Image().Clone());}
else if(this.IsMediaElement())
{aElement=new this._Player.QSElement(this._Downloader,this.Label,this.MediaElement().Clone());}
else
{aElement=new this._Player.QSElement(this._Downloader,this.Label,this.File);}
aElement._Canvas.RenderTransform=this._Player._Container.createFromXaml("<MatrixTransform></MatrixTransform>");var m=this._Canvas.RenderTransform.Matrix;aElement._Canvas.RenderTransform.Matrix=this._Player._Container.createFromXaml("<Matrix M11='"+m.M11+"' M12='"+m.M12+"' M21='"+m.M21+"' M22='"+m.M22+"' OffsetX='"+m.OffsetX+"' OffsetY='"+m.OffsetY+"' />");aElement._Canvas.Opacity=this._Canvas.Opacity;return aElement;},Update:function(){if(!this.Show(true))return false;var ue=this.UIElement;if(this.IsImage())ue=this.UIElement._Image;if(this.IsMediaElement())ue=this.UIElement._ME;if(this._Canvas.Children.Count!=1)
{this._Canvas.Children.Clear();this._Canvas.Children.Add(ue);}
return true;}},QSPlayer.prototype.QSSymbol);QSPlayer.prototype.QSMovieClip=_STJS.Class.create("MovieClip","GreyJS.SilverLight.QSPlayer.MovieClip",{construct:function(sLabel,aFrameList,aDisplayList){this.Label=($T(sLabel)?sLabel:"SSLP_MovieClip_"+QSPlayer.index++);this.FrameList=($T(aFrameList)?aFrameList:new this._Player.QSFrameList());this.DisplayList=($T(aDisplayList)?aDisplayList:new this._Player.QSDisplayList());this.Repeat=true;this.Playing=true;this.CurrFrame=0;this._Canvas=this._Player._Container.createFromXaml("<Canvas Background='#"+_STJS.randomColor()+"'></Canvas>");this._Canvas.RenderTransform=this._Player._Container.createFromXaml("<MatrixTransform></MatrixTransform>");this._Canvas.RenderTransform.Matrix=this._Player._Container.createFromXaml("<Matrix />")}},{_Player:null,_Canvas:null,SymbolList:null,FrameList:null,DisplayList:null,Repeat:true,Playing:true,CurrFrame:0,GetSymbol:function(Index){return this.DisplayList.GetSymbol(Index);},GetShape:function(Index){var aSymbol=this.GetSymbol(Index);if(aSymbol==null||!aSymbol.IsElement())return null;return aSymbol.Canvas();},GetText:function(Index){var aSymbol=this.GetSymbol(Index);if(aSymbol==null||!aSymbol.IsElement())return null;return aSymbol.TextBlock();},GetImage:function(Index){var aSymbol=this.GetSymbol(Index);if(aSymbol==null||!aSymbol.IsElement())return null;return aSymbol.Image();},GetVideo:function(Index){var aSymbol=this.GetSymbol(Index);if(aSymbol==null||!aSymbol.IsElement())return null;return aSymbol.MediaElement();},GetMovieClip:function(Index){var aSymbol=this.GetSymbol(Index);if(aSymbol==null||!aSymbol.IsMovieClip())return null;return aSymbol;},GetButton:function(Index){var aSymbol=this.GetSymbol(Index);if(aSymbol==null||!aSymbol.IsButton())return null;return aSymbol;},IsEmpty:function(){return(!$T(this.FrameList)||this.FrameList.IsEmpty()||!$T(this.DisplayList));},Clone:function(){var aMovieClip=new this._Player.QSMovieClip(this.Label,this.FrameList.Clone(),null);aMovieClip.DisplayList=this.DisplayList.Clone(aMovieClip);aMovieClip.Repeat=this.Repeat;aMovieClip.Playing=this.Playing;aMovieClip.CurrFrame=this.CurrFrame;aMovieClip._Canvas.RenderTransform=this._Player._Container.createFromXaml("<MatrixTransform></MatrixTransform>");var m=this._Canvas.RenderTransform.Matrix;aMovieClip._Canvas.RenderTransform.Matrix=this._Player._Container.createFromXaml("<Matrix M11='"+m.M11+"' M12='"+m.M12+"' M21='"+m.M21+"' M22='"+m.M22+"' OffsetX='"+m.OffsetX+"' OffsetY='"+m.OffsetY+"' />");aMovieClip._Canvas.Opacity=this._Canvas.Opacity;return aMovieClip;},Update:function(){if(!this.Show(true))return false;var nCount=this.DisplayList.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{var aDisplay=this.DisplayList.Displays[nIndex];if(!$T(aDisplay)||aDisplay.IsEmpty())continue;var aSymbol=aDisplay.Symbol;if(!$T(aSymbol)||aSymbol.IsEmpty())continue;if(!aSymbol.Update()){return false;}}
return true;},Reset:function(){if(!this.DisplayList.Clear(this))return false;this.CurrFrame=0;return true;},Advance:function(nDeltaFrame){if(nDeltaFrame<1)return false;if(nDeltaFrame>1)
{if(!this.Advance(nDeltaFrame-1))return false;if(!this.Advance(1))return false;return true;}
var aFrameEventList=null;var bResult=true;if(!this.Playing){bResult=false;}
else if(this.CurrFrame>=0&&this.CurrFrame<this.FrameList.Count()){var nSymbolCount=this._Player.SymbolList.Count();var aFrame=this.FrameList.Frames[this.CurrFrame];aFrameEventList=aFrame.EventList;var nCommandCount=aFrame.CommandList.Count();for(var nCommandID=0;nCommandID<nCommandCount;nCommandID++)
{var aCommand=aFrame.CommandList.Commands[nCommandID];if(aCommand.IsCommandSound())
{var aCommandSound=aCommand;var strSource=aCommandSound.Source;var nRepeatCount=aCommandSound.RepeatCount;this._Player.RootGrid.Children.Add((new this._Player.QSMediaElement(strSource,nRepeatCount,true))._ME);}
else if(aCommand.IsCommandPlace()){var aCommandPlace=aCommand;var nSymbolID=aCommandPlace.SymbolID;var aSymbol=this._Player.SymbolList.Symbols[nSymbolID%nSymbolCount].Clone();if(!aSymbol.Reset())return false;if(!this.DisplayList.Append(new this._Player.QSDisplay(nSymbolID,aSymbol),this))return false;}
else if(aCommand.IsCommandPlace2()){var aCommandPlace2=aCommand;var nSymbolID=aCommandPlace2.SymbolID;var nDisplayID=aCommandPlace2.DisplayID;var aSymbol=this._Player.SymbolList.Symbols[nSymbolID%nSymbolCount].Clone();if(!aSymbol.Reset())return false;if(nDisplayID<0)nDisplayID=0;if(nDisplayID<this.DisplayList.Count()){if(!this.DisplayList.Insert(nDisplayID,new this._Player.QSDisplay(nSymbolID,aSymbol),this))return false;}
else{if(!this.DisplayList.Append(new this._Player.QSDisplay(nSymbolID,aSymbol),this))return false;}}
else if(aCommand.IsCommandRemove()){var aCommandRemove=aCommand;var nDisplayID=aCommandRemove.DisplayID;if(nDisplayID<0||nDisplayID>=this.DisplayList.Count())continue;if(!this.DisplayList.Erase(nDisplayID,this))return false;}
else if(aCommand.IsCommandRename()){var aCommandRename=aCommand;var nDisplayID=aCommandRename.DisplayID;var strLable=aCommandRename.Label;if(nDisplayID<0||nDisplayID>=this.DisplayList.Count())continue;var aDisplay=this.DisplayList.Displays[nDisplayID];if(!$T(aDisplay)||aDisplay.IsEmpty())continue;var aSymbol=aDisplay.Symbol;if(!$T(aSymbol)||aSymbol.IsEmpty())continue;aSymbol.Label=strLable;}
else if(aCommand.IsCommandTransform()){var aCommandTransform=aCommand;var nDisplayID=aCommandTransform.DisplayID;var m=aCommandTransform.Matrix;var matTransform=this._Player._Container.createFromXaml("<Matrix M11='"+m.M11+"' M12='"+m.M12+"' M21='"+m.M21+"' M22='"+m.M22+"' OffsetX='"+m.OffsetX+"' OffsetY='"+m.OffsetY+"' />");if(nDisplayID<0||nDisplayID>=this.DisplayList.Count())continue;if(!this.DisplayList.GetSymbol(nDisplayID).Transform(matTransform,false))
return false;}
else if(aCommand.IsCommandOpacify()){var aCommandOpacify=aCommand;var nDisplayID=aCommandOpacify.DisplayID;var fOpacity=aCommandOpacify.Opacity;if(nDisplayID<0||nDisplayID>=this.DisplayList.Count())continue;if(!this.DisplayList.GetSymbol(nDisplayID).Opacify(fOpacity,false))return false;}
else if(aCommand.IsCommandEvent()){var aCommandEvent=aCommand;var nDisplayID=aCommandEvent.DisplayID;var aEventList=aCommandEvent.EventList;if(nDisplayID<0||nDisplayID>=this.DisplayList.Count())continue;if(!this.DisplayList.GetSymbol(nDisplayID).AddEvent(aEventList))return false;}
else{return false;}}
this.CurrFrame++;}
else{if(this.Repeat){if(this.FrameList.Count()>1){if(!this.Reset()||!this.Advance(1))return false;return true;}}
else{bResult=false;}}
var nDisplayCount=this.DisplayList.Count();for(var nDisplayID=0;nDisplayID<nDisplayCount;nDisplayID++)
{var aDisplay=this.DisplayList.Displays[nDisplayID];if(!$T(aDisplay)||aDisplay.IsEmpty())continue;var aSymbol=aDisplay.Symbol;if(!$T(aSymbol)||aSymbol.IsEmpty())continue;if(aSymbol.Advance(1))bResult=true;}
if($T(aFrameEventList)&&!aFrameEventList.IsEmpty()){var nEventCount=aFrameEventList.Count();for(var nEventID=0;nEventID<nEventCount;nEventID++)
{var aEvent=aFrameEventList.Events[nEventID];aEvent.Handler(this,new this._Player.QSFrameEventArgs(this.CurrFrame,aEvent.Event));}}
return bResult;},Play:function(){if(this.Playing&&$T(this._Player.Timer))return true;this.Playing=true;if(!this.Show(false))return false;if(!this.Advance(1))return false;if(!this.Update())return false;if(!this.Startup())return false;return true;},Stop:function(){this.Playing=false;return true;},GotoAndPlay:function(nDestFrame){this.Playing=true;if(!this.Show(false))return false;if(nDestFrame<1||nDestFrame>this.FrameList.Count())return false;var nDeltaFrame=nDestFrame-this.CurrFrame;if(nDeltaFrame<1){if(!this.Reset())return false;if(!this.Advance(nDestFrame))return false;}
else{if(!this.Advance(nDeltaFrame))return false;}
var nDisplayCount=this.DisplayList.Count();for(var nDisplayID=0;nDisplayID<nDisplayCount;nDisplayID++)
{var aDisplay=this.DisplayList.Displays[nDisplayID];if(!$T(aDisplay)||aDisplay.IsEmpty())continue;var aSymbol=aDisplay.Symbol;if(!$T(aSymbol)||aSymbol.IsEmpty())continue;if(!aSymbol.Reset())return false;}
if(!this.Update())return false;if(!this.Startup())return false;return true;},GotoAndStop:function(nDestFrame){this.Playing=true;if(!this.Show(false))return false;if(nDestFrame<1||nDestFrame>this.FrameList.Count())return false;var nDeltaFrame=nDestFrame-this.CurrFrame;if(nDeltaFrame<1){if(!this.Reset())return false;if(!this.Advance(nDestFrame))return false;}
else{if(!this.Advance(nDeltaFrame))return false;}
var nDisplayCount=this.DisplayList.Count();for(var nDisplayID=0;nDisplayID<nDisplayCount;nDisplayID++)
{var aDisplay=this.DisplayList.Displays[nDisplayID];if(!$T(aDisplay)||aDisplay.IsEmpty())continue;var aSymbol=aDisplay.Symbol;if(!$T(aSymbol)||aSymbol.IsEmpty())continue;if(!aSymbol.Reset())return false;}
if(!this.Update())return false;if(!this.Stop())return false;if(!this.Startup())return false;return true;},Startup:function(){var aMainMovie=(this._Player.MainMovie!=null?this._Player.MainMovie:this);if(this._Player.Timer==null){if(!this._Player.AddToRootGrid(aMainMovie))return false;if(!this._Player.StartTimer(aMainMovie))return false;}
return true;}},QSPlayer.prototype.QSSymbol);QSPlayer.prototype.QSMovieClipList=_STJS.Class.create("MovieClipList","GreyJS.SilverLight.QSPlayer.MovieClipList",{construct:function(){this.MovieClips=[];}},{_Player:null,MovieClips:[],Count:function(){return this.MovieClips.length;},IsEmpty:function(){return!$T(this.MovieClips);},GetMovieClip:function(nIndex){return MovieClips[nIndex];},Clone:function(){var aMovieClipList=new this._Player.QSMovieClipList();var nCount=this.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{aMovieClipList.Append(this.MovieClips[nIndex].Clone());}
return aMovieClipList;},Clear:function(){this.MovieClips=[];return true;},Append:function(aMovieClip){this.MovieClips.push(aMovieClip);return true;},Insert:function(nIndex,aMovieClip){this.MovieClips.splice(nIndex,0,aMovieClip);return true;},Erase:function(Index){if(typeof Index=="number"){this.MovieClips.splice(Index,1);}
else{var nCount=this.Count();var index=-1;for(var nIndex=0;nIndex<nCount;nIndex++)
{if(this.MovieClips[nIndex].Label==Index.Label)
{index=nIndex;break;}}
if(index>-1)this.MovieClips.splice(index,1);}
return true;}});QSPlayer.prototype.QSButton=_STJS.Class.create("Button","GreyJS.SilverLight.QSPlayer.Button",{BUTTON_MOVIE_CLIP_ID_MINVALUE:0,BUTTON_MOVIE_CLIP_ID_UP:0,BUTTON_MOVIE_CLIP_ID_OVER:1,BUTTON_MOVIE_CLIP_ID_DOWN:2,BUTTON_MOVIE_CLIP_ID_HIT:3,BUTTON_MOVIE_CLIP_ID_MAXVALUE:3,BUTTON_TOTAL_MOVIE_CLIP_COUNT:4,construct:function(strLabel,aMovieClipList,nCurrMovieClipID){this.Label=(strLabel==null||strLabel==""?"SSLP_Button_"+QSPlayer.index++:strLabel);if(!$T(aMovieClipList)){this.MovieClipList=new this._Player.QSMovieClipList();this.MovieClipList.Append(new this._Player.QSMovieClip());this.MovieClipList.Append(new this._Player.QSMovieClip());this.MovieClipList.Append(new this._Player.QSMovieClip());this.MovieClipList.Append(new this._Player.QSMovieClip());}
else{this.MovieClipList=aMovieClipList;}
this.CurrMovieClipID=(nCurrMovieClipID==null?0:nCurrMovieClipID);this._Canvas=this._Player._Container.createFromXaml("<Canvas Background='#"+_STJS.randomColor()+"'></Canvas>");this._Canvas.RenderTransform=this._Player._Container.createFromXaml("<MatrixTransform></MatrixTransform>");}},{_Player:null,_Canvas:null,MovieClipList:null,CurrMovieClipID:0,UpMovieClip:function(){return this.MovieClipList.MovieClips[this._Player.QSButton.BUTTON_MOVIE_CLIP_ID_UP];},OverMovieClip:function(){return this.MovieClipList.MovieClips[this._Player.QSButton.BUTTON_MOVIE_CLIP_ID_OVER];},DownMovieClip:function(){return this.MovieClipList.MovieClips[this._Player.QSButton.BUTTON_MOVIE_CLIP_ID_DOWN];},HitMovieClip:function(){return this.MovieClipList.MovieClips[this._Player.QSButton.BUTTON_MOVIE_CLIP_ID_HIT];},CurrMovieClip:function(){return this.MovieClipList.MovieClips[this.CurrMovieClipID];},IsEmpty:function(){return(this._Player.RootGrid==null||this.MovieClipList==null||this.MovieClipList.Count()!=this._Player.QSButton.BUTTON_TOTAL_MOVIE_CLIP_COUNT||this.CurrMovieClipID<this._Player.QSButton.BUTTON_MOVIE_CLIP_ID_MINVALUE||this.CurrMovieClipID>this._Player.QSButton.BUTTON_MOVIE_CLIP_ID_MAXVALUE);},Clone:function(){var aButton=new this._Player.QSButton(this.Label,this.MovieClipList.Clone(),this.CurrMovieClipID);aButton._Canvas.RenderTransform=this._Player._Container.createFromXaml("<MatrixTransform></MatrixTransform>");aButton._Canvas.RenderTransform.Matrix=this._Player._Container.createFromXaml("<Matrix />")
aButton._Canvas.Opacity=this._Canvas.Opacity;aButton.Reset();return aButton;},Update:function(){if(!this.Show(true))return false;var nCount=this.MovieClipList.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{var aMovieClip=this.MovieClipList.MovieClips[nIndex];if(nIndex==this._Player.QSButton.BUTTON_MOVIE_CLIP_ID_HIT){if(!aMovieClip.Reset())return false;var bPlaying=aMovieClip.Playing;aMovieClip.Playing=true;if(!aMovieClip.Advance(1))return false;aMovieClip.Playing=bPlaying;}
if(!aMovieClip.Update())return false;if(nIndex==this._Player.QSButton.BUTTON_MOVIE_CLIP_ID_HIT){if(!aMovieClip.Opacify(0.0,false))return false;}
else if(nIndex!=this.CurrMovieClipID){if(!aMovieClip.Show(false))return false;}}
if(this._Canvas.Children.Count!=nCount){this._Canvas.Children.Clear();for(var nIndex=0;nIndex<nCount;nIndex++)
{var aMovieClip=this.MovieClipList.MovieClips[nIndex];this._Canvas.Children.Add(aMovieClip._Canvas);}}
return true;},Reset:function(){var nCount=this.MovieClipList.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{var aMovieClip=this.MovieClipList.MovieClips[nIndex];if(!aMovieClip.Reset())return false;}
if(!this.AddBtnEvent())return false;return true;},Advance:function(nOffset){if(!this.CurrMovieClip().Advance(1))return false;return true;},AddEvent:function(aEventList){var aHitMovieClip=this.MovieClipList.MovieClips[this._Player.QSButton.BUTTON_MOVIE_CLIP_ID_HIT];if(!aHitMovieClip.AddEvent(aEventList))return false;return true;},AddBtnEvent:function(){var aHitMovieClip=this.MovieClipList.MovieClips[this._Player.QSButton.BUTTON_MOVIE_CLIP_ID_HIT];if(!aHitMovieClip.AddEvent("MouseLeave",this.MouseLeaveProc,this))return false;if(!aHitMovieClip.AddEvent("MouseEnter",this.MouseEnterProc,this))return false;if(!aHitMovieClip.AddEvent("MouseLeftButtonDown",this.MouseLeftButtonDownProc,this))return false;if(!aHitMovieClip.AddEvent("MouseLeftButtonUp",this.MouseLeftButtonUpProc,this))return false;return true;},MouseLeaveProc:function(sender,e,obj){obj._Canvas.Cursor="Arrow";obj.AlterCurrMovieClipID(obj._Player.QSButton.BUTTON_MOVIE_CLIP_ID_UP);},MouseEnterProc:function(sender,e,obj){obj._Canvas.Cursor="Hand";obj.AlterCurrMovieClipID(obj._Player.QSButton.BUTTON_MOVIE_CLIP_ID_OVER);},MouseLeftButtonDownProc:function(sender,e,obj){obj.AlterCurrMovieClipID(obj._Player.QSButton.BUTTON_MOVIE_CLIP_ID_DOWN);},MouseLeftButtonUpProc:function(sender,e,obj){obj.AlterCurrMovieClipID(obj._Player.QSButton.BUTTON_MOVIE_CLIP_ID_OVER);},AlterCurrMovieClipID:function(nCurrMovieClipID){if(!this.CurrMovieClip().Reset())return false;this.CurrMovieClipID=nCurrMovieClipID;var nCount=this.MovieClipList.Count();for(var nIndex=0;nIndex<nCount;nIndex++)
{var aMovieClip=this.MovieClipList.MovieClips[nIndex];if(!aMovieClip.Stop())return false;}
var aCurrMovieClip=this.MovieClipList.MovieClips[this.CurrMovieClipID];if(!aCurrMovieClip.Play())return false;return true;}},QSPlayer.prototype.QSSymbol);}})();
