﻿
function ScriptManager(){var _self=this;this.Packages={};this.Scripts={};this.Console=null;this.ConsoleText=null;this.DebugEnabled=false;this.Displayed=false;this.CreateConsole=function(){_self.Console=$("<div>").addClass("script_manager_console pane").prependTo(document.body);if(this.DebugEnabled===true){_self.ConsoleText=$("<textarea>").appendTo(_self.Console);}
var button=$("<a>").addClass("button_close").attr("title","Close").attr("href","#").html("X").bind("click",{_self:_self},_self.HideConsole).appendTo(_self.Console);var ul=$("<ul>").appendTo(_self.Console);for(var id in _self.Packages){var pkg=_self.Packages[id];if(pkg.icon!=null){var li=$("<li>").appendTo(ul);$("<a>").attr("id","script_manager_button_"+id).attr("title","Toggle "+pkg.title).attr("href","#").bind("click",{_self:_self,id:id},_self.ToggleClick).appendTo(li);$("<img>").attr("alt",pkg.title).attr("src",pkg.icon).appendTo(li);}}
this.UpdateConsole();};this.ShowConsole=function(){if(_self.Console==null){_self.CreateConsole();}
if(this.Displayed!==true){_self.Console.show("slide");this.Displayed=true;}};this.HideConsole=function(){if(_self.Console!=null){_self.Console.hide("slide");_self.Displayed=false;}
_self.UnloadAllPackages();return false;};this.ToggleConsole=function(){if(_self.Displayed){_self.HideConsole();}
else{_self.ShowConsole();}};this.WriteConsole=function(message){if(_self.DebugEnabled&&_self.ConsoleText!=null){_self.ConsoleText.append(message+"\n");}};this.UpdateConsole=function(){if(_self.Console!=null){for(var id in _self.Packages){var pkg=_self.Packages[id];if(pkg.loaded===true){$("#script_manager_button_"+id).removeClass("button_off").addClass("button_on");}
else{$("#script_manager_button_"+id).removeClass("button_on").addClass("button_off");}}}};this.ToggleClick=function(e){var _self=(e==null?this:e.data._self);var id=e.data.id;_self.TogglePackage(id);return false;};this.TogglePackage=function(id){var pkg=_self.Packages[id];if(pkg.loaded===false){_self.LoadPackage(id);}
else{_self.UnloadPackage(id);}};this.LoadPackage=function(id){var pkg=_self.Packages[id];_self.WriteConsole("loading package "+id);if(pkg.loaded===false){_self.FetchScripts(id);}
else{pkg.loaded=true;_self.UpdateConsole();_self.LoadObject(id);}};this.UnloadAllPackages=function(){_self.WriteConsole("unloading all packages");for(var id in _self.Packages){_self.UnloadPackage(id);}};this.UnloadPackage=function(id){var pkg=_self.Packages[id];_self.WriteConsole("unloading package "+id);if(pkg.loaded===true){pkg.loaded=false;_self.UpdateConsole();_self.UnloadObject(id);}};this.LoadObject=function(id){_self.WriteConsole("loading object "+id);var pkg=_self.Packages[id];var object=window[pkg.object];if(object&&object.load){object.load();}
if(pkg.onLoad){pkg.onLoad(pkg);}};this.UnloadObject=function(id){_self.WriteConsole("unloading object "+id);var pkg=_self.Packages[id];var object=window[pkg.object];if(object&&object.unload){object.unload();}};this.FetchScripts=function(id,i){var pkg=_self.Packages[id];var scripts=pkg.scripts;if(i==null){i=0;}
if(i>=scripts.length){pkg.loaded=true;_self.UpdateConsole();_self.LoadObject(id);return;}
_self.WriteConsole("package "+id+": fetching script "+i);var onFetchComplete=_self.FetchScripts.bind(_self,id,i+1);_self.FetchScript(scripts[i],onFetchComplete);};this.FetchScript=function(scriptId,onFetchComplete){var script=_self.Scripts[scriptId];if(script.fetched==false){script.fetched=true;var url=script.url;_self.WriteConsole("fetching script "+scriptId+": "+url);this.AppendScript(url,onFetchComplete);}
else{_self.WriteConsole("fetching script "+scriptId+": (already fetched)");onFetchComplete();}};this.AppendScript=function(src,onLoad,parent){var scriptElt=document.createElement("script");scriptElt.setAttribute("type","text/javascript");scriptElt.setAttribute("src",src);if(onLoad!=null){scriptElt.onload=onLoad;scriptElt.onreadystatechange=function(){if(!this.markAsComplete&&this.readyState=="complete"){this.markAsComplete=true;onLoad();}};}
scriptElt.setAttribute("src",src);if(parent==null){parent=document.getElementsByTagName("head")[0];}
parent.appendChild(scriptElt);};}
;;;
var _om_gbls={s_account:"mswindowsbow",s_accountdev:"mswindowsbowdev",prefix:"bow: ",host:"",path:"",href:"",extraRsids:"",extraevars:"",apl:"",split:"",addrsid:"",oldevts:"",getOmniMeta:function(mn){var m=document.getElementsByTagName('meta');for(var i in m){if(m[i].name==mn){return m[i].content;}}
return"";},omniAddPVEvent:function(){if(!s.linkType){s.events=_om_gbls.apl(s.events,"event1",",",2);}},trackLanding:function(){var tp=_om_gbls.path.substring(1).toLowerCase();var hp="#";s.pageName=_om_gbls.prefix+tp;s.channel="home";s.prop1="en-us";var pageName=_om_gbls.getOmniMeta("t_omni_pagename");if(pageName){s.pageName=pageName;}
var channel=_om_gbls.getOmniMeta("t_omni_channel");if(channel){s.channel=channel;}
try{s.t();}
catch(e){_om_gbls.logError(e,"error in s.t call");}},trackEvent:function(ch,page,suffix,evts){s.channel=ch.toLowerCase();page=_om_gbls.prefix+page;s.pageName=(suffix)?page+"_"+suffix:page;if(!evts){evts=""};evts=evts.toLowerCase();if(evts=="download"){s.eVar41=_om_gbls.prefix+evts;s.events="event14";s.t();s.eVar41="";}
else if(evts=="partner"){s.events="event4";s.t();}
else if(evts=="videostart"){s.events="event5";s.t();}
else if(evts=="videocomplete"){s.events="event6";s.t();}
else{s.events="";s.t();}},trackLink:function(value,anchorElt,evts){if(!anchorElt){anchorElt=true;}
evts=evts.toLowerCase();if(evts=="search_location"){s.linkTrackVars="prop6,eVar6";s.linkTrackEvents="None";s.prop6=value;s.eVar6=value;s.tl(true,"o","Search Location");s.prop6="";s.eVar6="";}
else if(evts=="map_results"){s.linkTrackVars="prop5,eVar5";s.linkTrackEvents="None";s.prop5=value;s.eVar5=value;s.tl(true,"o","Map Results Viewed");s.prop5="";s.eVar5="";}
else if(evts=="camp_registrations"){s.linkTrackVars="events";s.linkTrackEvents="event2";s.events="event2";s.tl(anchorElt,"o","Camp Registrations");}}}
_om_gbls.apl=new Function("l","v","d","u",""
+"var s=this,m=0;if(!l)l='';if(u){var i,n,a=_om_gbls.split(l,d);for(i=0;i<a."
+"length;i++){n=a[i];m=m||(u==1?(n==v):(n.toLowerCase()==v.toLowerCas"
+"e()));}}if(!m)l=l?l+d+v:v;return l");_om_gbls.split=new Function("l","d",""
+"var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x"
+"++]=l.substring(0,i);l=l.substring(i+d.length);}return a");_om_gbls.path=window.location.pathname.toLowerCase();_om_gbls.host=window.location.hostname.toLowerCase();_om_gbls.href=_om_gbls.host+_om_gbls.path;if(_om_gbls.host.indexOf("www.beautyoftheweb.com")==-1){_om_gbls.s_account=_om_gbls.s_accountdev;}
var s=s_gi(_om_gbls.s_account);s.currencyCode="USD";s.trackDownloadLinks=true;s.trackExternalLinks=true;s.trackInlineStats=true;s.linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,wmv,pdf,doc,docx,xls,xlsx,ppt,pptx,asx";s.linkInternalFilters="javascript:,www.beautyoftheweb.com";s.linkLeaveQueryString=true;s.linkTrackVars="None";s.linkTrackEvents="None";s.usePlugins=true;s.events='';function s_doPlugins(s){_om_gbls.omniAddPVEvent();if(_om_gbls.getOmniMeta("t_omni_errorpage")){s.pageType="errorPage";s.pageName="";}
if(!s.campaign)s.campaign=s.getQueryParam('ocid');if(!s.campaign)s.campaign=s.getQueryParam('cmxid');s.campaign=s.getValOnce(s.campaign,"s_campaign",0);s.prop7=s.getAndPersistValue(s.campaign,'s_prop7_persist',0);s.eVar10="D=g";s.eVar21="D=pageName";if(!s.eVar13){s.eVar13=s.getQueryParam('icid');}
s.eVar13=s.getValOnce(s.eVar13,"s_eVar13",0)
s.eVar15="D=v0";if(s.prop2){s.eVar2="D=c2"}
if(s.prop3){s.eVar3="D=c3"}
s.eVar47="D=User-Agent";}
s.doPlugins=s_doPlugins;s.getQueryParam=new Function("p","d","u",""
+"var s=this,v='',i,t;d=d?d:'';u=u?u:(s.pageURL?s.pageURL:s.wd.locati"
+"on);if(u=='f')u=s.gtfs().location;while(p){i=p.indexOf(',');i=i<0?p"
+".length:i;t=s.p_gpv(p.substring(0,i),u+'');if(t)v+=v?d+t:t;p=p.subs"
+"tring(i==p.length?i:i+1)}return v");s.p_gpv=new Function("k","u",""
+"var s=this,v='',i=u.indexOf('?'),q;if(k&&i>-1){q=u.substring(i+1);v"
+"=s.pt(q,'&','p_gvf',k)}return v");s.p_gvf=new Function("t","k",""
+"if(t){var s=this,i=t.indexOf('='),p=i<0?t:t.substring(0,i),v=i<0?'T"
+"rue':t.substring(i+1);if(p.toLowerCase()==k.toLowerCase())return s."
+"epa(v)}return ''");s.getValOnce=new Function("v","c","e",""
+"var s=this,k=s.c_r(c),a=new Date;e=e?e:0;if(v){a.setTime(a.getTime("
+")+e*86400000);s.c_w(c,v,e?a:0);}return v==k?'':v");s.getAndPersistValue=new Function("v","c","e",""
+"var s=this,a=new Date;"
+"e=e?e:0;"
+"a.setTime(a.getTime()+e*86400000);"
+"if(v)s.c_w(c,v,e?a:0);"
+"return s.c_r(c);");s.apl=new Function("l","v","d","u",""
+"var s=this,m=0;if(!l)l='';if(u){var i,n,a=s.split(l,d);for(i=0;i<a."
+"length;i++){n=a[i];m=m||(u==1?(n==v):(n.toLowerCase()==v.toLowerCas"
+"e()));}}if(!m)l=l?l+d+v:v;return l");s.split=new Function("l","d",""
+"var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x"
+"++]=l.substring(0,i);l=l.substring(i+d.length);}return a");s.p_fo=new Function("n",""
+"var s=this;if(!s.__fo){s.__fo=new Object;}if(!s.__fo[n]){s.__fo[n]="
+"new Object;return 1;}else {return 0;}");s.p_gh=new Function(""
+"var s=this;if(!s.eo&&!s.lnk)return '';var o=s.eo?s.eo:s.lnk,y=s.ot("
+"o),n=s.oid(o),x=o.s_oidt;if(s.eo&&o==s.eo){while(o&&!n&&y!='BODY'){"
+"o=o.parentElement?o.parentElement:o.parentNode;if(!o)return '';y=s."
+"ot(o);n=s.oid(o);x=o.s_oidt}}return o.href?o.href:'';");s.p_gh_windows_new=new Function(""
+"var s=this;if(!s.eo&&!s.lnk)return '';var o=s.eo?s.eo:s.lnk,y=s.ot("
+"o),n=s.oid(o),x=o.s_oidt;if(s.eo&&o==s.eo){while(o&&!n&&y!='BODY'){"
+"o=o.parentElement?o.parentElement:o.parentNode;if(!o)return '';y=s."
+"ot(o);n=s.oid(o);x=o.s_oidt}}return o.href?o:'';");s.p_c=new Function("v","c",""
+"var x=v.indexOf('=');return c.toLowerCase()==v.substring(0,x<0?v.le"
+"ngth:x).toLowerCase()?v:0");s.visitorNamespace="microsoftsto";s.dc=112;s.m_Media_c="var m=s.m_i('Media');m.cn=function(n){var m=this;return m.s.rep(m.s.rep(m.s.rep(n,\"\\n\",''),\"\\r\",''),'--**--','')};m.open=function(n,l,p,b){var m=this,i=new Object,tm=new Date,a='',"
+"x;n=m.cn(n);l=parseInt(l);if(!l)l=1;if(n&&p){if(!m.l)m.l=new Object;if(m.l[n])m.close(n);if(b&&b.id)a=b.id;for (x in m.l)if(m.l[x]&&m.l[x].a==a)m.close(m.l[x].n);i.n=n;i.l=l;i.p=m.cn(p);i.a=a;i.t=0"
+";i.ts=0;i.s=Math.floor(tm.getTime()/1000);i.lx=0;i.lt=i.s;i.lo=0;i.e='';i.to=-1;m.l[n]=i}};m.close=function(n){this.e(n,0,-1)};m.play=function(n,o){var m=this,i;i=m.e(n,1,o);i.m=new Function('var m"
+"=s_c_il['+m._in+'],i;if(m.l){i=m.l[\"'+m.s.rep(i.n,'\"','\\\\\"')+'\"];if(i){if(i.lx==1)m.e(i.n,3,-1);i.mt=setTimeout(i.m,5000)}}');i.m()};m.stop=function(n,o){this.e(n,2,o)};m.track=function(n){va"
+"r m=this;if (m.trackWhilePlaying) {m.e(n,4,-1)}};m.e=function(n,x,o){var m=this,i,tm=new Date,ts=Math.floor(tm.getTime()/1000),ti=m.trackSeconds,tp=m.trackMilestones,z=new Array,j,d='--**--',t=1,b,"
+"v=m.trackVars,e=m.trackEvents,pe='media',pev3,w=new Object,vo=new Object;n=m.cn(n);i=n&&m.l&&m.l[n]?m.l[n]:0;if(i){w.name=n;w.length=i.l;w.playerName=i.p;if(i.to<0)w.event=\"OPEN\";else w.event=(x="
+"=1?\"PLAY\":(x==2?\"STOP\":(x==3?\"MONITOR\":\"CLOSE\")));w.openTime=new Date();w.openTime.setTime(i.s*1000);if(x>2||(x!=i.lx&&(x!=2||i.lx==1))) {b=\"Media.\"+name;pev3 = m.s.ape(i.n)+d+i.l+d+m.s.a"
+"pe(i.p)+d;if(x){if(o<0&&i.lt>0){o=(ts-i.lt)+i.lo;o=o<i.l?o:i.l-1}o=Math.floor(o);if(x>=2&&i.lo<o){i.t+=o-i.lo;i.ts+=o-i.lo;}if(x<=2){i.e+=(x==1?'S':'E')+o;i.lx=x;}else if(i.lx!=1)m.e(n,1,o);i.lt=ts"
+";i.lo=o;pev3+=i.t+d+i.s+d+(m.trackWhilePlaying&&i.to>=0?'L'+i.to:'')+i.e+(x!=2?(m.trackWhilePlaying?'L':'E')+o:'');if(m.trackWhilePlaying){b=0;pe='m_o';if(x!=4){w.offset=o;w.percent=((w.offset+1)/w"
+".length)*100;w.percent=w.percent>100?100:Math.floor(w.percent);w.timePlayed=i.t;if(m.monitor)m.monitor(m.s,w)}if(i.to<0)pe='m_s';else if(x==4)pe='m_i';else{t=0;v=e='None';ti=ti?parseInt(ti):0;z=tp?"
+"m.s.sp(tp,','):0;if(ti&&i.ts>=ti)t=1;else if(z){if(o<i.to)i.to=o;else{for(j=0;j<z.length;j++){ti=z[j]?parseInt(z[j]):0;if(ti&&((i.to+1)/i.l<ti/100)&&((o+1)/i.l>=ti/100)){t=1;j=z.length}}}}}}}else{m"
+".e(n,2,-1);if(m.trackWhilePlaying){w.offset=i.lo;w.percent=((w.offset+1)/w.length)*100;w.percent=w.percent>100?100:Math.floor(w.percent);w.timePlayed=i.t;if(m.monitor)m.monitor(m.s,w)}m.l[n]=0;if(i"
+".e){pev3+=i.t+d+i.s+d+(m.trackWhilePlaying&&i.to>=0?'L'+i.to:'')+i.e;if(m.trackWhilePlaying){v=e='None';pe='m_o'}else{t=0;m.s.fbr(b)}}else t=0;b=0}if(t){vo.linkTrackVars=v;vo.linkTrackEvents=e;vo.p"
+"e=pe;vo.pev3=pev3;m.s.t(vo,b);if(m.trackWhilePlaying){i.ts=0;i.to=o;i.e=''}}}}return i};m.ae=function(n,l,p,x,o,b){if(n&&p){var m=this;if(!m.l||!m.l[n])m.open(n,l,p,b);m.e(n,x,o)}};m.a=function(o,t"
+"){var m=this,i=o.id?o.id:o.name,n=o.name,p=0,v,c,c1,c2,xc=m.s.h,x,e,f1,f2='s_media_'+m._in+'_oc',f3='s_media_'+m._in+'_t',f4='s_media_'+m._in+'_s',f5='s_media_'+m._in+'_l',f6='s_media_'+m._in+'_m',"
+"f7='s_media_'+m._in+'_c',tcf,w;if(!i){if(!m.c)m.c=0;i='s_media_'+m._in+'_'+m.c;m.c++}if(!o.id)o.id=i;if(!o.name)o.name=n=i;if(!m.ol)m.ol=new Object;if(m.ol[i])return;m.ol[i]=o;if(!xc)xc=m.s.b;tcf=n"
+"ew Function('o','var e,p=0;try{if(o.versionInfo&&o.currentMedia&&o.controls)p=1}catch(e){p=0}return p');p=tcf(o);if(!p){tcf=new Function('o','var e,p=0,t;try{t=o.GetQuickTimeVersion();if(t)p=2}catc"
+"h(e){p=0}return p');p=tcf(o);if(!p){tcf=new Function('o','var e,p=0,t;try{t=o.GetVersionInfo();if(t)p=3}catch(e){p=0}return p');p=tcf(o)}}v=\"var m=s_c_il[\"+m._in+\"],o=m.ol['\"+i+\"']\";if(p==1){"
+"p='Windows Media Player '+o.versionInfo;c1=v+',n,p,l,x=-1,cm,c,mn;if(o){cm=o.currentMedia;c=o.controls;if(cm&&c){mn=cm.name?cm.name:c.URL;l=cm.duration;p=c.currentPosition;n=o.playState;if(n){if(n="
+"=8)x=0;if(n==3)x=1;if(n==1||n==2||n==4||n==5||n==6)x=2;}';c2='if(x>=0)m.ae(mn,l,\"'+p+'\",x,x!=2?p:-1,o)}}';c=c1+c2;if(m.s.isie&&xc){x=m.s.d.createElement('script');x.language='jscript';x.type='tex"
+"t/javascript';x.htmlFor=i;x.event='PlayStateChange(NewState)';x.defer=true;x.text=c;xc.appendChild(x);o[f6]=new Function(c1+'if(n==3){x=3;'+c2+'}setTimeout(o.'+f6+',5000)');o[f6]()}}if(p==2){p='Qui"
+"ckTime Player '+(o.GetIsQuickTimeRegistered()?'Pro ':'')+o.GetQuickTimeVersion();f1=f2;c=v+',n,x,t,l,p,p2,mn;if(o){mn=o.GetMovieName()?o.GetMovieName():o.GetURL();n=o.GetRate();t=o.GetTimeScale();l"
+"=o.GetDuration()/t;p=o.GetTime()/t;p2=o.'+f5+';if(n!=o.'+f4+'||p<p2||p-p2>5){x=2;if(n!=0)x=1;else if(p>=l)x=0;if(p<p2||p-p2>5)m.ae(mn,l,\"'+p+'\",2,p2,o);m.ae(mn,l,\"'+p+'\",x,x!=2?p:-1,o)}if(n>0&&"
+"o.'+f7+'>=10){m.ae(mn,l,\"'+p+'\",3,p,o);o.'+f7+'=0}o.'+f7+'++;o.'+f4+'=n;o.'+f5+'=p;setTimeout(\"'+v+';o.'+f2+'(0,0)\",500)}';o[f1]=new Function('a','b',c);o[f4]=-1;o[f7]=0;o[f1](0,0)}if(p==3){p='"
+"RealPlayer '+o.GetVersionInfo();f1=n+'_OnPlayStateChange';c1=v+',n,x=-1,l,p,mn;if(o){mn=o.GetTitle()?o.GetTitle():o.GetSource();n=o.GetPlayState();l=o.GetLength()/1000;p=o.GetPosition()/1000;if(n!="
+"o.'+f4+'){if(n==3)x=1;if(n==0||n==2||n==4||n==5)x=2;if(n==0&&(p>=l||p==0))x=0;if(x>=0)m.ae(mn,l,\"'+p+'\",x,x!=2?p:-1,o)}if(n==3&&(o.'+f7+'>=10||!o.'+f3+')){m.ae(mn,l,\"'+p+'\",3,p,o);o.'+f7+'=0}o."
+"'+f7+'++;o.'+f4+'=n;';c2='if(o.'+f2+')o.'+f2+'(o,n)}';if(m.s.wd[f1])o[f2]=m.s.wd[f1];m.s.wd[f1]=new Function('a','b',c1+c2);o[f1]=new Function('a','b',c1+'setTimeout(\"'+v+';o.'+f1+'(0,0)\",o.'+f3+"
+"'?500:5000);'+c2);o[f4]=-1;if(m.s.isie)o[f3]=1;o[f7]=0;o[f1](0,0)}};m.as=new Function('e','var m=s_c_il['+m._in+'],l,n;if(m.autoTrack&&m.s.d.getElementsByTagName){l=m.s.d.getElementsByTagName(m.s.i"
+"sie?\"OBJECT\":\"EMBED\");if(l)for(n=0;n<l.length;n++)m.a(l[n]);}');if(s.wd.attachEvent)s.wd.attachEvent('onload',m.as);else if(s.wd.addEventListener)s.wd.addEventListener('load',m.as,false)";s.m_i("Media");var s_code='',s_objectID;function s_gi(un,pg,ss){var c="=fun`o(~.substring(~){`Ps=^O~.indexOf(~#2 ~;$2~`b$2~=new Fun`o(~.length~.toLowerCase()~`Ps#8c_#k^an+'],~=new Object~};s.~`YMigrationServer~.toU"
+"pperCase~){$2~','~s.wd~);s.~')q='~=new Array~ookieDomainPeriods~.location~^LingServer~dynamicAccount~var ~link~s.m_~=='~s.apv~BufferedRequests~Element~)$2x^b!Object#WObject.prototype#WObject.protot"
+"ype[x])~etTime~visitor~$w@c(~referrer~else ~s.pt(~s.maxDelay~}c#E(e){~#i+~=''~.lastIndexOf(~^wc_i~}$2~.protocol~=new Date~^wobjectID=s.ppu=$I=$Iv1=$Iv2=$Iv3~for(i=~ction~javaEnabled~onclick~Name~te"
+"rnalFilters~javascript~s.dl~@6s.b.addBehavior(\"# default# ~=parseFloat(~typeof(v)==\"~window~cookie~while(~s.vl_g~Type~;i#U{~tfs~s.un~&&s.~o^woid~browser~.parent~document~colorDepth~String~.host~s"
+".fl(~s.rep(~s.eo~'+tm@S~s.sq~parseInt(~t=s.ot(o)~track~nload~j='1.~this~#PURL~}else{~s.vl_l~lugins~'){q='~dynamicVariablePrefix~');~;for(~Sampling~s.rc[un]~Event~._i~&&(~loadModule~resolution~s.c_r"
+"(~s.c_w(~s.eh~s.isie~\"m_\"+n~Secure~Height~tcf~isopera~ismac~escape(~'s_~.href~screen.~s#8gi(~Version~harCode~variableProvider~.s_~)s_sv(v,n[k],i)}~')>=~){s.~)?'Y':'N'~u=m[t+1](~i)clearTimeout(~e&"
+"&l$bSESSION'~name~home#P~;try{~,$m)~s.ssl~s.oun~s.rl[u~Width~o.type~s.vl_t~=s.sp(~Lifetime~s.gg('objectID~sEnabled~'+n+'~.mrq(@wun+'\"~ExternalLinks~charSet~lnk~onerror~http~currencyCode~.src~disab"
+"le~.get~MigrationKey~(''+~&&!~f',~){t=~r=s[f](~u=m[t](~Opera~Math.~s.ape~s.fsg~s.ns6~conne~InlineStats~&&l$bNONE'~Track~'0123456789~true~+\"_c\"]~s.epa(~t.m_nl~s.va_t~m._d~n=s.oid(o)~,'sqs',q);~Lea"
+"veQuery~?'&~'=')~n){~\"'+~){n=~'_'+~'+n;~\",''),~,255)}~if(~vo)~s.sampled~=s.oh(o);~+(y<1900?~n]=~1);~&&o~:'';h=h?h~;'+(n?'o.~sess~campaign~lif~ in ~s.co(~ffset~s.pe~m._l~s.c_d~s.brl~s.nrs~s[mn]~,'"
+"vo~s.pl~=(apn~space~\"s_gs(\")~vo._t~b.attach~2o7.net'~Listener~Year(~d.create~=s.n.app~)}}}~!='~'||t~)+'/~s()+'~){p=~():''~a['!'+t]~&&c){~://')i+=~){v=s.n.~channel~100~rs,~.target~o.value~s_si(t)~"
+"')dc='1~\".tl(\")~etscape~s_')t=t~omePage~='+~&&t~[b](e);~\"){n[k]~';s.va_~a+1,b):~return~mobile~height~events~random~code~=s_~=un~,pev~'MSIE ~'fun~floor(~atch~transa~s.num(~m._e~s.c_gd~,'lt~tm.g~."
+"inner~;s.gl(~,f1,f2~',s.bc~page~Group,~.fromC~sByTag~')<~++)~)){~||!~+';'~i);~y+=~l&&~''+x~[t]=~[i]=~[n];~' '+~'+v]~>=5)~:'')~+1))~il['+s~!a[t])~~s._c=^pc';`H=`y`5!`H`i@v`H`il`K;`H`in=0;}s^al=`H`il"
+";s^an=`H`in;s^al[s^a$7s;`H`in++;s.an#8an;s.cls`0x,c){`Pi,y`g`5!c)c=^O.an;`n0;i<x`8^3n=x`1i,i+1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?'5.1':'1'$dH.20.3/'+$C+'?AQB=1&ndh=1'+(q?q`f'&AQE=1'`5^h@Vs.^n`"
+"F`T>5.5)rs=^E$n4095);`brs=^E$n2047)`jid^zbr(id,rs);#2}`js.d.images&&`T>=3^b!s.^m||`T>=7)^b@e<0||`T>=6.1)`F!s.rc)s.rc`B`5!^Y){^Y=1`5!s.rl)s.rl`B;@An]`K;s`Xout('$2`y`il)`y`il['+s^an+']@J)',750)^Ql=@A"
+"n]`5l){r.t=ta;r.u#9;r.r=rs;l[l`8]=r;`4''}imn+=@y^Y;^Y++}im=`H[imn]`5!im)im=`H[im$7new Image;im^wl=0;im.o^M`7'e`G^O^wl=1;`Pwd=`y,s`5wd`il){s=wd`il['+s^an+'];s@J`Inrs--`5!$M)`Rm(\"rr\")}')`5!$M^znrs="
+"1;`Rm('rs')}`b$M++;im@Q=rs`5rs`3'&pe=^y0^b!ta||ta`S_self$ca`S_top'||(`H.@4$xa==`H.@4)#Vb=e`l;^0!im^w#ae.g`X()-b.g`X()<500)e`l}`4''}`4'<im'+'g sr'+'c=@wrs+'\" width=1 #4=1 border=0 alt=\"\">'`Cgg`0v"
+"`2`5!`H[^p#g)`H[^p#g`g;`4`H[^p#g`Cglf`0t,a`Ft`10,2)`S$u`12);`Ps=^O,v=s.gg(t)`5v)s#cv`Cgl`0v`2`5s.pg)`cv,`G,'gl@W0)`Crf`0x`2,y,i,j,h,l,a,b`g,c`g,t`5x){y`g+x;i=y`3'?')`5i>0){a=y`1i+$8y=y`10,#Yh=y`9;i"
+"=0`5h`10,7)`S@O$j7;`6h`10,8)`S@Os$j8;h=h`1#Yi=h`3\"/\")`5i>0){h=h`10,i)`5h`3'google^y0){a@Ea,'&')`5a`8>1){l=',q,ie,start,search_key,word,kw,cd,'^Wj=0;j<a`8;j++@Xa[j];i=t`3@u`5i>0&&l`3`G+t`10,i)+`G)"
+">=0)b+=(b@t'`ft;`bc+=(c@t'`ft`jb$i#Z'?'+b+'&'+c`5#b!=y)x=y}}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id`2,trk=1,tm`l,sed=Math&&@b#6?@b#D@b#6()*$m000000"
+"00000):#K`X(),$C='s'+@b#D#K`X()/10800000)%10+sed,y=tm@S$X),vt=tm@SDate($d^HMonth($d'$6y+1900:y)+' ^HHour$e:^HMinute$e:^HSecond$e ^HDay()+#f#K`XzoneO$H(),^l,^4=s.g^4(),ta`g,q`g,qs`g,#7`g,vb`B#M^1`Iu"
+"ns(`Im_ll()`5!s.td){`Ptl=^4`M,a,o,i,x`g,c`g,v`g,p`g,bw`g,bh`g,^N0',k=^f^pcc`G@k',0@0,hp`g,ct`g,pn=0,ps`5^C&&^C.prototype){^N1'`5j.m#E){^N2'`5tm.setUTCDate){^N3'`5^h^6^n&&`T#h^N4'`5pn.toPrecisio@v^N"
+"5';a`K`5a.forEach){^N6';i=0;o`B;^l`7'o`G`Pe,i=0@6i=new Iterator(o)`e}`4i^Vi=^l(o)`5i&&i.next)^N7'}}}}`j`T>=4)x=^rwidth+'x'+^r#4`5s.isns||s.^m`F`T>=3$k`p(@0`5`T>=4){c=^rpixelDepth;bw=`H#L@B;bh=`H#L^"
+"k}}$P=s.n.p^S}`6^h`F`T>=4$k`p(@0;c=^r^B`5`T#h{bw=s.d.^A`V.o$H@B;bh=s.d.^A`V.o$H^k`5!s.^n^6b){^l`7's`Gtl`G`Pe,hp=0`vh$v\");hp=s.b.isH$v(tl)?\"Y\":\"N\"`e}`4hp^Vhp=^l(s,tl);^l`7's`G`Pe,ct=0`vclientCa"
+"ps\");ct=s.b.@f`o^2`e}`4ct^Vct=^l(s$a`br`g`j$P)^0pn<$P`8&&pn<30){ps=^E$P[pn].@4@7#X`5p`3ps)<0)p+=ps;pn++}s.^d=x;s.^B=c;s.`t^t=j;s.`p=v;s.`z@H=k;s.^8@B=bw;s.^8^k=bh;s.@f`o^2=ct;s.@5=hp;s.p^S=p;s.td="
+"1`j$3{`c^1,`G$O2',vb`Ipt(^1,`G$O1',$3`js.useP^S)s.doP^S(s);`Pl=`H`M,r=^4.^A.`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.b=s.d.body`5s.d@S`V#S`r^zh=s.d@S`V#S`r('HEAD')`5s.h"
+")s.h=s.h[0]}s.n=navigator;s.u=s.n.userAgent;@e=s.u`3'N$t6/^V`Papn$Z`r,v$Z^t,ie=v`3#B'),o=s.u`3'@a '),i`5v`3'@a^y0||o>0)apn='@a';^h$Q`SMicrosoft Internet Explorer'`Iisns$Q`SN$t'`I^m$Q`S@a'`I^n=(s.u`"
+"3'Mac^y0)`5o>0)`T`ws.u`1o+6));`6ie>0){`T=^Ji=v`1ie+5))`5`T>3)`T`wi)}`6@e>0)`T`ws.u`1@e+10));`b`T`wv`Iem=0`5^C#R^u){i=^o^C#R^u(256))`E(`Iem=(i`S%C4%80'?2:(i`S%U0$m'?1:0))}s.sa(un`Ivl_l='^U,`YID,vmk,"
+"`Y@T,`D,`D^j,ppu,@L,`Y`r$R,c`L,`z@F,#P`r,^P,`a,@P#0l@E^R,`G`Ivl_t=^R+',^v,$l,server,#P^2,#F`oID,purchaseID,$D,state,zip,#5,products,`Q`r,`Q^2'^W`Pn=1;n<51;n#U@D+=',prop@I,eVar@I,hier@I,list@z^R2=',"
+"tnt,pe#A1#A2#A3,^d,^B,`t^t,`p,`z@H,^8@B,^8^k,@f`o^2,@5,p^S';@D+=^R2;@o@E@D,`G`Ivl_g=@D+',`N,`N^j,`NBase,fpC`L,@R`U,#3,`Y^X,`Y^X#Q`OSele`o,`OList,`OM#E,^LDow^MLinks,^L@K,^L@g,`Q@s^C,`QDow^MFile^2s,`"
+"QEx`s,`QIn`s,`Q@iVa$n`Q@i^Zs,`Q`rs,@M,eo,_1_`a#0g@E^1,`G`Ipg=pg#M^1)`5!ss)`Hs()",w=window,l=w.s_c_il,n=navigator,u=n.userAgent,v=n.appVersion,e=v.indexOf('MSIE '),m=u.indexOf('Netscape6/'),a,i,s;if(un){un=un.toLowerCase();if(l)for(i=0;i<l.length;i++){s=l[i];if(!s._c||s._c=='s_c'){if(s.oun==un)return s;else if(s.fs&&s.sa&&s.fs(s.oun,un)){s.sa(un);return s}}}}w.s_an='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';w.s_sp=new Function("x","d","var a=new Array,i=0,j;if(x){if(x.split)a=x.split(d);else if(!d)for(i=0;i<x.length;i++)a[a.length]=x.substring(i,i+1);else while(i>=0){j=x.indexOf(d,i);a[a.length]=x.subst"
+"ring(i,j<0?x.length:j);i=j;if(i>=0)i+=d.length}}return a");w.s_jn=new Function("a","d","var x='',i,j=a.length;if(a&&j>0){x=a[0];if(j>1){if(a.join)x=a.join(d);else for(i=1;i<j;i++)x+=d+a[i]}}return x");w.s_rep=new Function("x","o","n","return s_jn(s_sp(x,o),n)");w.s_d=new Function("x","var t='`^@$#',l=s_an,l2=new Object,x2,d,b=0,k,i=x.lastIndexOf('~~'),j,v,w;if(i>0){d=x.substring(0,i);x=x.substring(i+2);l=s_sp(l,'');for(i=0;i<62;i++)l2[l[i]]=i;t=s_sp(t,'');d"
+"=s_sp(d,'~');i=0;while(i<5){v=0;if(x.indexOf(t[i])>=0) {x2=s_sp(x,t[i]);for(j=1;j<x2.length;j++){k=x2[j].substring(0,1);w=t[i]+k;if(k!=' '){v=1;w=d[b+l2[k]]}x2[j]=w+x2[j].substring(1)}}if(v)x=s_jn("
+"x2,'');else{w=t[i]+' ';if(x.indexOf(w)>=0)x=s_rep(x,w,t[i]);i++;b+=62}}}return x");w.s_fe=new Function("c","return s_rep(s_rep(s_rep(c,'\\\\','\\\\\\\\'),'\"','\\\\\"'),\"\\n\",\"\\\\n\")");w.s_fa=new Function("f","var s=f.indexOf('(')+1,e=f.indexOf(')'),a='',c;while(s>=0&&s<e){c=f.substring(s,s+1);if(c==',')a+='\",\"';else if((\"\\n\\r\\t \").indexOf(c)<0)a+=c;s++}return a?'\"'+a+'\"':"
+"a");w.s_ft=new Function("c","c+='';var s,e,o,a,d,q,f,h,x;s=c.indexOf('=function(');while(s>=0){s++;d=1;q='';x=0;f=c.substring(s);a=s_fa(f);e=o=c.indexOf('{',s);e++;while(d>0){h=c.substring(e,e+1);if(q){i"
+"f(h==q&&!x)q='';if(h=='\\\\')x=x?0:1;else x=0}else{if(h=='\"'||h==\"'\")q=h;if(h=='{')d++;if(h=='}')d--}if(d>0)e++}c=c.substring(0,s)+'new Function('+(a?a+',':'')+'\"'+s_fe(c.substring(o+1,e))+'\")"
+"'+c.substring(e+1);s=c.indexOf('=function(')}return c;");c=s_d(c);if(e>0){a=parseInt(i=v.substring(e+5));if(a>3)a=parseFloat(i)}else if(m>0)a=parseFloat(u.substring(m+10));else a=parseFloat(v);if(a>=5&&v.indexOf('Opera')<0&&u.indexOf('Opera')<0){w.s_c=new Function("un","pg","ss","var s=this;"+c);return new s_c(un,pg,ss)}else s=new Function("un","pg","ss","var s=new Object;"+s_ft(c)+";return s");return s(un,pg,ss)}
_om_gbls.trackLanding();
;;;
var Bravo={};Bravo.Engine={};Bravo.Engine.Math={};Bravo.Engine.Graphics={};Bravo.Engine.Controls={};
;;;
var Base=function(){};Base.extend=function(_instance,_static){var extend=Base.prototype.extend;Base._prototyping=true;var proto=new this;extend.call(proto,_instance);proto.base=function(){};delete Base._prototyping;var constructor=proto.constructor;var klass=proto.constructor=function(){if(!Base._prototyping){if(this._constructing||this.constructor==klass){this._constructing=true;constructor.apply(this,arguments);delete this._constructing;}else if(arguments[0]!=null){return(arguments[0].extend||extend).call(arguments[0],proto);}}};klass.ancestor=this;klass.extend=this.extend;klass.forEach=this.forEach;klass.implement=this.implement;klass.prototype=proto;klass.toString=this.toString;klass.valueOf=function(type){return(type=="object")?klass:constructor.valueOf();};extend.call(klass,_static);if(typeof klass.init=="function")klass.init();return klass;};Base.prototype={extend:function(source,value){if(arguments.length>1){var ancestor=this[source];if(ancestor&&(typeof value=="function")&&(!ancestor.valueOf||ancestor.valueOf()!=value.valueOf())&&/\bbase\b/.test(value)){var method=value.valueOf();value=function(){var previous=this.base||Base.prototype.base;this.base=ancestor;var returnValue=method.apply(this,arguments);this.base=previous;return returnValue;};value.valueOf=function(type){return(type=="object")?value:method;};value.toString=Base.toString;}
this[source]=value;}else if(source){var extend=Base.prototype.extend;if(!Base._prototyping&&typeof this!="function"){extend=this.extend||extend;}
var proto={toSource:null};var hidden=["constructor","toString","valueOf"];var i=Base._prototyping?0:1;while(key=hidden[i++]){if(source[key]!=proto[key]){extend.call(this,key,source[key]);}}
for(var key in source){if(!proto[key])extend.call(this,key,source[key]);}}
return this;}};Base=Base.extend({constructor:function(){this.extend(arguments[0]);}},{ancestor:Object,version:"1.1",forEach:function(object,block,context){for(var key in object){if(this.prototype[key]===undefined){block.call(context,object[key],key,object);}}},implement:function(){for(var i=0;i<arguments.length;i++){if(typeof arguments[i]=="function"){arguments[i](this.prototype);}else{this.prototype.extend(arguments[i]);}}
return this;},toString:function(){return String(this.valueOf());}});
;;;
InitBase=Base.extend({constructor:function(initObject){this.InitializeObject(initObject);},InitializeObject:function(initObject){for(attributeName in initObject){this[attributeName]=initObject[attributeName];}}});
;;;
Bravo.Engine.Preload=Base.extend({constructor:function(){var _self=this;_self.Map={};_self.MapFiles={};_self.MapObjects={};_self.MapFilesLoaded=0;_self.MapFilesTotal=0;_self.MapProcessed=false;},Map:null,MapObjects:null,MapFiles:null,MapFilesLoaded:null,MapFilesTotal:null,MapProcessed:null,LoadMap:function(mapUrl,onLoadFn){var _self=this;_self.MapFilesLoaded=0;_self.MapFilesTotal=0;_self.MapProcessed=false;if(mapUrl===null||mapUrl===undefined){_self.ProcessMapComplete(onLoadFn);}
else{Bravo.Engine.Preload.GetJSONData(mapUrl,onLoadFn);}},ProcessMap:function(JSONObject,onLoadFn){var _self=this;_self.Map=JSONObject;_self.MapFiles=_self.Map.files;_self.MapObjects=_self.Map.objects;var total=0;for(var i in _self.MapFiles){if(_self.MapFiles.hasOwnProperty(i)){total++;}}
_self.MapFilesLoaded=0;_self.MapFilesTotal=total;},IsLoaded:function(){var _self=this;return _self.MapProcessed;},ProcessMapComplete:function(onLoadFn){var _self=this;_self.MapProcessed=true;if(onLoadFn!==null&&onLoadFn!==undefined){onLoadFn();}},GetPercentComplete:function(){var _self=this;var percent=_self.MapFilesLoaded/_self.MapFilesTotal;return percent;},GetMapObject:function(objectId){var _self=this;var mapObject=_self.MapObjects[objectId];return mapObject;},GetMapFile:function(fileId){var _self=this;var mapFile=_self.MapFiles[fileId];return mapFile;},GetMapFileElement:function(fileId){var _self=this;var mapFile=_self.GetMapFile(fileId);var mapFileElement=null;if(mapFile!==null&&mapFile!==undefined){mapFileElement=mapFile.element;}
return mapFileElement;},GetElement:function(objectId){var _self=this;var mapObject=_self.GetMapObject(objectId);var mapFileElement=null;if(mapObject!==null&&mapObject!==undefined){var fileId=mapObject.fileId;mapFileElement=_self.GetMapFileElement(fileId);}
return mapFileElement;},GetFrames:function(objectId){var _self=this;var mapObject=_self.GetMapObject(objectId);var frames=null;if(mapObject!==null&&mapObject!==undefined){frames=mapObject.frames;}
return frames;}},{GetJSONData:function(url,callbackFn){var httpRequest=new XMLHttpRequest();httpRequest.open("GET",url,true);httpRequest.onreadystatechange=function(){if(httpRequest.readyState===4&&(httpRequest.status===200||httpRequest.status===0)){var text=httpRequest.responseText;var JSONObject;if(window.JSON){text=text.replace(/[\r\n]/g,"");JSONObject=JSON.parse(text);}
else{text="("+text+")";JSONObject=eval(text);}
callbackFn(JSONObject);}};httpRequest.send(null);}});
;;;
Bravo.Engine.Math.Matrix=Base.extend({constructor:function(width,height,values){this.w=width;this.h=height;if(values===null||values===undefined){this.values=Bravo.Engine.Math.Matrix.Allocate(width,height);}
else{this.values=values;}},w:null,h:null,values:null,TransformProjectiveVector:function(operand){var out=[];var y;for(y=0;y<this.h;++y){out[y]=0;for(var x=0;x<this.w;++x){out[y]+=this.values[y][x]*operand[x];}}
var iz=1/(out[out.length-1]);for(y=0;y<this.h;++y){out[y]*=iz;}
return out;},RowEchelon:function(){if(this.w<=this.h){throw"Matrix rowEchelon size mismatch";}
var temp=Bravo.Engine.Math.Matrix.Clone(this.values);for(var yp=0;yp<this.h;++yp){var pivot=temp[yp][yp];while(pivot===0){for(var ys=yp+1;ys<this.h;++ys){if(temp[ys][yp]!==0){var tmpRow=temp[ys];temp[ys]=temp[yp];temp[yp]=tmpRow;break;}}
if(ys==this.h){return new Bravo.Engine.Math.Matrix(this.w,this.h,temp);}
else{pivot=temp[yp][yp];}}
var scale=1/pivot;var x,y;for(x=yp;x<this.w;++x){temp[yp][x]*=scale;}
for(y=0;y<this.h;++y){if(y==yp){continue;}
var factor=temp[y][yp];temp[y][yp]=0;for(x=yp+1;x<this.w;++x){temp[y][x]-=factor*temp[yp][x];}}}
return new Bravo.Engine.Math.Matrix(this.w,this.h,temp);}},{Allocate:function(width,height){var values=[];for(var i=0;i<height;i++){values[i]=[];for(var j=0;j<width;j++){values[i][j]=0;}}
return values;},Clone:function(values){var clone=[];for(var i=0;i<values.length;++i){clone[i]=[].concat(values[i]);}
return clone;},GetProjectiveTransform:function(points){var eqMatrix=new Bravo.Engine.Math.Matrix(9,8,[[1,1,1,0,0,0,-points[3][0],-points[3][0],-points[3][0]],[0,1,1,0,0,0,0,-points[2][0],-points[2][0]],[1,0,1,0,0,0,-points[1][0],0,-points[1][0]],[0,0,1,0,0,0,0,0,-points[0][0]],[0,0,0,-1,-1,-1,points[3][1],points[3][1],points[3][1]],[0,0,0,0,-1,-1,0,points[2][1],points[2][1]],[0,0,0,-1,0,-1,points[1][1],0,points[1][1]],[0,0,0,0,0,-1,0,0,points[0][1]]]);var kernel=eqMatrix.RowEchelon().values;var transform=new Bravo.Engine.Math.Matrix(3,3,[[-kernel[0][8],-kernel[1][8],-kernel[2][8]],[-kernel[3][8],-kernel[4][8],-kernel[5][8]],[-kernel[6][8],-kernel[7][8],1]]);return transform;}});
;;;
Bravo.Engine.Math.Trig=Base.extend({},{GUID:0,GetGUID:function(){return Bravo.Engine.Math.Trig.GUID++;},GetDistanceFrom:function(sprite,x2,y2){var position=sprite.GetAbsolutePosition();x1=position.x;y1=position.y;return Math.sqrt(Math.pow((x2-x1),2)+Math.pow((y2-y1),2));},Between:function(x,lower,upper){if(x>=lower&&x<=upper){return true;}
else{return false;}},LineIntersectsLine:function(p1,p2,p3,p4){var denom=((p4.y-p3.y)*(p2.x-p1.x))-((p4.x-p3.x)*(p2.y-p1.y));var numerator=((p4.x-p3.x)*(p1.y-p3.y))-((p4.y-p3.y)*(p1.x-p3.x));var numerator2=((p2.x-p1.x)*(p1.y-p3.y))-((p2.y-p1.y)*(p1.x-p3.x));if(denom===0){return false;}
var ua=numerator/denom;var ub=numerator2/denom;return(ua>=0&&ua<=1&&ub>=0&&ub<=1);},RectIntersectsLine:function(left,right,top,bottom,p1,p2){var lowerLeft={x:left,y:bottom};var upperRight={x:right,y:top};var upperLeft={x:left,y:top};var lowerRight={x:right,y:bottom};if(p1.x>lowerLeft.x&&p1.x<upperRight.x&&p1.y<lowerLeft.y&&p1.y>upperRight.y&&p2.x>lowerLeft.x&&p2.x<upperRight.x&&p2.y<lowerLeft.y&&p2.y>upperRight.y){return true;}
if(Bravo.Engine.Math.Trig.LineIntersectsLine(p1,p2,upperLeft,lowerLeft)){return true;}
if(Bravo.Engine.Math.Trig.LineIntersectsLine(p1,p2,lowerLeft,lowerRight)){return true;}
if(Bravo.Engine.Math.Trig.LineIntersectsLine(p1,p2,upperLeft,upperRight)){return true;}
if(Bravo.Engine.Math.Trig.LineIntersectsLine(p1,p2,upperRight,lowerRight)){return true;}
return false;},RectIntersectsPolygon:function(left,right,top,bottom,pArray){for(var i=0;i<pArray.length-1;i++){var p1=pArray[i];var p2=pArray[i+1];if(Bravo.Engine.Math.Trig.RectIntersectsLine(left,right,top,bottom,p1,p2)){return[p1,p2];}}
return null;},SpriteIntersectsPoint:function(sprite,p){return(Bravo.Engine.Math.Trig.SpriteIntersectsX(sprite,p)&&Bravo.Engine.Math.Trig.SpriteIntersectsY(sprite,p));},SpriteIntersectsX:function(sprite,p){return(p.x>=sprite.Left()&&p.x<=sprite.Right());},SpriteIntersectsY:function(sprite,p){return(p.y>=sprite.Top()&&p.y<=sprite.Bottom());},SpriteIntersectsLine:function(sprite,p1,p2){return Bravo.Engine.Math.Trig.RectIntersectsLine(sprite.Left(),sprite.Right(),sprite.Top(),sprite.Bottom(),p1,p2);},SpriteIntersectsSprite:function(sprite1,sprite2){return(Bravo.Engine.Math.Trig.SpriteIntersectsRect(sprite1,sprite2.Left(),sprite2.Right(),sprite2.Top(),sprite2.Bottom()));},SpriteIntersectsRect:function(sprite,left,right,top,bottom){return(sprite.Top()<=bottom&&sprite.Bottom()>=top&&sprite.Left()<=right&&sprite.Right()>=left);},SpriteIntersectsPolygon:function(sprite,pArray){return(Bravo.Engine.Math.Trig.RectIntersectsPolygon(sprite.Left(),sprite.Right(),sprite.Top(),sprite.Bottom(),pArray));},TextDimensions:function(text,font,context){var dimensions={width:0,height:0};if(context.measureText!==null&&context.measureText!==undefined){context.save();context.font=font;var widthMeasurement=context.measureText(text);dimensions.width=widthMeasurement.width;var heightMeasurement=context.measureText("gM");dimensions.height=heightMeasurement.width;context.restore();}
return dimensions;},PerpendicularSlope:function(p1,p2){return-(p2.x-p1.x)/(p2.y-p1.y);},Rotate:function(points,center,axis,focalLength){var sx=Math.sin(axis[0]);var cx=Math.cos(axis[0]);var sy=Math.sin(axis[1]);var cy=Math.cos(axis[1]);var sz=Math.sin(axis[2]);var cz=Math.cos(axis[2]);var rotatedPoints=[];for(var i=0;i<points.length;i++){var x=points[i][0]-center[0];var y=points[i][1]-center[1];var z=points[i][2]-center[2];var xy=cx*y-sx*z;var xz=sx*y+cx*z;var yz=cy*xz-sy*x;var yx=sy*xz+cy*x;var zx=cz*yx-sz*xy;var zy=sz*yx+cz*xy;var scaleFactor=focalLength/(focalLength+yz);x=zx*scaleFactor+center[0];y=zy*scaleFactor+center[1];z=yz+center[2];rotatedPoints[rotatedPoints.length]=[x,y,z];}
return rotatedPoints;}});
;;;
Bravo.Engine.Graphics.SpriteManager=Base.extend({constructor:function(containerArray,clearEnabledArray){this.ContainerArray=containerArray;this.ClearEnabledArray=clearEnabledArray;this.Initialize();},ContainerArray:null,SpriteArray:null,SpriteHash:null,NeedsRepaintArray:null,NeedsResortArray:null,BufferIndexArray:null,ClearEnabledArray:null,Initialize:function(){this.SpriteHash={};this.SpriteArray=[];this.NeedsRepaintArray=[];this.NeedsResortArray=[];this.BufferIndexArray=[];if(this.ClearEnabledArray==null){this.ClearEnabledArray=[];}
for(var containerIndex=0;containerIndex<this.ContainerArray.length;containerIndex++){this.SpriteArray[containerIndex]=[];this.NeedsRepaintArray[containerIndex]=false;this.NeedsResortArray[containerIndex]=false;this.BufferIndexArray[containerIndex]=0;if(this.ClearEnabledArray[containerIndex]==null){this.ClearEnabledArray[containerIndex]=false;}}},Paint:function(){var j,sprite;for(var containerIndex=0;containerIndex<this.ContainerArray.length;containerIndex++){if(this.NeedsResortArray[containerIndex]===true){this.Sort(containerIndex);this.NeedsResortArray[containerIndex]=false;}
if(this.NeedsRepaintArray[containerIndex]===true){var spriteArray=this.SpriteArray[containerIndex];var container=this.GetContainer(containerIndex);var clearEnabled=this.ClearEnabledArray[containerIndex];if(clearEnabled===true){Bravo.Engine.Graphics.CanvasSprite.ClearRect(container,{x:0,y:0},{width:container.width,height:container.height});}
else{for(j=0;j<spriteArray.length;j++){sprite=spriteArray[j];if(sprite.NeedsRepaint===true){sprite.Clear(container);}}}
for(j=0;j<spriteArray.length;j++){sprite=spriteArray[j];if(clearEnabled===true||sprite.NeedsRepaint===true){if(sprite.Active===true&&sprite.GetAbsoluteVisible()===true){sprite.Paint(container);}
sprite.NeedsRepaint=false;}}
for(j=0;j<spriteArray.length;j++){sprite=spriteArray[j];if(sprite.Active===false){this.Remove(j,containerIndex);j--;}}
this.NeedsRepaintArray[containerIndex]=false;}}},GetContainer:function(containerIndex){var bufferIndex=this.BufferIndexArray[containerIndex];return this.ContainerArray[containerIndex][bufferIndex];},SwapBuffers:function(containerIndex){var bufferArray=this.ContainerArray[containerIndex];var bufferCount=bufferArray.length;var bufferIndex=this.BufferIndexArray[containerIndex];if(bufferCount>1){bufferArray[bufferIndex].style.visibility="hidden";bufferIndex++;if(bufferIndex>=bufferCount){bufferIndex=0;}
this.BufferIndexArray[containerIndex]=bufferIndex;bufferArray[bufferIndex].style.visibility="visible";}},SetNeedsRepaint:function(containerIndex){this.NeedsRepaintArray[containerIndex]=true;},SetNeedsResort:function(containerIndex){this.NeedsResortArray[containerIndex]=true;},Add:function(sprite,containerIndex){sprite.SpriteManager=this;sprite.ContainerIndex=containerIndex;var spriteArray=this.SpriteArray[containerIndex];spriteArray[spriteArray.length]=sprite;this.SpriteHash[sprite.ID]=sprite;this.NeedsRepaintArray[containerIndex]=true;this.NeedsResortArray[containerIndex]=true;},Sort:function(containerIndex){var spriteArray=this.SpriteArray[containerIndex];spriteArray.sort(function(a,b){var aPosition=a.GetAbsolutePosition();var bPosition=b.GetAbsolutePosition();return aPosition.z-bPosition.z;});},Remove:function(j,containerIndex){var sprite=this.SpriteArray[containerIndex][j];if(sprite.DeallocateFn){sprite.DeallocateFn();}
if(sprite.Remove){sprite.Remove();}
this.SpriteHash[sprite.ID]=null;this.SpriteArray[containerIndex].splice(j,1);},RemoveAll:function(){for(var containerIndex=0;containerIndex<this.ContainerArray.length;containerIndex++){while(this.SpriteArray[containerIndex].length>0){this.Remove(0,containerIndex);}}
this.Initialize();},Get:function(id){return this.SpriteHash[id];},GetAll:function(containerIndex){return this.SpriteArray[containerIndex];},Find:function(property,value,like){var matchedSprites=[];for(var containerIndex=0;containerIndex<this.ContainerArray.length;containerIndex++){for(var j=0;j<this.SpriteArray[containerIndex].length;j++){var sprite=this.SpriteArray[containerIndex][j];var match=false;if(like){if(sprite[property].indexOf(value)>=0){match=true;}}else{if(sprite[property]===value){match=true;}}
if(match){matchedSprites.push(sprite);}}}
return matchedSprites;},ToString:function(){var arr=[];for(var containerIndex=0;containerIndex<this.ContainerArray.length;containerIndex++){arr[arr.length]="";arr[arr.length]="containerIndex #"+containerIndex+" ("+this.SpriteArray[containerIndex].length+" sprites)";arr[arr.length]="-------------------------------------------------";for(var j=0;j<this.SpriteArray[containerIndex].length;j++){arr[arr.length]=this.SpriteArray[containerIndex][j].ToString();}}
return arr.join("\n");}});
;;;
Bravo.Engine.Graphics.Sprite=InitBase.extend({constructor:function(initObject){this.ID=null;this.Type=null;this.EvalFn=null;this.DeallocateFn=null;this.Shape=null;this.Points=null;this.Text=null;this.Image=null;this.Alpha=1;this.AlphaMax=1;this.Align="left";this.Font=null;this.Leading=0;this.Wrap=false;this.Elipsis=null;this.Color=null;this.DropShadow=null;this.Composite=null;this.Visible=true;this.ParentSprite=null;this.Position={x:0,y:0,z:0};this.Size={width:null,height:null};this.Transform3D=false;this.Centered=false;this.Scale={x:1,y:1,z:1};this.Skew={x:0,y:0,z:0};this.Rotation={x:0,y:0,z:0};this.Bounds={width:null,height:null};this.Velocity={x:0,y:0,z:0};this.RotationalVelocity={x:0,y:0,z:0};this.Frames=[];this.FrameIndex=0;this.InitializeObject(initObject);if(this.ID===null||this.ID===undefined){this.ID="unnamed_"+Bravo.Engine.Math.Trig.GetGUID();}
if(this.Scale.x===null||this.Scale.x===undefined){this.Scale.x=1;}
if(this.Scale.y===null||this.Scale.y===undefined){this.Scale.y=1;}
if(this.Scale.z===null||this.Scale.z===undefined){this.Scale.z=1;}
if(this.Skew.x===null||this.Skew.x===undefined){this.Skew.x=0;}
if(this.Skew.y===null||this.Skew.y===undefined){this.Skew.y=0;}
if(this.Skew.z===null||this.Skew.z===undefined){this.Skew.z=0;}
if(this.Rotation.x===null||this.Rotation.x===undefined){this.Rotation.x=0;}
if(this.Rotation.y===null||this.Rotation.y===undefined){this.Rotation.y=0;}
if(this.Rotation.z===null||this.Rotation.z===undefined){this.Rotation.z=0;}
if(this.Position.x===null||this.Position.x===undefined){this.Position.x=0;}
if(this.Position.y===null||this.Position.y===undefined){this.Position.y=0;}
if(this.Position.z===null||this.Position.z===undefined){this.Position.z=0;}
if(this.Velocity.x===null||this.Velocity.x===undefined){this.Velocity.x=0;}
if(this.Velocity.y===null||this.Velocity.y===undefined){this.Velocity.y=0;}
if(this.Velocity.z===null||this.Velocity.z===undefined){this.Velocity.z=0;}
if(this.RotationalVelocity.x===null||this.RotationalVelocity.x===undefined){this.RotationalVelocity.x=0;}
if(this.RotationalVelocity.y===null||this.RotationalVelocity.y===undefined){this.RotationalVelocity.y=0;}
if(this.RotationalVelocity.z===null||this.RotationalVelocity.z===undefined){this.RotationalVelocity.z=0;}
if(this.Frames===null||this.Frames===undefined){this.Frames=[];}
if(this.Image!==null&&this.Image!==undefined){if(this.Frames.length===0){this.UserDefinedFrames=false;this.Frames=[{x:0,y:0,width:this.Image.width,height:this.Image.height}];}
if(this.Size.width===null||this.Size.width===undefined){this.Size.width=this.Frames[this.FrameIndex].width;}
if(this.Size.height===null||this.Size.height===undefined){this.Size.height=this.Frames[this.FrameIndex].height;}}
if(this.Bounds.width===null||this.Bounds.width===undefined){this.Bounds.width=this.Size.width;}
if(this.Bounds.height===null||this.Bounds.height===undefined){this.Bounds.height=this.Size.height;}
this.UserDefinedFrames=true;this.FrameSequence=[];this.FrameSequenceIndex=0;this.FrameLoopCount=0;this.CustomAnimate=true;this.Active=true;this.NeedsRepaint=true;this.SpriteManager=null;this.ContainerIndex=null;},ID:null,Type:null,EvalFn:null,DeallocateFn:null,Shape:null,Points:null,Text:null,Image:null,Alpha:null,AlphaMax:null,Align:null,Font:null,Leading:null,Elipsis:null,Wrap:null,Color:null,DropShadow:null,Composite:null,Visible:null,ParentSprite:null,Position:null,Size:null,Transform3D:null,Centered:null,Scale:null,Skew:null,Rotation:null,Bounds:null,Velocity:null,RotationalVelocity:null,Frames:null,FrameIndex:null,UserDefinedFrames:null,FrameSequence:null,FrameSequenceIndex:null,FrameLoopCount:null,CustomAnimate:null,Active:null,NeedsRepaint:null,SpriteManager:null,ContainerIndex:null,GetAbsolutePosition:function(){if(this.ParentSprite==null){return this.Position;}
else{parentPosition=this.ParentSprite.GetAbsolutePosition();return{x:this.Position.x+parentPosition.x,y:this.Position.y+parentPosition.y,z:this.Position.z+parentPosition.z};}},GetAbsoluteRotation:function(){if(this.ParentSprite==null){return this.Rotation;}
else{parentRotation=this.ParentSprite.GetAbsoluteRotation();return{x:this.Rotation.x+parentRotation.x,y:this.Rotation.y+parentRotation.y,z:this.Rotation.z+parentRotation.z};}},GetAbsoluteAlpha:function(){if(this.Alpha===0){return 0;}
else if(this.ParentSprite==null){return this.Alpha;}
else{parentAlpha=this.ParentSprite.GetAbsoluteAlpha();return parentAlpha*this.Alpha;}},GetAbsoluteVisible:function(){if(this.Visible===false){return false;}
else if(this.ParentSprite==null){return this.Visible;}
else{parentVisible=this.ParentSprite.GetAbsoluteVisible();return parentVisible;}},AddChild:function(sprite){sprite.ParentSprite=this;this.SetNeedsResort();},SetPosition:function(position){if(position!==null&&position!==undefined){var oldPosition=this.Position;this.Position.x=(position.x==null?0:position.x);this.Position.y=(position.y==null?0:position.y);this.Position.z=(position.z==null?0:position.z);if(position.x!==oldPosition.x||position.y!==oldPosition.y||position.z!==oldPosition.z){this.SetNeedsRepaint();}}},SetRotation:function(rotation){if(rotation!==null&&rotation!==undefined){var oldRotation=this.Rotation;this.Rotation.x=(rotation.x==null?0:rotation.x);this.Rotation.y=(rotation.y==null?0:rotation.y);this.Rotation.z=(rotation.z==null?0:rotation.z);if(rotation.x!==oldRotation.x||rotation.y!==oldRotation.y||rotation.z!==oldRotation.z){this.SetNeedsRepaint();}}},SetZ:function(z){if(this.Position.z!=z){this.Position.z=z;this.SetNeedsResort();this.SetNeedsRepaint();}},SetImage:function(image,assumeFrames,assumeSize){this.Image=image;if(assumeFrames===true){this.UserDefinedFrames=false;this.Frames=[{x:0,y:0,width:image.width,height:image.height}];}
if(assumeSize===true){this.Size.width=image.width;this.Size.height=image.height;}
this.SetNeedsRepaint();},GetTextSize:function(container){},SetText:function(text){this.Text=text;},SetFont:function(text){this.Font=font;},Step:function(){if(this.EvalFn!==null&&this.EvalFn!==undefined){this.EvalFn(this);}
this.StepPosition();this.StepRotation();this.AdvanceFrameSequence();},StepPosition:function(){var position={x:this.Position.x+this.Velocity.x,y:this.Position.y+this.Velocity.y,z:this.Position.z+this.Velocity.z};this.SetPosition(position);},StepRotation:function(){var rotation={x:this.Rotation.x+this.RotationalVelocity.x,y:this.Rotation.y+this.RotationalVelocity.y,z:this.Rotation.z+this.RotationalVelocity.z};this.SetRotation(rotation);},SetNeedsRepaint:function(){this.NeedsRepaint=true;if(this.SpriteManager!==null&&this.SpriteManager!==undefined){this.SpriteManager.SetNeedsRepaint(this.ContainerIndex);}},SetNeedsResort:function(){if(this.SpriteManager!==null&&this.SpriteManager!==undefined){this.SpriteManager.SetNeedsResort(this.ContainerIndex);}},Set:function(property,newValue){var oldValue=this[property];if(oldValue!==newValue){this[property]=newValue;this.SetNeedsRepaint();}},SetFrameIndex:function(frameIndex){if(this.FrameIndex!==frameIndex){this.FrameIndex=frameIndex;this.SetNeedsRepaint();}},CreateFrameSequence:function(stepCount,frameLoopCount,startFrameIndex,endFrameIndex){if(startFrameIndex===null||startFrameIndex===undefined){startFrameIndex=0;}
if(endFrameIndex===null||endFrameIndex===undefined){endFrameIndex=this.Frames.length-1;}
var frameSequence=[];for(var i=startFrameIndex;i<=endFrameIndex;i++){frameSequence[frameSequence.length]={frameIndex:i,stepCount:stepCount};}
this.SetFrameSequence(frameSequence,frameLoopCount);},SetFrameSequence:function(frameSequence,frameLoopCount){if(frameSequence===null||frameSequence===undefined){this.FrameSequence=[];}else{this.FrameSequence=frameSequence;}
if(frameLoopCount===null||frameLoopCount===undefined){this.FrameLoopCount=1;}else{this.FrameLoopCount=frameLoopCount;}
this.FrameSequenceIndex=0;if(this.FrameSequence.length>0){this.FrameSequence[this.FrameSequenceIndex].stepElapsed=0;this.SetFrameIndex(this.FrameSequence[this.FrameSequenceIndex].frameIndex);}else{this.SetFrameIndex(0);}},AdvanceFrameSequence:function(){if(this.FrameSequence.length>0){var currentFrameSequence=this.FrameSequence[this.FrameSequenceIndex];currentFrameSequence.stepElapsed=currentFrameSequence.stepElapsed+1;var stepElapsed=currentFrameSequence.stepElapsed;var stepCount=currentFrameSequence.stepCount;if(stepElapsed>=stepCount){this.FrameSequenceIndex++;if(this.FrameSequenceIndex>=this.FrameSequence.length){this.FrameSequenceIndex=0;if(this.FrameLoopCount>0){this.FrameLoopCount--;if(this.FrameLoopCount===0){this.FrameSequence=[];}}}
if(this.FrameSequence.length>0){this.FrameSequence[this.FrameSequenceIndex].stepElapsed=0;this.SetFrameIndex(this.FrameSequence[this.FrameSequenceIndex].frameIndex);}}}},Left:function(position){if(position==null){position=this.GetAbsolutePosition()};return position.x+(this.Size.width*0.5-this.Bounds.width*0.5);},Right:function(position){if(position==null){position=this.GetAbsolutePosition()};return position.x+(this.Size.width*0.5+this.Bounds.width*0.5);},Top:function(position){if(position==null){position=this.GetAbsolutePosition()};return position.y+(this.Size.height*0.5-this.Bounds.height*0.5);},Bottom:function(position){if(position==null){position=this.GetAbsolutePosition()};return position.y+(this.Size.height*0.5+this.Bounds.height*0.5);},MidpointX:function(position){if(position==null){position=this.GetAbsolutePosition()};return this.Left(position)+(this.Right(position)-this.Left(position)*0.5);},MidpointY:function(position){if(position==null){position=this.GetAbsolutePosition()};return this.Top(position)+(this.Bottom(position)-this.Top(position)*0.5);},Paint:function(container){},ToString:function(position){if(position==null){position=this.GetAbsolutePosition()};var str=this.ID+" "+"("+[parseInt(position.x,10),parseInt(position.y,10),parseInt(position.z,10)].join(",")+")"+"("+[parseInt(this.Size.width,10),parseInt(this.Size.height,10)].join(",")+")"+" "+(this.Active?"Active":"Inactive");return str;}});
;;;
Bravo.Engine.Graphics.CanvasSprite=Bravo.Engine.Graphics.Sprite.extend({constructor:function(initObject){this.ClearEnabled=true;this.base(initObject);this.SubdivisionLimit=10;this.PatchArea=100*100;this.FocalLength=400;this.PreviousPosition=null;this.PreviousSize=null;this.TextLines=null;this.CharacterSize={w:0,h:0};this.RefreshTextLines=true;},ClearEnabled:null,SubdivisionLimit:null,PatchArea:null,FocalLength:null,PreviousPosition:null,PreviousSize:null,TextLines:null,CharacterSize:null,RefreshTextLines:null,GetTextSize:function(container){var context=container.getContext("2d");this.GenerateTextLines(context);var lineHeight=this.CharacterSize.height+this.Leading;var textSize={};textSize.height=lineHeight*this.TextLines.length;textSize.width=this.Size.width;return textSize;},SetText:function(text){this.base(text);this.RefreshTextLines=true;},SetFont:function(font){this.base(font);this.RefreshTextLines=true;},GenerateTextLines:function(context){if(this.RefreshTextLines===true){var textLines;this.GenerateCharacterSize(context);if(this.Wrap===true){var charactersPerLine=Math.floor(this.Size.width/this.CharacterSize.width);var maxLines=Math.floor(this.Size.height/this.CharacterSize.height);this.TextLines=this.TruncateTextLines(this.Text,charactersPerLine,maxLines,"\n",this.Elipsis);}
else{this.TextLines=this.Text.split("\n");}
this.RefreshTextLines=false;}},TruncateTextLines:function(inputText,charactersPerLine,maxLines,lineSeparator,elipsis){var wrapArr=[];var startRange=0;var endRange=0;var i=0;do{var midWord=true;var endRange=startRange+charactersPerLine;var lineSeparatorPosition=inputText.lastIndexOf(lineSeparator,endRange);if(lineSeparatorPosition>=startRange){endRange=lineSeparatorPosition;midWord=false;}
else if(endRange>inputText.length){endRange=inputText.length;}
else{var spacePosition=inputText.lastIndexOf(" ",endRange);if(spacePosition>=startRange){endRange=spacePosition;midWord=false;}}
var slicedText=inputText.slice(startRange,endRange);wrapArr[wrapArr.length]=slicedText;startRange=endRange+(midWord?0:1);i++;}while(endRange<inputText.length&&i<1000);if(elipsis&&wrapArr.length>0&&wrapArr.length>maxLines){var lastLine=wrapArr[maxLines-1];var spacePosition=lastLine.lastIndexOf(" ",lastLine.length-elipsis.length);if(spacePosition>=0){wrapArr[maxLines-1]=lastLine.slice(0,spacePosition)+elipsis;}
else{wrapArr[maxLines-1]=elipsis;}}
var outputArr=wrapArr.slice(0,maxLines);return outputArr;},GenerateCharacterSize:function(context){this.CharacterSize.width=(Bravo.Engine.Math.Trig.TextDimensions("D",this.Font,context)).width;this.CharacterSize.height=(Bravo.Engine.Math.Trig.TextDimensions("gM",this.Font,context)).height;},Clear:function(container){var context=container.getContext("2d");if(this.ClearEnabled==true&&(this.PreviousPosition!==null&&this.PreviousPosition!==undefined)){Bravo.Engine.Graphics.CanvasSprite.ClearRect(container,this.PreviousPosition,this.PreviousSize);}},Paint:function(container){var context=container.getContext("2d");var position=this.GetAbsolutePosition();var rotation=this.GetAbsoluteRotation();context.save();if(this.Color!==null&&this.Color!==undefined){context.fillStyle=this.Color;}
context.globalAlpha=this.GetAbsoluteAlpha();context.translate(position.x,position.y);if(this.DropShadow){context.shadowOffsetX=2;context.shadowOffsetY=2;context.shadowBlur=2;context.shadowColor="rgba(0, 0, 0, "+(this.Alpha*0.5)+")";}
if(this.Centered===false){context.translate(this.Size.width*0.5,this.Size.height*0.5);}
if(this.Skew.x!==0||this.Skew.y!==0){context.transform(1,this.Skew.y,this.Skew.x,1,0,0);}
if(this.Scale.x!==1||this.Scale.y!==1){context.scale(this.Scale.x,this.Scale.y);}
if(this.Transform3D===false&&rotation.z!==0){context.rotate(rotation.z*Math.PI/180);}
context.translate(-this.Size.width*0.5,-this.Size.height*0.5);if(this.Composite!==null&&this.Composite!==undefined){context.globalCompositeOperation=this.Composite;}
if(this.Image!==null&&this.Image!==undefined){this.PaintImage(context);}
if(this.Text!==null&&this.Text!==undefined){this.PaintText(context);}
if(this.Points!==null&&this.Points!==undefined){this.PaintPoints(context);}
context.restore();this.PreviousPosition={x:position.x-2,y:position.y-2};this.PreviousSize={width:this.Size.width+4,height:this.Size.height+4};},PaintText:function(context){if(context.fillText){context.textBaseline="top";context.textAlign=this.Align;if(this.Font!==null&&this.Font!==undefined){context.font=this.Font;}
this.GenerateTextLines(context);var lineHeight=this.CharacterSize.height+this.Leading;for(var i=0;i<this.TextLines.length;i++){context.fillText(this.TextLines[i],0,lineHeight*i);}}},PaintPoints:function(context){var points=this.Points;if(this.Color!==null&&this.Color!==undefined){context.strokeStyle=this.Color;}
context.lineWidth=2;context.beginPath();for(var i=0;i<points.length;i++){if(i===0){context.moveTo(points[i].x,points[i].y);}else{context.lineTo(points[i].x,points[i].y);}}
context.stroke();context.closePath();},PaintShape:function(context){if(this.Shape==="rectangle"){var rotation=this.GetAbsoluteRotation();var points=[[0,0,0],[this.Size.width,0,0],[0,this.Size.height,0],[this.Size.width,this.Size.height,0]];if(rotation.x!==0||rotation.y!==0||rotation.z!==0){var center=[this.Size.width*0.5,this.Size.height*0.5,0];var axis=[rotation.x*Math.PI/180,rotation.y*Math.PI/180,rotation.z*Math.PI/180];points=Bravo.Engine.Math.Trig.Rotate(points,center,axis,this.FocalLength);}
context.beginPath();context.moveTo(points[0][0],points[0][1]);context.lineTo(points[1][0],points[1][1]);context.lineTo(points[3][0],points[3][1]);context.lineTo(points[2][0],points[2][1]);context.fill();context.closePath();}},PaintImage:function(context){if(this.Transform3D===false){var frame=this.Frames[this.FrameIndex];if(this.UserDefinedFrames===true){context.drawImage(this.Image,frame.x,frame.y,frame.width,frame.height,0,0,this.Size.width,this.Size.height);}else{if(frame.width!==this.Size.width||frame.height!==this.Size.height){context.drawImage(this.Image,0,0,this.Size.width,this.Size.height);}else{context.drawImage(this.Image,0,0);}}}else{var rotation=this.GetAbsoluteRotation();var points=[[0,0,0],[this.Size.width,0,0],[0,this.Size.height,0],[this.Size.width,this.Size.height,0]];var center=[this.Size.width*0.5,this.Size.height*0.5,0];var axis=[rotation.x*Math.PI/180,rotation.y*Math.PI/180,rotation.z*Math.PI/180];points=Bravo.Engine.Math.Trig.Rotate(points,center,axis,this.FocalLength);var transform=Bravo.Engine.Math.Matrix.GetProjectiveTransform(points);var ptl=transform.TransformProjectiveVector([0,0,1]);var ptr=transform.TransformProjectiveVector([1,0,1]);var pbl=transform.TransformProjectiveVector([0,1,1]);var pbr=transform.TransformProjectiveVector([1,1,1]);this.PaintImageSubdivide(context,0,0,1,1,ptl,ptr,pbl,pbr,this.SubdivisionLimit,transform);}},PaintImageSubdivide:function(context,u1,v1,u4,v4,p1,p2,p3,p4,limit,transform){if(limit){var d1=[p2[0]+p3[0]-2*p1[0],p2[1]+p3[1]-2*p1[1]];var d2=[p2[0]+p3[0]-2*p4[0],p2[1]+p3[1]-2*p4[1]];var d3=[d1[0]+d2[0],d1[1]+d2[1]];var r=Math.abs((d3[0]*d3[0]+d3[1]*d3[1])/(d1[0]*d2[0]+d1[1]*d2[1]));d1=[p2[0]-p1[0]+p4[0]-p3[0],p2[1]-p1[1]+p4[1]-p3[1]];d2=[p3[0]-p1[0]+p4[0]-p2[0],p3[1]-p1[1]+p4[1]-p2[1]];var area=Math.abs(d1[0]*d2[1]-d1[1]*d2[0]);if((u1===0&&u4===1)||((0.25+r*5)*area>this.PatchArea)){var umid=(u1+u4)/2;var vmid=(v1+v4)/2;var pmid=transform.TransformProjectiveVector([umid,vmid,1]);var pt=transform.TransformProjectiveVector([umid,v1,1]);var pb=transform.TransformProjectiveVector([umid,v4,1]);var pl=transform.TransformProjectiveVector([u1,vmid,1]);var pr=transform.TransformProjectiveVector([u4,vmid,1]);limit--;this.PaintImageSubdivide(context,u1,v1,umid,vmid,p1,pt,pl,pmid,limit,transform);this.PaintImageSubdivide(context,umid,v1,u4,vmid,pt,p2,pmid,pr,limit,transform);this.PaintImageSubdivide(context,u1,vmid,umid,v4,pl,pmid,p3,pb,limit,transform);this.PaintImageSubdivide(context,umid,vmid,u4,v4,pmid,pr,pb,p4,limit,transform);return;}}
context.save();var d12=[p2[0]-p1[0],p2[1]-p1[1]];var d24=[p4[0]-p2[0],p4[1]-p2[1]];var d43=[p3[0]-p4[0],p3[1]-p4[1]];var d31=[p1[0]-p3[0],p1[1]-p3[1]];var a1=Math.abs(d12[0]*d31[1]-d12[1]*d31[0]);var a2=Math.abs(d24[0]*d12[1]-d24[1]*d12[0]);var a4=Math.abs(d43[0]*d24[1]-d43[1]*d24[0]);var a3=Math.abs(d31[0]*d43[1]-d31[1]*d43[0]);var amax=Math.max(Math.max(a1,a2),Math.max(a3,a4));var dx=0,dy=0,padx=0,pady=0;switch(amax){case a1:context.transform(d12[0],d12[1],-d31[0],-d31[1],p1[0],p1[1]);if(u4!==1){padx=1.05/Math.sqrt(d12[0]*d12[0]+d12[1]*d12[1]);}
if(v4!==1){pady=1.05/Math.sqrt(d31[0]*d31[0]+d31[1]*d31[1]);}
break;case a2:context.transform(d12[0],d12[1],d24[0],d24[1],p2[0],p2[1]);if(u4!==1){padx=1.05/Math.sqrt(d12[0]*d12[0]+d12[1]*d12[1]);}
if(v4!==1){pady=1.05/Math.sqrt(d24[0]*d24[0]+d24[1]*d24[1]);}
dx=-1;break;case a3:context.transform(-d43[0],-d43[1],-d31[0],-d31[1],p3[0],p3[1]);if(u4!==1){padx=1.05/Math.sqrt(d43[0]*d43[0]+d43[1]*d43[1]);}
if(v4!==1){pady=1.05/Math.sqrt(d31[0]*d31[0]+d31[1]*d31[1]);}
dy=-1;break;case a4:context.transform(-d43[0],-d43[1],d24[0],d24[1],p4[0],p4[1]);if(u4!==1){padx=1.05/Math.sqrt(d43[0]*d43[0]+d43[1]*d43[1]);}
if(v4!==1){pady=1.05/Math.sqrt(d24[0]*d24[0]+d24[1]*d24[1]);}
dx=-1;dy=-1;break;}
var du=(u4-u1);var dv=(v4-v1);var padu=padx*du;var padv=pady*dv;var frame=this.Frames[this.FrameIndex];context.drawImage(this.Image,u1*frame.width,v1*frame.height,Math.min(u4-u1+padu,1)*frame.width,Math.min(v4-v1+padv,1)*frame.height,dx,dy,1+padx,1+pady);context.restore();}},{ClearRect:function(container,position,size){var context=container.getContext("2d");context.clearRect(position.x,position.y,size.width,size.height);},FillRect:function(container,position,size){var context=container.getContext("2d");context.save();context.fillStyle="rgba(255,255,255,1)";context.fillRect(position.x,position.y,size.width,size.height);context.restore();}});
;;;
Bravo.Engine.Graphics.Engine=Bravo.Engine.Preload.extend({constructor:function(containerArray,clearEnabledArray,width,height){var _self=this;_self.base();for(var i=0;i<containerArray.length;i++){for(var j=0;j<containerArray[i].length;j++){if(width!=null){containerArray[i][j].width=width;}
if(height!=null){containerArray[i][j].height=height;}}}
_self.SpriteManager=new Bravo.Engine.Graphics.SpriteManager(containerArray,clearEnabledArray);},SpriteManager:null,ProcessMap:function(JSONObject,onLoadFn){var _self=this;_self.base(JSONObject,onLoadFn);for(var i in _self.MapFiles){var mapFile=_self.MapFiles[i];mapFile.element=_self.LoadFile(mapFile.src,_self.MapFileLoaded.bind(_self,onLoadFn));}},MapFileLoaded:function(onLoadFn,image){var _self=this;_self.MapFilesLoaded++;if(_self.MapFilesLoaded===_self.MapFilesTotal){_self.ProcessMapComplete(onLoadFn);}},LoadFile:function(src,onLoadFn){var image=new Image();$(image).bind({load:function(){onLoadFn(this);},error:function(){onLoadFn(this);}});image.src=src;return image;},Step:function(){var _self=this;_self.SpriteManager.Paint();},AddSprite:function(initObject){var _self=this;if(initObject===null||initObject===undefined){initObject={};}
if(initObject.Image===null||initObject.Image===undefined){if(initObject.ImageMapID!==null&&initObject.ImageMapID!==undefined){initObject.Image=_self.GetElement(initObject.ImageMapID);if(initObject.Image===null||initObject.Image===undefined||!initObject.Image.complete){initObject.Image=null;}}}
if(initObject.Frames===null||initObject.Frames===undefined){if(initObject.ImageMapID!==null&&initObject.ImageMapID!==undefined){initObject.Frames=_self.GetFrames(initObject.ImageMapID);}}
if(initObject.ContainerIndex===null||initObject.ContainerIndex===undefined){initObject.ContainerIndex=0;}
var sprite=new Bravo.Engine.Graphics.CanvasSprite(initObject);_self.SpriteManager.Add(sprite,initObject.ContainerIndex);return sprite;},RemoveAllSprites:function(){this.SpriteManager.RemoveAll();},GetTextSize:function(sprite){var containerIndex=sprite.ContainerIndex;var container=this.SpriteManager.GetContainer(containerIndex);return sprite.GetTextSize(container);},FadeIn:function(sprite,duration){if(duration==null){duration=500;}
if(sprite){$(sprite).stop();if(sprite.Visible===false){sprite.Visible=true;sprite.Alpha=0;}
if(duration===0){sprite.Alpha=sprite.AlphaMax;sprite.SetNeedsRepaint();}
else{$(sprite).animate({"Alpha":sprite.AlphaMax},{queue:false,easing:"easeOutQuad",duration:duration,step:function(){sprite.SetNeedsRepaint();}});}}},FadeOut:function(sprite,duration){if(duration==null){duration=500;}
if(sprite){$(sprite).stop();if(duration===0){sprite.Alpha=0;sprite.Visible=false;sprite.SetNeedsRepaint();}
else{$(sprite).animate({"Alpha":0},{queue:false,easing:"easeOutQuad",duration:duration,step:function(){sprite.SetNeedsRepaint();},complete:function(){sprite.Visible=false;}});}}}},{});
;;;
Bravo.Engine.Controls.Engine=Base.extend({constructor:function(eventSurface,supportsTouch,isDocumentDraggable,onSurfaceMouseEnter,onSurfaceMouseLeave,surfaceEnabled){this.Initialize();eventSurface=eventSurface==null?null:eventSurface;supportsTouch=supportsTouch==null?false:supportsTouch;isDocumentDraggable=isDocumentDraggable==null?false:isDocumentDraggable;surfaceEnabled=surfaceEnabled==null?true:surfaceEnabled;this.OnSurfaceMouseEnter=onSurfaceMouseEnter;this.OnSurfaceMouseLeave=onSurfaceMouseLeave;this.SetEventSurface(eventSurface);this.SetSupportsTouch(supportsTouch);this.SetIsDocumentDraggable(isDocumentDraggable);this.SetSurfaceEnabled(surfaceEnabled);},Initialize:function(){this.CurrentlyDragging=null
this.EventHash={};this.LastEventObject={};this.NeedsResort=false;},EventSurface:null,SupportsTouch:null,SurfaceEnabled:null,IsDocumentDraggable:null,OnSurfaceMouseEnter:null,OnSurfaceMouseLeave:null,CurrentlyDragging:null,EventHash:null,LastEventObject:null,NeedsResort:null,SetEventSurface:function(eventSurface){this.EventSurface=eventSurface;this.EventSurface["onmouseover"]=this.HandleSurfaceMouseEnter.bind(this);this.EventSurface["onmouseout"]=this.HandleSurfaceMouseLeave.bind(this);},HandleSurfaceMouseEnter:function(e){if(this.OnSurfaceMouseEnter!=null){this.OnSurfaceMouseEnter();}},HandleSurfaceMouseLeave:function(e){this.TriggerEvent("onmouseleave",{});if(this.OnSurfaceMouseLeave!=null){this.OnSurfaceMouseLeave();}},SetSupportsTouch:function(enable){this.SupportsTouch=enable;if(this.SupportsTouch){Bravo.Engine.Controls.Engine.TouchEvent="touchstart";}else{Bravo.Engine.Controls.Engine.TouchEvent="mousedown";}},SetIsDocumentDraggable:function(enable){this.IsDocumentDraggable=enable;this.DetachDrag();},SetSurfaceEnabled:function(surfaceEnabled){this.SurfaceEnabled=surfaceEnabled;},AddSlider:function(initObject){if(initObject.ControlsEngine===null||initObject.ControlsEngine===undefined){initObject.ControlsEngine=this;}
var slider=new Bravo.Engine.Controls.Slider(initObject);return slider;},MapEventName:function(eventName){var mappedEventName=eventName;if(this.SupportsTouch){switch(eventName){case"onclick":case"onmousedown":mappedEventName="ontouchstart";break;case"onmouseup":mappedEventName="ontouchend";break;case"onmousemove":case"onmouseenter":case"onmouseleave":mappedEventName="ontouchmove";break;}}
return mappedEventName;},AttachSurfaceEvent:function(eventSurface,eventName){if(eventSurface!=null&&(eventSurface[eventName]===null||eventSurface[eventName]===undefined)){var mappedEventName=this.MapEventName(eventName);eventSurface[mappedEventName]=this.HandleSurfaceEvent.bind(this,eventName);}},DetachSurfaceEvent:function(eventSurface,eventName){if(eventSurface!=null&&eventSurface[eventName]!=null){var mappedEventName=this.MapEventName(eventName);eventSurface[mappedEventName]=null;}},AddEventListener:function(sprite,eventName,eventHandler){var virtualEventName=eventName;if(eventName==="onmouseenter"||eventName==="onmouseleave"){virtualEventName="onmousemove";}
this.AttachSurfaceEvent(this.EventSurface,virtualEventName);if(this.EventHash[virtualEventName]===null||this.EventHash[virtualEventName]===undefined){this.EventHash[virtualEventName]=[];}
var event=null;var eventArray=this.EventHash[virtualEventName];if(eventArray!=null){for(var i=0;i<eventArray.length;i++){if(eventArray[i].sprite===sprite){event=eventArray[i];break;}}}
if(event==null){event={sprite:sprite,eventHandler:null,eventHandlerMouseEnter:null,eventHandlerMouseLeave:null,mouseEntered:false};eventArray[eventArray.length]=event;}
if(eventName==="onmouseenter"){event.eventHandlerMouseEnter=eventHandler;}
else if(eventName==="onmouseleave"){event.eventHandlerMouseLeave=eventHandler;}
else{event.eventHandler=eventHandler;}
this.NeedsResort=true;},RemoveAllEventListeners:function(){for(eventName in this.EventHash){if(this.EventHash.hasOwnProperty(eventName)){var eventArray=this.EventHash[eventName];if(eventArray!=null){while(eventArray.length>0){this.RemoveEvent(eventArray,0);}}
delete this.EventHash[eventName];this.DetachSurfaceEvent(this.EventSurface,eventName);}}
this.Initialize();},RemoveEventListener:function(sprite,eventName){var virtualEventName=eventName;if(eventName==="onmouseenter"||eventName==="onmouseleave"){virtualEventName="onmousemove";}
var eventArray=this.EventHash[virtualEventName];if(eventArray!=null){for(var i=0;i<eventArray.length;i++){var event=eventArray[i];if(event.sprite===sprite){if(eventName==="onmouseenter"){event.eventHandlerMouseEnter=null;}
else if(eventName==="onmouseleave"){event.eventHandlerMouseLeave=null;}
else{event.eventHandler=null;}
if(event.eventHandlerMouseEnter==null&&event.eventHandlerMouseLeave==null&&event.eventHandler==null){this.RemoveEvent(eventArray,i);if(eventArray.length===0){delete this.EventHash[eventName];this.DetachSurfaceEvent(this.EventSurface,eventName);}}
break;}}}},RemoveEvent:function(eventArray,i){var event=eventArray[i];event.eventHandlerMouseEnter=null;event.eventHandlerMouseLeave=null;event.eventHandler=null;event.sprite=null;event.mouseEntered=null;event=null;eventArray.splice(i,1);},TriggerEvent:function(eventName,lastEventObject){var virtualEventName=eventName;if(eventName==="onmouseenter"||eventName==="onmouseleave"){virtualEventName="onmousemove";}
if(lastEventObject==null){lastEventObject=this.LastEventObject;}
this.HandleSurfaceEvent(virtualEventName,lastEventObject);},Sort:function(eventArray){for(eventName in this.EventHash){if(this.EventHash.hasOwnProperty(eventName)){var eventArray=this.EventHash[eventName];eventArray.sort(function(a,b){var aPosition=a.sprite.GetAbsolutePosition();var bPosition=b.sprite.GetAbsolutePosition();return aPosition.z-bPosition.z;});}}},HandleSurfaceEvent:function(eventName,e){if(!this.SurfaceEnabled)return;var eventArray=this.EventHash[eventName];var numSpritesIntersected=0;this.LastEventObject=e;if(eventArray!=null){var absolutePosition=this.GetAbsolutePosition(e);var relativePosition=this.GetRelativePosition(absolutePosition.x,absolutePosition.y);if(this.NeedsResort){this.Sort(eventArray);this.NeedsResort=false;}
for(var i=eventArray.length-1;i>=0;i--){var sprite=eventArray[i].sprite;var mouseEntered=eventArray[i].mouseEntered;if(sprite.Active&&sprite.GetAbsoluteVisible()){var intersects=Bravo.Engine.Math.Trig.SpriteIntersectsPoint(sprite,relativePosition);if(intersects&&numSpritesIntersected===0){numSpritesIntersected++;e.sprite=sprite;e.relativeX=relativePosition.x;e.relativeY=relativePosition.y;e.absoluteX=absolutePosition.x;e.absoluteY=absolutePosition.y;var eventHandler=eventArray[i].eventHandler;if(eventHandler!=null){e.eventName=eventName;eventHandler(e);}
var eventHandlerMouseEnter=eventArray[i].eventHandlerMouseEnter;if(eventHandlerMouseEnter!=null&&mouseEntered===false){e.eventName="onmouseenter";eventHandlerMouseEnter(e);}
eventArray[i].mouseEntered=true;}
else{var eventHandlerMouseLeave=eventArray[i].eventHandlerMouseLeave;if(eventHandlerMouseLeave!=null&&mouseEntered===true){e.sprite=sprite;e.relativeX=relativePosition.x;e.relativeY=relativePosition.y;e.absoluteX=absolutePosition.x;e.absoluteY=absolutePosition.y;e.eventName="onmouseleave";eventHandlerMouseLeave(e);}
eventArray[i].mouseEntered=false;}}}}},EnableDrag:function(element,container,handleValidDrag,handleStartDrag,handleMoveDrag,handleStopDrag){if(container==null){container=this.EventSurface;}
if(this.IsSprite(element)){this.AddEventListener(element,"onmousedown",this.StartDrag.bind(this,element,container,handleValidDrag,handleStartDrag,handleMoveDrag,handleStopDrag));}
else{if(this.SupportsTouch){element.ontouchstart=this.StartDrag.bind(this,element,container,handleValidDrag,handleStartDrag,handleMoveDrag,handleStopDrag);}else{element.onmousedown=this.StartDrag.bind(this,element,container,handleValidDrag,handleStartDrag,handleMoveDrag,handleStopDrag);}}},DisableDrag:function(element,container){if(this.IsSprite(element)){this.RemoveEventListener(element,"onmousedown");}
else{if(this.SupportsTouch){element.ontouchstart=null;}else{element.onmousedown=null;}}},StartDrag:function(element,container,handleValidDrag,handleStartDrag,handleMoveDrag,handleStopDrag,e){Bravo.Engine.Controls.Engine.PreventDefault(e);var dragIsValid=true;if(handleValidDrag!==null&&handleValidDrag!==undefined){var absolutePosition=this.GetAbsolutePosition(e);var relativePosition=this.GetRelativePosition(absolutePosition.x,absolutePosition.y,container);e.sprite=element;e.relativeX=relativePosition.x;e.relativeY=relativePosition.y;e.absoluteX=absolutePosition.x;e.absoluteY=absolutePosition.y;dragIsValid=handleValidDrag(e);}
if(dragIsValid==true){this.DetachDrag(e);this.CurrentlyDragging=container;this.AttachDrag(element,handleValidDrag,handleStartDrag,handleMoveDrag,handleStopDrag,e);this.MoveDrag(element,handleMoveDrag,e);if(handleStartDrag!==null&&handleStartDrag!==undefined){handleStartDrag(e);}}},MoveDrag:function(element,handleMoveDrag,e){Bravo.Engine.Controls.Engine.PreventDefault(e);if(handleMoveDrag!==null&&handleMoveDrag!==undefined){var container=this.CurrentlyDragging;var absolutePosition=this.GetAbsolutePosition(e);var relativePosition=this.GetRelativePosition(absolutePosition.x,absolutePosition.y,container);e.sprite=element;e.relativeX=relativePosition.x;e.relativeY=relativePosition.y;e.absoluteX=absolutePosition.x;e.absoluteY=absolutePosition.y;handleMoveDrag(e);}},StopDrag:function(element,handleStopDrag,e){Bravo.Engine.Controls.Engine.PreventDefault(e);this.DetachDrag(element,e);this.CurrentlyDragging=null;if(handleStopDrag!==null&&handleStopDrag!==undefined){handleStopDrag(e);}},LeaveDrag:function(element,handleStopDrag,e){var from=e.relatedTarget||e.toElement;if(!from||from.nodeName=="HTML"){this.StopDrag(element,handleStopDrag,e);}},AttachDrag:function(element,handleValidDrag,handleStartDrag,handleMoveDrag,handleStopDrag,e){if(this.SupportsTouch){document.body.ontouchmove=this.MoveDrag.bind(this,element,handleMoveDrag);document.body.ontouchend=this.StopDrag.bind(this,element,handleStopDrag);}
else{document.body.onmousedown=this.MoveDrag.bind(this,element,handleMoveDrag);document.body.onmousemove=this.MoveDrag.bind(this,element,handleMoveDrag);document.body.onmouseup=this.StopDrag.bind(this,element,handleStopDrag);window.onmouseout=this.LeaveDrag.bind(this,element,handleStopDrag);}},DetachDrag:function(element,e){var fn=null;if(this.IsDocumentDraggable==false){fn=Bravo.Engine.Controls.Engine.PreventDefault;}
if(this.SupportsTouch){document.body.ontouchend=fn;document.body.ontouchmove=fn;}
else{document.body.onmousedown=fn;document.body.onmousemove=fn;document.body.onmouseup=fn;window.onmouseout=fn;}},IsSprite:function(element){if(element&&element.SpriteManager!=null){return true;}
return false;},GetAbsolutePosition:function(e){var position={x:null,y:null};if(this.SupportsTouch){if(e!=null&&e.touches!=null&&e.touches.length>0){position.x=e.touches[0].pageX;position.y=e.touches[0].pageY;}}
else{if(e!=null){position.x=e.clientX;position.y=e.clientY;}}
return position;},GetRelativePosition:function(x,y,element){var position={x:x,y:y}
if(element==null){element=this.EventSurface;}
if(x!=null&&y!=null){position.x+=$(window).scrollLeft();position.y+=$(window).scrollTop();var offset=$(element).offset();position.x-=offset.left;position.y-=offset.top;}
return position;},ToString:function(){var arr=[];for(eventName in this.EventHash){if(this.EventHash.hasOwnProperty(eventName)){var eventArray=this.EventHash[eventName];arr[arr.length]="------------";arr[arr.length]="event: "+eventName;if(eventArray!=null){for(var i=0;i<eventArray.length;i++){var spriteID=eventArray[i].sprite.ID
var eventName=eventArray[i].eventHandler;if(eventName!=null){eventName=eventName.toString().slice(0,20);}
arr[arr.length]=i+" ["+spriteID+"] "+eventName;}}}}
return arr.join("\n");}},{TouchEvent:"touchstart",PreventDefault:function(e){if(e&&e.preventDefault){e.preventDefault();}
if(e&&e.stopPropagation){e.stopPropagation();}
return false;},DisableSelection:function(DOMElement){DOMElement.style.userSelect="none";DOMElement.style.MozUserSelect="none";DOMElement.style.KhtmlUserSelect="none";DOMElement.style.cursor="default";DOMElement.ondragstart=Bravo.Engine.Controls.Engine.PreventDefault;DOMElement.onmousedown=Bravo.Engine.Controls.Engine.PreventDefault;DOMElement.onselectstart=Bravo.Engine.Controls.Engine.PreventDefault;}});
;;;
var DevUnpluggedManager=Class.create({Snipe:null,KeepHidden:false,ShowDelay:3500,Iteration:0,Shown:false,initialize:function(){var _self=this;_self.Snipe=$("#enter_unplugged_snipe");_self.Snipe.click(function(){window.location='/#/unplugged';});$("#enter_unplugged_snipe .close").click(function(e){_self.KeepHidden=true;_self.Close();e.stopPropagation();});},Show:function(){var _self=this;_self.Snipe.css("display","block").animate({left:0},{easing:EasingTypes.InCirc,queue:false,duration:1000,complete:function(){_self.Shown=true;setTimeout(_self.Close.bind(_self),15000);}});},Close:function(){var _self=this;_self.Snipe.animate({left:-300},{easing:EasingTypes.OutBack,queue:false,duration:3000,complete:function(){_self.Shown=false;_self.ShowWithDelay();}});},ShowWithDelay:function(){var _self=this;if(_self.Shown===true)return;if(_self.KeepHidden===false){_self.Iteration+=1;setTimeout(_self.Show.bind(_self),_self.ShowDelay*_self.Iteration);}}});var DevUnpluggedManagerObj=new DevUnpluggedManager();
;;;
var Slideshow=Class.create();Slideshow.SlideshowArray=[];Slideshow.Attach=function(){var slideshows=$(".slideshow");if(slideshows.length>0){$.each(slideshows,function(i,element){if($(element).attr("data-initialized")==null||$(element).attr("data-initialized")==""){var slideshow=new Slideshow($(element));Slideshow.SlideshowArray.push(slideshow);}});}};Slideshow.Detach=function(){for(var i=0;i<Slideshow.SlideshowArray.length;i++){var slideshow=Slideshow.SlideshowArray[i];slideshow.Dispose();delete slideshow;}
Slideshow.SlideshowArray.length=0;};Object.extend(Slideshow.prototype,{VideoIsPlaying:false,Container:null,initialize:function(container){var _self=this;_self.Container=container;_self.Container.attr("data-initialized","true");_self.CreateSlideshow();var articles=_self.Container.find(".poster, section > article");articles.bind("click",_self.ShowVideo.bind(_self)).bind("keydown",_self.OnKeydown.bind(_self)).attr("tabindex","0").attr("onclick","");_self.Container.bind("mouseenter",_self.OnEnter.bind(_self)).bind("mouseleave",_self.OnLeave.bind(_self));_self.Container.find("nav li a").attr("href","javascript:void(0)").attr("onclick","");},OnKeydown:function(e){var _self=this;switch(e.keyCode){case 13:case 32:$(e.currentTarget).trigger("click");e.preventDefault();break;}},CreateSlideshow:function(){var _self=this;_self.Container.cycle({width:688,height:385,containerResize:false,slideResize:false,pager:'.slideshow nav ul',pagerEvent:'click',slideExpr:'section',fx:'scrollHorz',speed:1200,direction:'left',delay:1000,timeout:10000,before:_self.BeforeSlideChange.bind(_self),pagerAnchorBuilder:_self.PagerAchorBuilder.bind(_self),updateActivePagerLink:_self.UpdateActivePagerLink.bind(_self)});},PagerAchorBuilder:function(idx,slide){return'<li><a href="#">'+$(slide).find("h1").eq(0).text()+'</a></li>';},UpdateActivePagerLink:function(pager,currSlideIndex){var _self=this;_self.Container.find("nav").find('li').removeClass('activeSlide').filter('li:eq('+currSlideIndex+')').addClass('activeSlide');},ShowVideo:function(e){var _self=this;var section=$(e.currentTarget).parents("section:eq(0)");var poster=section.find(".poster");var video=section.find(".video");var videoPlayer=section.find(".video_player");var article=section.find("article");var nav=_self.Container.find("nav");if(video.length>0){poster.hide();article.hide();nav.addClass("video_playing");video.show();VideoPlayer.Detach();videoPlayer.attr("data-initialized","");VideoPlayer.Attach();_self.VideoIsPlaying=true;_self.Container.cycle("pause");}},BeforeSlideChange:function(curr,next,opts){var _self=this;var section=$(curr);var poster=section.find(".poster");var video=section.find(".video");var article=section.find("article");var nav=_self.Container.find("nav");poster.show();article.show();nav.removeClass("video_playing");video.hide();VideoPlayer.Detach();_self.VideoIsPlaying=false;_self.Container.cycle("resume");},OnEnter:function(e){var _self=this;_self.Container.cycle("pause");},OnLeave:function(e){var _self=this;if(!_self.VideoIsPlaying){_self.Container.cycle("resume");}},Dispose:function(){var _self=this;_self.Container.attr("data-initialized","false");_self.Container.cycle("destroy");}});
;;;
var BingMap=Class.create({Elements:null,Options:null,Map:null,RestAPI:null,ScrollDirectionLat:null,ScrollDirectionLong:null,initialize:function(newElements,newOptions){this.Elements={Map:null,LocationList:null,ZoomControls:null,ScrollControls:null};this.Elements=$.extend({},this.Elements,newElements);this.Options={Credentials:"",LocationArray:[],MaxLocationsDisplayed:3,MagnifyZoomDefault:5,MagnifyRadiusMiles:null,MagnifyRadiusClosest:null,ScrollSpeed:1,PinIconUrl:null,PinIconSize:{width:0,height:0},InfoboxOffset:{x:0,y:0},InfoboxMovement:{x:0,y:0},InfoboxHtmlFn:null,InitializeCallbackFn:null,DisposeCallbackFn:null,GeolocationCallbackFn:null,SearchCallbackFn:null,ShowInfoBoxCallbackFn:null};this.Options=$.extend({},this.Options,newOptions);this.ScrollDirectionLat=null;this.ScrollDirectionLong=null;this.CreateElements();this.BindEvents();if(this.Options.InitializeCallbackFn){this.Options.InitializeCallbackFn();}
this.GetGeoLocation();},CreateElements:function(){this.Map=new Microsoft.Maps.Map(this.Elements.Map.get(0),{credentials:this.Options.Credentials,mapTypeId:Microsoft.Maps.MapTypeId.road,enableClickableLogo:false,enableSearchLogo:false,showCopyright:false});var scriptContainer=$(Selectors.MAIN_CONTAINER);this.RestAPI=new BingRestAPI(this.Map,this.CoordinatesFromAddressCallback.bind(this),this.AddressFromCoordinatesCallback.bind(this),scriptContainer);this.AddLocationsToMap();},BindEvents:function(){Microsoft.Maps.Events.addHandler(this.Map,"viewchangeend",this.ViewChangeEndHandler.bind(this));if(this.Elements.ScrollControls!==null&&this.Elements.ScrollControls!==undefined&&this.Elements.ScrollControls.length>=4){$(document.body).bind("mouseup.BingMaps",this.MapScrollCancel.bind(this));this.Elements.ScrollControls[0].bind("mousedown",this.MapScrollStart.bind(this,1,0));this.Elements.ScrollControls[1].bind("mousedown",this.MapScrollStart.bind(this,0,1));this.Elements.ScrollControls[2].bind("mousedown",this.MapScrollStart.bind(this,-1,0));this.Elements.ScrollControls[3].bind("mousedown",this.MapScrollStart.bind(this,0,-1));}
if(this.Elements.ZoomControls!==null&&this.Elements.ZoomControls!==undefined&&this.Elements.ZoomControls.length>=2){this.Elements.ZoomControls[0].bind("mousedown",this.MapZoomIncrement.bind(this,1));this.Elements.ZoomControls[1].bind("mousedown",this.MapZoomIncrement.bind(this,-1));}},UnbindEvents:function(){if(this.Elements.ScrollControls!==null&&this.Elements.ScrollControls!==undefined&&this.Elements.ScrollControls.length>=4){$(document.body).unbind("mouseup.BingMaps");}},Dispose:function(){if(this.Options.DisposeCallbackFn){this.Options.DisposeCallbackFn();}
this.UnbindEvents();this.Map.dispose();this.RestAPI.Dispose();},GroupLocations:function(){if(this.Options.LocationArray[0].group==undefined){var groups=[];for(var i=0;i<this.Options.LocationArray.length;i++){var locA=this.Options.LocationArray[i];if(locA.group==undefined){groups.push([locA]);locA.group=groups.length-1;for(var j=i+1;j<this.Options.LocationArray.length;j++){var locB=this.Options.LocationArray[j];if(Math.abs(locA.Lat-locB.Lat)+Math.abs(locA.Long-locB.Long)<0.5){locB.group=locA.group;groups[locA.group].push(locB);}}}}
for(var i=0;i<groups.length;i++){if(groups[i].length>1){var xx=groups[i][0].Lat;var yy=groups[i][0].Long;for(var u=0;u<groups[i].length;u++){pointRatio=u/groups[i].length;var xSteps=Math.cos(pointRatio*2*Math.PI);var ySteps=Math.sin(pointRatio*2*Math.PI);groups[i][u].Lat=xx+xSteps*.3;groups[i][u].Long=yy+ySteps*.5;}}}}},AddLocationsToMap:function(){var pushpinCollection=new Microsoft.Maps.EntityCollection();var infoboxCollection=new Microsoft.Maps.EntityCollection();this.GroupLocations();for(var i=0;i<this.Options.LocationArray.length;i++){this.AddLocation(this.Options.LocationArray[i],pushpinCollection,infoboxCollection);}
this.Map.entities.push(pushpinCollection);this.Map.entities.push(infoboxCollection);this.ShowAllInfoBox();this.HideAllInfoBox();},AddLocation:function(location,pushpinCollection,infoboxCollection){var name=location.Name;var description=location.Description;var lat=location.Lat;var long=location.Long;var coordinates=new Microsoft.Maps.Location(lat,long);var icon=this.Options.PinIconUrl;var iconWidth=this.Options.PinIconSize.width;var iconHeight=this.Options.PinIconSize.height;var textWidth=0;var textHeight=0;var pin;if(icon){pin=new Microsoft.Maps.Pushpin(coordinates,{icon:icon,width:iconWidth+textWidth,height:iconHeight+textHeight,anchor:new Microsoft.Maps.Point(iconWidth/2,iconHeight/2)});}
else{pin=new Microsoft.Maps.Pushpin(coordinates,{});}
var infobox;if(this.Options.InfoboxHtmlFn){infobox=new Microsoft.Maps.Infobox(coordinates,{visible:false,offset:new Microsoft.Maps.Point(this.Options.InfoboxOffset.x,this.Options.InfoboxOffset.y),htmlContent:this.Options.InfoboxHtmlFn(location)});}
else{infobox=new Microsoft.Maps.Infobox(coordinates,{title:name,description:description,visible:false});}
Microsoft.Maps.Events.addHandler(pin,"click",this.ShowInfoBox.bind(this,location,pin,infobox));pushpinCollection.push(pin);infoboxCollection.push(infobox);},ShowInfoBox:function(location,pin,infobox,e){var coordinates=pin.getLocation();var lat=coordinates.latitude;var long=coordinates.longitude;var metersPerPixel=this.Map.getMetersPerPixel();var nudgeLat=(this.Options.InfoboxMovement.y*metersPerPixel)/111000;var nudgeLong=(this.Options.InfoboxMovement.x*metersPerPixel)/111000;lat=lat+nudgeLat;long=long+nudgeLong;this.SetMapPosition(lat,long);var infoboxOptions=infobox.getOptions();if(infoboxOptions.visible===false){this.HideAllInfoBox();infoboxOptions.visible=true;infobox.setOptions(infoboxOptions);pin.setOptions({visible:false});}
if(this.Options.ShowInfoBoxCallbackFn){this.Options.ShowInfoBoxCallbackFn(location,pin,infobox);}},HideAllInfoBox:function(){var infoboxCollection=this.Map.entities.get(1);for(var i=0;i<infoboxCollection.getLength();i++){var infobox=infoboxCollection.get(i);var options=infobox.getOptions();if(options.visible===true){options.visible=false;infobox.setOptions(options);}}
var pinCollection=this.Map.entities.get(0);for(var i=0;i<pinCollection.getLength();i++){var pin=pinCollection.get(i);if(pin.getVisible()===false){pin.setOptions({visible:true});}}},ShowAllInfoBox:function(){var infoboxCollection=this.Map.entities.get(1);for(var i=0;i<infoboxCollection.getLength();i++){var infobox=infoboxCollection.get(i);var options=infobox.getOptions();if(options.visible===false){options.visible=true;infobox.setOptions(options);}}},MapScrollStep:function(){if(this.ScrollDirectionLat!=null&&this.ScrollDirectionLong!=null){var coordinates=this.Map.getCenter();var lat=coordinates.latitude;var long=coordinates.longitude;lat=lat+(this.ScrollDirectionLat*this.Options.ScrollSpeed);long=long+(this.ScrollDirectionLong*this.Options.ScrollSpeed);this.SetMapPosition(lat,long);}},SetMapZoom:function(zoomLevel,animate){if(animate===null||animate===undefined){animate=true;}
this.HideAllInfoBox();this.Map.setView({zoom:zoomLevel,animate:animate});},SetMapPosition:function(latitude,longitude,animate){var coordinates=new Microsoft.Maps.Location(latitude,longitude);this.SetMapPositionCoordinates(coordinates,animate);},SetMapPositionCoordinates:function(coordinates,animate){if(animate===null||animate===undefined){animate=true;}
this.HideAllInfoBox();this.Map.setView({center:coordinates,animate:animate});},SetMapBounds:function(r1,r2,r3,r4,animate){if(animate===null||animate===undefined){animate=true;}
this.HideAllInfoBox();var boundaries=Microsoft.Maps.LocationRect.fromLocations(new Microsoft.Maps.Location(r1,r2),new Microsoft.Maps.Location(r3,r4));this.Map.setView({bounds:boundaries,animate:animate});},GetGeoLocation:function(){if(navigator.geolocation&&navigator.geolocation.getCurrentPosition){navigator.geolocation.getCurrentPosition(this.GetGeoLocationSuccess.bind(this),this.GetGeoLocationError.bind(this));}},GetGeoLocationSuccess:function(coordinates){if(coordinates&&coordinates.coords){var lat=coordinates.coords.latitude;var long=coordinates.coords.longitude;this.UpdateDistance(lat,long);this.MagnifyClosest(lat,long,false);if(this.Options.GeolocationCallbackFn){this.RestAPI.AddressFromCoordinates(lat,long);}}},GetGeoLocationError:function(msg){},SearchAddressClick:function(addressString){if(addressString!==null&&addressString!==undefined){addressString=addressString.replace(/\W/g," ");addressString=$.trim(addressString);if(addressString!==""){this.RestAPI.CoordinatesFromAddress(addressString);}}},MapScrollCancel:function(){this.ScrollDirectionLat=null;this.ScrollDirectionLong=null;},MapScrollStart:function(scrollDirectionLat,scrollDirectionLong){this.ScrollDirectionLat=scrollDirectionLat;this.ScrollDirectionLong=scrollDirectionLong;this.MapScrollStep();},MapZoomIncrement:function(zoomDirection){var zoomLevel=this.Map.getZoom();zoomLevel=zoomLevel+zoomDirection;this.SetMapZoom(zoomLevel);},ViewChangeEndHandler:function(){var coordinates=this.Map.getCenter();var lat=coordinates.latitude;var long=coordinates.longitude;this.UpdateDistance(lat,long);this.UpdateLocationList();this.MapScrollStep();},UpdateDistance:function(latCenter,longCenter){for(var i=0;i<this.Options.LocationArray.length;i++){var lat=this.Options.LocationArray[i].Lat;var long=this.Options.LocationArray[i].Long;var distanceInKilometers=this.DistanceBetweenCoordinates(latCenter,longCenter,lat,long);var distanceInMiles=this.KilometersToMiles(distanceInKilometers);this.Options.LocationArray[i].DistanceInKilometers=distanceInKilometers;this.Options.LocationArray[i].DistanceInMiles=distanceInMiles;}},UpdateLocationList:function(){if(this.Elements.LocationList!==null&&this.Elements.LocationList!==undefined){var sortedLocationArray=this.Options.LocationArray.sort(function(a,b){return a.DistanceInMiles-b.DistanceInMiles;});this.Elements.LocationList.empty();for(var i=0;i<this.Options.MaxLocationsDisplayed&&i<sortedLocationArray.length;i++){var name=sortedLocationArray[i].Name;var distance=parseInt(sortedLocationArray[i].DistanceInMiles);var string=name+" - "+distance+" miles";$("<li/>").html(string).appendTo(this.Elements.LocationList);}}},MagnifyClosest:function(latCenter,longCenter,animate){var sortedLocationArray=this.Options.LocationArray.sort(function(a,b){return a.DistanceInMiles-b.DistanceInMiles;});var magnifyRadiusClosest=this.Options.MagnifyRadiusClosest
var magnifyRadiusMiles=this.Options.MagnifyRadiusMiles;if(magnifyRadiusClosest==null||magnifyRadiusClosest>sortedLocationArray.length){magnifyRadiusClosest=sortedLocationArray.length;}
var closestLocationArray=[];for(var i=0;i<magnifyRadiusClosest;i++){var location=sortedLocationArray[i];if(magnifyRadiusMiles==null||location.DistanceInMiles<=magnifyRadiusMiles){closestLocationArray.push(location);}}
if(closestLocationArray.length>0){var furthestLocation=closestLocationArray[closestLocationArray.length-1];var lat=furthestLocation.Lat;var long=furthestLocation.Long;var borderRadius=0.2;var latOffset=Math.abs(latCenter-lat)+borderRadius;var longOffset=Math.abs(longCenter-long)+borderRadius;var lat1=latCenter-latOffset;var lat2=latCenter+latOffset;var long1=longCenter-longOffset;var long2=longCenter+longOffset;this.SetMapBounds(lat1,long1,lat2,long2,animate);}
else{this.SetMapPosition(latCenter,longCenter,animate);this.SetMapZoom(this.Options.MagnifyZoomDefault,animate);}},AddressFromCoordinatesCallback:function(e,result){var match=null;if(result&&result.resourceSets&&result.resourceSets.length>0&&result.resourceSets[0].resources&&result.resourceSets[0].resources.length>0){match=result.resourceSets[0].resources[0];}
if(this.Options.GeolocationCallbackFn){this.Options.GeolocationCallbackFn(match);}},CoordinatesFromAddressCallback:function(e,result){var match=null;if(result&&result.resourceSets&&result.resourceSets.length>0&&result.resourceSets[0].resources&&result.resourceSets[0].resources.length>0){match=result.resourceSets[0].resources[0];}
if(match){var lat=match.point.coordinates[0];var long=match.point.coordinates[1];this.UpdateDistance(lat,long);this.MagnifyClosest(lat,long);}
if(this.Options.SearchCallbackFn){this.Options.SearchCallbackFn(match);}},DistanceBetweenCoordinates:function(lat1,long1,lat2,long2){var R=6371;var dLat=this.DegreesToRad(lat2-lat1);var dLong=this.DegreesToRad(long2-long1);var a=Math.sin(dLat/2)*Math.sin(dLat/2)+
Math.cos(this.DegreesToRad(lat1))*Math.cos(this.DegreesToRad(lat2))*Math.sin(dLong/2)*Math.sin(dLong/2);var c=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));var d=R*c;return d;},DegreesToRad:function(deg){return deg*Math.PI/180},KilometersToMiles:function(km){return 0.621371192*km;}});var BingRestAPI=Class.create({Map:null,ScriptContainer:null,RestAPIUrl:"http://dev.virtualearth.net/REST/v1",initialize:function(map,coordinatesFromAddressCallback,addressFromCoordinatesCallback,scriptContainer){this.Map=map;this.ScriptContainer=$("<div/>").appendTo(scriptContainer);$(window).bind("CoordinatesFromAddressCallback",coordinatesFromAddressCallback);$(window).bind("AddressFromCoordinatesCallback",addressFromCoordinatesCallback);},Dispose:function(){$(window).unbind("CoordinatesFromAddressCallback");$(window).unbind("AddressFromCoordinatesCallback");this.ScriptContainer.remove();},AddressFromCoordinates:function(latitude,longitude){this.Map.getCredentials(this.AddressFromCoordinatesRequest.bind(this,latitude,longitude));},AddressFromCoordinatesRequest:function(latitude,longitude,credentials){var restServiceURL=this.RestAPIUrl+"/Locations/"+latitude+","+longitude+"?output=json&jsonp=AddressFromCoordinatesGlobalCallback&key="+credentials;this.CallRestService(restServiceURL);},CoordinatesFromAddress:function(address){this.Map.getCredentials(this.CoordinatesFromAddressRequest.bind(this,address));},CoordinatesFromAddressRequest:function(address,credentials){var restServiceURL=this.RestAPIUrl+"/Locations/"+address+"?output=json&jsonp=CoordinatesFromAddressGlobalCallback&key="+credentials;this.CallRestService(restServiceURL);},CallRestService:function(url){_scriptManager.AppendScript(url,null,this.ScriptContainer.get(0));}});function CoordinatesFromAddressGlobalCallback(result){$(window).trigger("CoordinatesFromAddressCallback",[result]);}
function AddressFromCoordinatesGlobalCallback(result){$(window).trigger("AddressFromCoordinatesCallback",[result]);}
;;;;;;
