/*
	musictheory.net core.js
	Copyright (c) 2000-2010 Ricci Adams

	Includes swfobject <http://code.google.com/p/swfobject/>, MIT license
	Some functions based on prototype.js <http://www.prototypejs.org/>, MIT license
	Feature-detection logic based on Modernizr <http://www.modernizr.com>, MIT license
	JSON parsing based on json.org's json2.js <http://www.json.org/json2.js>, Public Domain

	Released under the MIT license <http://creativecommons.org/licenses/MIT/>
	For an uncompressed version of the source code, please contact Ricci at:
	http://www.musictheory.net/contact
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;
if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;
if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;
X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");
ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);
ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);
ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0
}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);
if(ad){ab=ad.GetVariable("$version");if(ab){X=true;
ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]
}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}
}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()
}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)
}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);
f()}});if(O==top){(function(){if(J){return
}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);
return}f()})()}}if(M.wk){(function(){if(J){return
}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);
return}f()})()}s(f)}}();function f(){if(J){return
}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));
Z.parentNode.removeChild(Z)}catch(aa){return
}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()
}}function K(X){if(J){X()}else{U[U.length]=X
}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)
}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)
}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)
}else{if(typeof O.onload=="function"){var X=O.onload;
O.onload=function(){X();Y()}}else{O.onload=Y
}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];
var aa=C(r);aa.setAttribute("width","1");
aa.setAttribute("height","1");aa.setAttribute("style","visibility: hidden");
aa.setAttribute("type",q);var Z=X.appendChild(aa);
if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");
if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]
}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);
return}}X.removeChild(aa);Z=null;H()})()}else{H()
}}function H(){var ag=o.length;if(ag>0){for(var af=0;
af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;
var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);
if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);
if(ab){aa.success=true;aa.ref=z(Y);ab(aa)
}}else{if(o[af].expressInstall&&A()){var ai={};
ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";
ai.height=ae.getAttribute("height")||"0";
if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")
}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")
}var ah={};var X=ae.getElementsByTagName("param");
var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")
}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);
if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;
aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;
var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y
}else{var Z=Y.getElementsByTagName(r)[0];
if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)
}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};
var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);
Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"
}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"
}j.title=j.title.slice(0,47)+" - Flash Player Installation";
var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+encodeURI(O.location).toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;
if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac
}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");
X+="SWFObjectNew";Y.setAttribute("id",X);
ae.parentNode.insertBefore(Y,ae);ae.style.display="none";
(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)
}else{setTimeout(arguments.callee,10)}})()
}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");
Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);
Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)
}else{setTimeout(arguments.callee,10)}})()
}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");
if(M.win&&M.ie){aa.innerHTML=ab.innerHTML
}else{var Y=ab.getElementsByTagName(r)[0];
if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;
for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))
}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);
if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y
}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]
}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'
}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'
}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'
}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";
N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);
Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])
}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])
}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])
}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X
}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);
aa.setAttribute("value",Y);Z.appendChild(aa)
}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";
(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)
}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);
if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null
}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;
try{X=j.getElementById(Z)}catch(Y){}return X
}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);
I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");
X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;
X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false
}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return
}var aa=j.getElementsByTagName("head")[0];
if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";
if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");
Z.setAttribute("type","text/css");Z.setAttribute("media",X);
n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]
}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)
}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))
}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";
if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)
}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;
return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y
}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;
for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])
}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])
}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null
}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};
Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;
Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})
}}},getObjectById:function(X){if(M.w3){return z(X)
}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};
if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);
K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]
}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};
if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]
}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]
}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);
if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an
}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);
return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)
}}},switchOffAutoHideShow:function(){m=false
},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}
},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)
}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)
}},removeSWF:function(X){if(M.w3){y(X)}},disableDetection:function(){T=false
},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)
}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;
if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)
}var Y=Z.split("&");for(var X=0;X<Y.length;
X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))
}}}return""},expressInstallCallback:function(){if(a){var X=c(R);
if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);
if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)
}}a=false}}}}();if(typeof Array.isArray=="undefined"){Array.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"
}}if(typeof Date.now=="undefined"){Date.now=function(){return new Date().getTime()
}}if(typeof Function.prototype.bind=="undefined"){Function.prototype.bind=function(a){var b=this;
return function(){return b.apply(a,arguments)
}}}if(!this.JSON){this.JSON={}}if(!this.JSON.parse){this.JSON.parse=function(text){var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)
})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return eval("("+text+")")
}return null}}var Util=Util||{};Util._LocalizableStrings={};
Util.applyCubicInOutEasing=function(a){if(a<=0.5){return(4*Math.pow(a,3))
}else{return(4*Math.pow(a-1,3)+1)}};Util.applyTemplate=function(f,d){var b=f.split("%");
for(var c=1;c<b.length;c++){var e=b[c];if(e.length==0){continue
}var a=parseInt(e.charAt(0));if(a==0||a>d.length){continue
}b[c]=d[a-1]+e.slice(1)}return b.join("")
};Util.clearAnimation=function(b){if(b){clearInterval(b)
}};Util.endsWith=function(a,b){var c=a.length-b.length;
return c>=0&&a.lastIndexOf(b)===c};Util.fetchURL=function(a,c){var b=new XMLHttpRequest();
b.open("GET",a,true);b.setRequestHeader("X-Requested-With","XMLHttpRequest");
b.onreadystatechange=function(){var d=b.readyState;
if(d!=4){return}if((b.status==0&&b.responseText!==undefined)||(b.status>=200&&b.status<300)){c(b.responseText)
}else{c(null)}};b.send("")};Util.getLocalizedString=function(a,b){if(Util._LocalizableStrings&&Util._LocalizableStrings[a]){return Util._LocalizableStrings[a]
}else{return b?b:a}};Util._interpretString=function(a){return a==null?"":String(a)
};Util.gsub=function(e,d,c){var a="",b;if(typeof(d)==="string"){d=RegExp.escape(d)
}if(!(d.length||d.source)){a=c("");return a+e.split("").join(a)+a
}while(e.length>0){if(b=e.match(d)){a+=e.slice(0,b.index);
a+=Util._interpretString(c(b));e=e.slice(b.index+b[0].length)
}else{a+=e,e=""}}return a};Util.installIECompatibility=function(){var b=("abbr,article,aside,audio,canvas,datalist,details,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video").split(",");
for(var a=0;a<b.length;a++){document.createElement(b[a])
}};var _gaq;Util.installTracker=function(){_gaq=_gaq||[];
_gaq.push(["_setAccount","UA-5397012-1"]);
_gaq.push(["_trackPageview"]);_gaq.push(["_setDomainName","none"]);
var a=document.createElement("script");a.type="text/javascript";
a.async=true;a.src="http://www.google-analytics.com/ga.js";
(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)
};Util.isEqual=function(b,a){if(b&&b.isEqual&&a&&a.isEqual){return b.isEqual(a)
}else{if((typeof(b)==typeof([]))&&(typeof(a)==typeof([]))){if(b.length==a.length){for(var c=0,d=b.length;
c<d;c++){if(!Util.isEqual(b[c],a[c])){return false
}}return true}else{return false}}else{return(b==a)
}}};Util.markNoBounce=function(a){if(_gaq){if(!a){a="markNoBounce()"
}_gaq.push(["_trackEvent","NoBounce",a]);
Util.markNoBounce=Util.identity}};Util.sanitizeURL=function(a){return a
};Util.log=function(a){if(window.StaticRenderer&&window.StaticRenderer.log_){window.StaticRenderer.log_(a)
}else{if(window.console&&window.console.log){window.console.log(a)
}else{try{console.log(a)}catch(b){}}}};Util.setLocalizedStrings=function(a){Util._LocalizableStrings=a
};Util.identity=function(a){return a};Util.popUpPiano=function(){window.open("/piano","PopUpPiano","width=562,height=233,menubar=0,location=0,toolbar=0,status=0,resizable=0,scrollbars=0")
};Util.setAnimation=function(d,c){var a=Date.now(),b=0;
b=setInterval(function(){var e=Date.now()-a,f=(e/c);
if(f>=1){f=1;clearInterval(b)}d(f,e)},1);
return b};Util.startsWith=function(a,b){return a.indexOf(b)===0
};Util.trim=function(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")
};var Browser=Browser||{};Browser._detectCSS=function(){var c=Dom.createElement("cssDetector"),b=["borderImage","webkitBorderImage","MozBorderImage","mozBorderImage"];
Dom.writeAttribute(c,"style","display:none;background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#000000), to(#000000));background: -moz-linear-gradient(0, #000000, #000000);opacity:.5;border-image:url(m.png) 1 1 stretch;-webkit-transition: opacity 1s linear;-webkit-border-image:url(m.png) 1 1 stretch;-moz-border-image:url(m.png) 1 1 stretch;");
Browser._supportsCSSAnimations=(!!c.style.webkitTransition);
Browser._supportsCSSGradients=(c.style.background.indexOf("-gradient")>=0);
Browser._supportsCSSOpacity=(c.style.opacity=="0.5");
Browser._supportsCSSBorderImages=false;for(var a in b){if(c.style[b[a]]!==undefined){Browser._supportsCSSBorderImages=true;
break}}Browser._detectCSS=Util.identity;Dom.remove(c)
};Browser._detectUA=function(){var a=navigator.userAgent,b=/WebKit/.test(a),c=b&&/Apple.*Mobile.*Safari/.test(a);
Browser._isWebKit=b;Browser._isApplePad=c&&/iPad.*Apple.*Safari/.test(a),Browser._isApplePhone=c&&/(iPhone|iPod).*Apple.*Safari/.test(a),Browser._isWebOS=b&&!c&&/webOS.*WebKit/.test(a),Browser._isDesktopSafari=b&&!c&&/Safari/.test(a),Browser._isGecko=(a.indexOf("Gecko")>-1)&&!b,Browser._isIE7=/MSIE 7\./.test(a),Browser._isIE8=/MSIE 8\./.test(a),Browser._isMobileWebKit=c||Browser._isWebOS;
Browser._detectUA=Util.identity};Browser.isApplePad=function(){Browser._detectUA();
return Browser._isApplePad};Browser.isApplePhone=function(){Browser._detectUA();
return Browser._isApplePhone};Browser.isMobileWebKit=function(){Browser._detectUA();
return Browser._isMobileWebKit};Browser.isDesktopSafari=function(){Browser._detectUA();
return Browser._isDesktopSafari};Browser.isGecko=function(){Browser._detectUA();
return Browser._isGecko};Browser.isWebKit=function(){Browser._detectUA();
return Browser._isWebKit};Browser.isIE7=function(){Browser._detectUA();
return Browser._isIE7};Browser.isIE8=function(){Browser._detectUA();
return Browser._isIE8};Browser.setViewport=function(a){if(!Browser._viewport){Browser._viewport=Dom.createElement("meta",{name:"viewport"});
Dom.appendChild(document.getElementsByTagName("head")[0],Browser._viewport)
}Dom.writeAttribute(Browser._viewport,"content",a)
};Browser.useNativeResolution=function(a){function b(){var c=a?",minimum-scale=1.0,maximum-scale=1.0":"";
if(window.orientation%180==0){Browser.setViewport("width=device-width"+c);
Dom.removeClassName(document.body,"orientation-landscape");
Dom.addClassName(document.body,"orientation-portrait")
}else{Browser.setViewport("width=device-height"+c);
Dom.addClassName(document.body,"orientation-landscape");
Dom.removeClassName(document.body,"orientation-portrait")
}}if(Browser.isApplePad()){window.onorientationchange=b;
b()}};Browser.addDeviceClassNameToBody=function(){var a=document.body;
if(Browser.isMobileWebKit()){if(Browser.isApplePhone()){Dom.addClassName(a,"apple-iphone")
}else{if(Browser.isApplePad()){Dom.addClassName(a,"apple-ipad")
}}Dom.addClassName(a,"mobile-webkit")}else{if(Browser.isWebKit()){Dom.addClassName(a,"desktop-webkit")
}}};Browser.prefersTouchEvents=function(){var a=navigator.userAgent;
var c=/(iPad|iPhone|iPod).*Apple.*Safari/.test(a);
if(!c){var b=a.match(/Android\s+([0-9.]+)/);
c=!!b&&(parseFloat(b[1])>=1.5)}if(c){c=("ontouchstart" in document.documentElement)
}Browser.prefersTouchEvents=function(){return c
};return c};Browser.isStaticRenderer=function(){return !!window.StaticRenderer
};Browser.saveStaticContent=function(){window.StaticRenderer&&window.StaticRenderer.save&&window.StaticRenderer.save()
};Browser.supportsCSSOpacity=function(){Browser._detectCSS();
return Browser._supportsCSSOpacity};Browser.supportsCSSAnimations=function(){Browser._detectCSS();
return Browser._supportsCSSAnimations};Browser.supportsCSSGradients=function(){Browser._detectCSS();
return Browser._supportsCSSGradients};Browser.supportsCSSBorderImages=function(){Browser._detectCSS();
return Browser._supportsCSSBorderImages};
Browser.supportsLocalStorage=function(){return window.localStorage&&localStorage.setItem&&localStorage.getItem
};Browser.supportsSVG=function(){return document&&document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")
};var Dom=Dom||{};Dom._classNameRegExp=function(a){return new RegExp("(^|\\s)"+a+"(\\s|$)")
};Dom.addClassName=function(a,b){if(!Dom.hasClassName(a,b)){a.className+=(a.className?" ":"")+b
}};Dom.appendChild=function(a,c){try{a.appendChild(c)
}catch(b){throw ("Dom.appendChild("+a+", "+c+"): "+b)
}};Dom.appendChildren=function(c,b){for(var a=0;
a<b.length;a++){c.appendChild(b[a])}};Dom.createElement=function(b,a){var e=document.createElement(b);
for(var d in a){Dom.writeAttribute(e,d,a[d])
}for(var c=2;c<arguments.length;c++){Dom.appendChild(e,arguments[c])
}return e};Dom.createVectorImage=function(d,b,c,a,e){if(Browser.supportsSVG()){if(Browser.isWebKit()&&!Browser.isMobileWebKit()){return Dom.createElement("img",{src:d,"class":b,width:c,height:a})
}}return e};Dom.createTextNode=function(a){return document.createTextNode(a)
};Dom.getElementById=function(a){if(!a){return null
}else{if(typeof(a)===typeof("")){return document.getElementById(a)
}else{return a}}};var $=Dom.getElementById;
Dom.hasClassName=function(a,b){return(a&&a.className&&a.className.length>0&&(a.className==b||Dom._classNameRegExp(b).test(a.className)))
};Dom.getStyle=function(b,c){var d=b.style[c];
if(!d||d=="auto"){if(b.currentStyle){d=b.currentStyle[c]
}else{if(document.defaultView){var a=document.defaultView.getComputedStyle(b,null);
d=a?a[c]:null}}}return d=="auto"?null:d};
Dom.getDimensions=function(c){var g=Dom.getStyle(c,"display");
if(g!="none"&&g!=null){return[c.offsetWidth,c.offsetHeight]
}var b=c.style;var f=b.visibility;var d=b.position;
var a=b.display;b.visibility="hidden";if(d!="fixed"){b.position="absolute"
}b.display="block";var h=c.clientWidth;var e=c.clientHeight;
b.display=a;b.position=d;b.visibility=f;return[h,e]
};Dom.getCumulativeOffset=function(a){var c=0,b=0;
do{c+=a.offsetLeft||0;b+=a.offsetTop||0;a=a.offsetParent
}while(a);return[c,b]};Dom.getChildElements=function(d){var e=d.childNodes;
var a=[];for(var c=0;c<e.length;c++){var b=e[c];
if(b.nodeType==1){a.push(b)}}return a};Dom.getTargetOfEvent=function(b){var a=b.target||b.srcElement;
if(a&&a.nodeType==3){a=a.parentNode}return a
};Dom.getMouseCoordinatesOfEvent=function(a){if(a.pageX||a.pageY){return[a.pageX,a.pageY]
}else{if(a.clientX||a.clientY){return[a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,a.clientY+document.body.scrollTop+document.documentElement.scrollTop]
}else{return[0,0]}}};Dom.prependChild=function(a,c){var b=a.firstChild;
if(b){a.insertBefore(c,b)}else{a.appendChild(c)
}};Dom.observe=function(a,b,c){var d=function(e){c(e||window.event)
};a["on"+b]=d};Dom.observeLoad=function(a){swfobject.addDomLoadEvent(a)
};Dom.readAttribute=function(b,a){if(a=="class"){return b.className
}else{if(a=="style"){return b.style.cssText
}else{return b.getAttribute(a)}}};Dom.remove=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)
};Dom.removeAllChildren=function(a){while(a.childNodes.length){a.removeChild(a.childNodes[0])
}};Dom.removeClassName=function(b,c){if(!b){return
}var a=b.className.replace(Dom._classNameRegExp(c)," ");
b.className=Util.trim(a)};Dom._setFilterAlpha=function(a,d){if(d>=1||d===""){if(a.style.removeAttribute){a.style.removeAttribute("filter")
}}if(d<0.00001){d=0}var b=a.style,c=b.display;
b.display="none";b.filter="alpha(opacity="+Math.floor(d*100)+")";
b.display=c};Dom._setOpacity=function(a,b){a.style.opacity=b
};Dom.setOpacity=function(a,c){var b=(Browser.supportsCSSOpacity()?Dom._setOpacity:Dom._setFilterAlpha);
Dom.setOpacity=b;b(a,c)};Dom.setVisible=function(b,a){b.style.visibility=a?"visible":"hidden"
};Dom.stopEvent=function(a){if(a){if(a.stopPropagation){a.stopPropagation()
}if(a.preventDefault){a.preventDefault()}a.cancelBubble=true;
a.returnValue=false}};Dom.unobserve=function(c,d){var b=document.getElementById("moo2");
c["on"+d]=null};Dom.update=function(b,c,a){if(a){b.innerHTML=c
}else{if(b.textContent!==undefined){b.textContent=c
}else{if(b.innerText!==undefined){b.innerText=c
}}}return b};Dom.writeAttribute=function(b,a,c){if(a=="class"){b.className=c
}else{if(a=="style"){b.style.cssText=c}else{b.setAttribute(a,c)
}}};var Aria=Aria||{};Aria._id=0;Aria._getIdForElement=function(a){var b=Dom.readAttribute(a,"id");
if(!b){b="aria_"+Aria._id++;Dom.writeAttribute(a,"id",b)
}return b};Aria._addRelationship=function(g,d,f){var b=Aria._getIdForElement(g),a=[],c,e;
if(!Array.isArray(f)){f=[f]}for(c=0,e=f.length;
c<e;c++){a.push(Aria._getIdForElement(f[c]))
}Dom.writeAttribute(g,d,a.join(" "))};Aria._setBoolean=function(b,a,c){Dom.writeAttribute(b,a,c?"true":"false")
};Aria.role=function(a,b){Dom.writeAttribute(a,"role",b)
};Aria.labelledBy=function(b,a){Aria._addRelationship(b,"aria-labelledby",a)
};Aria.owns=function(b,a){Aria._addRelationship(b,"aria-owns",a)
};Aria.setChecked=function(a,b){Aria._setBoolean(a,"aria-checked",b)
};Aria.setEnabled=function(a,b){Aria._setBoolean(a,"aria-disabled",!b)
};var Fader=Fader||{};Fader._fadeInOrOutImmediate=function(c,d,e){for(var a=0,b=c.length;
a<b;a++){Dom.setVisible(c[a],!e)}};Fader._fadeInOrOutCSS=function(f,g,h){function e(){for(var a=0,b=f.length;
a<b;a++){var c=f[a];c.style.opacity=(h?"1":"0");
Dom.setVisible(c,true)}setTimeout(d,0)}function d(){for(var a=0,b=f.length;
a<b;a++){f[a].style.webkitTransition="opacity "+g+"ms ease-in-out"
}setTimeout(i,0)}function i(){for(var a=0,b=f.length;
a<b;a++){f[a].style.opacity=(h?"0":"1")}}setTimeout(function(){for(var a=0,b=f.length;
a<b;a++){var c=f[a];Dom.setVisible(c,!h);
c.style.opacity="";c.style.webkitTransition=""
}},g);e()};Fader._fadeInOrOutJS=function(f,h,j){var a=Date.now(),b=0,d=f.length,c;
if(!j){for(c=0;c<d;c++){var g=f[c];Dom.setOpacity(g,0);
Dom.setVisible(g,true)}}return Util.setAnimation(function(k){if(j&&k>=1){for(c=0;
c<d;c++){var i=f[c];Dom.setVisible(i,false);
Dom.setOpacity(i,1)}}else{if(j){k=1-k}for(c=0;
c<d;c++){Dom.setOpacity(f[c],k)}}},h)};Fader.abort=function(a){if(a){Util.clearAnimation(a)
}};Fader.fadeIn=function(b,c,a){var d=0;if(!a&&Browser.isMobileWebKit()){Fader._fadeInOrOutImmediate(b,c,false)
}else{if(Browser.supportsCSSAnimations()){Fader._fadeInOrOutCSS(b,c,false)
}else{d=Fader._fadeInOrOutJS(b,c,false)}}return d
};Fader.fadeOut=function(b,c,a){var d=0;if(!a&&Browser.isMobileWebKit()){Fader._fadeInOrOutImmediate(b,c,true)
}else{if(Browser.supportsCSSAnimations()){Fader._fadeInOrOutCSS(b,c,true)
}else{d=Fader._fadeInOrOutJS(b,c,true)}}return d
};Range=function(b,a){this._lowest=(b>a)?a:b;
this._highest=(b>a)?b:a};Range.prototype.getArray=function(){var a=[];
for(var b=this._lowest;b<=this._highest;b++){a.push(b)
}return a};Range.prototype.getHighestNumber=function(){return this._highest
};Range.prototype.getLowestNumber=function(){return this._lowest
};Range.prototype.include=function(a){return(a>=this._lowest&&a<=this._highest)
};Range.prototype.fix=function(b,a,c){if((this._highest-this._lowest)<c){this._highest=this._lowest+c;
if(this._highest>a){this._highest=a;this._lowest=this._highest-c
}}};Interval=function(j,f){var e=(f-1);var b=0;
b+=[0,2,4,5,7,9,11][e%7];b+=(12*Math.floor(e/7));
b+=j;var h=(e%7)+1;var a=(h==1||h==4||h==5);
if(j<=-2&&a){b++}var g="";if(a&&j==0){g="P"
}else{if(j>=-2&&j<=1){g=["d","m","M","A","AA"][j- -2]
}else{if(j<-2){for(var c=j;c<=-2;c++){g+="d"
}}else{if(j>1){for(var c=1;c<=j;c++){g+="A"
}}}}}this._quality=j;this._type=f;this._diatonicDelta=e;
this._chromaticDelta=b;this._name=g+f.toString()
};Interval.prototype.toString=function(){return"Interval("+this._name+")"
};Interval.prototype.isEqual=function(a){return this._diatonicDelta==a._diatonicDelta&&this._chromaticDelta==a._chromaticDelta
};Interval.prototype.isEnharmonic=function(a){return this._chromaticDelta==a._chromaticDelta
};Interval.prototype.getQuality=function(){return this._quality
};Interval.prototype.getType=function(){return this._type
};Interval.prototype.getDiatonicDelta=function(){return this._diatonicDelta
};Interval.prototype.getChromaticDelta=function(){return this._chromaticDelta
};Interval.prototype.getName=function(){return this._name
};Note=function(b,c,a){this._letter=b;this._quality=c;
this._octave=a};Note._newStaffNote=function(f,b,g,e){var d=f+b,c=d%7,a=Math.floor(d/7);
if(g==1000&&e!==undefined){g=Note._getAccidentalType(c,0,e);
if(g==0){g=(e<0)?-1:1}}if(g===undefined||g==1000){g=0
}return new Note(c,g,a)};Note.newStaffNoteWithQuality=function(b,a,c){return Note._newStaffNote(b,a,c)
};Note.newStaffNoteWithKeySignature=function(c,a,b){return Note._newStaffNote(c,a,1000,b)
};Note._getMIDIValue=function(b,d,a){var c=[12,14,16,17,19,21,23][b];
c+=(a*12);c+=d;return c};Note._getAccidentalType=function(a,c,b){if(c==0){c=1000
}if(b<0){if([6,4,2,7,5,3,1][a]<=(b*=-1)){if(c==-1){c=1000
}else{if(c==1000){c=0}}}}else{if(b>0){if([2,4,6,1,3,5,7][a]<=b){if(c==1){c=1000
}else{if(c==1000){c=0}}}}}return c};Note.prototype.getLetterDescription=function(){var a=["C","D","E","F","G","A","B"][this._letter];
var c=this._quality;if(c>=-2&&c<=2){a+=["bb","b","","#","x"][c- -2]
}else{if(c<-2){for(var b=0;b>c;b--){a+="b"
}}else{if(c>2){for(var b=0;b<c;b++){a+="#"
}}}}return a};Note.prototype.toString=function(){return(this.getLetterDescription()+this._octave.toString())
};Note.prototype.isEqual=function(a){return this._letter==a._letter&&this._octave==a._octave&&this._quality==a._quality
};Note.prototype.isEnharmonic=function(a){return this.getMIDIValue()==a.getMIDIValue()
};Note.prototype.getStaffPosition=function(a){return((this._octave*7)+this._letter)-a
};Note.prototype.getLedgerLineCount=function(b){var a=this.getStaffPosition(b);
if(a>=4){return Math.floor((a-4)/2)}else{if(a<=-4){return Math.ceil((a+4)/2)
}else{return 0}}};Note.prototype.getAccidentalType=function(a){return Note._getAccidentalType(this.getLetter(),this.getQuality(),a)
};Note.prototype.getMIDIValue=function(){return Note._getMIDIValue(this._letter,this._quality,this._octave)
};Note.prototype.getLetter=function(){return this._letter
};Note.prototype.setOctave=function(a){this._octave=a
};Note.prototype.getOctave=function(){return this._octave
};Note.prototype.getQuality=function(){return this._quality
};var Composer=Composer||{};Composer._Initialize=function(){Composer._P1=new Interval(0,1);
Composer._A1=new Interval(1,1);Composer._m2=new Interval(-1,2);
Composer._M2=new Interval(0,2);Composer._A2=new Interval(1,2);
Composer._m3=new Interval(-1,3);Composer._M3=new Interval(0,3);
Composer._P4=new Interval(0,4);Composer._A4=new Interval(1,4);
Composer._S4=new Interval(2,4);Composer._d5=new Interval(-2,5);
Composer._P5=new Interval(0,5);Composer._A5=new Interval(1,5);
Composer._m6=new Interval(-1,6);Composer._M6=new Interval(0,6);
Composer._A6=new Interval(1,6);Composer._d7=new Interval(-2,7);
Composer._m7=new Interval(-1,7);Composer._M7=new Interval(0,7);
Composer._P8=new Interval(0,8)};Composer.applyChord=function(d,c,f){var b=Composer.getIntervalsForChord(c);
var e=Composer.applyIntervals(d,b);var a;
for(a=0;a<f;a++){Composer.invertNoteArray(e)
}return e};Composer.applyInterval=function(d,b,f){if(f===undefined){f=1
}var e=d.getLetter()+(f*b.getDiatonicDelta());
var c=d.getOctave();var h=Math.floor(e/7);
c+=h;if(e<0){e+=(-1*h*7)}e=e%7;var a=Note._getMIDIValue(e,0,c);
var g=d.getMIDIValue()+(f*b.getChromaticDelta())-a;
return new Note(e,g,c)};Composer.applyIntervals=function(c,b){var e=[c],a,d;
for(var a=0,d=b.length;a<d;a++){e.push(Composer.applyInterval(c,b[a]))
}return e};Composer.applyPitches=function(b,e){var c,d;
var a=[b];for(c=0,d=e.length;c<d;c++){a.push(b+e[c])
}return a};Composer.getPitchesForIntervals=function(b){var a,c;
var d=[];for(a=0,c=b.length;a<c;a++){d.push(b[a].getChromaticDelta())
}return d};Composer.getArrayForAnalysisSymbol=function(c){Composer._Initialize();
if(!Composer._AnalysisSymbolToArrayMap){var b,d,a;
Composer._AnalysisSymbolToArrayMap=[[Composer._P1,0],[Composer._M2,1],[Composer._M3,1],[Composer._P4,0],[Composer._P5,0],[Composer._M6,1],[Composer._M7,2],[Composer._M6,4],[Composer._M7,4],[Composer._P1,4],[Composer._M2,4],[Composer._M3,4],[Composer._A1,7],[Composer._A2,7],[Composer._M3,7],[Composer._A4,7],[Composer._A5,7],[Composer._A1,8],[Composer._A2,8],[Composer._M3,8],[Composer._A4,8],[Composer._A5,8],[Composer._P1,1],[Composer._M2,2],[Composer._m3,0],[Composer._P4,1],[Composer._P5,1],[Composer._m6,0],[Composer._m7,0],[Composer._M2,8],[Composer._M7,7],[Composer._m7,4],[Composer._P1,4],[Composer._M2,4],[Composer._m3,4],[Composer._P4,4],[Composer._M2,7],[Composer._M3,7],[Composer._A4,7],[Composer._P5,7],[Composer._M6,7],[Composer._M2,8],[Composer._M3,8],[Composer._A4,8],[Composer._P5,8],[Composer._M6,8],[Composer._P4,13],[Composer._m6,9],[Composer._m6,10],[Composer._m6,11],[Composer._m6,12],[Composer._m3,1],[Composer._m6,1],[Composer._M3,0],[Composer._M6,0],[Composer._A2,7],[Composer._A6,7]];
for(b=0,d=Composer._AnalysisSymbolToArrayMap.length;
b<d;b++){a=Composer._AnalysisSymbolToArrayMap[b];
a[1]=Composer.getIntervalsForChord(a[1])}}return Composer._AnalysisSymbolToArrayMap[c]
};Composer.getIntervalsForChord=function(a){Composer._Initialize();
if(!Composer._ChordTypeToChordMap){Composer._ChordTypeToChordMap=[[Composer._M3,Composer._P5],[Composer._m3,Composer._P5],[Composer._m3,Composer._d5],[Composer._M3,Composer._A5],[Composer._M3,Composer._P5,Composer._m7],[Composer._M3,Composer._P5,Composer._M7],[Composer._m3,Composer._P5,Composer._m7],[Composer._m3,Composer._d5,Composer._d7],[Composer._m3,Composer._d5,Composer._m7],[Composer._M3,Composer._P5,Composer._A6],[Composer._M3,Composer._A6],[Composer._M3,Composer._A4,Composer._A6],[Composer._M3,Composer._S4,Composer._A6],[Composer._m3,Composer._m6],[Composer._m3,Composer._P5,Composer._M7]]
}return Composer._ChordTypeToChordMap[a]};
Composer.getIntervalsForScale=function(a){Composer._Initialize();
if(!Composer._ScaleTypeToIntervalsMap){Composer._ScaleTypeToIntervalsMap=[[Composer._M2,Composer._M3,Composer._P4,Composer._P5,Composer._M6,Composer._M7],[Composer._M2,Composer._m3,Composer._P4,Composer._P5,Composer._m6,Composer._m7],[Composer._M2,Composer._m3,Composer._P4,Composer._P5,Composer._m6,Composer._M7],[Composer._M2,Composer._m3,Composer._P4,Composer._P5,Composer._M6,Composer._M7],[Composer._M2,Composer._m3,Composer._P4,Composer._P5,Composer._M6,Composer._m7],[Composer._m2,Composer._m3,Composer._P4,Composer._P5,Composer._m6,Composer._m7],[Composer._M2,Composer._M3,Composer._A4,Composer._P5,Composer._M6,Composer._M7],[Composer._M2,Composer._M3,Composer._P4,Composer._P5,Composer._M6,Composer._m7],[Composer._m2,Composer._m3,Composer._P4,Composer._d5,Composer._m6,Composer._m7]]
}return Composer._ScaleTypeToIntervalsMap[a]
};Composer.getTonicForKey=function(c,d,b){if(!Composer._TonicMap){Composer._TonicMap=[[5,-1],[2,-1],[6,-1],[3,0],[0,0],[4,0],[1,0],[5,0],[2,0],[6,0],[3,1],[0,1],[4,1],[1,1],[5,1],[0,-1],[4,-1],[1,-1],[5,-1],[2,-1],[6,-1],[3,0],[0,0],[4,0],[1,0],[5,0],[2,0],[6,0],[3,1],[0,1]]
}var a=Composer._TonicMap[(c==0?22:7)+d];
if(!b){b=4}return new Note(a[0],a[1],b)};
Composer.invertNoteArray=function(a){Composer._Initialize();
a.push(Composer.applyInterval(a.shift(),Composer._P8))
};Composer.invertPitchArray=function(a){a.push(a.shift()+12)
};Composer.isNoteArrayValidForAccidentalLevel=function(e,f,d){var a,c,b;
for(a=0,c=e.length;a<c;a++){b=e[a].getAccidentalType(f);
if(b==1000){continue}else{if(b==0){b=1}}if(Math.abs(b)>d){return false
}}return true};Composer.isNoteArrayValidForStaffRange=function(e,f,a){var b,d,c;
for(b=0,d=e.length;b<d;b++){c=e[b];if(c.getQuality()>2||c.getQuality()<-2){return false
}if(!a.include(c.getStaffPosition(f))){return false
}}return true};Composer.isPitchArrayValidForRange=function(c,a){var b,d;
for(b=0,d=c.length;b<d;b++){if(!a.include(c[b])){return false
}}return true};var Clickable=Clickable||{};
Clickable.install=function(b,d,a){Clickable._Initialize();
var c=a?a:{};c.activate=d;c.element=b;if(c.stop===undefined){c.stop=true
}if(Browser.prefersTouchEvents()){Dom.observe(b,"touchstart",Clickable._handleTouchStart.bind(c));
Dom.observe(b,"touchend",Clickable._handleTouchEnd.bind(c));
Dom.observe(b,"touchcancel",Clickable._handleTouchCancel.bind(c))
}else{Dom.observe(b,"mousedown",Clickable._handleMouseDown.bind(c));
Dom.observe(b,"mouseup",Clickable._handleMouseUp.bind(c));
Dom.observe(b,"mouseover",Clickable._handleMouseOver.bind(c));
Dom.observe(b,"mouseout",Clickable._handleMouseOut.bind(c));
Dom.observe(b,"click",Clickable._handleClick.bind(c));
if(c.doubleClick){Dom.observe(b,"dblclick",Clickable._handleDoubleClick.bind(c))
}}};Clickable.setDisablePanning=function(a){Clickable._disablePanning=a
};Clickable._Initialize=function(){var a=function(b){var d=Clickable._currentContext;
if(d){if(d.up){d.up(b,d.element,d.tag)}delete (Clickable._currentContext)
}};if(Browser.prefersTouchEvents()){document.body.addEventListener("touchstart",a,false);
document.body.addEventListener("touchend",a,false)
}else{Dom.observe(document.body,"mouseup",a);
Dom.observe(document.body,"mousedown",a)}Clickable._Initialize=Util.identity
};Clickable._handleTouchStart=function(b){if(b.targetTouches.length!=1){return false
}if(this.down){this.down(b,this.element,this.tag)
}this.didMoveTooFar=false;this.startX=b.targetTouches[0].clientX;
this.startY=b.targetTouches[0].clientY;this._handleTouchMove=Clickable._handleTouchMove.bind(this);
this._handleTouchEnd=Clickable._handleTouchEnd.bind(this);
var c=Dom.getCumulativeOffset(this.element),a=Dom.getDimensions(this.element);
this.minX=c[0];this.minY=c[1];this.maxX=c[0]+a[0];
this.maxY=c[1]+a[1];this.element.addEventListener("touchmove",this._handleTouchMove,false);
if(Clickable._disablePanning){Dom.stopEvent(b)
}};Clickable._handleTouchMove=function(c){if(c.targetTouches.length!=1){return false
}var b=c.targetTouches[0].clientX,a=c.targetTouches[0].clientY;
if(b<this.minX||b>this.maxX||a<this.minY||a>this.maxY){this.didMoveTooFar=true;
if(this.up){this.up(c,this.element,this.tag)
}}};Clickable._handleTouchEnd=function(a){if(a.targetTouches.length>0){return false
}if(!this.didMoveTooFar){if(this.activate){this.activate(a,this.element,this.tag)
}if(this.up){this.up(a,this.element,this.tag)
}}delete (Clickable._currentContext);if(this.stop){Dom.stopEvent(a)
}this.element.removeEventListener("touchmove",this._handleTouchMove,false);
return false};Clickable._handleTouchCancel=function(a){this.didMoveTooFar=true;
Clickable._handleTouchEnd(a)};Clickable._handleMouseDown=function(a){if(this.down){this.down(a,this.element,this.tag)
}Clickable._currentContext=this;if(this.stop){Dom.stopEvent(a)
}};Clickable._handleMouseUp=function(a){if(this.up){this.up(a,this.element,this.tag)
}delete (Clickable._currentContext);if(this.stop){Dom.stopEvent(a)
}};Clickable._handleMouseOver=function(a){if(Clickable._currentContext==this){if(this.down){this.down(a,this.element,this.tag)
}if(this.stop){Dom.stopEvent(a)}}};Clickable._handleMouseOut=function(a){if(Clickable._currentContext==this){if(this.up){this.up(a,this.element,this._tag)
}if(this.stop){Dom.stopEvent(a)}}};Clickable._handleClick=function(a){if(this.activate){this.activate(a,this.element,this.tag)
}delete (Clickable._currentContext);if(this.stop){Dom.stopEvent(a)
}};Clickable._handleDoubleClick=function(a){if(this.doubleClick){this.doubleClick(a,this.element,this.tag)
}};Highlighter=function(a,b){this._parent=a;
this._elements=b;this._setVisible(false)};
Highlighter.prototype._setVisible=function(c){for(var a=0,b=this._elements.length;
a<b;a++){Dom.setVisible(this._elements[a],c)
}};Highlighter.prototype._setHighlightColor=function(a){Dom.removeClassName(this._parent,"Highlighter-color-.*?");
if(a){Dom.addClassName(this._parent,"Highlighter-color-"+a)
}};Highlighter.prototype.removeHighlight=function(){if(this._isHighlighted){if(this._flashAnimation){this._flashAnimation.abort()
}this._setVisible(false);this._setHighlightColor(null);
this._isHighlighted=false}};Highlighter.prototype.highlight=function(a){this._setHighlightColor(a);
Fader.abort(this._fade);this._setVisible(true);
this._isHighlighted=true};Highlighter.prototype.flash=function(a){this._setHighlightColor(a);
this._setVisible(true);this._fade=Fader.fadeOut(this._elements,250,true)
};UserDefaults=function(a){this._domain=a
};UserDefaults.prototype.remove=function(a){try{if(window.localStorage&&localStorage.removeItem){localStorage.removeItem(this._domain)
}}catch(b){}};UserDefaults.prototype.readKey=function(b,a){var c=this.read()[b];
return(c!==undefined)?c:a};UserDefaults.prototype.write=function(c,f){try{if(window.JSON&&window.localStorage&&JSON.stringify&&localStorage.removeItem&&localStorage.setItem){if(f){var a=this.read(),b;
for(b in c){a[b]=c[b]}c=a}localStorage.removeItem(this._domain);
localStorage.setItem(this._domain,JSON.stringify(c))
}}catch(d){}};UserDefaults.prototype.read=function(f){try{if(window.JSON&&window.localStorage&&JSON.parse&&localStorage.getItem){var d=localStorage.getItem(this._domain),c,a;
if(d){c=JSON.parse(d)}if(c){if(typeof(c)!=typeof({})){throw ("UserDefaults: root type not an object")
}for(a in f){if(c[a]==undefined){c[a]=f[a]
}if(typeof(c[a])!=typeof(f[a])){throw ("UserDefaults: type mismatch for key '"+a+"', resetting to defaults")
}}return c}}}catch(b){Util.log(b)}return f?f:{}
};Button=function(d,e,b,c){if(!c){c={}}this._domElement=$(d);
this._callback=e;this._role=(c&&c.role)?c.role:"button";
this._isEnabled=true;this._tag=b;var a={down:this._handleDown.bind(this),up:this._handleUp.bind(this)};
if(Browser.isIE7()||Browser.isIE8()){a.doubleClick=this._handleIEDoubleClick.bind(this);
this._domElement.onselectstart=function(){return false
}}Clickable.install(this._domElement,this.click.bind(this),a);
this._useVector=Browser.supportsCSSGradients()&&!Browser.isApplePad();
this._readClassHierarchy(d.className);this._buildInterior();
Aria.role(this._domElement,this._role);this.reset()
};Button._defaultSize="small";Button.setDefaultSize=function(a){Button._defaultSize=a
};Button.prototype.setTag=function(a){this._tag=a
};Button.prototype.getTag=function(){return this._tag
};Button.prototype.setEnabled=function(a){Aria.setEnabled(this._domElement,a);
this._isEnabled=a;this._writeClassHierarchy()
};Button.prototype.isEnabled=function(){return this._isEnabled
};Button.prototype.setVisible=function(a){Dom.setVisible(this._domElement,a)
};Button.prototype._setState=function(a){if(this._classState!=a){this._classState=a;
this._writeClassHierarchy()}};Button.prototype.select=function(){if(this._role=="radio"){Aria.setChecked(this._domElement,true)
}this._setState("selected");this._isSelected=true
};Button.prototype.reset=function(){if(this._role=="radio"){Aria.setChecked(this._domElement,false)
}this._setState("normal");Dom.removeClassName(this._domElement,"Button-red");
this._isSelected=false;this._highlighter.removeHighlight();
this._isRed=false};Button.prototype.goGhost=function(){this.setEnabled(false);
Dom.remove(this._backgroundParent);this._highlighter.highlight("ghost")
};Button.prototype._buildInterior=function(){var a=[],f,c,e;
if(this._useCloak){a.push(Dom.createElement("div",{"class":"Button-cloak"}))
}if(this._useVector){if(this._leftCap=="curved"){this._additionalClasses+=" Button-vector-left-curved"
}if(this._rightCap=="curved"){this._additionalClasses+=" Button-vector-right-curved"
}if(this._rightCap=="square"){this._additionalClasses+=" Button-vector-right-square"
}a.push(Dom.createElement("div",{"class":"Button-vector-outline"}));
this._backgroundParent=Dom.createElement("div",{"class":"Button-vector-background"});
a.push(this._backgroundParent);var d=Dom.createElement("div",{"class":"Button-vector-highlight"});
this._highlighter=new Highlighter(d,[d]);
a.push(d)}else{var g=(this._leftCap=="pill"?" Button-image-background-middle-pill":""),d,b,i,h;
this._backgroundParent=Dom.createElement("div",{"class":"Button-image-div Button-image-backgrounds"},Dom.createElement("div",{"class":"Button-image-div Button-image-background-left-"+this._leftCap}),Dom.createElement("div",{"class":"Button-image-div Button-image-background-middle"+g}),Dom.createElement("div",{"class":"Button-image-div Button-image-background-right-"+this._rightCap}));
a.push(this._backgroundParent);d=Dom.createElement("div",{"class":"Button-image-div Button-image-highlights"},(b=Dom.createElement("div",{"class":"Button-image-div Button-image-highlight-left-"+this._leftCap})),(i=Dom.createElement("div",{"class":"Button-image-div Button-image-highlight-middle"})),(h=Dom.createElement("div",{"class":"Button-image-div Button-image-highlight-right-"+this._rightCap})));
this._highlighter=new Highlighter(d,[b,i,h]);
a.push(d)}a.push(Dom.createElement("div",{"class":"Button-content-container"},(f=Dom.createElement("div",{"class":"Button-content"}))));
c=this._domElement.firstChild,e;while(c){e=c.nextSibling;
Dom.appendChild(f,c);c=e}Dom.appendChildren(this._domElement,a)
};Button.prototype._readClassHierarchy=function(d){var a=[],f=d.split(/\s+/),c=false;
this._classType="rounded";this._classSize=Button._defaultSize;
this._leftCap="curved";this._rightCap="curved";
for(var e=0;e<f.length;e++){var b=f[e];if(b=="Button-segmented-first"){this._rightCap="square"
}else{if(b=="Button-segmented-middle"){this._leftCap="square";
this._rightCap="square"}else{if(b=="Button-segmented-last"){this._leftCap="square"
}else{if(b=="Button-small"){this._classSize="small"
}else{if(b=="Button-large"){this._classSize="large"
}else{if(b=="Button-jumbo"){this._classSize="jumbo"
}else{if(b=="Button-pill"){a.push(b);c=true
}else{if(b=="Button-sub"){this._isSubButton=true
}else{if(b=="Button-cloaked"){this._useCloak=true
}else{if(b!="Button"){a.push(b)}}}}}}}}}}}if(c){this._leftCap="pill";
this._rightCap="pill";if(this._classSize=="jumbo"){this._classSize="large";
this._useVector=Browser.supportsCSSGradients()
}}this._additionalClasses=a.join(" ")};Button.prototype._writeClassHierarchy=function(a){var b="-"+this._classSize,c="-"+this._classState;
classes=[(this._isSubButton?"Button-sub":"Button"),"Button"+b,"Button"+c,"Button"+b+c];
if(this._additionalClasses.length){classes.push(this._additionalClasses)
}if(this._isRed){classes.push("Button-red")
}if(!this._isEnabled){classes.push("Button-disabled")
}this._domElement.className=classes.join(" ")
};Button.prototype._handleDown=function(){if(this._isEnabled&&!this._isSelected){this._setState("pressed")
}};Button.prototype._handleUp=function(){if(!this._isSelected){this._setState("normal")
}};Button.prototype._handleIEDoubleClick=function(){if(this._isEnabled){this._setState("pressed");
this.click();setTimeout(function(){if(this._isEnabled){this._setState("normal")
}}.bind(this),100)}};Button.prototype.click=function(){if(this._isEnabled&&this._callback){this._callback(this)
}};Button.prototype.imitateUserClick=function(){if(this._isSelected){return
}if(this._isEnabled){this._setState("pressed")
}setTimeout(function(){if(this._isEnabled){this._setState("normal")
}this.click()}.bind(this),100)};Button.prototype.setTooltip=function(a){this._tooltip=a;
if(!a){a=""}Dom.writeAttribute(this._domElement,"title",a)
};Button.prototype.getTooltip=function(){return this._tooltip
};Button.prototype.highlightRed=function(){this._isRed=true;
this._highlighter.highlight("red");this._writeClassHierarchy()
};Button.prototype.highlightGreen=function(){this._highlighter.highlight("green")
};Button.prototype.flashGreen=function(){this._highlighter.flash("green")
};Button.prototype.flashRed=function(){this._highlighter.flash("red")
};CheckButton=function(g,l,d,o,e){var b,k,j=g.className?g.className.split(/\s+/):[],n=Button._defaultSize,m,f,a,c,h;
for(f=0,a=j.length;f<a;f++){m=j[f];if(m=="Button-small"){n="small"
}else{if(m=="Button-large"){n="large"}else{if(m=="Button-jumbo"){n="jumbo"
}}}}Dom.appendChildren(g,[(b=Dom.createElement("div",{"class":"Button-sub Button-"+n+" CheckButton-check-sub  Button-segmented-first"})),(k=Dom.createElement("div",{"class":"Button-sub Button-"+n+" CheckButton-button-sub Button-segmented-last"}))]);
Dom.appendChild(b,(this._checkMark=(Dom.createVectorImage("/v2c/1460c5d2a6c18cc763ee77da0728455d33f11ef1/v2/images/button_check.svg","CheckButton-check-icon-svg",13,15,Dom.createElement("span",{"class":"CheckButton-check-icon"})))));
c=g.firstChild;while(c!=b){h=c.nextSibling;
Dom.appendChild(k,c);c=h}Dom.addClassName(g,"Button");
Dom.addClassName(g,"Button-"+n);this._checkDiv=b;
this._check=new Button(b,this._handleCheck.bind(this),o);
this._button=new Button(k,l,o);this._callback=d;
Aria.role(g,"group");Aria.role(b,"checkbox");
this.setChecked(e)};CheckButton.prototype._handleCheck=function(a){this.setChecked(!this.isChecked());
this._callback(this)};CheckButton.prototype.setChecked=function(a){this._isChecked=a;
Dom.setVisible(this._checkMark,this._isChecked);
Aria.setChecked(this._checkDiv,a)};CheckButton.prototype.isChecked=function(){return this._isChecked
};CheckButton.prototype.getTag=function(){return this._button.getTag()
};CheckButton.prototype.getCheck=function(){return this._check
};CheckButton.prototype.getButton=function(){return this._button
};FretboardView=function(e,d,b,c,a){this._div=e;
this._markers={};this._grid=[];this._noteLabels=[];
this._numberOfStrings=d.length;this._notesArray=d;
this._buildElements(12,this._numberOfStrings,a);
this._addBordersAndLabels(b,a);this._addInlays(c)
};FretboardView.MaxWidth=660;FretboardView.PaddingWidth=16;
FretboardView.ZeroFretPercent=0.05;FretboardView.TwelveRootTwo=[0.1122,0.106,0.1,0.0944,0.0891,0.0841,0.0794,0.0749,0.0707,0.0667,0.063,0.0595];
FretboardView.prototype._cellAt=function(c,a){var b=Dom.getChildElements(this._grid[c][a]);
return b.length?b[0]:null};FretboardView.prototype._buildElements=function(b,c,f){var e=Dom.createElement("tbody");
var g;function a(k,l){var m=FretboardView.PaddingWidth;
if(l!==undefined){m=(FretboardView.MaxWidth-(FretboardView.PaddingWidth*2));
if(f){l=12-l}if(l==0){m*=FretboardView.ZeroFretPercent
}else{m*=(1-FretboardView.ZeroFretPercent)*FretboardView.TwelveRootTwo[l-1]
}}var n=Dom.createElement("td",{"class":k,style:"width:"+m+"px"},Dom.createElement("div",{"class":"FretboardView-cell"}));
Dom.appendChild(g,n);return n}function h(i){g=Dom.createElement("tr",{"class":i});
Dom.appendChild(e,g);var k=[];a("FretboardView-column FretboardView-column-padding");
for(var l=0;l<=b;l++){k.push(a("fretboardview-column",l))
}a("FretboardView-column FretboardView-column-padding");
return k}this._grid.push(h("FretboardView-header-row"));
for(var j=0;j<(c-1);j++){this._grid.push(h("FretboardView-string-row"))
}this._grid.push(h("FretboardView-footer-row"));
this._grid.push(h("FretboardView-label-row"));
if(f){for(var d=0;d<this._grid.length;d++){this._grid[d].reverse()
}}Dom.appendChild(this._div,Dom.createElement("div",{"class":"FretboardView-container",style:"max-width:"+FretboardView.MaxWidth+"px"},Dom.createElement("table",{},e)))
};FretboardView.prototype._addBordersAndLabels=function(d,g){var e=(this._grid.length-1),q=e-1,h=g?"Right":"Left",f=g?"Left":"Right";
var k="#000";var i="#999";function c(s,r){return"border"+s+r
}for(var p=0;p<=q;p++){for(var b=0;b<this._grid[p].length;
b++){var a={};function o(r,s){a[c(h,"Width")]=r;
a[c(h,"Color")]=(d[b]||d[b-1])?k:i;a[c(f,"Width")]=s;
a[c(f,"Color")]=(d[b]||d[b+1])?k:i}if(b==0){o(null,"4px")
}else{if(b==1){o("4px","2px")}else{o("2px","2px")
}}if(p!=0){a[c("Top","Width")]="1px"}if(p!=q){a[c("Bottom","Width")]="1px"
}a[c("Top","Color")]=d[b]?k:i;a[c("Bottom","Color")]=d[b]?k:i;
for(attribute in a){this._grid[p][b].style[attribute]=a[attribute]
}}}for(var b=1;b<this._grid[e].length;b++){var m=this._cellAt(e,b);
Dom.update(m,b);m.style.color=(d[b]?k:i)}var n="FretboardView-note-label-"+(g?"right":"left")+"-side";
for(var p=1;p<=q;p++){var l=["C","D","E","F","G","A","B"][this._notesArray[p-1]];
var j=Dom.createElement("div",{"class":n},Dom.createTextNode(l));
Dom.appendChild(this._cellAt(p,0),j);this._noteLabels.push(j)
}};FretboardView.prototype._addInlays=function(b){if(b){for(var a=0;
a<b.length;a++){var c=b[a];var d=Dom.createElement("div",{"class":"FretboardView-inlay"});
Dom.appendChild(this._cellAt(c[0]+1,c[1]),d)
}}};FretboardView.prototype._arrayIndexForMarker=function(b,a){return(a*this._numberOfStrings)+b
};FretboardView.prototype.addMarker=function(b,a){var c=this._arrayIndexForMarker(b,a);
var d=Dom.createElement("div",{"class":"FretboardView-marker"});
Dom.appendChild(this._cellAt(b+1,a),d);this._markers[c]=d
};FretboardView.prototype.removeMarker=function(b,a){var c=this._arrayIndexForMarker(b,a);
var d=this._markers[c];Dom.remove(d);delete this._markers[c]
};FretboardView.prototype.fadeOutNoteLabels=function(){Fader.fadeOut(this._noteLabels,100)
};FretboardView.prototype.removeAllMarkers=function(){for(var a in this._markers){var b=this._markers[a];
Dom.remove(b)}this._markers={}};GlyphSetter=function(b,a,c){if(!GlyphSetter._Instances){GlyphSetter._Instances=[]
}GlyphSetter._Instances.push(this);GlyphSetter._Initialize();
if(!b&&!Browser.isMobileWebKit()){GlyphSetter._SetupResizer()
}this._glyphsToResize=[];this._vectorSize=""+a;
this._useImage=Browser.isWebKit();if(b){if(c){this.resize=this._resizeVectorAccidentals
}else{this.resize=Util.identity}this._createAccidental=this._createVectorAccidental
}else{this.resize=this._resizeRasterAccidentals;
this._createAccidental=this._createRasterAccidental
}};GlyphSetter._Initialize=function(){GlyphSetter._Initialize=Util.identity;
GlyphSetter._AccidentalID=0;if(Browser.isStaticRenderer()){GlyphSetter.prototype._convertNoteNames=Util.identity;
GlyphSetter.prototype._convertLoneAccidentals=Util.identity;
GlyphSetter.prototype._convertAnalysisSymbols=function(a){return a.split("h").join("\u00f8")
}}GlyphSetter._SpeechMap={bb:"-double-flat",b:"-flat","#":"-sharp",x:"-double-sharp"};
GlyphSetter._VectorMap={"18":{bb:["doubleflat",11,18],b:["flat",6,18],"#":["sharp",6,18],x:["doublesharp",8,8]},"24":{bb:["doubleflat",14,24],b:["flat",8,24],"#":["sharp",7,24],x:["doublesharp",11,11]},"32":{bb:["doubleflat",21,30],b:["flat",11,30],"#":["sharp",12,32],x:["doublesharp",15,15]}}
};GlyphSetter._SetupResizer=function(){GlyphSetter._SetupResizer=Util.identity;
Dom.appendChild(document.body,Dom.createElement("div",{style:"position: absolute; top: -1000px"},Dom.createElement("iframe",{id:"_GlyphSetterResizeDetector",style:"width: 1em; height: 1em",src:"/v2c/1627aa6758e80e452e3f99994849c1678c5e3ce1/v2/support/resizer.html"})));
var a=function(){var c,d,b;for(c=0,d=GlyphSetter._Instances.length;
c<d;c++){b=GlyphSetter._Instances[c];b.resize.call(b)
}};GlyphSetter.onHandleTextResize=a};GlyphSetter.prototype._createVectorAccidental=function(b,a){var d=GlyphSetter._VectorMap[this._vectorSize];
if(!d){return b}var c=d[b];if(!c){return b
}this._glyphsToResize.push(a);if(this._useImage){return'<span class="glyph-text">'+GlyphSetter._SpeechMap[b]+'</span><img id="glyph-toresize-'+a+'" class="glyph-svg-accidental glyph-svg-accidental-'+c[0]+"-"+this._vectorSize+'" src="/v2/images/'+c[0]+"_"+this._vectorSize+'.svg" width="'+c[1]+'" height="'+c[2]+'">'
}else{return'<span class="glyph-text">'+GlyphSetter._SpeechMap[b]+'</span><object id="glyph-toresize-'+a+'" class="glyph-svg-accidental glyph-svg-accidental-'+c[0]+"-"+this._vectorSize+'" data="/v2/images/'+c[0]+"_"+this._vectorSize+'.svg" width="'+c[1]+'" height="'+c[2]+'" type="image/svg+xml"></object>'
}};GlyphSetter.prototype._createRasterAccidental=function(b,a){var c={bb:"glyph-double-flat",b:"glyph-flat",n:"glyph-natural","#":"glyph-sharp",x:"glyph-double-sharp"}[b];
if(!c){return b}this._glyphsToResize.push(a);
return'<span class="glyph-accidental '+c+'"><span class="glyph-text">'+b+'</span><span id="glyph-toresize-'+a+'" class="glyph-image glyph-size-0"></span></span>'
};GlyphSetter.prototype._convertNoteNames=function(a){return Util.gsub(a,/^([A-Ga-g])([b#xn]*)$/,function(c){var b='<span class="glyph-note">';
if(c[2]){if(c[2]&&(c[2].length>2)){b+='<span style="color: red" class="glyph-name">'+c[1]+""+c[2]+"</span>"
}else{GlyphSetter._AccidentalID++;b+='<span id="glyph-control-'+GlyphSetter._AccidentalID+'" class="glyph-name glyph-has-accidental-suffix">'+c[1]+"</span>"+this._createAccidental(c[2],GlyphSetter._AccidentalID)
}}else{b+='<span class="glyph-name">'+c[1]+"</span>"
}return(b+"</span>")}.bind(this))};GlyphSetter.prototype._convertAnalysisSymbols=function(a){return Util.gsub(a,/^([b#xn]*)([IViv]+|N|Gr|It|Fr|Sw)([+oh]?)([2-7]?)([2-7]?)$/,function(d){var b='<span class="glyph-analysis">';
var f=d[3];var e=d[4];var c=d[5];if(d[1]){GlyphSetter._AccidentalID++;
b+=this._createAccidental(d[1],GlyphSetter._AccidentalID);
if(Util.endsWith(d[1],"b")&&Util.startsWith(d[2],"V")){additionalNameClass=" glyph-kern-b-V"
}else{additionalNameClass=" glyph-has-accidental-prefix"
}b+='<span id="glyph-control-'+GlyphSetter._AccidentalID+'" class="glyph-name '+additionalNameClass+'">'+d[2]+"</span>"
}else{b+='<span class="glyph-name">'+d[2]+"</span>"
}if(f){b+='<span class="glyph-chord-symbol">'+(f=="h"?"\u00f8":f)+"</span>"
}if(e||c){b+='<span class="glyph-chord-segment">';
if(e){b+='<span class="glyph-chord-upper">'+e+"</span>"
}if(c){b+='<span class="glyph-chord-lower">'+c+"</span>"
}b+="</span>"}return(b+"</span>")}.bind(this))
};GlyphSetter.prototype._convertLoneAccidentals=function(a){return Util.gsub(a,/^\-([b#xn]+)\-$/,function(c){var b='<span class="glyph-lone-accidental">';
GlyphSetter._AccidentalID++;b+='<span id="glyph-control-'+GlyphSetter._AccidentalID+'">&nbsp;</span>'+this._createAccidental(c[1],GlyphSetter._AccidentalID)+"&nbsp;</span>";
return(b+"</span>")}.bind(this))};GlyphSetter.prototype.createElement=function(a){var c="";
a=Util.gsub(a,/<>/,function(d){return(d[0]=="<")?"&lt;":"&gt;"
});a=Util.gsub(a,/\*(.*?)\*/,function(e){var d=e[1];
return(d.length>0)?"<b>"+d+"</b>":"*"});a=Util.gsub(a,/_(.*?)_/,function(e){var d=e[1];
return(d.length>0)?"<i>"+d+"</i>":"_"});a=Util.gsub(a,/\{(.*?)\}/,function(e){var d=e[1];
d=this._convertNoteNames(d);d=this._convertAnalysisSymbols(d);
d=this._convertLoneAccidentals(d);return d
}.bind(this));var b=Dom.createElement("span");
b.innerHTML=a;return b};GlyphSetter.prototype._resizeVectorAccidentals=function(){var a,b,d,c;
for(a=0,b=this._glyphsToResize.length;a<b;
a++){d=$("glyph-toresize-"+this._glyphsToResize[a]);
c=Dom.getCumulativeOffset(d);if((c[0]%2)==1){Dom.addClassName(d,"glyph-svg-nudge-width")
}}};GlyphSetter.prototype._resizeRasterAccidentals=function(){var c,e,d,a,b,f;
if(this._glyphsToResize.length){for(c=0,e=this._glyphsToResize.length;
c<e;c++){f=$("glyph-control-"+this._glyphsToResize[c]);
if(f){break}}if(f){a=Dom.getDimensions(f)[1];
if(a<=14){b=1}else{if(a<=16){b=2}else{if(a<=18){b=3
}else{if(a<=22){b=4}else{b=5}}}}}}for(c=0;
c<this._glyphsToResize.length;c++){d=$("glyph-toresize-"+this._glyphsToResize[c]);
if(!d){this._glyphsToResize.splice(c--,1);
continue}Dom.removeClassName(d,"glyph-size-[0-9]+");
Dom.addClassName(d,"glyph-size-"+b)}};KeyboardView=function(g,d,c,a,b,e,f){this._div=g;
this._size=d;this._startValue=c;this._endValue=a;
this._downCallback=b;this._upCallback=e;this._activateCallback=f;
this._isEnabled=(!!this._activateCallback||!!this._downCallback||!!this._upCallback);
this._highlighters=[];this._stateDivs=[];
this._markerDivs=[];this._isKeyEnabled=[];
this._buildElements()};KeyboardView.prototype._buildElements=function(){var q=this._size,s={small:[24,16,1,1],large:[36,24,1,2],jumbo:[48,32,1,4]}[q],l=s[0],k=s[1],y=s[2],c=s[3];
var v=[[0],[1,-1],[1],[2,1],[2],[3],[4,-1],[4],[5,0],[5],[6,1],[6]];
function x(d){return v[d%12][0]+(Math.floor(d/12)*7)
}function w(d){return v[d%12][1]!==undefined
}function a(d){return v[d%12][1]*c}var j=this._handleDown.bind(this),n=this._handleUp.bind(this),z=this._handleActivate.bind(this),o=Dom.createElement("div",{"class":"KeyboardView-container-"+q}),m,e,b,r,h,f,u,g,A,p;
for(var t=this._startValue;t<=this._endValue;
t++){e=(x(t)*(l+y))-(m?m:0);if(m==undefined){m=e;
e=0}if(w(t)){e-=Math.floor((k+y)/2);e+=a(t);
b="black";r=k}else{b="white";r=l}h=Dom.createElement("div",{"class":"KeyboardView-"+b+" KeyboardView-"+b+"-"+q,style:"left:"+e+"px"},(f=Dom.createElement("div",{"class":"KeyboardView-state"},Dom.createElement("div",{"class":"KeyboardView-div-"+q+" KeyboardView-background-"+q}),(g=Dom.createElement("div",{"class":"KeyboardView-div-"+q+" KeyboardView-highlight-"+q})),Dom.createElement("div",{"class":"KeyboardView-marker-"+q},(u=Dom.createElement("div",{"class":"KeyboardView-marker-"+q+" KeyboardView-"+b+"-marker-"+q}))))));
Dom.appendChild(o,h);A=new Highlighter(f,[g]);
this._highlighters.push(A);this._stateDivs.push(f);
this._markerDivs.push(u);this._isKeyEnabled.push(this._isEnabled);
Dom.setVisible(u,false);if(this._isEnabled){Clickable.install(h,z,{tag:t,down:j,up:n})
}p=e+r}Dom.appendChild(this._div,o);Dom.writeAttribute(this._div,"style","width:"+p+"px")
};KeyboardView.prototype.resetAll=function(){var c=(this._activateCallback||this._downCallback||this._upCallback);
for(var a=0,b=this._highlighters.length;a<b;
a++){this._highlighters[a].removeHighlight();
this._isKeyEnabled[a]=this._isEnabled}};KeyboardView.prototype._handleActivate=function(c,b,a){if(!this._isEnabled||!this.isEnabled(a)){return
}if(this._activateCallback){this._activateCallback(c,a)
}};KeyboardView.prototype._handleDown=function(c,b,a){if(!this._isEnabled||!this.isEnabled(a)){return
}Dom.addClassName(this._stateDivs[a-this._startValue],"KeyboardView-pressed");
if(this._downCallback){this._downCallback(c,a)
}};KeyboardView.prototype._handleUp=function(c,b,a){if(!this._isEnabled||!this.isEnabled(a)){return
}Dom.removeClassName(this._stateDivs[a-this._startValue],"KeyboardView-pressed");
if(this._upCallback){this._upCallback(c,a)
}};KeyboardView.prototype.setMarkerVisible=function(a,b){Dom.setVisible(this._markerDivs[a-this._startValue],b)
};KeyboardView.prototype.setEnabled=function(a){this._isEnabled=a
};KeyboardView.prototype.isEnabled=function(){return this._isEnabled
};KeyboardView.prototype.setKeyEnabled=function(a,b){this._isKeyEnabled[a-this._startValue]=b
};KeyboardView.prototype.isKeyEnabled=function(a){return this._isKeyEnabled[a-this._startValue]
};KeyboardView.prototype._getHighlighter=function(a){return this._highlighters[a-this._startValue]
};KeyboardView.prototype.removeHighlight=function(a){this._getHighlighter(a).removeHighlight()
};KeyboardView.prototype.highlightGreen=function(a){this._getHighlighter(a).highlight("green")
};KeyboardView.prototype.highlightRed=function(a){this._getHighlighter(a).highlight("red")
};KeyboardView.prototype.flashGreen=function(a){this._getHighlighter(a).flash("green")
};KeyboardView.prototype.flashRed=function(a){this._getHighlighter(a).flash("red")
};ModalDialog=function(b,c,a){this._titleText=b;
this._cancelText=c;this._okText=a;this._fadeDuration=250
};ModalDialog.prototype._createElements=function(){if(this._shroudDiv){return
}Dom.appendChild(document.body,(this._screenDiv=Dom.createElement("div",{"class":"ModalDialog-screen"},(this._shroudDiv=Dom.createElement("div",{"class":"ModalDialog-shroud"})),Dom.createElement("div",{"class":"ModalDialog-bottom-pinning"},(this._windowDiv=Dom.createElement("div",{"class":"ModalDialog-window"},Dom.createElement("table",{},Dom.createElement("tbody",{},Dom.createElement("tr",{},(this._titleDiv=Dom.createElement("td",{colspan:"2"}))),Dom.createElement("tr",{},Dom.createElement("td",{},(this._cancelDiv=Dom.createElement("div",{"class":"ModalDialog-button"}))),Dom.createElement("td",{},(this._okDiv=Dom.createElement("div",{"class":"ModalDialog-button"}))))))))))));
Dom.setOpacity(this._shroudDiv,0.5);Dom.update(this._titleDiv,this._titleText);
Dom.update(this._cancelDiv,this._cancelText);
Dom.update(this._okDiv,this._okText);var a=this.cancel.bind(this),b=this._ok.bind(this);
new Button(this._cancelDiv,a);new Button(this._okDiv,b);
Clickable.install(this._screenDiv,a);Clickable.install(this._windowDiv,Util.identity)
};ModalDialog.prototype._ok=function(a){if(this._callback){this._callback()
}this.cancel()};ModalDialog.prototype.show=function(a){this._callback=a;
this._createElements();Fader.fadeIn([this._screenDiv],this._fadeDuration);
this._isShowing=true};ModalDialog.prototype.isShowing=function(a){return this._isShowing
};ModalDialog.prototype.cancel=function(a){this._isShowing=false;
delete (this._callback);Fader.fadeOut([this._screenDiv],this._fadeDuration)
};NavBar=function(d,b,c){var a;this._domElement=$(d);
Dom.addClassName(document.body,"NavBar-body");
Dom.addClassName(this._domElement,"NavBar");
Dom.appendChildren(this._domElement,[Dom.createElement("span",{"class":"NavBar-piano"},(a=Dom.createElement("a",{href:"javascript:Util.popUpPiano()"}))),(this._crumbs=Dom.createElement("span",{"class":"NavBar-crumbs"},(this._homeAElement=Dom.createElement("a",{},Dom.createElement("span",{"class":"NavBar-home"})))))]);
Dom.update(a,Util.getLocalizedString("DISPLAY_KEYBOARD","Display Keyboard"))
};NavBar.prototype.setHomeURL=function(a){Dom.writeAttribute(this._homeAElement,"href",a)
};NavBar.prototype.alignElementToTop=function(a){Dom.addClassName(a,"NavBar-top")
};NavBar.prototype.addCrumb=function(b,a){Dom.appendChild(this._crumbs,Dom.createElement("span",{"class":"NavBar-arrow"}));
if(a){Dom.appendChild(this._crumbs,Dom.update(Dom.createElement("a",{href:a}),b))
}else{Dom.appendChild(this._crumbs,Dom.update(Dom.createElement("span"),b))
}};SoundPlayer=function(c,a,b){this._div=c;
this._delegate=b;this._shouldLog=!!b.soundPlayerLog;
this._playTimeouts={};this._hasUI=!!c;this._needsPolyphony=a.polyphonic;
if(this._hasUI){Dom.appendChild(this._div,(this._container=Dom.createElement("div",{"class":"SoundPlayer-container"})))
}if(swfobject.hasFlashPlayerVersion("10")){this._timeoutInterval=setTimeout(this._handleNoPlatform.bind(this),3000);
this._platform=new SoundPlayerActionScriptPlatform(this._container,this)
}else{this._handleNoPlatform()}};SoundPlayer.prototype._handleNoPlatform=function(){if(this._hasUI){if(Browser.isApplePad()||Browser.isApplePhone()){Dom.addClassName(this._container,"SoundPlayer-fake-player");
this._errorText=Dom.createElement("div",{"class":"SoundPlayer-error-text"});
Dom.appendChild(this._container,this._errorText);
Dom.update(this._errorText,"Sorry, Apple iOS is not yet supported")
}else{Dom.addClassName(this._container,"SoundPlayer-flash-blocker");
this._errorText=Dom.createElement("div",{"class":"SoundPlayer-error-text"});
Dom.appendChild(this._container,this._errorText);
Dom.update(this._errorText,"Please install Adobe Flash Player 10")
}Fader.fadeIn([this._errorText],250)}this._timeoutInterval=0
};SoundPlayer.prototype.handleAudioHello=function(){this._isReady=true;
clearInterval(this._timeoutInterval);delete (this._timeoutInterval);
if(this._delegate&&this._delegate.soundPlayerHello){this._delegate.soundPlayerHello.call(this._delegate)
}if(this._deferLoadInstrument){this._platform.loadInstrument.apply(this._platform,this._deferLoadInstrument);
delete (this._deferLoadInstrument)}};SoundPlayer.prototype.handleInstrumentReady=function(){if(this._delegate&&this._delegate.soundPlayerInstrumentReady){this._delegate.soundPlayerInstrumentReady.call(this._delegate)
}};SoundPlayer.prototype.handleSequenceReady=function(){if(this._delegate&&this._delegate.soundPlayerSequenceReady){this._delegate.soundPlayerSequenceReady.call(this._delegate)
}};SoundPlayer.prototype.handleLog=function(a){if(this._delegate&&this._delegate.soundPlayerLog){this._delegate.soundPlayerLog.call(this._delegate,a)
}else{Util.log(a)}};SoundPlayer.prototype.getRange=function(){return this._range
};SoundPlayer.prototype.isPolyphonic=function(){return this._platform.isPolyphonic()
};SoundPlayer.prototype.loadInstrument=function(b,e){var a="piano",d=[0,48,72];
if(!this._usingHTML5){if(b==10||b=="flute"){a="flute"
}else{if(b==11||b=="oboe"){a="oboe"}else{if(b==12||b=="clarinet"){a="clarinet"
}else{if(b==13||b=="bassoon"){a="bassoon"
}else{if(b==20||b=="trumpet"){a="trumpet"
}}}}}var c={flute:[10,60,91],oboe:[11,58,82],clarinet:[12,53,77],bassoon:[13,34,62],"alto-flute":[14,55,91],"bass-flute":[15,48,74],trumpet:[20,52,83],trombone:[21,40,72],tuba:[22,24,60]};
if(c[a]){d=c[a]}}this._range=new Range(d[1],d[2]);
if(this._isReady){this._platform.loadInstrument(d[0],a,e,this._range)
}else{this._deferLoadInstrument=[d[0],a,e,this._range]
}};SoundPlayer.prototype.replay=function(){this._platform.replay()
};SoundPlayer.prototype.playSequence=function(b,c,a){if(this._platform.playSequence){this._platform.playSequence(b,c,!!a)
}};SoundPlayer.prototype.playPitches=function(l,c,b){if(this._platform.playPitches){this._platform.playPitches(l,c,b)
}else{var d=0,k=[],g,e,a,m,h,f;for(g=0,a=l.length;
g<a;g++){f=(g==(a-1));h=l[g];if(typeof(h)==typeof(0)){h=[h]
}for(e=0,m=h.length;e<m;e++){k.push([h[e],d,c,(f?0.25:0.1)])
}d+=c;if(f){d+=0.25}}this.playSequence(k,d)
}};SoundPlayerActionScriptPlatform=function(i,c,b){this._player=c;
SoundPlayerActionScriptPlatform._sharedInstance=this;
var g="SoundPlayerHelper",f={AllowScriptAccess:"always",allowNetworking:"all"},e,a,d;
if(i){e=i;a="420";d="24";if(Browser.isGecko()){a++
}else{f.scale="exactfit"}}else{e=document.body;
a=d="8"}Dom.appendChild(e,Dom.createElement("div",{id:g,"class":"SoundPlayer-helper"}));
swfobject.embedSWF("/v2c/1fe1ddbd8afb6ae0749fdccb34bf1a103ff52188/v2/swf/SoundPlayerHelper.swf",g,a,d,"10","",{},f,{},this._handleMovieEmbedded.bind(this))
};SoundPlayerActionScriptPlatform.prototype._handleMovieEmbedded=function(a){this._movie=a.ref
};SoundPlayerActionScriptPlatform.prototype._handleMovieCallback=function(b,a){if(b=="player-hello"){this._player.handleAudioHello()
}else{if(b=="instrument-ready"){this._player.handleInstrumentReady()
}else{if(b=="log"){this._player.handleLog(a)
}}}};SoundPlayerActionScriptPlatform.prototype.isPolyphonic=function(){return true
};SoundPlayerActionScriptPlatform.prototype.loadInstrument=function(d,b,c,a){if(d>0){this._movie.loadSound({path:"/v2c/fb43e72a214abbdda0c843ce53952295226a6cdd/v2/sounds/synth.dat",volume:0.5,patch:d})
}else{this._movie.loadSound({path:"/v2c/41b061ab0a3998dc540a7dd205a99fbf37a110fa/v2/sounds/0_piano.mp3",volume:0.75,samples:[[36,37,0,1.35],[40,41,1.4,1.35],[43,45,2.8,1.45],[48,49,4.3,1.35],[52,53,5.7,1.35],[55,57,7.1,1.45],[60,61,8.6,1.35],[64,65,10,1.35],[67,69,11.4,1.45],[72,73,12.9,1.35],[76,77,14.3,1.35],[79,81,15.7,1.45],[84,127,17.2,1.35]]})
}};SoundPlayerActionScriptPlatform.prototype.replay=function(){this._movie.replay()
};SoundPlayerActionScriptPlatform.prototype.playSequence=function(b,c,a){this._movie.playSequence(b,c,a)
};gSoundPlayerHelperCallback=function(a,b){window.setTimeout(function(){var c=SoundPlayerActionScriptPlatform._sharedInstance;
c._handleMovieCallback.apply(c,[a,b])},1)
};gSoundPlayerHelperLog=function(a){window.setTimeout(function(){var b=SoundPlayerActionScriptPlatform._sharedInstance;
b._handleMovieCallback.apply(b,["log",a])
},1)};StaffCSSRenderer=function(a){this._div=a;
this._containerHeightText="0px"};StaffCSSRenderer.prototype.clear=function(){Dom.removeAllChildren(this._div);
this._container=Dom.createElement("div",{"class":"StaffView-container",style:this._containerHeightText});
Dom.appendChild(this._div,this._container)
};StaffCSSRenderer.prototype.setContainerHeight=function(a){this._containerHeightText=("height: "+a+"px");
this._div.style.cssText=this._containerHeightText
};StaffCSSRenderer.prototype._getInfoForGlyph=function(a){switch(a){case 34:return[[0,106],[65,169],"clef-g"];
case 22:return[[0,24],[68,75],"clef-f"];case 28:return[[0,48],[67,97],"clef-c"];
case 26:return[[0,48],[67,97],"clef-c"];case 99:return[[0,46],[0,93],"staff"];
case 98:return[[0,12],[39,24],"note"];case 97:return[[0,0],[55,1],"ledger"];
case -4:return[[0,24],[43,33],"flat-4"];case -3:return[[0,24],[32,33],"flat-3"];
case -2:return[[0,48],[39,66],"flat-2"];case -1:return[[0,48],[21,66],"flat-1"];
case 0:return[[0,33],[17,66],"natural"];case 1:return[[0,35],[20,70],"sharp-1"];
case 2:return[[0,11],[24,23],"sharp-2"];case 3:return[[0,17],[32,33],"sharp-3"];
case 4:return[[0,17],[43,33],"sharp-4"];case 90:return[[0,0],[0,0],null];
case 91:return[[0,0],[8,0],null];case 94:return[[0,0],[12,0],null];
case 95:return[[0,0],[16,0],null];case 92:return[[0,0],[32,0],null];
case 93:return[[0,0],[32,0],null];default:return null
}};StaffCSSRenderer.prototype.getOffset=function(a){var b=this._getInfoForGlyph(a);
return b?b[0]:[0,0]};StaffCSSRenderer.prototype.getSize=function(a){if(a==100){return Dom.getDimensions(this._div)
}else{var b=this._getInfoForGlyph(a);return b?b[1]:[0,0]
}};StaffCSSRenderer.prototype.drawGlyph=function(b,a,d){var c=this._getInfoForGlyph(b);
if(!c){return}a=Math.round(a);d=Math.round(d);
Dom.appendChild(this._container,Dom.createElement("div",{"class":"StaffView-glyph StaffView-"+c[2],style:"left: "+a+"px; top:"+d+"px;"}))
};StaffView=function(a){this._renderer=new StaffCSSRenderer(a);
this.setStaffPositionRange(new Range(-12,12));
this._isReady=false;setTimeout(function(){this._isReady=true
}.bind(this),1)};StaffView.prototype._getUnitHeight=function(){var c=this._renderer;
if(!c){return 0}var a=c.getSize(97),b=c.getSize(98),d=((b[1]-a[1])/2);
return d};StaffView.prototype._updateHeight=function(){if(!this._range||!this._renderer){return
}var e=this._getUnitHeight(),c=this._range.getHighestNumber(),a=this._range.getLowestNumber(),d=this._renderer.getOffset(-1)[1],b=this._renderer.getSize(1)[1]-this._renderer.getOffset(1)[1];
if(a>-5){a=-5}if(c<4){c=4}this._yForPosition0=(e*c)+d;
this._renderer.setContainerHeight((e*(c-a))+d+b)
};StaffView.prototype._createInfoObject=function(r,m,l){var v={},t,c,a=[];
v.clef=r;v.keyAccidentals=[];v.noteAccidentals=[];
v.notes=[];v.lines=[];v.layout={};var w={},u=m<0;
w[34]=u?[0,3,-1,2,-2,1,-3]:[4,1,5,2,-1,3,0];
w[22]=u?[-2,1,-3,0,-4,-1,-5]:[2,-1,3,0,-3,1,-2];
w[28]=u?[-1,2,-2,1,-3,0,-4]:[3,0,4,1,-2,2,-1];
w[26]=u?[1,4,0,3,-1,2,-2]:[-2,2,-1,3,0,4,1];
for(t=0,c=Math.abs(m);t<c;t++){v.keyAccidentals.push({glyph:(u?-1:1),position:w[r][t]})
}var p=0,o,k;l.sort(function(i,f){return i.getMIDIValue()-f.getMIDIValue()
});for(t=0,c=l.length;t<c;t++){var x=l[t].getStaffPosition(r),e=l[t].getAccidentalType(m);
v.notes.push({position:x});a.push({glyph:e,position:x});
p+=x;if(o!==undefined&&(x==(o+1))){v.notes[t-1]._second=true;
v.hasSecond=true}o=x}if(v.hasSecond){var q=v.notes;
if(p<0){q[0].offset=0;for(t=1,c=q.length;
t<c;t++){if(q[t]._second){q[t].offset=(1-q[t-1].offset)
}else{q[t].offset=1}}}else{q[q.length-1].offset=1;
for(t=(q.length-2);t>=0;t--){if(q[t]._second){q[t].offset=(1-q[t+1].offset)
}else{q[t].offset=1}}}}t=0;c=a.length;if(c>1){var g=a[c-1];
if(Math.abs(g.position-a[0].position)>5){v.noteAccidentals.push([g,a[0]]);
t++}else{v.noteAccidentals.push([g])}c--}for(;
t<c;t++){v.noteAccidentals.push([a[t]])}v.noteAccidentals.reverse();
var b={},y,h,d,s,u=function(f,i,j){b[""+i+":"+j]={position:f+(i*2),offset:j}
};for(t=0,c=l.length;t<c;t++){h=l[t].getLedgerLineCount(r);
d=v.notes[t].offset;for(s=h;s>0;s--){u(4,s,d)
}for(s=h;s<0;s++){u(-4,s,d)}}for(y in b){if(b.hasOwnProperty(y)){v.lines.push(b[y])
}}return v};StaffView.prototype._redraw=function(){var E=this._info,s=this._renderer,k=0,c=this._getUnitHeight(),I=this._yForPosition0,C,b,B,D,v;
if(!E||!s){return}var l=s.getSize(100)[0],w=s.getSize(98),f=s.getSize(97),q=s.getSize(22)[0],m=s.getSize(-1)[0],A=s.getSize(90)[0],G=s.getSize(91)[0],p=s.getSize(94)[0],a=s.getSize(95)[0],h=s.getSize(92)[0],n=s.getSize(93)[0],g=[],e=0;
function t(r,j,i){var x=s.getOffset(r);s.drawGlyph(r,j,((-c*i)+I)-x[1])
}var z=A+q+G+h+n+(w[0]*(E.hasSecond?2:1));
z+=(E.keyAccidentals.length*(m+p));for(C=0,b=E.noteAccidentals.length;
C<b;C++){v=0;for(B=0,D=E.noteAccidentals[C].length;
B<D;B++){v=Math.max(s.getSize(E.noteAccidentals[C][B].glyph)[0],v)
}g[C]=v;e+=v;z+=(v+a)}if(z>l){var H=(E.noteAccidentals.length+E.keyAccidentals.length),o=Math.round((z-l)/(3+H));
A=Math.max(A-o,0);G=Math.max(G-o,0);h=Math.max(h-o,0);
n=Math.max(n-o,0);p-=o;a-=o}s.clear();t(99,0,0);
var J=0;switch(E.clef){case 34:J=-2;break;
case 22:J=2;break;case 28:J=0;break;case 26:J=2;
break}k+=A;t(E.clef,k,J);k+=q;k+=G;b=E.keyAccidentals.length;
if(b>0){v=(s.getSize(E.keyAccidentals[0].glyph)[0]+p);
for(C=0;C<b;C++){t(E.keyAccidentals[C].glyph,k,E.keyAccidentals[C].position);
k+=v}k-=p}k+=h;var K=e+n+(E.noteAccidentals.length*a)+(w[0]*(E.hasSecond?2:1)),d;
k+=Math.floor(((l-k)-K)/2);for(C=0,b=E.noteAccidentals.length;
C<b;C++){for(B=0,D=E.noteAccidentals[C].length;
B<D;B++){d=E.noteAccidentals[C][B];t(d.glyph,k+((g[C]-s.getSize(d.glyph)[0])/2),d.position)
}k+=g[C]+a}var y=(w[0]*0.87),u,F;for(C=0,b=E.lines.length;
C<b;C++){u=E.lines[C];F=(E.hasSecond?u.offset:0)*y;
t(97,k+F,u.position)}k+=(f[0]-w[0])/2;for(C=0,b=E.notes.length;
C<b;C++){u=E.notes[C];F=(E.hasSecond?u.offset:0)*y;
t(98,k+F,u.position)}};StaffView.prototype.setStaffPositionRange=function(a){this._range=a;
this._updateHeight();this._redraw()};StaffView.prototype.getStaffPositionRange=function(a){return this._range
};StaffView.prototype.draw=function(c,b,a){if(!this._isReady){setTimeout(function(){this.draw(c,b,a)
}.bind(this),1);return}this._info=this._createInfoObject(c,b,a);
this._redraw()};StaffView.prototype.setLabel=function(a){if(this._label!=a){this._label=a;
this._redraw()}};StaffView.prototype.getLabel=function(){return this._label
};