//////////////////////////////////////////////////////
//
//	Library of Congress
//  Creating the US Silverlight
//	Library
//
// 	Author: Lenny Burdette lburdette@schematic.com
// 	Version: 1.0
// 	Date: Fri May 02 12:49:04 -0700 2008
//
//////////////////////////////////////////////////////

var Loc=window.Loc||{};if(!Array.from){Array.from=function(iterable){if(!iterable){return[];}
if(iterable.toArray){return iterable.toArray();}else if(!!(document.getBoxObjectFor)||!!(window.devicePixelRatio)){return[].slice.call(iterable,0,iterable.length);}else{var results=[];for(var i=0,length=iterable.length;i<length;i++){results[results.length]=iterable[i];}
return results;}};}
if(!Function.prototype.argumentNames){Function.prototype.argumentNames=function(){var names=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",");if(names.length===1&&!names[0]){return[];}else{for(var i=0,j=names.length;i<j;i++){names[i]=names[i].replace(/^\s+/,'').replace(/\s+$/,'');}
return names;}};}
if(!Function.prototype.wrap){Function.prototype.wrap=function(wrapper){var __method=this;return function(){return wrapper.apply(this,[__method.bind(this)].concat(Array.from(arguments)));};};}
if(!Function.bind){Function.prototype.bind=function(){var method=this,args=Array.from(arguments),object=args.shift();return function(){return method.apply(object,args.concat(Array.from(arguments)));};};}
if(!Array.indexOf){Array.indexOf=function(array,value){if(array.indexOf){return array.indexOf(value);}
for(var i=0,j=array.length;i<j;i++){if(value===array[i]){return i;}}
return-1;};}
var Class={create:function(){var parent=null,mixins=Array.from(arguments);if(typeof mixins[0]==='function'){parent=mixins.shift();}
function klass(){this.initialize.apply(this,arguments);};klass.addMethods=function(source){var ancestor=this.superclass&&this.superclass.prototype;for(var property in source){var value=source[property];if(ancestor&&typeof value==='function'&&value.argumentNames()[0]==='$super'){var method=value;value=(function(m){return function(){return ancestor[m].apply(this,arguments);};})(property).wrap(method);value.valueOf=function(){return method;};value.toString=function(){return method.toString();};}
this.prototype[property]=value;}
return this;};klass.superclass=parent;klass.subclasses=[];if(parent){var subclass=function(){};subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.subclasses.push(klass);}
for(var i=0,j=mixins.length;i<j;i++){klass.addMethods(mixins[i]);}
if(!klass.prototype.initialize){klass.prototype.initialize=function(){};}
klass.prototype.constructor=klass;return klass;}};var Utils={registerPlugin:function(plugin){Utils.plugin=plugin;},Downloader:function(params){var plugin=Utils.plugin,downloader=plugin.createObject('Downloader'),that=this,completedToken=downloader.addEventListener('completed',function(){if(params.onComplete){params.onComplete(downloader);}
that.destroy();}),progressToken=downloader.addEventListener('downloadProgressChanged',function(){if(params.onDownloadProgress){params.onDownloadProgress(downloader);}});this.destroy=function(){downloader.removeEventListener('completed',completedToken);downloader.removeEventListener('downloadProgressChanged',progressToken);downloader=null;};this.start=function(url){downloader.open('GET',url);downloader.send();};this.abort=function(){downloader.abort();this.destroy();};this.progress=function(){try{return downloader.downloadProgress;}catch(e){return 1;}};},XamlDownloader:function(path,options){var downloader=new Utils.Downloader({onComplete:function(downloader){if(typeof options.onComplete==="function"){options.onComplete(new Utils.ZipHandler(downloader));}},onDownloadProgress:function(downloader){if(typeof options.onDownloadProgress==="function"){options.onDownloadProgress(downloader);}}});downloader.start(path);},ZipHandler:function(downloader){this.make=function(part,createNameSpace){if(createNameSpace!==false){createNameSpace=true;}
var xamlText=downloader.getResponseText(part);return Utils.plugin.content.createFromXaml(xamlText);};this.save=function(part){var xamlText=downloader.getResponseText(part);return function(createNameSpace){if(createNameSpace!==false){createNameSpace=true;}
return Utils.plugin.content.createFromXaml(xamlText,createNameSpace);};};this.destroy=function(){downloader=null;};},EventDispatcher:function(){var subscriptions={};this.subscribe=function(eventType,handler,scope){if(!subscriptions[eventType]){subscriptions[eventType]=[];}
subscriptions[eventType][subscriptions[eventType].length]=[handler,scope];return subscriptions[eventType].length-1;};this.broadcast=function(eventType,params,source){var event=new Utils.Event(eventType,params,source);if(subscriptions[eventType]){for(var i=0,j=subscriptions[eventType].length;i<j;i++){if(subscriptions[eventType][i]!==null){if(subscriptions[eventType][i][1]){subscriptions[eventType][i][0].call(subscriptions[eventType][i][1],event);}else{subscriptions[eventType][i][0](event);}}}}};this.unsubscribe=function(eventType,token){if(subscriptions[eventType][token]){subscriptions[eventType][token]=null;}};},Event:function(type,params,source){this.source=source;this.type=type;for(var prop in params){this[prop]=params[prop];}
this.toString=function(){return'[Event '+this.type+']';};},DomLoaded:{onload:[],loaded:function()
{if(arguments.callee.done){return;}
arguments.callee.done=true;for(var i=0;i<Utils.DomLoaded.onload.length;i++){Utils.DomLoaded.onload[i]();}},load:function(fireThis){this.onload.push(fireThis);if(document.addEventListener){document.addEventListener("DOMContentLoaded",Utils.DomLoaded.loaded,null);}
if(/KHTML|WebKit/i.test(navigator.userAgent)){var _timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(_timer);delete _timer;Utils.DomLoaded.loaded();}},10);}
/*@cc_on @*/
/*@if (@_win32)
   var proto = "src='javascript:void(0)'";
   if (location.protocol == "https:") proto = "src=//0";
   document.write("<scr"+"ipt id=__ie_onload defer " + proto + "><\/scr"+"ipt>");
   var script = document.getElementById("__ie_onload");
   script.onreadystatechange = function() {
       if (this.readyState == "complete") {
           Utils.DomLoaded.loaded();
       }
   };
   /*@end @*/
window.onload=Utils.DomLoaded.loaded;}}};var SilverlightUtils={postInstall:function(div){if(Silverlight.ua.Browser==="MSIE"){if(Silverlight.available){div.innerHTML="When installation is complete, restart your browser to activate your Silverlight content.";}else{div.innerHTML="";}}else if(Silverlight.ua.Browser==="Firefox"||Silverlight.ua.Browser==="Safari"){div.innerHTML="When installation is complete, restart your browser to activate your Silverlight content.";}else{div.innerHTML="Your browser may not be supported by Microsoft Silverlight. Please visit http://www.microsoft.com/silverlight/system-requirements.aspx for more information.";}},createInstallExperience:function(plugin,promptDomId,postInstallDomId){var pluginElement=document.getElementById(plugin.host),promptElement=document.getElementById(promptDomId),postInstallElement=document.getElementById(postInstallDomId),version=plugin.version||'1.0',initializeSilverlight=function(){Silverlight.createObjectEx({source:plugin.xaml,parentElement:pluginElement,id:plugin.id,properties:{width:plugin.width,height:plugin.height,version:version,background:plugin.background,isWindowless:plugin.isWindowless||'false'},events:plugin.events});}
if(Silverlight.isInstalled(version)){initializeSilverlight();}else{if(promptElement){promptElement.innerHTML=Silverlight.createObject(null,null,null,{version:version,inplaceInstallPrompt:true},{},null);}
if(postInstallElement){SilverlightUtils.postInstall(postInstallElement);}
if(!(Silverlight.available||Silverlight.ua.Browser!='MSIE')){TimeoutDelegate=function(){SilverlightUtils.createInstallExperience(plugin,promptDomId,postInstallDomId);}
setTimeout(TimeoutDelegate,3000);}}},errorHandler:function(sender,errorArgs){var errorMsg="Silverlight Error: \n\n";errorMsg+="Error Type:    "+errorArgs.errorType+"\n";errorMsg+="Error Message: "+errorArgs.errorMessage+"\n";errorMsg+="Error Code:    "+errorArgs.errorCode+"\n";switch(errorArgs.errorType){case"RuntimeError":if(errorArgs.lineNumber!==0){errorMsg+="Line: "+errorArgs.lineNumber+"\n";errorMsg+="Position: "+errorArgs.charPosition+"\n";}
errorMsg+="MethodName: "+errorArgs.methodName+"\n";break;case"ParserError":errorMsg+="Xaml File:      "+errorArgs.xamlFile+"\n";errorMsg+="Xml Element:    "+errorArgs.xmlElement+"\n";errorMsg+="Xml Attribute:  "+errorArgs.xmlAttribute+"\n";errorMsg+="Line:           "+errorArgs.lineNumber+"\n";errorMsg+="Position:       "+errorArgs.charPosition+"\n";break;default:break;}
console.log(errorMsg);}};if(!window.ASDL){window.ASDL={};}
ASDL.DisplayObject={get:function(property){return this.xaml[property];},set:function(){if(arguments.length===2){this.xaml[arguments[0]]=arguments[1];}else{var hash=arguments[0];for(var property in hash){this.xaml[property]=hash[property];}}},position:function(x,y){this.xaml['canvas.left']=x;this.xaml['canvas.top']=y;},find:function(xName,refresh){this._ensureCache();if(this._objectCache[xName]&&!refresh){return this._objectCache[xName];}
this._objectCache[xName]=this.xaml.findName(xName);if(this._objectCache[xName]===null){}
return this._objectCache[xName];},_ensureCache:function(){if(!this._objectCache){this._objectCache=[];this._ensureCache=function(){};}},addEventListener:function(type,func){this._ensureListenerList(type);var token=this.xaml.addEventListener(type,func);this._listenerList[type]=token;return token;},removeEventListener:function(type,token){var list=this._ensureListenerList(type);list.splice(Array.indexOf(list,token),1);return this.xaml.removeEventListener(type,token);},removeAllListeners:function(type){this._ensureListenerList();if(type&&this._listenerList[type]){for(var i=0,token=null;token=this._listenerList[type][i];i++){this.xaml.removeEventListener(type,token);}}else{for(var type in this._listenerList){for(var i=0,token=null;token=this._listenerList[type][i];i++){this.xaml.removeEventListener(type,token);}}}},_ensureListenerList:function(type){if(!this._listenerList){this._listenerList={};}
if(type&&!this._listenerList[type]){this._listenerList[type]=[];return this._listenerList[type];}},destroy:function(){this.removeAllListeners();}};ASDL.Sprite=Class.create(ASDL.DisplayObject,{initialize:function(xaml){this.xaml=xaml;},addChild:function(displayObject){if(!displayObject.xaml){var that=this;displayObject.onXamlLoad=function(){that.addChild(displayObject);};return displayObject;}
this._ensureChildren();this.children[this.children.length]=displayObject;displayObject.parent=this;this._sortChildren();this._attach(displayObject);return displayObject;},addChildAt:function(displayObject,index){if(!displayObject.xaml){var that=this;displayObject.onXamlLoad=function(){that.addChildAt(displayObject,index);};return displayObject;}
this._ensureChildren();this.children.splice(index,0,displayObject);displayObject.parent=this;this._sortChildren();this._attach(displayObject);return displayObject;},removeChild:function(displayObject){for(var i=0,j=this.children.length;i<j;i++){if(displayObject===this.children[i]){displayObject.parent=null;this._remove(displayObject);}}
return displayObject;},removeChildAt:function(index){var displayObject=this.children.splice(index,1);displayObject.parent=null;this._remove(displayObject);return displayObject;},replaceChild:function(oldObject,newObject){var index=this.getChildIndex(oldObject);this.removeChildAt(index);this.addChildAt(newObject,index);return newObject;},contains:function(displayObject){return this.getChildIndex(displayObject)!==false;},getChildAt:function(index){this._ensureChildren();return this.children[index];},getChildIndex:function(displayObject){this._ensureChildren();for(var i=0,j=this.children.length;i<j;i++){if(this.children[i]===displayObject){return i;}}
return false;},swapChildren:function(displayObject,displayObject2){var index=this.getChildIndex(displayObject),index2=this.getChildIndex(displayObject);this.swapChildrenAt(index,index2);},swapChildrenAt:function(index,index2){this._ensureChildren();if(index>index2){this.children.splice(index2,1,displayObject);this.children.splice(index,1,displayObject2);}else{this.children.splice(index,1,displayObject2);this.children.splice(index2,1,displayObject);}
this._sortChildren();},destroy:function(){this._ensureChildren();for(var i=0,j=this.children.length;i<j;i++){this.children[i].destroy();}
if(this.parent){this.parent.removeChild(this);}
this.removeAllListeners();},_ensureChildren:function(){if(!this.children){this.children=[];this._ensureChildren=function(){};}},_attach:function(displayObject){if(!displayObject.xaml.getParent()){displayObject._xamlIndex=this.xaml.children.add(displayObject.xaml);}},_remove:function(displayObject){displayObject._xamlIndex=null;this.xaml.children.remove(displayObject.xaml);},_sortChildren:function(){for(var i=0,j=this.children.length;i<j;i++){this.children[i].set('Canvas.ZIndex',i);}},toString:function(){return'[displayObject Sprite]';}});ASDL.LoadedSprite=Class.create(ASDL.Sprite,{initialize:function($super,path,callback){var pieces=path.split(':'),part=pieces[1]||'',that=this;path=pieces[0];this.downloader=new Utils.XamlDownloader(path,{onComplete:function(zip){$super(zip.make(part));that.onXamlLoad();callback();}});},onXamlLoad:function(){},toString:function(){return'[displayObject LoadedSprite]'}});ASDL.Canvas=Class.create(ASDL.Sprite,{initialize:function($super,properties){$super(Utils.plugin.content.createFromXaml('<Canvas/>',true));},toString:function(){return'[displayObject Canvas]'}});ASDL.TextBlock=Class.create(ASDL.DisplayObject,{initialize:function(text,properties){this.xaml=Utils.plugin.content.createFromXaml('<TextBlock/>',true);for(var property in properties){this.xaml[property]=properties[property];}
if(text){Loc.TextFormatter.format(this.xaml,text);}},toString:function(){return'[displayObject textBlock]';}});var Tween=function(params,duration,options){this.setDuration(duration);this.options=options||{};this.init(params);this._listeners={};return this;}
Tween.prototype={init:function(params){this.isPlaying=false;this.objects=[];if(params instanceof Array){for(var i=0,j=params.length;i<j;i++){this.initOne(params[i]);}}else{this.initOne(params);}
return this;},initOne:function(object){this.objects[this.objects.length]=new Tween.Element(object,this.mostRecent());},mostRecent:function(){if(this.objects.length<1){return{};}
return this.objects[this.objects.length-1];},setDuration:function(d){this.duration=(d==null||d<=0)?1:d;},start:function(){this.goTo(0);this.initTimer();this.update();this.startEnterFrame();this.broadcast('onMotionStarted');return this;},startFromHere:function(){for(var i=0,j=this.objects.length;i<j;i++){this.objects[i].getCurrentValue();}
return this.start();},stop:function(){this.isPlaying=false;this.broadcast('onMotionStopped',{halted:true});return this;},loop:function(){this.options.loop=true;return this.start();},resume:function(){this.initTimer();this.update();this.startEnterFrame();this.broadcast('onMotionResumed');return this;},ffoward:function(){this.stop();this.time=this.duration;this.fixTime();this.update();return this;},rewind:function(to){this.stop();this.time=(to===undefined)?0:to;this.initTimer();this.update();return this;},initTimer:function(){this.startTime=this.getTimer()-this.time*1000;},goTo:function(time){if(time>this.duration){if(this.options.loop){this.time=0;this.loops=(this.loops===undefined)?1:this.loops+1;this.broadcast('onMotionLooped',{times:this.loops});}else{this.time=this.duration;this.isPlaying=false;this.broadcast('onMotionFinished');}}else if(time<0){this.time=0;}else{this.time=time;}},nextFrame:function(){this.goTo((this.getTimer()-this.startTime)/1000);},getTimer:function(){return new Date().getTime()-this.time;},update:function(){for(var i=0,j=this.objects.length;i<j;i++){this.objects[i].update(this.time,this.duration);}
this.broadcast('onMotionChanged');},startEnterFrame:function(){this.isPlaying=true;this.onEnterFrame();},onEnterFrame:function(){if(this.isPlaying){this.nextFrame();this.update();var me=this;setTimeout(function(){me.onEnterFrame();},0);}},addListener:function(type,callback){if(!this._listeners[type]){this._listeners[type]=[];}
this._listeners[type].push(callback);return this;},broadcast:function(type,params){params=params||{};params.type=type;params.tween=this;if(this._listeners[type]){for(var i=0,j=this._listeners[type].length;i<j;i++){this._listeners[type][i](params);}}}}
Tween.Element=function(params,defaults){this.obj=params.obj===undefined?defaults['obj']:params.obj;this.prop=params.prop===undefined?defaults['prop']:params.prop;if(!this.obj||!this.prop){return;}
if(params.func===undefined){this.func=defaults['func']===undefined?Tween.Equations.linear:defaults['func'];}else{this.func=Tween.Equations[params.func];}
if(params.begin===undefined){this.begin=parseInt(this.obj[this.prop])||0;}else{this.begin=params.begin;}
if(params.end===undefined){this.end=defaults['end']||0;}else{this.end=params.end;}
if(params.suffix===undefined){this.suffix=defaults['suffix']||'';}else{this.suffix=params.suffix;}
this.change=this.end-this.begin;}
Tween.Element.prototype={update:function(time,duration){var newValue=this.func(time,this.begin,this.change,duration);this.obj[this.prop]=newValue+((this.suffix=='')?0:this.suffix);},getCurrentValue:function(){this.begin=this.obj[this.prop];this.change=this.end-this.begin;}}
Tween.Equations={backEaseIn:function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},backEaseOut:function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backEaseInOut:function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},elasticEaseIn:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}else{var s=p/(2*Math.PI)*Math.asin(c/a);}
return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticEaseOut:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);return(a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b);},elasticEaseInOut:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)var p=d*(.3*1.5);if(!a||a<Math.abs(c)){var a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},bounceEaseOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},bounceEaseIn:function(t,b,c,d){return c-bounceEaseOut(d-t,0,c,d)+b;},bounceEaseInOut:function(t,b,c,d){if(t<d/2)return Tween.Equations.bounceEaseIn(t*2,0,c,d)*.5+b;else return Tween.Equations.bounceEaseOut(t*2-d,0,c,d)*.5+c*.5+b;},strongEaseInOut:function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;},regularEaseIn:function(t,b,c,d){return c*(t/=d)*t+b;},regularEaseOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},regularEaseInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},strongEaseIn:function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;},strongEaseOut:function(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},strongEaseInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},linear:function(t,b,c,d){return c*t/d+b;},easeInQuad:function(t,b,c,d){return c*(t/=d)*t+b;},easeOutQuad:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOutQuad:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInCubic:function(t,b,c,d){return c*(t/=d)*t*t+b;},easeOutCubic:function(t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},easeInOutCubic:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b;},easeInQuart:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutQuart:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOutQuart:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},easeInQuint:function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOutQuint:function(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOutQuint:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},easeInExpo:function(t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOutExpo:function(t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOutExpo:function(t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},easeOutInExpo:function(t,b,c,d){if(t<d/2)return Tween.easeOutExpo(t*2,b,c/2,d);return Tween.easeInExpo((t*2)-d,b+c/2,c/2,d);}}