// Turner XMP, Release Build, © 2007 Turner Broadcasting System, Inc. A Time Warner Company.  File: xmp_views, Version: 0.1.555.2010

xmp.ABSOLUTE_POSITION="absolute";xmp.OVERLAY="Overlay";xmp.OVERLAY_ELEMENT="div";xmp.OVERLAY_WIDTH_PARAMETER="{{width}}";xmp.OVERLAY_HEIGHT_PARAMETER="{{height}}";xmp.Overlay=function(aa,ba,ca,da,ea){try{this.viewport=ba;this.rawName="";this.group="";if(ca===null||ca.length===0){throw new xmp.OverlayError("Validating group.","Invalid overlay group.  Missing group.",this);}
if(ca.indexOf(" ")!==-1){throw new xmp.OverlayError("Validating group.","Invalid overlay group.  Group cannot contain spaces.",this);}
this.group=ca;if(da===null||da.length===0){throw new xmp.OverlayError("Validating name.","Invalid overlay name.  Missing name.",this);}
if(da.indexOf(" ")!==-1){throw new xmp.OverlayError("Validating name.","Invalid overlay name.  Name cannot contain spaces.",this);}
this.rawName=da;this.name=aa+this.group+this.rawName+xmp.OVERLAY;this.style="";this.html="";this.display=xmp.DISPLAY_NONE;this.zIndex=-1;this.position=xmp.ABSOLUTE_POSITION;this.rectangle={left:0,top:0,width:0,height:0};this.type=((ea)?ea:xmp.OVERLAY);this.properties={};}
catch(e){this._handleError("Constructing overlay.",e);}};xmp.Overlay.prototype.open=function(fa){try{this.viewport=fa;this.refresh();}
catch(e){this._handleError("Opening overlay.",e);}};xmp.Overlay.prototype.close=function(){try{this.viewport=null;this._destoryNativeOverlay();}
catch(e){this._handleError("Closing overlay.",e);}};xmp.Overlay.prototype.setHTML=function(ga){try{this.html=ga;if(true===this.viewportExists()){this.getNativeOverlay().innerHTML=this.getRenderableHTML();}}
catch(e){this._handleError("Setting overlay HTML.",e);}};xmp.Overlay.prototype.setStyle=function(ha){try{this.style=ha;if(true===this.viewportExists()&&true===this.isVisible()){this.applyCustomStyle(this.getNativeOverlay());}}
catch(e){this._handleError("Setting overlay style.",e);}};xmp.Overlay.prototype.show=function(ia){try{this.display=xmp.DISPLAY_BLOCK;if(false===this.viewportExists()){return;}
this.setZOrder();this.getNativeOverlay().style.display=this.display;}
catch(e){this._handleError("Showing overlay.",e);}};xmp.Overlay.prototype.hide=function(){try{if(false===this.viewportExists()||false===this.isVisible()){return;}
this.display=xmp.DISPLAY_NONE;this.getNativeOverlay().style.display=this.display;}
catch(e){this._handleError("Hiding overlay.",e);}};xmp.Overlay.prototype.refresh=function(){try{if(false===this.viewportExists()){return;}
this._destoryNativeOverlay();if(true===this.isVisible()){this.show();}
else{this.getNativeOverlay();}}
catch(e){this._handleError("Refreshing overlay.",e);}};xmp.Overlay.prototype.moveTo=function(ja,ka,la,ma){try{this.rectangle={left:xmp.getPixelUnits(ja),top:xmp.getPixelUnits(ka),width:xmp.getPixelUnits(la),height:xmp.getPixelUnits(ma)};if(true===this.viewportExists()&&true===this.isVisible()){var na=this.getNativeOverlay();var oa=((this.style.length>0)?this.style+"; ":"")+"z-Index: "+this.zIndex+"; position: "+this.position+"; display: "+this.display+"; marginLeft: "+"0px"+"; marginTop: "+"0px"+"; left: "+this.rectangle.left+"; top: "+this.rectangle.top+"; width: "+this.rectangle.width+"; height: "+this.rectangle.height;na.style.cssText=oa;}}
catch(e){this._handleError("Moving overlay.",e);}};xmp.Overlay.prototype.getNativeOverlay=function(){var pa=document.getElementById(this.name);if(pa===null){pa=document.createElement(xmp.OVERLAY_ELEMENT);pa.setAttribute(xmp.ID_ATTRIBUTE,this.name);pa.setAttribute(xmp.NAME_ATTRIBUTE,this.name);pa.style.display=this.display;this.position=xmp.ABSOLUTE_POSITION;pa.style.position=this.position;pa.style.marginLeft="0px";pa.style.marginTop="0px";pa.style.left=this.rectangle.left;pa.style.top=this.rectangle.top;pa.style.width=this.rectangle.width;pa.style.height=this.rectangle.height;pa.innerHTML=this.getRenderableHTML();this.applyCustomStyle(pa);var qa=xmp.getDomParent(this.viewport.getNative());xmp.insertDomChildBefore(qa,pa);}
return pa;};xmp.Overlay.prototype.getType=function(){return this.type;};xmp.Overlay.prototype.getName=function(){return this.rawName;};xmp.Overlay.prototype.getGroup=function(){return this.group;};xmp.Overlay.prototype.getViewport=function(){return this.viewport;};xmp.Overlay.prototype.setViewport=function(ra){this.viewport=ra;};xmp.Overlay.prototype.isVisible=function(){return(this.display===xmp.DISPLAY_BLOCK);};xmp.Overlay.prototype.viewportExists=function(){return(this.viewport!==null);};xmp.Overlay.prototype._handleError=function(sa,e){var ta=e;if(false===(ta instanceof xmp.OverlayError)){ta=new xmp.OverlayError(((e.context)?e.context:sa),((e.rawMessage)?e.rawMessage:e.message),this);ta.setInnerError(e);}
throw ta;};xmp.Overlay.prototype._destoryNativeOverlay=function(){var ua=document.getElementById(this.name);if(ua!==null){var va=xmp.getDomParent(ua);va.removeChild(ua);}};xmp.Overlay.prototype.onViewportChange=function(wa,xa,ya,za){};xmp.Overlay.prototype.getRenderableHTML=function(){var Aa=this.html;var Ba=[{name:xmp.OVERLAY_WIDTH_PARAMETER,value:this.rectangle.width},{name:xmp.OVERLAY_HEIGHT_PARAMETER,value:this.rectangle.height}];var Ca=Ba.length;for(var i=0;i<Ca;i++){Aa=Aa.replace(Ba[i].name,Ba[i].value);}
return Aa;};xmp.Overlay.prototype.getId=function(){return this.name;};xmp.Overlay.prototype.setProperty=function(Da,Ea){this.properties[Da]=Ea;this.onPropertyChange(Da,Ea);};xmp.Overlay.prototype.getProperty=function(Fa){return this.properties[Fa];};xmp.Overlay.prototype.onPropertyChange=function(Ga,Ha){};xmp.Overlay.prototype.applyCustomStyle=function(Ia){var Ja=((this.style.length>0)?this.style+"; ":"")+"z-Index: "+Ia.style.zIndex+"; position: "+Ia.style.position+"; display: "+Ia.style.display+"; marginLeft: "+Ia.style.left+"; marginTop: "+Ia.style.top+"; width: "+Ia.style.width+"; height: "+Ia.style.height;Ia.style.cssText=Ja;};xmp.Overlay.prototype.setZOrder=function(){var Ka=this.viewport.getNativePlayer().getNative();if(!Ka){throw new xmp.OverlayError("Showing overlay.","A native player does not exist for the viewport.",this);}
if(!Ka.style.zIndex||Ka.style.zIndex<=0){Ka.style.zIndex=1;}
var La=this.getNativeOverlay();this.zIndex=parseInt(Ka.style.zIndex,10)+1;La.style.zIndex=this.zIndex;};xmp.NATIVE_VIEWPORT_Z_INDEX=1;xmp.Viewport=function(Ma,Na,Oa,Pa,Qa){this.listener=Ma;this.type=Na;this.mime_type=Oa;this.contextName=Pa;this.name=Pa+this.type.substr(this.type.indexOf(".")+1);this.overlays=Qa;this.opened=false;this.style="";this.nativeViewport=null;this.nativePlayer=null;};xmp.Viewport.prototype.init=function(Ra,Sa,Ta){try{this.createContext=Ra;xmp.ViewportRegistry.addViewport(this);this.nativeViewport=this.listener.onCreateViewport(this.type,this.name,Sa,Ta);}
catch(e){this.setError("Creating viewport.",e);}};xmp.Viewport.prototype.open=function(Ua){this.createContext=Ua;};xmp.Viewport.prototype.close=function(){try{xmp.ViewportRegistry.removeViewport(this);for(var i=0;i<this.overlays.length;i++){this.overlays[i].close();}
this.opened=false;this.listener.onDestroyViewport(this.type,this.name);}
catch(e){this.setError("Closing viewport.",e);}};xmp.Viewport.prototype.isOpen=function(){return this.opened;};xmp.Viewport.prototype.reset=function(Va){this.createContext=Va;};xmp.Viewport.prototype.getSize=function(){try{return{width:this.nativeViewport.style.width,height:this.nativeViewport.style.height};}
catch(e){this.setError("Retrieving viewport size.",e);}
return{width:0,height:0};};xmp.Viewport.prototype.setSize=function(Wa,Xa,Ya){try{var Za=((this.nativeViewport.style.marginLeft.length>0)?this.nativeViewport.style.marginLeft:"0px");var $a=((this.nativeViewport.style.marginTop.length>0)?this.nativeViewport.style.marginTop:"0px");this.moveTo(Za,$a,Wa,Xa,Ya);}
catch(e){this.setError("Setting viewport size.",e);}};xmp.Viewport.prototype.moveTo=function(ab,bb,cb,db,eb){try{if(this.nativePlayer){this.nativePlayer.moveTo(ab,bb,cb,db);}
var fb=((this.style.length>0)?this.style+"; ":"")+((this.nativeViewport.style.zIndex)?"z-Index: "+this.nativeViewport.style.zIndex+";":"")+"margin-left: "+xmp.getPixelUnits(ab)+"; margin-top: "+xmp.getPixelUnits(bb)+"; width: "+xmp.getPixelUnits(cb)+"; height: "+xmp.getPixelUnits(db);this.nativeViewport.style.cssText=fb;if(true===eb){for(var i=0;i<this.overlays.length;i++){this.overlays[i].onViewportChange(ab,bb,cb,db);}}}
catch(e){this.setError("Moving viewport.",e);}};xmp.Viewport.prototype.setStyle=function(gb){try{this.style=gb;var hb=((this.nativeViewport.style.left.length>0)?this.nativeViewport.style.left:"0");var ib=((this.nativeViewport.style.top.length>0)?this.nativeViewport.style.top:"0");var jb=((this.style.length>0)?this.style+"; ":"")+"left: "+hb+"; top: "+ib+"; width: "+this.nativeViewport.style.width+"; height: "+this.nativeViewport.style.height;this.nativeViewport.style.cssText=jb;}
catch(e){this.setError("Setting viewport style.",e);}};xmp.Viewport.prototype.getNative=function(){return this.nativeViewport;};xmp.Viewport.prototype.getContextName=function(){return this.contextName;};xmp.Viewport.prototype.getName=function(){return this.name;};xmp.Viewport.prototype.getType=function(){return this.type;};xmp.Viewport.prototype.getNativeData=function(){return this.native_data;};xmp.Viewport.prototype.setError=function(kb,e){var lb=e;if(false===(lb instanceof xmp.ViewportError)){lb=new xmp.ViewportError(((e.context)?e.context:kb),((e.rawMessage)?e.rawMessage:e.message),this);lb.setInnerError(e);}
this._createTimer({id:"setError",interval:xmp.DEFAULT_TIMER_INTERVAL,handler:this.onSetError,context:lb}).start();};xmp.Viewport.prototype.setOpened=function(){this.opened=true;this._createTimer({id:"setOpened",interval:xmp.DEFAULT_TIMER_INTERVAL,handler:this.onSetOpened,context:null}).start();};xmp.Viewport.prototype.setCreated=function(){this._createTimer({id:"setCreated",interval:xmp.DEFAULT_TIMER_INTERVAL,handler:this.onSetCreated,context:null}).start();};xmp.Viewport.prototype._createTimer=function(mb){var nb=new xmp.util.Callback(mb.id,mb.handler,this);nb.setMetadata(xmp.CONTEXT,mb.context);return new xmp.util.Timer(mb.id,mb.interval,-1,nb);};xmp.Viewport.prototype.setNativePlayer=function(ob){this.nativePlayer=ob;for(var i=0;i<this.overlays.length;i++){this.overlays[i].open(this);}};xmp.Viewport.prototype.getNativePlayer=function(){return this.nativePlayer;};xmp.Viewport.prototype.onSetError=function(pb,qb){var rb=null;try{qb.stop();rb=pb.getMetadata(xmp.CONTEXT,{});this.listener.onViewportError(rb);}
catch(e){var sb=((rb)?rb:e);xmp.handleFatalError(sb);}};xmp.Viewport.prototype.onSetOpened=function(tb,ub){try{ub.stop();this.listener.onViewportOpened(this,this.createContext);}
catch(e){this.setError("Forwarding opened notification to listener.",e);}};xmp.Viewport.prototype.onSetCreated=function(vb,wb){try{wb.stop();this.listener.onViewportCreated(this,this.createContext);}
catch(e){this.setError("Forwarding created notification to listener.",e);}};xmp.Viewport.prototype.getCallbackMethod=function(xb){return"xmp.ViewportRegistry.getViewport( '"+this.getName()+"' )."+xb;};xmp.DHTML_VIEWPORT="xmp.DHTMLViewport";xmp.DHTMLViewport=function(yb,zb,Ab,Bb){xmp.DHTMLViewport.ctor.call(this,yb,xmp.DHTML_VIEWPORT,zb,Ab,Bb);};xmp.DERIVE_CLASS(xmp.Viewport,xmp.DHTMLViewport);xmp.DHTMLViewport.prototype.open=function(Cb,Db){xmp.DHTMLViewport.base.open.call(this,Cb,Db);this.setOpened();};xmp.DHTMLViewport.prototype.init=function(Eb,Fb,Gb){xmp.DHTMLViewport.base.init.call(this,Eb,Fb,Gb);this.setCreated();};xmp.FLASH_VIEWPORT="xmp.FlashViewport";xmp.FLASH_VIEWPORT_OPENED_METHOD="onOpened";xmp.FLASH_VIEWPORT_CREATED_METHOD="onCreated";xmp.FLASH_VIEWPORT_ERROR_METHOD="onError";xmp.FVP_OPEN_COMMAND="fvpOpen";xmp.FlashViewport=function(Hb,Ib,Jb,Kb){xmp.FlashViewport.ctor.call(this,Hb,xmp.FLASH_VIEWPORT,Ib,Jb,Kb);};xmp.DERIVE_CLASS(xmp.Viewport,xmp.FlashViewport);xmp.FlashViewport.prototype.init=function(Lb,Mb,Nb){var Ob=[{name:xmp.ALLOW_SCRIPT_ACCESS,value:xmp.ALWAYS_ACCESS},{name:xmp.QUALITY,value:xmp.QUALITY_HIGH},{name:xmp.WINDOW_MODE,value:xmp.TRANSPARENT_WINDOW_MODE}];var Pb=[{name:xmp.FLASH_INITIALIZATION_CALLBACK,value:this.getCallbackMethod(xmp.FLASH_VIEWPORT_CREATED_METHOD)},{name:xmp.FLASH_ERROR_CALLBACK,value:this.getCallbackMethod(xmp.FLASH_VIEWPORT_ERROR_METHOD)},{name:xmp.FLASH_NATIVE_PLAYER_COMPONENT,value:xmp.makeSWFPath(xmp.FLASH_PLAYER_SWF_BASE_NAME,true)}];xmp.FlashViewport.base.init.call(this,Lb,Ob,Pb);};xmp.FlashViewport.prototype.open=function(Qb,Rb){xmp.FlashViewport.base.open.call(this,Qb,Rb);var Sb=this.getNative();Sb.style.zIndex=xmp.NATIVE_VIEWPORT_Z_INDEX;Sb.SetVariable(xmp.FLASH_INITIALIZATION_CALLBACK,this.getCallbackMethod(xmp.FLASH_VIEWPORT_OPENED_METHOD));Sb.fvpOpen();};xmp.FlashViewport.prototype.reset=function(Tb,Ub){};xmp.FlashViewport.prototype.onOpened=function(){try{this.setOpened();}
catch(e){this.setError("Handling open.",e);}};xmp.FlashViewport.prototype.onCreated=function(){try{this.setCreated();}
catch(e){this.setError("Handling create.",e);}};xmp.FlashViewport.prototype.onError=function(Vb,Wb){try{var Xb=[{label:"Flash Error Type",text:Vb}];this.setError(null,new xmp.ViewportError("Handling error.",Wb,this,Xb));}
catch(e){this.setError("Handling error.",e);}};xmp.MEDIA_OVERLAY="MediaOverlay";xmp.MEDIA_OVERLAY_NODE="MediaOverlayNode";xmp.MEDIA_OVERLAY_LISTENER="MediaOverlayListener";xmp.MediaOverlay=function(Yb,Zb,$b,ac){xmp.MediaOverlay.ctor.call(this,Yb,Zb,$b,ac,xmp.MEDIA_OVERLAY);};xmp.DERIVE_CLASS(xmp.Overlay,xmp.MediaOverlay);xmp.MediaOverlay.prototype.show=function(bc){try{this.display=xmp.DISPLAY_BLOCK;if(false===this.viewportExists()){return;}
this.setZOrder();this.moveTo(this.rectangle.left,this.rectangle.top,this.rectangle.width,this.rectangle.height);this.getNativeOverlay().style.display=this.display;this.openMedia();}
catch(e){this._handleError("Showing media overlay.",e);}};xmp.MediaOverlay.prototype.hide=function(){try{if(false===this.viewportExists()||false===this.isVisible()){return;}
this.display=xmp.DISPLAY_NONE;this.getNativeOverlay().style.display=this.display;this.destoryMediaPlayer();}
catch(e){this._handleError("Hiding media overlay.",e);}};xmp.MediaOverlay.prototype.onPropertyChange=function(cc,dc){if(cc!==xmp.MEDIA_OVERLAY_NODE){return;}
if(false===this.viewportExists()||false===this.isVisible()){return;}
this.openMedia();};xmp.MediaOverlay.prototype.onViewportChange=function(ec,fc,gc,hc){};xmp.MediaOverlay.prototype.setPlacement=function(ic,jc){};xmp.MediaOverlay.prototype.getMediaPlayer=function(){if(!this.mediaPlayer){this.mediaPlayer=xmp.MediaPlayerFactory.createPlayer(this.getId()+"MediaPlayer",this);this.mediaPlayer.init();}
return this.mediaPlayer;};xmp.MediaOverlay.prototype.destoryMediaPlayer=function(){if(!this.mediaPlayer){this.mediaPlayer.fini();this.mediaPlayer=null;}};xmp.MediaOverlay.prototype.onInitialized=function(){this.mediaPlayer.setVolume(100);this.mediaPlayer.setMute(true);var kc=[xmp.FLASH_MIME_TYPE,xmp.WINDOWS_MEDIA_MIME_TYPE,xmp.IMAGE_MIME_TYPE,xmp.DHTML_MIME_TYPE,xmp.QUICKTIME_MIME_TYPE];var lc=kc.length;for(var i=0;i<lc;i++){this.mediaPlayer.setViewportConfig(kc[i],xmp.DHTML_VIEWPORT);}};xmp.MediaOverlay.prototype.onTimelineChange=function(mc,nc,oc){this.getListener().onOverlayTimelineChange(mc,nc,oc);};xmp.MediaOverlay.prototype.onStateChange=function(pc,qc,rc){this.getListener().onOverlayStateChange(pc,qc,rc);};xmp.MediaOverlay.prototype.onError=function(sc,e){this.getListener().onOverlayError(sc,e);};xmp.MediaOverlay.prototype.onCreateViewport=function(tc,uc,vc,wc){return this.getNativeOverlay();};xmp.MediaOverlay.prototype.onDestroyViewport=function(xc,yc){};xmp.MediaOverlay.prototype.onPlugInError=function(e){this.getListener().onOverlayPlugInError(e);};xmp.MediaOverlay.prototype.onUnsupportedPlatformError=function(e){this.getListener().onOverlayUnsupportedPlatformError(e);};xmp.MediaOverlay.prototype.openMedia=function(){var zc=this.getProperty(xmp.MEDIA_OVERLAY_NODE);if(!zc){return;}
this.getMediaPlayer().open(zc);};xmp.MediaOverlay.prototype.getListener=function(){var Ac=this.getProperty(xmp.MEDIA_OVERLAY_LISTENER);if(!Ac){throw new xmp.OverlayError("Retrieving media overlay listener.","Missing media overlay listener.",this);}
return Ac;};xmp.OverlayError=function(Bc,Cc,Dc){var Ec=[{label:"Overlay Group",text:((Dc)?Dc.getGroup():"")},{label:"Overlay Type",text:((Dc)?Dc.getType():"")},{label:"Overlay Name",text:((Dc)?Dc.getName():"")},{label:"Overlay Id",text:((Dc)?Dc.getId():"")}];xmp.OverlayError.ctor.call(this,"OverlayError",Bc,Cc,Ec);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.OverlayError);xmp.OverlayFactory=function(){return{createOverlay:function(Fc,Gc,Hc,Ic,Jc){if(Ic===xmp.OVERLAY){return new xmp.Overlay(Fc,Gc,Hc,Jc);}
else if(Ic===xmp.SLATE_OVERLAY){return new xmp.SlateOverlay(Fc,Gc,Hc,Jc);}
else if(Ic===xmp.MEDIA_OVERLAY){return new xmp.MediaOverlay(Fc,Gc,Hc,Jc);}
throw new xmp.OverlayError("Creating overlay.","Unable to create \""+Ic+"\" overlay.",null);}};}();xmp.OverlayProxy=function(Kc){this.object=Kc;};xmp.OverlayProxy.prototype.object=null;xmp.OverlayProxy.prototype.show=function(){this.object.show();};xmp.OverlayProxy.prototype.hide=function(){this.object.hide();};xmp.OverlayProxy.prototype.refresh=function(){this.object.refresh();};xmp.OverlayProxy.prototype.setHTML=function(Lc){xmp.validateArguments(arguments,[xmp.STRING_TYPE],"OverlayProxy.setHTML");this.object.setHTML(Lc);};xmp.OverlayProxy.prototype.setStyle=function(Mc){xmp.validateArguments(arguments,[xmp.STRING_TYPE],"OverlayProxy.setStyle");this.object.setStyle(Mc);};xmp.OverlayProxy.prototype.moveTo=function(Nc,Oc,Pc,Qc){xmp.validateArguments(arguments,[xmp.STRING_TYPE,xmp.STRING_TYPE,xmp.STRING_TYPE,xmp.STRING_TYPE],"OverlayProxy.moveTo");this.object.moveTo(Nc,Oc,Pc,Qc);};xmp.OverlayProxy.prototype.setProperty=function(Rc,Sc){this.object.setProperty(Rc,Sc);};xmp.OverlayProxy.prototype.getProperty=function(Tc){return this.object.getProperty(Tc);};xmp.SLATE_OVERLAY="SlateOverlay";xmp.SlateOverlay=function(Uc,Vc,Wc,Xc){xmp.SlateOverlay.ctor.call(this,Uc,Vc,Wc,Xc,xmp.SLATE_OVERLAY);this.nonVisibleViewportRect={left:"0px",top:"0px",width:"1px",height:"1px"};this.origViewportRect=null;};xmp.DERIVE_CLASS(xmp.Overlay,xmp.SlateOverlay);xmp.SlateOverlay.prototype.show=function(Yc){try{this.display=xmp.DISPLAY_BLOCK;if(false===this.viewportExists()){return;}
if(!this.origViewportRect){var Zc=this.viewport.getSize();this.setPlacement(Zc.width,Zc.height);}
this.viewport.moveTo(this.nonVisibleViewportRect.left,this.nonVisibleViewportRect.top,this.nonVisibleViewportRect.width,this.nonVisibleViewportRect.height,false);this.getNativeOverlay().style.display=this.display;}
catch(e){this._handleError("Showing slate overlay.",e);}};xmp.SlateOverlay.prototype.hide=function(){try{if(false===this.viewportExists()||false===this.isVisible()){return;}
if(this.origViewportRect){this.viewport.moveTo(this.origViewportRect.left,this.origViewportRect.top,this.origViewportRect.width,this.origViewportRect.height,false);}
this.display=xmp.DISPLAY_NONE;this.getNativeOverlay().style.display=this.display;}
catch(e){this._handleError("Hiding slate overlay.",e);}};xmp.SlateOverlay.prototype.moveTo=function($c,ad,bd,cd){throw new xmp.util.internals.UnsupportedOperationError("The \"moveTo\" operation is not supported.");};xmp.SlateOverlay.prototype.onViewportChange=function(dd,ed,fd,gd){this.setPlacement(fd,gd);this.refresh();};xmp.SlateOverlay.prototype.setPlacement=function(hd,jd){this.origViewportRect={left:"0px",top:"0px",width:hd,height:jd};this.rectangle={left:0,top:0,width:hd,height:jd};};xmp.ALL_OVERLAYS="AllOverlays";xmp.OVERLAY_GROUP_SHOW="GroupShow";xmp.OVERLAY_GROUP_HIDE="GroupHide";xmp.OVERLAY_GROUP_REFRESH="GroupRefresh";xmp.ViewManager=function(kd){this.activeViewport=null;this.viewportsConfig={};this.overlays=[];this.context=kd;};xmp.ViewManager.prototype.setViewportConfig=function(ld,md){if(false===xmp.ViewportFactory.canCreate(md)){throw new xmp.ViewportError("Setting viewport configuration.","Invalid media player viewport type \""+md+"\".",null);}
this.viewportsConfig[ld]=md;};xmp.ViewManager.prototype.getViewportConfig=function(nd){var od=this.viewportsConfig[nd];if(od===null){throw new xmp.InvalidMimeTypeError("Retrieving viewport configuration.","Unable to find media player viewport configuration for MIME type \""+nd+"\".");}
return od;};xmp.ViewManager.prototype.getActiveViewport=function(){return this.activeViewport;};xmp.ViewManager.prototype.openViewport=function(pd,qd,rd,sd){var td=this.getViewportConfig(rd);var ud=this.activeViewport;if(this.activeViewport===null||(this.activeViewport.getType()!==td)){return this.createViewport(pd,qd,rd,sd);}
else if(this.activeViewport.mime_type!==rd){this.activeViewport.reset(sd);}
if(false===ud.isOpen()){try{ud.open(sd);return true;}
catch(e){ud.close();throw e;}}
return false;};xmp.ViewManager.prototype.createViewport=function(vd,wd,xd,yd){var zd=this.getViewportConfig(xd);if(!zd){throw new xmp.ViewportError("Creating viewport.","Unable to find viewport configuration for MIME type \""+xd+"\" .",null);}
if(this.activeViewport===null||(this.activeViewport.getType()!==zd)){var Ad=xmp.ViewportFactory.createViewport(vd,wd,zd,xd,yd,this.overlays);try{if(this.activeViewport!==null){this.activeViewport.close();this.activeViewport=null;}}
catch(e){throw e;}
finally{this.activeViewport=Ad;}
return true;}
return false;};xmp.ViewManager.prototype.createOverlay=function(Bd,Cd,Dd){if(this.getOverlay(Dd)!==null){throw new xmp.OverlayError("Creating overlay.","An overlay already exists with the name \""+Dd+"\".",null);}
var Ed=xmp.OverlayFactory.createOverlay(this.context,this.activeViewport,Bd,Cd,Dd);this.overlays.push(Ed);return Ed;};xmp.ViewManager.prototype.getOverlay=function(Fd){for(var i=0;i<this.overlays.length;i++){if(this.overlays[i].getName()===Fd){return this.overlays[i];}}
return null;};xmp.ViewManager.prototype.showOverlays=function(Gd){this.doOverlayGroupAction(Gd,xmp.OVERLAY_GROUP_SHOW);};xmp.ViewManager.prototype.hideOverlays=function(Hd){this.doOverlayGroupAction(Hd,xmp.OVERLAY_GROUP_HIDE);};xmp.ViewManager.prototype.refreshOverlays=function(Id){this.doOverlayGroupAction(Id,xmp.OVERLAY_GROUP_REFRESH);};xmp.ViewManager.prototype.doOverlayGroupAction=function(Jd,Kd){for(var i=0;i<this.overlays.length;i++){if(this.overlays[i].group===Jd||Jd===xmp.ALL_OVERLAYS){var Ld=this.overlays[i];Ld.setViewport(this.activeViewport);if(Kd===xmp.OVERLAY_GROUP_SHOW){Ld.show();}
else if(Kd===xmp.OVERLAY_GROUP_HIDE){Ld.hide();}
else if(Kd===xmp.OVERLAY_GROUP_REFRESH){Ld.refresh();}}}};xmp.ViewManager.prototype.close=function(){if(this.activeViewport!==null){this.activeViewport.close();this.activeViewport=null;}};xmp.ViewportError=function(Md,Nd,Od,Pd){var Qd=[];if(Od){Qd.push({label:"Viewport Type",text:Od.getType()});Qd.push({label:"Viewport Name",text:Od.getName()});}
if(Pd){Qd=Qd.concat(Pd);}
xmp.ViewportError.ctor.call(this,"ViewportError",Md,Nd,Qd);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.ViewportError);xmp.VIEWPORT="Viewport";xmp.ViewportFactory=function(){return{createViewport:function(Rd,Sd,Td,Ud,Vd,Wd){var Xd=xmp.getNamespacedMethod(Td);if(!Xd){throw new xmp.ViewportError("Creating viewport.","Unable to create \""+Td+"\" viewport.",null);}
var Yd=new Xd(Rd,Ud,Sd,Wd);Yd.init(Vd,null,null);return Yd;},canCreate:function(Zd){try{return(true===xmp.isDefined(xmp.getNamespacedMethod(Zd)));}
catch(e){}
return false;}};}();xmp.ViewportProxy=function($d){this.viewManager=$d;};xmp.ViewportProxy.prototype.viewManager=null;xmp.ViewportProxy.prototype.getType=function(){return((this.viewManager.getActiveViewport()!==null)?this.viewManager.getActiveViewport().getType():"None");};xmp.ViewportProxy.prototype.getSize=function(){return((this.viewManager.getActiveViewport()!==null)?this.viewManager.getActiveViewport().getSize():null);};xmp.ViewportProxy.prototype.setSize=function(ae,be){xmp.validateArguments(arguments,[xmp.STRING_TYPE,xmp.STRING_TYPE],"ViewportProxy.setSize");this.viewManager.getActiveViewport().setSize(ae,be,true);};xmp.ViewportProxy.prototype.moveTo=function(ce,de,ee,fe){xmp.validateArguments(arguments,[xmp.STRING_TYPE,xmp.STRING_TYPE,xmp.STRING_TYPE,xmp.STRING_TYPE],"ViewportProxy.moveTo");this.viewManager.getActiveViewport().moveTo(ce,de,ee,fe,true);};xmp.ViewportProxy.prototype.setStyle=function(ge){xmp.validateArguments(arguments,[xmp.STRING_TYPE],"ViewportProxy.setStyle");this.viewManager.getActiveViewport().setStyle(ge);};xmp.ViewportProxy.prototype.createOverlay=function(he,ie,je){xmp.validateArguments(arguments,[xmp.STRING_TYPE,xmp.STRING_TYPE,xmp.STRING_TYPE],"ViewportProxy.createOverlay");return new xmp.OverlayProxy(this.viewManager.createOverlay(he,ie,je));};xmp.ViewportProxy.prototype.getOverlay=function(ke){xmp.validateArguments(arguments,[xmp.STRING_TYPE],"ViewportProxy.getOverlay");var le=this.viewManager.getOverlay(ke);return((le!==null)?new xmp.OverlayProxy(le):null);};xmp.ViewportProxy.prototype.showOverlays=function(me){xmp.validateArguments(arguments,[xmp.STRING_TYPE],"ViewportProxy.showOverlays");this.viewManager.showOverlays(me);};xmp.ViewportProxy.prototype.hideOverlays=function(ne){xmp.validateArguments(arguments,[xmp.STRING_TYPE],"ViewportProxy.hideOverlays");this.viewManager.hideOverlays(ne);};xmp.ViewportProxy.prototype.refreshOverlays=function(oe){xmp.validateArguments(arguments,[xmp.STRING_TYPE],"ViewportProxy.refreshOverlays");this.viewManager.refreshOverlays(oe);};xmp.ViewportRegistry=function(){var pe={};return{addViewport:function(qe){var re=qe.getName();if(pe[re]!==null&&true===xmp.isDefined(pe[re])){throw new xmp.ViewportError("Adding viewport to registry.","A media player viewport already exists with the name \""+re+"\".",qe);}
pe[re]=qe;},getViewport:function(se){return pe[se];},removeViewport:function(te){if(te===null||false===xmp.isDefined(te)){throw new xmp.ViewportError("Removing viewport from registry.","Cannot remove NULL viewport from viewport registry.",te);}
pe[te.getName()]=null;}};}();