--- /dev/null
+===============================
+TimeSide - Web Audio Components
+===============================
+
+TimeSide UI Dependencies
+========================
+
+* SoundManager 2 >= 2.91 : http://www.schillmania.com/projects/soundmanager2
+* jQuery => 1.2.6 : http://www.jquery.com
+* jsGraphics => 3.03 http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm
+
+Licensing
+=========
+
+Copyright (c) 2008-2009 Samalyse
+Author: Olivier Guilyardi <olivier samalyse com>
+
+TimeSide is released under the terms of the GNU General Public License
+version 2. Please see the LICENSE file for details.
+
--- /dev/null
+/*!
+ * jQuery JavaScript Library v1.6
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Mon May 2 13:50:00 2011 -0400
+ */
+(function(a,b){function cw(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function ct(a){if(!ch[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ci||(ci=c.createElement("iframe"),ci.frameBorder=ci.width=ci.height=0),c.body.appendChild(ci);if(!cj||!ci.createElement)cj=(ci.contentWindow||ci.contentDocument).document,cj.write("<!doctype><html><body></body></html>");b=cj.createElement(a),cj.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ci)}ch[a]=d}return ch[a]}function cs(a,b){var c={};f.each(cn.concat.apply([],cn.slice(0,b)),function(){c[this]=a});return c}function cr(){co=b}function cq(){setTimeout(cr,0);return co=f.now()}function cg(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cf(){try{return new a.XMLHttpRequest}catch(b){}}function b_(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function b$(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bZ(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):bZ(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bZ(a+"["+e+"]",b[e],c,d);else d(a,b)}function bY(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bY(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bY(a,c,d,e,"*",g));return l}function bX(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?bv:bw,e=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return e;f.each(d,function(){c||(e-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?e+=parseFloat(f.css(a,"margin"+this))||0:e-=parseFloat(f.css(a,"border"+this+"Width"))||0});return e}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):a.getElementsByTagName&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bf(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function W(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(R.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(x,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){name="data-"+c.replace(j,"$1-$2").toLowerCase(),d=a.getAttribute(name);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(e){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?g=[null,a,null]:g=i.exec(a);if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:E?function(a){return a==null?"":E.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?C.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(F)return F.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=D.call(arguments,2),g=function(){return a.apply(c,f.concat(D.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(c,d){d&&d instanceof e&&!(d instanceof a)&&(d=a(d));return e.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){G["[object "+b+"]"]=b.toLowerCase()}),x=e.uaMatch(w),x.browser&&(e.browser[x.browser]=!0,e.browser.version=x.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?z=function(){c.removeEventListener("DOMContentLoaded",z,!1),e.ready()}:c.attachEvent&&(z=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",z),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b,d,e,f,g,h,i,j,k,l,m,n,o,p,q;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",b=a.getElementsByTagName("*"),d=a.getElementsByTagName("a")[0];if(!b||!b.length||!d)return{};e=c.createElement("select"),f=e.appendChild(c.createElement("option")),g=a.getElementsByTagName("input")[0],i={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.55$/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:g.value==="on",optSelected:f.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},g.checked=!0,i.noCloneChecked=g.cloneNode(!0).checked,e.disabled=!0,i.optDisabled=!f.disabled;try{delete a.test}catch(r){i.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function click(){i.noCloneEvent=!1,a.detachEvent("onclick",click)}),a.cloneNode(!0).fireEvent("onclick")),g=c.createElement("input"),g.value="t",g.setAttribute("type","radio"),i.radioValue=g.value==="t",g.setAttribute("checked","checked"),a.appendChild(g),j=c.createDocumentFragment(),j.appendChild(a.firstChild),i.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",k=c.createElement("body"),l={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(p in l)k.style[p]=l[p];k.appendChild(a),c.documentElement.appendChild(k),i.appendChecked=g.checked,i.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,i.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",i.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",m=a.getElementsByTagName("td"),q=m[0].offsetHeight===0,m[0].style.display="",m[1].style.display="none",i.reliableHiddenOffsets=q&&m[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(h=c.createElement("div"),h.style.width="0",h.style.marginRight="0",a.appendChild(h),i.reliableMarginRight=(parseInt(c.defaultView.getComputedStyle(h,null).marginRight,10)||0)===0),k.innerHTML="",c.documentElement.removeChild(k);if(a.attachEvent)for(p in{submit:1,change:1,focusin:1})o="on"+p,q=o in a,q||(a.setAttribute(o,"return;"),q=typeof a[o]=="function"),i[p+"Bubbles"]=q;return i}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[c]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function l(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark";while(g--)if(tmp=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,tmp.done(l);l();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:data-|aria-)/,u=/\:/,v;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.addClass(a.call(this,b,c.attr("class")||""))});if(a&&typeof a=="string"){var b=(a||"").split(o);for(var c=0,d=this.length;c<d;c++){var e=this[c];if(e.nodeType===1)if(!e.className)e.className=a;else{var g=" "+e.className+" ",h=e.className;for(var i=0,j=b.length;i<j;i++)g.indexOf(" "+b[i]+" ")<0&&(h+=" "+b[i]);e.className=f.trim(h)}}}return this},removeClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a=="string"||a===b){var c=(a||"").split(o);for(var d=0,e=this.length;d<e;d++){var g=this[d];if(g.nodeType===1&&g.className)if(a){var h=(" "+g.className+" ").replace(n," ");for(var i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){var d=f(this);d.toggleClass(a.call(this,c,d.attr("class"),b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||"set"in c&&c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b=a.selectedIndex,c=[],d=a.options,e=a.type==="select-one";if(b<0)return null;for(var g=e?b:0,h=e?b+1:d.length;g<h;g++){var i=d[g];if(i.selected&&(f.support.optDisabled?!i.disabled:i.getAttribute("disabled")===null)&&(!i.parentNode.disabled||!f.nodeName(i.parentNode,"optgroup"))){value=f(i).val();if(e)return value;c.push(value)}}if(e&&!c.length&&d.length)return f(d[b]).val();return c},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex",readonly:"readOnly"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c]||(v&&(f.nodeName(a,"form")||u.test(c))?v:b);if(d!==b){if(d===null||d===!1&&!t.test(c)){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;d===!0&&!t.test(c)&&(d=c),a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.getAttribute("value");a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),f.support.getSetAttribute||(f.attrFix=f.extend(f.attrFix,{"for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder"}),v=f.attrHooks.name=f.attrHooks.value=f.valHooks.button={get:function(a,c){var d;if(c==="value"&&!f.nodeName(a,"button"))return a.getAttribute(c);d=a.getAttributeNode(c);return d&&d.specified?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=Object.prototype.hasOwnProperty,x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,N(a.origType,a.selector),f.extend({},a,{handler:M,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,N(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?E:D):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=E;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=E;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=E,this.stopPropagation()},isDefaultPrevented:D,isPropagationStopped:D,isImmediatePropagationStopped:D};var F=function(a){var b=a.relatedTarget;try{if(b&&b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&(a.type=a.data,f.event.handle.apply(this,arguments))}catch(d){}},G=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?G:F,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?G:F)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&K("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&K("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var H,I=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function J(a){var c=a.target,d,e;if(!!y.test(c.nodeName)&&!c.readOnly){d=f._data(c,"_change_data"),e=I(c),(a.type!=="focusout"||c.type!=="radio")&&f._data(c,"_change_data",e);if(d===b||e===d)return;if(d!=null||e)a.type="change",a.liveFired=b,f.event.trigger(a,arguments[1],c)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var L={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||D,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=x.exec(h),k="",j&&(k=j[0],h=h.replace(x,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,L[h]?(a.push(L[h]+k),h=h+k):h=(L[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+N(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+N(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){return a.nodeName.toLowerCase()==="input"&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;return 0}if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var O=/Until$/,P=/^(?:parents|prevUntil|prevAll)/,Q=/,/,R=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,T=f.expr.match.POS,U={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(W(this,a,!1),"not",a)},filter:function(a){return this.pushStack(W(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=T.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/<tbody/i,ba=/<|&#?\w+;/,bb=/<(?:script|object|embed|option|style)/i,bc=/checked\s*(?:[^=]|=\s*.checked.)/i,bd=/\/(java|ecma)script/i,be={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!be[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bc.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bf(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bl)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bb.test(a[0])&&(f.support.checkClone||!bc.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[];for(var i=0,j;(j=a[i])!=null;i++){typeof j=="number"&&(j+="");if(!j)continue;if(typeof j=="string")if(!ba.test(j))j=b.createTextNode(j);else{j=j.replace(Z,"<$1></$2>");var k=($.exec(j)||["",""])[1].toLowerCase(),l=be[k]||be._default,m=l[0],n=b.createElement("div");n.innerHTML=l[1]+j+l[2];while(m--)n=n.lastChild;if(!f.support.tbody){var o=_.test(j),p=k==="table"&&!o?n.firstChild&&n.firstChild.childNodes:l[1]==="<table>"&&!o?n.childNodes:[];for(var q=p.length-1;q>=0;--q)f.nodeName(p[q],"tbody")&&!p[q].childNodes.length&&p[q].parentNode.removeChild(p[q])}!f.support.leadingWhitespace&&Y.test(j)&&n.insertBefore(b.createTextNode(Y.exec(j)[0]),n.firstChild),j=n.childNodes}var r;if(!f.support.appendChecked)if(j[0]&&typeof (r=j.length)=="number")for(i=0;i<r;i++)bk(j[i]);else bk(j);j.nodeType?h.push(j):h=f.merge(h,j)}if(d){g=function(a){return!a.type||bd.test(a.type)};for(i=0;h[i];i++)if(e&&f.nodeName(h[i],"script")&&(!h[i].type||h[i].type.toLowerCase()==="text/javascript"))e.push(h[i].parentNode?h[i].parentNode.removeChild(h[i]):h[i]);else{if(h[i].nodeType===1){var s=f.grep(h[i].getElementsByTagName("script"),g);h.splice.apply(h,[i+1,0].concat(s))}d.appendChild(h[i])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bm=/alpha\([^)]*\)/i,bn=/opacity=([^)]*)/,bo=/-([a-z])/ig,bp=/([A-Z]|^ms)/g,bq=/^-?\d+(?:px)?$/i,br=/^-?\d/,bs=/^[+\-]=/,bt=/[^+\-\.\de]+/g,bu={position:"absolute",visibility:"hidden",display:"block"},bv=["Left","Right"],bw=["Top","Bottom"],bx,by,bz,bA=function(a,b){return b.toUpperCase()};f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bx(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0,widows:!0,orphans:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bs.test(d)&&(d=+d.replace(bt,"")+parseFloat(f.css(a,c))),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bx)return bx(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bo,bA)}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){a.offsetWidth!==0?e=bB(a,b,d):f.swap(a,bu,function(){e=bB(a,b,d)});if(e<=0){e=bx(a,b,b),e==="0px"&&bz&&(e=bz(a,b,b));if(e!=null)return e===""||e==="auto"?"0px":e}if(e<0||e==null){e=a.style[b];return e===""||e==="auto"?"0px":e}return typeof e=="string"?e:e+"px"}},set:function(a,b){if(!bq.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV;try{bU=e.href}catch(bW){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bX(bS),ajaxTransport:bX(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?b$(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b_(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bY(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bY(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bZ(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var ca=f.now(),cb=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+ca++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cb.test(b.url)||e&&cb.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cb,l),b.url===j&&(e&&(k=k.replace(cb,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cc=a.ActiveXObject?function(){for(var a in ce)ce[a](0,1)}:!1,cd=0,ce;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cf()||cg()}:cf,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cc&&delete ce[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cd,cc&&(ce||(ce={},f(a).unload(cc)),ce[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ch={},ci,cj,ck=/^(?:toggle|show|hide)$/,cl=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cm,cn=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],co,cp=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cs("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",ct(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cs("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cs("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g];if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=ct(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block")),b.animatedProperties[g]=f.isArray(h)?h[1]:b.specialEasing&&b.specialEasing[g]||b.easing||"swing"}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],ck.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=cl.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[g]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cs("show",1),slideUp:cs("hide",1),slideToggle:cs("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this),f.isFunction(d.old)&&d.old.call(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=co||cq(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!cm&&(cp?(cm=1,g=function(){cm&&(cp(g),e.tick())},cp(g)):cm=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=co||cq(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a=f.timers,b=a.length;while(b--)a[b]()||a.splice(b,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cm),cm=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cu=/^t(?:able|d|h)$/i,cv=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cw(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cu.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cv.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cv.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cw(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cw(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);
\ No newline at end of file
--- /dev/null
+/*
+ * Raphael 1.5.2 - JavaScript Vector Library
+ *
+ * Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
+ * Licensed under the MIT (http://raphaeljs.com/license.html) license.
+ */
+(function(){function a(){if(a.is(arguments[0],G)){var b=arguments[0],d=bV[m](a,b.splice(0,3+a.is(b[0],E))),e=d.set();for(var g=0,h=b[w];g<h;g++){var i=b[g]||{};c[f](i.type)&&e[L](d[i.type]().attr(i))}return e}return bV[m](a,arguments)}a.version="1.5.2";var b=/[, ]+/,c={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},d=/\{(\d+)\}/g,e="prototype",f="hasOwnProperty",g=document,h=window,i={was:Object[e][f].call(h,"Raphael"),is:h.Raphael},j=function(){this.customAttributes={}},k,l="appendChild",m="apply",n="concat",o="createTouch"in g,p="",q=" ",r=String,s="split",t="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[s](q),u={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},v="join",w="length",x=r[e].toLowerCase,y=Math,z=y.max,A=y.min,B=y.abs,C=y.pow,D=y.PI,E="number",F="string",G="array",H="toString",I="fill",J=Object[e][H],K={},L="push",M=/^url\(['"]?([^\)]+?)['"]?\)$/i,N=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,O={"NaN":1,Infinity:1,"-Infinity":1},P=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,Q=y.round,R="setAttribute",S=parseFloat,T=parseInt,U=" progid:DXImageTransform.Microsoft",V=r[e].toUpperCase,W={blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:"10px \"Arial\"","font-family":"\"Arial\"","font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},X={along:"along",blur:E,"clip-rect":"csv",cx:E,cy:E,fill:"colour","fill-opacity":E,"font-size":E,height:E,opacity:E,path:"path",r:E,rotation:"csv",rx:E,ry:E,scale:"csv",stroke:"colour","stroke-opacity":E,"stroke-width":E,translation:"csv",width:E,x:E,y:E},Y="replace",Z=/^(from|to|\d+%?)$/,$=/\s*,\s*/,_={hs:1,rg:1},ba=/,?([achlmqrstvxz]),?/gi,bb=/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,bc=/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,bd=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/,be=function(a,b){return a.key-b.key};a.type=h.SVGAngle||g.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(a.type=="VML"){var bf=g.createElement("div"),bg;bf.innerHTML="<v:shape adj=\"1\"/>";bg=bf.firstChild;bg.style.behavior="url(#default#VML)";if(!(bg&&typeof bg.adj=="object"))return a.type=null;bf=null}a.svg=!(a.vml=a.type=="VML");j[e]=a[e];k=j[e];a._id=0;a._oid=0;a.fn={};a.is=function(a,b){b=x.call(b);if(b=="finite")return!O[f](+a);return b=="null"&&a===null||b==typeof a||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||J.call(a).slice(8,-1).toLowerCase()==b};a.angle=function(b,c,d,e,f,g){{if(f==null){var h=b-d,i=c-e;if(!h&&!i)return 0;return((h<0)*180+y.atan(-i/-h)*180/D+360)%360}return a.angle(b,c,f,g)-a.angle(d,e,f,g)}};a.rad=function(a){return a%360*D/180};a.deg=function(a){return a*180/D%360};a.snapTo=function(b,c,d){d=a.is(d,"finite")?d:10;if(a.is(b,G)){var e=b.length;while(e--)if(B(b[e]-c)<=d)return b[e]}else{b=+b;var f=c%b;if(f<d)return c-f;if(f>b-d)return c-f+b}return c};function bh(){var a=[],b=0;for(;b<32;b++)a[b]=(~(~(y.random()*16)))[H](16);a[12]=4;a[16]=(a[16]&3|8)[H](16);return"r-"+a[v]("")}a.setWindow=function(a){h=a;g=h.document};var bi=function(b){if(a.vml){var c=/^\s+|\s+$/g,d;try{var e=new ActiveXObject("htmlfile");e.write("<body>");e.close();d=e.body}catch(a){d=createPopup().document.body}var f=d.createTextRange();bi=bm(function(a){try{d.style.color=r(a)[Y](c,p);var b=f.queryCommandValue("ForeColor");b=(b&255)<<16|b&65280|(b&16711680)>>>16;return"#"+("000000"+b[H](16)).slice(-6)}catch(a){return"none"}})}else{var h=g.createElement("i");h.title="Raphaël Colour Picker";h.style.display="none";g.body[l](h);bi=bm(function(a){h.style.color=a;return g.defaultView.getComputedStyle(h,p).getPropertyValue("color")})}return bi(b)},bj=function(){return"hsb("+[this.h,this.s,this.b]+")"},bk=function(){return"hsl("+[this.h,this.s,this.l]+")"},bl=function(){return this.hex};a.hsb2rgb=function(b,c,d,e){if(a.is(b,"object")&&"h"in b&&"s"in b&&"b"in b){d=b.b;c=b.s;b=b.h;e=b.o}return a.hsl2rgb(b,c,d/2,e)};a.hsl2rgb=function(b,c,d,e){if(a.is(b,"object")&&"h"in b&&"s"in b&&"l"in b){d=b.l;c=b.s;b=b.h}if(b>1||c>1||d>1){b/=360;c/=100;d/=100}var f={},g=["r","g","b"],h,i,j,k,l,m;if(c){d<0.5?h=d*(1+c):h=d+c-d*c;i=2*d-h;for(var n=0;n<3;n++){j=b+1/3*-(n-1);j<0&&j++;j>1&&j--;j*6<1?f[g[n]]=i+(h-i)*6*j:j*2<1?f[g[n]]=h:j*3<2?f[g[n]]=i+(h-i)*(2/3-j)*6:f[g[n]]=i}}else f={r:d,g:d,b:d};f.r*=255;f.g*=255;f.b*=255;f.hex="#"+(16777216|f.b|f.g<<8|f.r<<16).toString(16).slice(1);a.is(e,"finite")&&(f.opacity=e);f.toString=bl;return f};a.rgb2hsb=function(b,c,d){if(c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b){d=b.b;c=b.g;b=b.r}if(c==null&&a.is(b,F)){var e=a.getRGB(b);b=e.r;c=e.g;d=e.b}if(b>1||c>1||d>1){b/=255;c/=255;d/=255}var f=z(b,c,d),g=A(b,c,d),h,i,j=f;{if(g==f)return{h:0,s:0,b:f,toString:bj};var k=f-g;i=k/f;b==f?h=(c-d)/k:c==f?h=2+(d-b)/k:h=4+(b-c)/k;h/=6;h<0&&h++;h>1&&h--}return{h:h,s:i,b:j,toString:bj}};a.rgb2hsl=function(b,c,d){if(c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b){d=b.b;c=b.g;b=b.r}if(c==null&&a.is(b,F)){var e=a.getRGB(b);b=e.r;c=e.g;d=e.b}if(b>1||c>1||d>1){b/=255;c/=255;d/=255}var f=z(b,c,d),g=A(b,c,d),h,i,j=(f+g)/2,k;if(g==f)k={h:0,s:0,l:j};else{var l=f-g;i=j<0.5?l/(f+g):l/(2-f-g);b==f?h=(c-d)/l:c==f?h=2+(d-b)/l:h=4+(b-c)/l;h/=6;h<0&&h++;h>1&&h--;k={h:h,s:i,l:j}}k.toString=bk;return k};a._path2string=function(){return this.join(",")[Y](ba,"$1")};function bm(a,b,c){function d(){var g=Array[e].slice.call(arguments,0),h=g[v]("►"),i=d.cache=d.cache||{},j=d.count=d.count||[];if(i[f](h))return c?c(i[h]):i[h];j[w]>=1000&&delete i[j.shift()];j[L](h);i[h]=a[m](b,g);return c?c(i[h]):i[h]}return d}a.getRGB=bm(function(b){if(!b||!(!((b=r(b)).indexOf("-")+1)))return{r:-1,g:-1,b:-1,hex:"none",error:1};if(b=="none")return{r:-1,g:-1,b:-1,hex:"none"};!(_[f](b.toLowerCase().substring(0,2))||b.charAt()=="#")&&(b=bi(b));var c,d,e,g,h,i,j,k=b.match(N);if(k){if(k[2]){g=T(k[2].substring(5),16);e=T(k[2].substring(3,5),16);d=T(k[2].substring(1,3),16)}if(k[3]){g=T((i=k[3].charAt(3))+i,16);e=T((i=k[3].charAt(2))+i,16);d=T((i=k[3].charAt(1))+i,16)}if(k[4]){j=k[4][s]($);d=S(j[0]);j[0].slice(-1)=="%"&&(d*=2.55);e=S(j[1]);j[1].slice(-1)=="%"&&(e*=2.55);g=S(j[2]);j[2].slice(-1)=="%"&&(g*=2.55);k[1].toLowerCase().slice(0,4)=="rgba"&&(h=S(j[3]));j[3]&&j[3].slice(-1)=="%"&&(h/=100)}if(k[5]){j=k[5][s]($);d=S(j[0]);j[0].slice(-1)=="%"&&(d*=2.55);e=S(j[1]);j[1].slice(-1)=="%"&&(e*=2.55);g=S(j[2]);j[2].slice(-1)=="%"&&(g*=2.55);(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360);k[1].toLowerCase().slice(0,4)=="hsba"&&(h=S(j[3]));j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsb2rgb(d,e,g,h)}if(k[6]){j=k[6][s]($);d=S(j[0]);j[0].slice(-1)=="%"&&(d*=2.55);e=S(j[1]);j[1].slice(-1)=="%"&&(e*=2.55);g=S(j[2]);j[2].slice(-1)=="%"&&(g*=2.55);(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360);k[1].toLowerCase().slice(0,4)=="hsla"&&(h=S(j[3]));j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsl2rgb(d,e,g,h)}k={r:d,g:e,b:g};k.hex="#"+(16777216|g|e<<8|d<<16).toString(16).slice(1);a.is(h,"finite")&&(k.opacity=h);return k}return{r:-1,g:-1,b:-1,hex:"none",error:1}},a);a.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||0.75},c=this.hsb2rgb(b.h,b.s,b.b);b.h+=0.075;if(b.h>1){b.h=0;b.s-=0.2;b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b})}return c.hex};a.getColor.reset=function(){delete this.start};a.parsePathString=bm(function(b){if(!b)return null;var c={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},d=[];a.is(b,G)&&a.is(b[0],G)&&(d=bo(b));d[w]||r(b)[Y](bb,function(a,b,e){var f=[],g=x.call(b);e[Y](bc,function(a,b){b&&f[L](+b)});if(g=="m"&&f[w]>2){d[L]([b][n](f.splice(0,2)));g="l";b=b=="m"?"l":"L"}while(f[w]>=c[g]){d[L]([b][n](f.splice(0,c[g])));if(!c[g])break}});d[H]=a._path2string;return d});a.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=C(j,3)*a+C(j,2)*3*i*c+j*3*i*i*e+C(i,3)*g,l=C(j,3)*b+C(j,2)*3*i*d+j*3*i*i*f+C(i,3)*h,m=a+2*i*(c-a)+i*i*(e-2*c+a),n=b+2*i*(d-b)+i*i*(f-2*d+b),o=c+2*i*(e-c)+i*i*(g-2*e+c),p=d+2*i*(f-d)+i*i*(h-2*f+d),q=(1-i)*a+i*c,r=(1-i)*b+i*d,s=(1-i)*e+i*g,t=(1-i)*f+i*h,u=90-y.atan((m-o)/(n-p))*180/D;(m>o||n<p)&&(u+=180);return{x:k,y:l,m:{x:m,y:n},n:{x:o,y:p},start:{x:q,y:r},end:{x:s,y:t},alpha:u}};var bn=bm(function(a){if(!a)return{x:0,y:0,width:0,height:0};a=bw(a);var b=0,c=0,d=[],e=[],f;for(var g=0,h=a[w];g<h;g++){f=a[g];if(f[0]=="M"){b=f[1];c=f[2];d[L](b);e[L](c)}else{var i=bv(b,c,f[1],f[2],f[3],f[4],f[5],f[6]);d=d[n](i.min.x,i.max.x);e=e[n](i.min.y,i.max.y);b=f[5];c=f[6]}}var j=A[m](0,d),k=A[m](0,e);return{x:j,y:k,width:z[m](0,d)-j,height:z[m](0,e)-k}}),bo=function(b){var c=[];if(!a.is(b,G)||!a.is(b&&b[0],G))b=a.parsePathString(b);for(var d=0,e=b[w];d<e;d++){c[d]=[];for(var f=0,g=b[d][w];f<g;f++)c[d][f]=b[d][f]}c[H]=a._path2string;return c},bp=bm(function(b){if(!a.is(b,G)||!a.is(b&&b[0],G))b=a.parsePathString(b);var c=[],d=0,e=0,f=0,g=0,h=0;if(b[0][0]=="M"){d=b[0][1];e=b[0][2];f=d;g=e;h++;c[L](["M",d,e])}for(var i=h,j=b[w];i<j;i++){var k=c[i]=[],l=b[i];if(l[0]!=x.call(l[0])){k[0]=x.call(l[0]);switch(k[0]){case"a":k[1]=l[1];k[2]=l[2];k[3]=l[3];k[4]=l[4];k[5]=l[5];k[6]=+(l[6]-d).toFixed(3);k[7]=+(l[7]-e).toFixed(3);break;case"v":k[1]=+(l[1]-e).toFixed(3);break;case"m":f=l[1];g=l[2];default:for(var m=1,n=l[w];m<n;m++)k[m]=+(l[m]-(m%2?d:e)).toFixed(3)}}else{k=c[i]=[];if(l[0]=="m"){f=l[1]+d;g=l[2]+e}for(var o=0,p=l[w];o<p;o++)c[i][o]=l[o]}var q=c[i][w];switch(c[i][0]){case"z":d=f;e=g;break;case"h":d+=+c[i][q-1];break;case"v":e+=+c[i][q-1];break;default:d+=+c[i][q-2];e+=+c[i][q-1]}}c[H]=a._path2string;return c},0,bo),bq=bm(function(b){if(!a.is(b,G)||!a.is(b&&b[0],G))b=a.parsePathString(b);var c=[],d=0,e=0,f=0,g=0,h=0;if(b[0][0]=="M"){d=+b[0][1];e=+b[0][2];f=d;g=e;h++;c[0]=["M",d,e]}for(var i=h,j=b[w];i<j;i++){var k=c[i]=[],l=b[i];if(l[0]!=V.call(l[0])){k[0]=V.call(l[0]);switch(k[0]){case"A":k[1]=l[1];k[2]=l[2];k[3]=l[3];k[4]=l[4];k[5]=l[5];k[6]=+(l[6]+d);k[7]=+(l[7]+e);break;case"V":k[1]=+l[1]+e;break;case"H":k[1]=+l[1]+d;break;case"M":f=+l[1]+d;g=+l[2]+e;default:for(var m=1,n=l[w];m<n;m++)k[m]=+l[m]+(m%2?d:e)}}else for(var o=0,p=l[w];o<p;o++)c[i][o]=l[o];switch(k[0]){case"Z":d=f;e=g;break;case"H":d=k[1];break;case"V":e=k[1];break;case"M":f=c[i][c[i][w]-2];g=c[i][c[i][w]-1];default:d=c[i][c[i][w]-2];e=c[i][c[i][w]-1]}}c[H]=a._path2string;return c},null,bo),br=function(a,b,c,d){return[a,b,c,d,c,d]},bs=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},bt=function(a,b,c,d,e,f,g,h,i,j){var k=D*120/180,l=D/180*(+e||0),m=[],o,p=bm(function(a,b,c){var d=a*y.cos(c)-b*y.sin(c),e=a*y.sin(c)+b*y.cos(c);return{x:d,y:e}});if(j){G=j[0];H=j[1];E=j[2];F=j[3]}else{o=p(a,b,-l);a=o.x;b=o.y;o=p(h,i,-l);h=o.x;i=o.y;var q=y.cos(D/180*e),r=y.sin(D/180*e),t=(a-h)/2,u=(b-i)/2,x=t*t/(c*c)+u*u/(d*d);if(x>1){x=y.sqrt(x);c=x*c;d=x*d}var z=c*c,A=d*d,C=(f==g?-1:1)*y.sqrt(B((z*A-z*u*u-A*t*t)/(z*u*u+A*t*t))),E=C*c*u/d+(a+h)/2,F=C*-d*t/c+(b+i)/2,G=y.asin(((b-F)/d).toFixed(9)),H=y.asin(((i-F)/d).toFixed(9));G=a<E?D-G:G;H=h<E?D-H:H;G<0&&(G=D*2+G);H<0&&(H=D*2+H);g&&G>H&&(G=G-D*2);!g&&H>G&&(H=H-D*2)}var I=H-G;if(B(I)>k){var J=H,K=h,L=i;H=G+k*(g&&H>G?1:-1);h=E+c*y.cos(H);i=F+d*y.sin(H);m=bt(h,i,c,d,e,0,g,K,L,[H,J,E,F])}I=H-G;var M=y.cos(G),N=y.sin(G),O=y.cos(H),P=y.sin(H),Q=y.tan(I/4),R=4/3*c*Q,S=4/3*d*Q,T=[a,b],U=[a+R*N,b-S*M],V=[h+R*P,i-S*O],W=[h,i];U[0]=2*T[0]-U[0];U[1]=2*T[1]-U[1];{if(j)return[U,V,W][n](m);m=[U,V,W][n](m)[v]()[s](",");var X=[];for(var Y=0,Z=m[w];Y<Z;Y++)X[Y]=Y%2?p(m[Y-1],m[Y],l).y:p(m[Y],m[Y+1],l).x;return X}},bu=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:C(j,3)*a+C(j,2)*3*i*c+j*3*i*i*e+C(i,3)*g,y:C(j,3)*b+C(j,2)*3*i*d+j*3*i*i*f+C(i,3)*h}},bv=bm(function(a,b,c,d,e,f,g,h){var i=e-2*c+a-(g-2*e+c),j=2*(c-a)-2*(e-c),k=a-c,l=(-j+y.sqrt(j*j-4*i*k))/2/i,n=(-j-y.sqrt(j*j-4*i*k))/2/i,o=[b,h],p=[a,g],q;B(l)>"1e12"&&(l=0.5);B(n)>"1e12"&&(n=0.5);if(l>0&&l<1){q=bu(a,b,c,d,e,f,g,h,l);p[L](q.x);o[L](q.y)}if(n>0&&n<1){q=bu(a,b,c,d,e,f,g,h,n);p[L](q.x);o[L](q.y)}i=f-2*d+b-(h-2*f+d);j=2*(d-b)-2*(f-d);k=b-d;l=(-j+y.sqrt(j*j-4*i*k))/2/i;n=(-j-y.sqrt(j*j-4*i*k))/2/i;B(l)>"1e12"&&(l=0.5);B(n)>"1e12"&&(n=0.5);if(l>0&&l<1){q=bu(a,b,c,d,e,f,g,h,l);p[L](q.x);o[L](q.y)}if(n>0&&n<1){q=bu(a,b,c,d,e,f,g,h,n);p[L](q.x);o[L](q.y)}return{min:{x:A[m](0,p),y:A[m](0,o)},max:{x:z[m](0,p),y:z[m](0,o)}}}),bw=bm(function(a,b){var c=bq(a),d=b&&bq(b),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1];b.Y=a[2];break;case"A":a=["C"][n](bt[m](0,[b.x,b.y][n](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x));d=b.y+(b.y-(b.by||b.y));a=["C",c,d][n](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.x));b.qy=b.y+(b.y-(b.qy||b.y));a=["C"][n](bs(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1];b.qy=a[2];a=["C"][n](bs(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][n](br(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][n](br(b.x,b.y,a[1],b.y));break;case"V":a=["C"][n](br(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][n](br(b.x,b.y,b.X,b.Y));break}return a},h=function(a,b){if(a[b][w]>7){a[b].shift();var e=a[b];while(e[w])a.splice(b++,0,["C"][n](e.splice(0,6)));a.splice(b,1);k=z(c[w],d&&d[w]||0)}},i=function(a,b,e,f,g){if(a&&b&&a[g][0]=="M"&&b[g][0]!="M"){b.splice(g,0,["M",f.x,f.y]);e.bx=0;e.by=0;e.x=a[g][1];e.y=a[g][2];k=z(c[w],d&&d[w]||0)}};for(var j=0,k=z(c[w],d&&d[w]||0);j<k;j++){c[j]=g(c[j],e);h(c,j);d&&(d[j]=g(d[j],f));d&&h(d,j);i(c,d,e,f,j);i(d,c,f,e,j);var l=c[j],o=d&&d[j],p=l[w],q=d&&o[w];e.x=l[p-2];e.y=l[p-1];e.bx=S(l[p-4])||e.x;e.by=S(l[p-3])||e.y;f.bx=d&&(S(o[q-4])||f.x);f.by=d&&(S(o[q-3])||f.y);f.x=d&&o[q-2];f.y=d&&o[q-1]}return d?[c,d]:c},null,bo),bx=bm(function(b){var c=[];for(var d=0,e=b[w];d<e;d++){var f={},g=b[d].match(/^([^:]*):?([\d\.]*)/);f.color=a.getRGB(g[1]);if(f.color.error)return null;f.color=f.color.hex;g[2]&&(f.offset=g[2]+"%");c[L](f)}for(d=1,e=c[w]-1;d<e;d++){if(!c[d].offset){var h=S(c[d-1].offset||0),i=0;for(var j=d+1;j<e;j++){if(c[j].offset){i=c[j].offset;break}}if(!i){i=100;j=e}i=S(i);var k=(i-h)/(j-d+1);for(;d<j;d++){h+=k;c[d].offset=h+"%"}}}return c}),by=function(b,c,d,e){var f;if(a.is(b,F)||a.is(b,"object")){f=a.is(b,F)?g.getElementById(b):b;if(f.tagName)return c==null?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:c,height:d}}else return{container:1,x:b,y:c,width:d,height:e}},bz=function(a,b){var c=this;for(var d in b){if(b[f](d)&&!(d in a))switch(typeof b[d]){case"function":(function(b){a[d]=a===c?b:function(){return b[m](c,arguments)}})(b[d]);break;case"object":a[d]=a[d]||{};bz.call(this,a[d],b[d]);break;default:a[d]=b[d];break}}},bA=function(a,b){a==b.top&&(b.top=a.prev);a==b.bottom&&(b.bottom=a.next);a.next&&(a.next.prev=a.prev);a.prev&&(a.prev.next=a.next)},bB=function(a,b){if(b.top===a)return;bA(a,b);a.next=null;a.prev=b.top;b.top.next=a;b.top=a},bC=function(a,b){if(b.bottom===a)return;bA(a,b);a.next=b.bottom;a.prev=null;b.bottom.prev=a;b.bottom=a},bD=function(a,b,c){bA(a,c);b==c.top&&(c.top=a);b.next&&(b.next.prev=a);a.next=b.next;a.prev=b;b.next=a},bE=function(a,b,c){bA(a,c);b==c.bottom&&(c.bottom=a);b.prev&&(b.prev.next=a);a.prev=b.prev;b.prev=a;a.next=b},bF=function(a){return function(){throw new Error("Raphaël: you are calling to method “"+a+"” of removed object")}};a.pathToRelative=bp;if(a.svg){k.svgns="http://www.w3.org/2000/svg";k.xlink="http://www.w3.org/1999/xlink";Q=function(a){return+a+(~(~a)===a)*0.5};var bG=function(a,b){if(b)for(var c in b)b[f](c)&&a[R](c,r(b[c]));else{a=g.createElementNS(k.svgns,a);a.style.webkitTapHighlightColor="rgba(0,0,0,0)";return a}};a[H]=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var bH=function(a,b){var c=bG("path");b.canvas&&b.canvas[l](c);var d=new bN(c,b);d.type="path";bK(d,{fill:"none",stroke:"#000",path:a});return d},bI=function(a,b,c){var d="linear",e=0.5,f=0.5,h=a.style;b=r(b)[Y](bd,function(a,b,c){d="radial";if(b&&c){e=S(b);f=S(c);var g=(f>0.5)*2-1;C(e-0.5,2)+C(f-0.5,2)>0.25&&(f=y.sqrt(0.25-C(e-0.5,2))*g+0.5)&&f!=0.5&&(f=f.toFixed(5)-0.00001*g)}return p});b=b[s](/\s*\-\s*/);if(d=="linear"){var i=b.shift();i=-S(i);if(isNaN(i))return null;var j=[0,0,y.cos(i*D/180),y.sin(i*D/180)],k=1/(z(B(j[2]),B(j[3]))||1);j[2]*=k;j[3]*=k;if(j[2]<0){j[0]=-j[2];j[2]=0}if(j[3]<0){j[1]=-j[3];j[3]=0}}var m=bx(b);if(!m)return null;var n=a.getAttribute(I);n=n.match(/^url\(#(.*)\)$/);n&&c.defs.removeChild(g.getElementById(n[1]));var o=bG(d+"Gradient");o.id=bh();bG(o,d=="radial"?{fx:e,fy:f}:{x1:j[0],y1:j[1],x2:j[2],y2:j[3]});c.defs[l](o);for(var q=0,t=m[w];q<t;q++){var u=bG("stop");bG(u,{offset:m[q].offset?m[q].offset:q?"100%":"0%","stop-color":m[q].color||"#fff"});o[l](u)}bG(a,{fill:"url(#"+o.id+")",opacity:1,"fill-opacity":1});h.fill=p;h.opacity=1;h.fillOpacity=1;return 1},bJ=function(b){var c=b.getBBox();bG(b.pattern,{patternTransform:a.format("translate({0},{1})",c.x,c.y)})},bK=function(c,d){var e={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},h=c.node,i=c.attrs,j=c.rotate(),k=function(a,b){b=e[x.call(b)];if(b){var c=a.attrs["stroke-width"]||"1",f=({round:c,square:c,butt:0})[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],i=b[w];while(i--)g[i]=b[i]*c+(i%2?1:-1)*f;bG(h,{"stroke-dasharray":g[v](",")})}};d[f]("rotation")&&(j=d.rotation);var m=r(j)[s](b);if(m.length-1){m[1]=+m[1];m[2]=+m[2]}else m=null;S(j)&&c.rotate(0,true);for(var n in d){if(d[f](n)){if(!W[f](n))continue;var o=d[n];i[n]=o;switch(n){case"blur":c.blur(o);break;case"rotation":c.rotate(o,true);break;case"href":case"title":case"target":var t=h.parentNode;if(x.call(t.tagName)!="a"){var u=bG("a");t.insertBefore(u,h);u[l](h);t=u}n=="target"&&o=="blank"?t.setAttributeNS(c.paper.xlink,"show","new"):t.setAttributeNS(c.paper.xlink,n,o);break;case"cursor":h.style.cursor=o;break;case"clip-rect":var y=r(o)[s](b);if(y[w]==4){c.clip&&c.clip.parentNode.parentNode.removeChild(c.clip.parentNode);var z=bG("clipPath"),A=bG("rect");z.id=bh();bG(A,{x:y[0],y:y[1],width:y[2],height:y[3]});z[l](A);c.paper.defs[l](z);bG(h,{"clip-path":"url(#"+z.id+")"});c.clip=A}if(!o){var B=g.getElementById(h.getAttribute("clip-path")[Y](/(^url\(#|\)$)/g,p));B&&B.parentNode.removeChild(B);bG(h,{"clip-path":p});delete c.clip}break;case"path":c.type=="path"&&bG(h,{d:o?i.path=bq(o):"M0,0"});break;case"width":h[R](n,o);if(i.fx){n="x";o=i.x}else break;case"x":i.fx&&(o=-i.x-(i.width||0));case"rx":if(n=="rx"&&c.type=="rect")break;case"cx":m&&(n=="x"||n=="cx")&&(m[1]+=o-i[n]);h[R](n,o);c.pattern&&bJ(c);break;case"height":h[R](n,o);if(i.fy){n="y";o=i.y}else break;case"y":i.fy&&(o=-i.y-(i.height||0));case"ry":if(n=="ry"&&c.type=="rect")break;case"cy":m&&(n=="y"||n=="cy")&&(m[2]+=o-i[n]);h[R](n,o);c.pattern&&bJ(c);break;case"r":c.type=="rect"?bG(h,{rx:o,ry:o}):h[R](n,o);break;case"src":c.type=="image"&&h.setAttributeNS(c.paper.xlink,"href",o);break;case"stroke-width":h.style.strokeWidth=o;h[R](n,o);i["stroke-dasharray"]&&k(c,i["stroke-dasharray"]);break;case"stroke-dasharray":k(c,o);break;case"translation":var C=r(o)[s](b);C[0]=+C[0]||0;C[1]=+C[1]||0;if(m){m[1]+=C[0];m[2]+=C[1]}cz.call(c,C[0],C[1]);break;case"scale":C=r(o)[s](b);c.scale(+C[0]||1,+C[1]||+C[0]||1,isNaN(S(C[2]))?null:+C[2],isNaN(S(C[3]))?null:+C[3]);break;case I:var D=r(o).match(M);if(D){z=bG("pattern");var E=bG("image");z.id=bh();bG(z,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1});bG(E,{x:0,y:0});E.setAttributeNS(c.paper.xlink,"href",D[1]);z[l](E);var F=g.createElement("img");F.style.cssText="position:absolute;left:-9999em;top-9999em";F.onload=function(){bG(z,{width:this.offsetWidth,height:this.offsetHeight});bG(E,{width:this.offsetWidth,height:this.offsetHeight});g.body.removeChild(this);c.paper.safari()};g.body[l](F);F.src=D[1];c.paper.defs[l](z);h.style.fill="url(#"+z.id+")";bG(h,{fill:"url(#"+z.id+")"});c.pattern=z;c.pattern&&bJ(c);break}var G=a.getRGB(o);if(G.error)if((({circle:1,ellipse:1})[f](c.type)||r(o).charAt()!="r")&&bI(h,o,c.paper)){i.gradient=o;i.fill="none";break}else{delete d.gradient;delete i.gradient;!a.is(i.opacity,"undefined")&&a.is(d.opacity,"undefined")&&bG(h,{opacity:i.opacity});!a.is(i["fill-opacity"],"undefined")&&a.is(d["fill-opacity"],"undefined")&&bG(h,{"fill-opacity":i["fill-opacity"]})}G[f]("opacity")&&bG(h,{"fill-opacity":G.opacity>1?G.opacity/100:G.opacity});case"stroke":G=a.getRGB(o);h[R](n,G.hex);n=="stroke"&&G[f]("opacity")&&bG(h,{"stroke-opacity":G.opacity>1?G.opacity/100:G.opacity});break;case"gradient":(({circle:1,ellipse:1})[f](c.type)||r(o).charAt()!="r")&&bI(h,o,c.paper);break;case"opacity":i.gradient&&!i[f]("stroke-opacity")&&bG(h,{"stroke-opacity":o>1?o/100:o});case"fill-opacity":if(i.gradient){var H=g.getElementById(h.getAttribute(I)[Y](/^url\(#|\)$/g,p));if(H){var J=H.getElementsByTagName("stop");J[J[w]-1][R]("stop-opacity",o)}break}default:n=="font-size"&&(o=T(o,10)+"px");var K=n[Y](/(\-.)/g,function(a){return V.call(a.substring(1))});h.style[K]=o;h[R](n,o);break}}}bM(c,d);m?c.rotate(m.join(q)):S(j)&&c.rotate(j,true)},bL=1.2,bM=function(b,c){if(b.type!="text"||!(c[f]("text")||c[f]("font")||c[f]("font-size")||c[f]("x")||c[f]("y")))return;var d=b.attrs,e=b.node,h=e.firstChild?T(g.defaultView.getComputedStyle(e.firstChild,p).getPropertyValue("font-size"),10):10;if(c[f]("text")){d.text=c.text;while(e.firstChild)e.removeChild(e.firstChild);var i=r(c.text)[s]("\n");for(var j=0,k=i[w];j<k;j++)if(i[j]){var m=bG("tspan");j&&bG(m,{dy:h*bL,x:d.x});m[l](g.createTextNode(i[j]));e[l](m)}}else{i=e.getElementsByTagName("tspan");for(j=0,k=i[w];j<k;j++)j&&bG(i[j],{dy:h*bL,x:d.x})}bG(e,{y:d.y});var n=b.getBBox(),o=d.y-(n.y+n.height/2);o&&a.is(o,"finite")&&bG(e,{y:d.y+o})},bN=function(b,c){var d=0,e=0;this[0]=b;this.id=a._oid++;this.node=b;b.raphael=this;this.paper=c;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1};!c.bottom&&(c.bottom=this);this.prev=c.top;c.top&&(c.top.next=this);c.top=this;this.next=null},bO=bN[e];bN[e].rotate=function(c,d,e){if(this.removed)return this;if(c==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][v](q);return this._.rt.deg}var f=this.getBBox();c=r(c)[s](b);if(c[w]-1){d=S(c[1]);e=S(c[2])}c=S(c[0]);d!=null&&d!==false?this._.rt.deg=c:this._.rt.deg+=c;e==null&&(d=null);this._.rt.cx=d;this._.rt.cy=e;d=d==null?f.x+f.width/2:d;e=e==null?f.y+f.height/2:e;if(this._.rt.deg){this.transformations[0]=a.format("rotate({0} {1} {2})",this._.rt.deg,d,e);this.clip&&bG(this.clip,{transform:a.format("rotate({0} {1} {2})",-this._.rt.deg,d,e)})}else{this.transformations[0]=p;this.clip&&bG(this.clip,{transform:p})}bG(this.node,{transform:this.transformations[v](q)});return this};bN[e].hide=function(){!this.removed&&(this.node.style.display="none");return this};bN[e].show=function(){!this.removed&&(this.node.style.display="");return this};bN[e].remove=function(){if(this.removed)return;bA(this,this.paper);this.node.parentNode.removeChild(this.node);for(var a in this)delete this[a];this.removed=true};bN[e].getBBox=function(){if(this.removed)return this;if(this.type=="path")return bn(this.attrs.path);if(this.node.style.display=="none"){this.show();var a=true}var b={};try{b=this.node.getBBox()}catch(a){}finally{b=b||{}}if(this.type=="text"){b={x:b.x,y:Infinity,width:0,height:0};for(var c=0,d=this.node.getNumberOfChars();c<d;c++){var e=this.node.getExtentOfChar(c);e.y<b.y&&(b.y=e.y);e.y+e.height-b.y>b.height&&(b.height=e.y+e.height-b.y);e.x+e.width-b.x>b.width&&(b.width=e.x+e.width-b.x)}}a&&this.hide();return b};bN[e].attr=function(b,c){if(this.removed)return this;if(b==null){var d={};for(var e in this.attrs)this.attrs[f](e)&&(d[e]=this.attrs[e]);this._.rt.deg&&(d.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(d.scale=this.scale());d.gradient&&d.fill=="none"&&(d.fill=d.gradient)&&delete d.gradient;return d}if(c==null&&a.is(b,F)){if(b=="translation")return cz.call(this);if(b=="rotation")return this.rotate();if(b=="scale")return this.scale();if(b==I&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[b]}if(c==null&&a.is(b,G)){var g={};for(var h=0,i=b.length;h<i;h++)g[b[h]]=this.attr(b[h]);return g}if(c!=null){var j={};j[b]=c}else b!=null&&a.is(b,"object")&&(j=b);for(var k in this.paper.customAttributes)if(this.paper.customAttributes[f](k)&&j[f](k)&&a.is(this.paper.customAttributes[k],"function")){var l=this.paper.customAttributes[k].apply(this,[][n](j[k]));this.attrs[k]=j[k];for(var m in l)l[f](m)&&(j[m]=l[m])}bK(this,j);return this};bN[e].toFront=function(){if(this.removed)return this;this.node.parentNode[l](this.node);var a=this.paper;a.top!=this&&bB(this,a);return this};bN[e].toBack=function(){if(this.removed)return this;if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);bC(this,this.paper);var a=this.paper}return this};bN[e].insertAfter=function(a){if(this.removed)return this;var b=a.node||a[a.length-1].node;b.nextSibling?b.parentNode.insertBefore(this.node,b.nextSibling):b.parentNode[l](this.node);bD(this,a,this.paper);return this};bN[e].insertBefore=function(a){if(this.removed)return this;var b=a.node||a[0].node;b.parentNode.insertBefore(this.node,b);bE(this,a,this.paper);return this};bN[e].blur=function(a){var b=this;if(+a!==0){var c=bG("filter"),d=bG("feGaussianBlur");b.attrs.blur=a;c.id=bh();bG(d,{stdDeviation:+a||1.5});c.appendChild(d);b.paper.defs.appendChild(c);b._blur=c;bG(b.node,{filter:"url(#"+c.id+")"})}else{if(b._blur){b._blur.parentNode.removeChild(b._blur);delete b._blur;delete b.attrs.blur}b.node.removeAttribute("filter")}};var bP=function(a,b,c,d){var e=bG("circle");a.canvas&&a.canvas[l](e);var f=new bN(e,a);f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"};f.type="circle";bG(e,f.attrs);return f},bQ=function(a,b,c,d,e,f){var g=bG("rect");a.canvas&&a.canvas[l](g);var h=new bN(g,a);h.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"};h.type="rect";bG(g,h.attrs);return h},bR=function(a,b,c,d,e){var f=bG("ellipse");a.canvas&&a.canvas[l](f);var g=new bN(f,a);g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"};g.type="ellipse";bG(f,g.attrs);return g},bS=function(a,b,c,d,e,f){var g=bG("image");bG(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"});g.setAttributeNS(a.xlink,"href",b);a.canvas&&a.canvas[l](g);var h=new bN(g,a);h.attrs={x:c,y:d,width:e,height:f,src:b};h.type="image";return h},bT=function(a,b,c,d){var e=bG("text");bG(e,{x:b,y:c,"text-anchor":"middle"});a.canvas&&a.canvas[l](e);var f=new bN(e,a);f.attrs={x:b,y:c,"text-anchor":"middle",text:d,font:W.font,stroke:"none",fill:"#000"};f.type="text";bK(f,f.attrs);return f},bU=function(a,b){this.width=a||this.width;this.height=b||this.height;this.canvas[R]("width",this.width);this.canvas[R]("height",this.height);return this},bV=function(){var b=by[m](0,arguments),c=b&&b.container,d=b.x,e=b.y,f=b.width,h=b.height;if(!c)throw new Error("SVG container not found.");var i=bG("svg");d=d||0;e=e||0;f=f||512;h=h||342;bG(i,{xmlns:"http://www.w3.org/2000/svg",version:1.1,width:f,height:h});if(c==1){i.style.cssText="position:absolute;left:"+d+"px;top:"+e+"px";g.body[l](i)}else c.firstChild?c.insertBefore(i,c.firstChild):c[l](i);c=new j;c.width=f;c.height=h;c.canvas=i;bz.call(c,c,a.fn);c.clear();return c};k.clear=function(){var a=this.canvas;while(a.firstChild)a.removeChild(a.firstChild);this.bottom=this.top=null;(this.desc=bG("desc"))[l](g.createTextNode("Created with Raphaël"));a[l](this.desc);a[l](this.defs=bG("defs"))};k.remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=bF(a)}}if(a.vml){var bW={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},bX=/([clmz]),?([^clmz]*)/gi,bY=/ progid:\S+Blur\([^\)]+\)/g,bZ=/-?[^,\s-]+/g,b$=1000+q+1000,b_=10,ca={path:1,rect:1},cb=function(a){var b=/[ahqstv]/ig,c=bq;r(a).match(b)&&(c=bw);b=/[clmz]/g;if(c==bq&&!r(a).match(b)){var d=r(a)[Y](bX,function(a,b,c){var d=[],e=x.call(b)=="m",f=bW[b];c[Y](bZ,function(a){if(e&&d[w]==2){f+=d+bW[b=="m"?"l":"L"];d=[]}d[L](Q(a*b_))});return f+d});return d}var e=c(a),f,g;d=[];for(var h=0,i=e[w];h<i;h++){f=e[h];g=x.call(e[h][0]);g=="z"&&(g="x");for(var j=1,k=f[w];j<k;j++)g+=Q(f[j]*b_)+(j!=k-1?",":p);d[L](g)}return d[v](q)};a[H]=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};bH=function(a,b){var c=cd("group");c.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px";c.coordsize=b.coordsize;c.coordorigin=b.coordorigin;var d=cd("shape"),e=d.style;e.width=b.width+"px";e.height=b.height+"px";d.coordsize=b$;d.coordorigin=b.coordorigin;c[l](d);var f=new bN(d,c,b),g={fill:"none",stroke:"#000"};a&&(g.path=a);f.type="path";f.path=[];f.Path=p;bK(f,g);b.canvas[l](c);return f};bK=function(c,d){c.attrs=c.attrs||{};var e=c.node,h=c.attrs,i=e.style,j,k=(d.x!=h.x||d.y!=h.y||d.width!=h.width||d.height!=h.height||d.r!=h.r)&&c.type=="rect",m=c;for(var n in d)d[f](n)&&(h[n]=d[n]);if(k){h.path=cc(h.x,h.y,h.width,h.height,h.r);c.X=h.x;c.Y=h.y;c.W=h.width;c.H=h.height}d.href&&(e.href=d.href);d.title&&(e.title=d.title);d.target&&(e.target=d.target);d.cursor&&(i.cursor=d.cursor);"blur"in d&&c.blur(d.blur);if(d.path&&c.type=="path"||k)e.path=cb(h.path);d.rotation!=null&&c.rotate(d.rotation,true);if(d.translation){j=r(d.translation)[s](b);cz.call(c,j[0],j[1]);if(c._.rt.cx!=null){c._.rt.cx+=+j[0];c._.rt.cy+=+j[1];c.setBox(c.attrs,j[0],j[1])}}if(d.scale){j=r(d.scale)[s](b);c.scale(+j[0]||1,+j[1]||+j[0]||1,+j[2]||null,+j[3]||null)}if("clip-rect"in d){var o=r(d["clip-rect"])[s](b);if(o[w]==4){o[2]=+o[2]+ +o[0];o[3]=+o[3]+ +o[1];var q=e.clipRect||g.createElement("div"),t=q.style,u=e.parentNode;t.clip=a.format("rect({1}px {2}px {3}px {0}px)",o);if(!e.clipRect){t.position="absolute";t.top=0;t.left=0;t.width=c.paper.width+"px";t.height=c.paper.height+"px";u.parentNode.insertBefore(q,u);q[l](u);e.clipRect=q}}d["clip-rect"]||e.clipRect&&(e.clipRect.style.clip=p)}c.type=="image"&&d.src&&(e.src=d.src);if(c.type=="image"&&d.opacity){e.filterOpacity=U+".Alpha(opacity="+d.opacity*100+")";i.filter=(e.filterMatrix||p)+(e.filterOpacity||p)}d.font&&(i.font=d.font);d["font-family"]&&(i.fontFamily="\""+d["font-family"][s](",")[0][Y](/^['"]+|['"]+$/g,p)+"\"");d["font-size"]&&(i.fontSize=d["font-size"]);d["font-weight"]&&(i.fontWeight=d["font-weight"]);d["font-style"]&&(i.fontStyle=d["font-style"]);if(d.opacity!=null||d["stroke-width"]!=null||d.fill!=null||d.stroke!=null||d["stroke-width"]!=null||d["stroke-opacity"]!=null||d["fill-opacity"]!=null||d["stroke-dasharray"]!=null||d["stroke-miterlimit"]!=null||d["stroke-linejoin"]!=null||d["stroke-linecap"]!=null){e=c.shape||e;var v=e.getElementsByTagName(I)&&e.getElementsByTagName(I)[0],x=false;!v&&(x=v=cd(I));if("fill-opacity"in d||"opacity"in d){var y=((+h["fill-opacity"]+1||2)-1)*((+h.opacity+1||2)-1)*((+a.getRGB(d.fill).o+1||2)-1);y=A(z(y,0),1);v.opacity=y}d.fill&&(v.on=true);if(v.on==null||d.fill=="none")v.on=false;if(v.on&&d.fill){var B=d.fill.match(M);if(B){v.src=B[1];v.type="tile"}else{v.color=a.getRGB(d.fill).hex;v.src=p;v.type="solid";if(a.getRGB(d.fill).error&&(m.type in{circle:1,ellipse:1}||r(d.fill).charAt()!="r")&&bI(m,d.fill)){h.fill="none";h.gradient=d.fill}}}x&&e[l](v);var C=e.getElementsByTagName("stroke")&&e.getElementsByTagName("stroke")[0],D=false;!C&&(D=C=cd("stroke"));if(d.stroke&&d.stroke!="none"||d["stroke-width"]||d["stroke-opacity"]!=null||d["stroke-dasharray"]||d["stroke-miterlimit"]||d["stroke-linejoin"]||d["stroke-linecap"])C.on=true;(d.stroke=="none"||C.on==null||d.stroke==0||d["stroke-width"]==0)&&(C.on=false);var E=a.getRGB(d.stroke);C.on&&d.stroke&&(C.color=E.hex);y=((+h["stroke-opacity"]+1||2)-1)*((+h.opacity+1||2)-1)*((+E.o+1||2)-1);var F=(S(d["stroke-width"])||1)*0.75;y=A(z(y,0),1);d["stroke-width"]==null&&(F=h["stroke-width"]);d["stroke-width"]&&(C.weight=F);F&&F<1&&(y*=F)&&(C.weight=1);C.opacity=y;d["stroke-linejoin"]&&(C.joinstyle=d["stroke-linejoin"]||"miter");C.miterlimit=d["stroke-miterlimit"]||8;d["stroke-linecap"]&&(C.endcap=d["stroke-linecap"]=="butt"?"flat":d["stroke-linecap"]=="square"?"square":"round");if(d["stroke-dasharray"]){var G={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};C.dashstyle=G[f](d["stroke-dasharray"])?G[d["stroke-dasharray"]]:p}D&&e[l](C)}if(m.type=="text"){i=m.paper.span.style;h.font&&(i.font=h.font);h["font-family"]&&(i.fontFamily=h["font-family"]);h["font-size"]&&(i.fontSize=h["font-size"]);h["font-weight"]&&(i.fontWeight=h["font-weight"]);h["font-style"]&&(i.fontStyle=h["font-style"]);m.node.string&&(m.paper.span.innerHTML=r(m.node.string)[Y](/</g,"<")[Y](/&/g,"&")[Y](/\n/g,"<br>"));m.W=h.w=m.paper.span.offsetWidth;m.H=h.h=m.paper.span.offsetHeight;m.X=h.x;m.Y=h.y+Q(m.H/2);switch(h["text-anchor"]){case"start":m.node.style["v-text-align"]="left";m.bbx=Q(m.W/2);break;case"end":m.node.style["v-text-align"]="right";m.bbx=-Q(m.W/2);break;default:m.node.style["v-text-align"]="center";break}}};bI=function(a,b){a.attrs=a.attrs||{};var c=a.attrs,d,e="linear",f=".5 .5";a.attrs.gradient=b;b=r(b)[Y](bd,function(a,b,c){e="radial";if(b&&c){b=S(b);c=S(c);C(b-0.5,2)+C(c-0.5,2)>0.25&&(c=y.sqrt(0.25-C(b-0.5,2))*((c>0.5)*2-1)+0.5);f=b+q+c}return p});b=b[s](/\s*\-\s*/);if(e=="linear"){var g=b.shift();g=-S(g);if(isNaN(g))return null}var h=bx(b);if(!h)return null;a=a.shape||a.node;d=a.getElementsByTagName(I)[0]||cd(I);!d.parentNode&&a.appendChild(d);if(h[w]){d.on=true;d.method="none";d.color=h[0].color;d.color2=h[h[w]-1].color;var i=[];for(var j=0,k=h[w];j<k;j++)h[j].offset&&i[L](h[j].offset+q+h[j].color);d.colors&&(d.colors.value=i[w]?i[v]():"0% "+d.color);if(e=="radial"){d.type="gradientradial";d.focus="100%";d.focussize=f;d.focusposition=f}else{d.type="gradient";d.angle=(270-g)%360}}return 1};bN=function(b,c,d){var e=0,f=0,g=0,h=1;this[0]=b;this.id=a._oid++;this.node=b;b.raphael=this;this.X=0;this.Y=0;this.attrs={};this.Group=c;this.paper=d;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};!d.bottom&&(d.bottom=this);this.prev=d.top;d.top&&(d.top.next=this);d.top=this;this.next=null};bO=bN[e];bO.rotate=function(a,c,d){if(this.removed)return this;if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][v](q);return this._.rt.deg}a=r(a)[s](b);if(a[w]-1){c=S(a[1]);d=S(a[2])}a=S(a[0]);c!=null?this._.rt.deg=a:this._.rt.deg+=a;d==null&&(c=null);this._.rt.cx=c;this._.rt.cy=d;this.setBox(this.attrs,c,d);this.Group.style.rotation=this._.rt.deg;return this};bO.setBox=function(a,b,c){if(this.removed)return this;var d=this.Group.style,e=this.shape&&this.shape.style||this.node.style;a=a||{};for(var g in a)a[f](g)&&(this.attrs[g]=a[g]);b=b||this._.rt.cx;c=c||this._.rt.cy;var h=this.attrs,i,j,k,l;switch(this.type){case"circle":i=h.cx-h.r;j=h.cy-h.r;k=l=h.r*2;break;case"ellipse":i=h.cx-h.rx;j=h.cy-h.ry;k=h.rx*2;l=h.ry*2;break;case"image":i=+h.x;j=+h.y;k=h.width||0;l=h.height||0;break;case"text":this.textpath.v=["m",Q(h.x),", ",Q(h.y-2),"l",Q(h.x)+1,", ",Q(h.y-2)][v](p);i=h.x-Q(this.W/2);j=h.y-this.H/2;k=this.W;l=this.H;break;case"rect":case"path":if(this.attrs.path){var m=bn(this.attrs.path);i=m.x;j=m.y;k=m.width;l=m.height}else{i=0;j=0;k=this.paper.width;l=this.paper.height}break;default:i=0;j=0;k=this.paper.width;l=this.paper.height;break}b=b==null?i+k/2:b;c=c==null?j+l/2:c;var n=b-this.paper.width/2,o=c-this.paper.height/2,q;d.left!=(q=n+"px")&&(d.left=q);d.top!=(q=o+"px")&&(d.top=q);this.X=ca[f](this.type)?-n:i;this.Y=ca[f](this.type)?-o:j;this.W=k;this.H=l;if(ca[f](this.type)){e.left!=(q=-n*b_+"px")&&(e.left=q);e.top!=(q=-o*b_+"px")&&(e.top=q)}else if(this.type=="text"){e.left!=(q=-n+"px")&&(e.left=q);e.top!=(q=-o+"px")&&(e.top=q)}else{d.width!=(q=this.paper.width+"px")&&(d.width=q);d.height!=(q=this.paper.height+"px")&&(d.height=q);e.left!=(q=i-n+"px")&&(e.left=q);e.top!=(q=j-o+"px")&&(e.top=q);e.width!=(q=k+"px")&&(e.width=q);e.height!=(q=l+"px")&&(e.height=q)}};bO.hide=function(){!this.removed&&(this.Group.style.display="none");return this};bO.show=function(){!this.removed&&(this.Group.style.display="block");return this};bO.getBBox=function(){if(this.removed)return this;if(ca[f](this.type))return bn(this.attrs.path);return{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}};bO.remove=function(){if(this.removed)return;bA(this,this.paper);this.node.parentNode.removeChild(this.node);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);for(var a in this)delete this[a];this.removed=true};bO.attr=function(b,c){if(this.removed)return this;if(b==null){var d={};for(var e in this.attrs)this.attrs[f](e)&&(d[e]=this.attrs[e]);this._.rt.deg&&(d.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(d.scale=this.scale());d.gradient&&d.fill=="none"&&(d.fill=d.gradient)&&delete d.gradient;return d}if(c==null&&a.is(b,"string")){if(b=="translation")return cz.call(this);if(b=="rotation")return this.rotate();if(b=="scale")return this.scale();if(b==I&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[b]}if(this.attrs&&c==null&&a.is(b,G)){var g,h={};for(e=0,g=b[w];e<g;e++)h[b[e]]=this.attr(b[e]);return h}var i;if(c!=null){i={};i[b]=c}c==null&&a.is(b,"object")&&(i=b);if(i){for(var j in this.paper.customAttributes)if(this.paper.customAttributes[f](j)&&i[f](j)&&a.is(this.paper.customAttributes[j],"function")){var k=this.paper.customAttributes[j].apply(this,[][n](i[j]));this.attrs[j]=i[j];for(var l in k)k[f](l)&&(i[l]=k[l])}i.text&&this.type=="text"&&(this.node.string=i.text);bK(this,i);i.gradient&&(({circle:1,ellipse:1})[f](this.type)||r(i.gradient).charAt()!="r")&&bI(this,i.gradient);(!ca[f](this.type)||this._.rt.deg)&&this.setBox(this.attrs)}return this};bO.toFront=function(){!this.removed&&this.Group.parentNode[l](this.Group);this.paper.top!=this&&bB(this,this.paper);return this};bO.toBack=function(){if(this.removed)return this;if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);bC(this,this.paper)}return this};bO.insertAfter=function(a){if(this.removed)return this;a.constructor==cC&&(a=a[a.length-1]);a.Group.nextSibling?a.Group.parentNode.insertBefore(this.Group,a.Group.nextSibling):a.Group.parentNode[l](this.Group);bD(this,a,this.paper);return this};bO.insertBefore=function(a){if(this.removed)return this;a.constructor==cC&&(a=a[0]);a.Group.parentNode.insertBefore(this.Group,a.Group);bE(this,a,this.paper);return this};bO.blur=function(b){var c=this.node.runtimeStyle,d=c.filter;d=d.replace(bY,p);if(+b!==0){this.attrs.blur=b;c.filter=d+q+U+".Blur(pixelradius="+(+b||1.5)+")";c.margin=a.format("-{0}px 0 0 -{0}px",Q(+b||1.5))}else{c.filter=d;c.margin=0;delete this.attrs.blur}};bP=function(a,b,c,d){var e=cd("group"),f=cd("oval"),g=f.style;e.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";e.coordsize=b$;e.coordorigin=a.coordorigin;e[l](f);var h=new bN(f,e,a);h.type="circle";bK(h,{stroke:"#000",fill:"none"});h.attrs.cx=b;h.attrs.cy=c;h.attrs.r=d;h.setBox({x:b-d,y:c-d,width:d*2,height:d*2});a.canvas[l](e);return h};function cc(b,c,d,e,f){return f?a.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z",b+f,c,d-f*2,f,-f,e-f*2,f*2-d,f*2-e):a.format("M{0},{1}l{2},0,0,{3},{4},0z",b,c,d,e,-d)}bQ=function(a,b,c,d,e,f){var g=cc(b,c,d,e,f),h=a.path(g),i=h.attrs;h.X=i.x=b;h.Y=i.y=c;h.W=i.width=d;h.H=i.height=e;i.r=f;i.path=g;h.type="rect";return h};bR=function(a,b,c,d,e){var f=cd("group"),g=cd("oval"),h=g.style;f.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";f.coordsize=b$;f.coordorigin=a.coordorigin;f[l](g);var i=new bN(g,f,a);i.type="ellipse";bK(i,{stroke:"#000"});i.attrs.cx=b;i.attrs.cy=c;i.attrs.rx=d;i.attrs.ry=e;i.setBox({x:b-d,y:c-e,width:d*2,height:e*2});a.canvas[l](f);return i};bS=function(a,b,c,d,e,f){var g=cd("group"),h=cd("image");g.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";g.coordsize=b$;g.coordorigin=a.coordorigin;h.src=b;g[l](h);var i=new bN(h,g,a);i.type="image";i.attrs.src=b;i.attrs.x=c;i.attrs.y=d;i.attrs.w=e;i.attrs.h=f;i.setBox({x:c,y:d,width:e,height:f});a.canvas[l](g);return i};bT=function(b,c,d,e){var f=cd("group"),g=cd("shape"),h=g.style,i=cd("path"),j=i.style,k=cd("textpath");f.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px";f.coordsize=b$;f.coordorigin=b.coordorigin;i.v=a.format("m{0},{1}l{2},{1}",Q(c*10),Q(d*10),Q(c*10)+1);i.textpathok=true;h.width=b.width;h.height=b.height;k.string=r(e);k.on=true;g[l](k);g[l](i);f[l](g);var m=new bN(k,f,b);m.shape=g;m.textpath=i;m.type="text";m.attrs.text=e;m.attrs.x=c;m.attrs.y=d;m.attrs.w=1;m.attrs.h=1;bK(m,{font:W.font,stroke:"none",fill:"#000"});m.setBox();b.canvas[l](f);return m};bU=function(a,b){var c=this.canvas.style;a==+a&&(a+="px");b==+b&&(b+="px");c.width=a;c.height=b;c.clip="rect(0 "+a+" "+b+" 0)";return this};var cd;g.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!g.namespaces.rvml&&g.namespaces.add("rvml","urn:schemas-microsoft-com:vml");cd=function(a){return g.createElement("<rvml:"+a+" class=\"rvml\">")}}catch(a){cd=function(a){return g.createElement("<"+a+" xmlns=\"urn:schemas-microsoft.com:vml\" class=\"rvml\">")}}bV=function(){var b=by[m](0,arguments),c=b.container,d=b.height,e,f=b.width,h=b.x,i=b.y;if(!c)throw new Error("VML container not found.");var k=new j,n=k.canvas=g.createElement("div"),o=n.style;h=h||0;i=i||0;f=f||512;d=d||342;f==+f&&(f+="px");d==+d&&(d+="px");k.width=1000;k.height=1000;k.coordsize=b_*1000+q+b_*1000;k.coordorigin="0 0";k.span=g.createElement("span");k.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";n[l](k.span);o.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",f,d);if(c==1){g.body[l](n);o.left=h+"px";o.top=i+"px";o.position="absolute"}else c.firstChild?c.insertBefore(n,c.firstChild):c[l](n);bz.call(k,k,a.fn);return k};k.clear=function(){this.canvas.innerHTML=p;this.span=g.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas[l](this.span);this.bottom=this.top=null};k.remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=bF(a);return true}}var ce=navigator.userAgent.match(/Version\\x2f(.*?)\s/);navigator.vendor=="Apple Computer, Inc."&&(ce&&ce[1]<4||navigator.platform.slice(0,2)=="iP")?k.safari=function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});h.setTimeout(function(){a.remove()})}:k.safari=function(){};var cf=function(){this.returnValue=false},cg=function(){return this.originalEvent.preventDefault()},ch=function(){this.cancelBubble=true},ci=function(){return this.originalEvent.stopPropagation()},cj=(function(){{if(g.addEventListener)return function(a,b,c,d){var e=o&&u[b]?u[b]:b,g=function(e){if(o&&u[f](b))for(var g=0,h=e.targetTouches&&e.targetTouches.length;g<h;g++){if(e.targetTouches[g].target==a){var i=e;e=e.targetTouches[g];e.originalEvent=i;e.preventDefault=cg;e.stopPropagation=ci;break}}return c.call(d,e)};a.addEventListener(e,g,false);return function(){a.removeEventListener(e,g,false);return true}};if(g.attachEvent)return function(a,b,c,d){var e=function(a){a=a||h.event;a.preventDefault=a.preventDefault||cf;a.stopPropagation=a.stopPropagation||ch;return c.call(d,a)};a.attachEvent("on"+b,e);var f=function(){a.detachEvent("on"+b,e);return true};return f}}})(),ck=[],cl=function(a){var b=a.clientX,c=a.clientY,d=g.documentElement.scrollTop||g.body.scrollTop,e=g.documentElement.scrollLeft||g.body.scrollLeft,f,h=ck.length;while(h--){f=ck[h];if(o){var i=a.touches.length,j;while(i--){j=a.touches[i];if(j.identifier==f.el._drag.id){b=j.clientX;c=j.clientY;(a.originalEvent?a.originalEvent:a).preventDefault();break}}}else a.preventDefault();b+=e;c+=d;f.move&&f.move.call(f.move_scope||f.el,b-f.el._drag.x,c-f.el._drag.y,b,c,a)}},cm=function(b){a.unmousemove(cl).unmouseup(cm);var c=ck.length,d;while(c--){d=ck[c];d.el._drag={};d.end&&d.end.call(d.end_scope||d.start_scope||d.move_scope||d.el,b)}ck=[]};for(var cn=t[w];cn--;)(function(b){a[b]=bN[e][b]=function(c,d){if(a.is(c,"function")){this.events=this.events||[];this.events.push({name:b,f:c,unbind:cj(this.shape||this.node||g,b,c,d||this)})}return this};a["un"+b]=bN[e]["un"+b]=function(a){var c=this.events,d=c[w];while(d--)if(c[d].name==b&&c[d].f==a){c[d].unbind();c.splice(d,1);!c.length&&delete this.events;return this}return this}})(t[cn]);bO.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)};bO.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};bO.drag=function(b,c,d,e,f,h){this._drag={};this.mousedown(function(i){(i.originalEvent||i).preventDefault();var j=g.documentElement.scrollTop||g.body.scrollTop,k=g.documentElement.scrollLeft||g.body.scrollLeft;this._drag.x=i.clientX+k;this._drag.y=i.clientY+j;this._drag.id=i.identifier;c&&c.call(f||e||this,i.clientX+k,i.clientY+j,i);!ck.length&&a.mousemove(cl).mouseup(cm);ck.push({el:this,move:b,end:d,move_scope:e,start_scope:f,end_scope:h})});return this};bO.undrag=function(b,c,d){var e=ck.length;while(e--)ck[e].el==this&&(ck[e].move==b&&ck[e].end==d)&&ck.splice(e++,1);!ck.length&&a.unmousemove(cl).unmouseup(cm)};k.circle=function(a,b,c){return bP(this,a||0,b||0,c||0)};k.rect=function(a,b,c,d,e){return bQ(this,a||0,b||0,c||0,d||0,e||0)};k.ellipse=function(a,b,c,d){return bR(this,a||0,b||0,c||0,d||0)};k.path=function(b){b&&!a.is(b,F)&&!a.is(b[0],G)&&(b+=p);return bH(a.format[m](a,arguments),this)};k.image=function(a,b,c,d,e){return bS(this,a||"about:blank",b||0,c||0,d||0,e||0)};k.text=function(a,b,c){return bT(this,a||0,b||0,r(c))};k.set=function(a){arguments[w]>1&&(a=Array[e].splice.call(arguments,0,arguments[w]));return new cC(a)};k.setSize=bU;k.top=k.bottom=null;k.raphael=a;function co(){return this.x+q+this.y}bO.resetScale=function(){if(this.removed)return this;this._.sx=1;this._.sy=1;this.attrs.scale="1 1"};bO.scale=function(a,b,c,d){if(this.removed)return this;if(a==null&&b==null)return{x:this._.sx,y:this._.sy,toString:co};b=b||a;!(+b)&&(b=a);var e,f,g,h,i=this.attrs;if(a!=0){var j=this.getBBox(),k=j.x+j.width/2,l=j.y+j.height/2,m=B(a/this._.sx),o=B(b/this._.sy);c=+c||c==0?c:k;d=+d||d==0?d:l;var r=this._.sx>0,s=this._.sy>0,t=~(~(a/B(a))),u=~(~(b/B(b))),x=m*t,y=o*u,z=this.node.style,A=c+B(k-c)*x*(k>c==r?1:-1),C=d+B(l-d)*y*(l>d==s?1:-1),D=a*t>b*u?o:m;switch(this.type){case"rect":case"image":var E=i.width*m,F=i.height*o;this.attr({height:F,r:i.r*D,width:E,x:A-E/2,y:C-F/2});break;case"circle":case"ellipse":this.attr({rx:i.rx*m,ry:i.ry*o,r:i.r*D,cx:A,cy:C});break;case"text":this.attr({x:A,y:C});break;case"path":var G=bp(i.path),H=true,I=r?x:m,J=s?y:o;for(var K=0,L=G[w];K<L;K++){var M=G[K],N=V.call(M[0]);{if(N=="M"&&H)continue;H=false}if(N=="A"){M[G[K][w]-2]*=I;M[G[K][w]-1]*=J;M[1]*=m;M[2]*=o;M[5]=+(t+u?!(!(+M[5])):!(+M[5]))}else if(N=="H")for(var O=1,P=M[w];O<P;O++)M[O]*=I;else if(N=="V")for(O=1,P=M[w];O<P;O++)M[O]*=J;else for(O=1,P=M[w];O<P;O++)M[O]*=O%2?I:J}var Q=bn(G);e=A-Q.x-Q.width/2;f=C-Q.y-Q.height/2;G[0][1]+=e;G[0][2]+=f;this.attr({path:G});break}if(this.type in{text:1,image:1}&&(t!=1||u!=1))if(this.transformations){this.transformations[2]="scale("[n](t,",",u,")");this.node[R]("transform",this.transformations[v](q));e=t==-1?-i.x-(E||0):i.x;f=u==-1?-i.y-(F||0):i.y;this.attr({x:e,y:f});i.fx=t-1;i.fy=u-1}else{this.node.filterMatrix=U+".Matrix(M11="[n](t,", M12=0, M21=0, M22=",u,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");z.filter=(this.node.filterMatrix||p)+(this.node.filterOpacity||p)}else if(this.transformations){this.transformations[2]=p;this.node[R]("transform",this.transformations[v](q));i.fx=0;i.fy=0}else{this.node.filterMatrix=p;z.filter=(this.node.filterMatrix||p)+(this.node.filterOpacity||p)}i.scale=[a,b,c,d][v](q);this._.sx=a;this._.sy=b}return this};bO.clone=function(){if(this.removed)return null;var a=this.attr();delete a.scale;delete a.translation;return this.paper[this.type]().attr(a)};var cp={},cq=function(b,c,d,e,f,g,h,i,j){var k=0,l=100,m=[b,c,d,e,f,g,h,i].join(),n=cp[m],o,p;!n&&(cp[m]=n={data:[]});n.timer&&clearTimeout(n.timer);n.timer=setTimeout(function(){delete cp[m]},2000);if(j!=null){var q=cq(b,c,d,e,f,g,h,i);l=~(~q)*10}for(var r=0;r<l+1;r++){if(n.data[j]>r)p=n.data[r*l];else{p=a.findDotsAtSegment(b,c,d,e,f,g,h,i,r/l);n.data[r]=p}r&&(k+=C(C(o.x-p.x,2)+C(o.y-p.y,2),0.5));if(j!=null&&k>=j)return p;o=p}if(j==null)return k},cr=function(b,c){return function(d,e,f){d=bw(d);var g,h,i,j,k="",l={},m,n=0;for(var o=0,p=d.length;o<p;o++){i=d[o];if(i[0]=="M"){g=+i[1];h=+i[2]}else{j=cq(g,h,i[1],i[2],i[3],i[4],i[5],i[6]);if(n+j>e){if(c&&!l.start){m=cq(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);k+=["C",m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k;k=["M",m.x,m.y+"C",m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]][v]();n+=j;g=+i[5];h=+i[6];continue}if(!b&&!c){m=cq(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j;g=+i[5];h=+i[6]}k+=i}l.end=k;m=b?n:c?l:a.findDotsAtSegment(g,h,i[1],i[2],i[3],i[4],i[5],i[6],1);m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},cs=cr(1),ct=cr(),cu=cr(0,1);bO.getTotalLength=function(){if(this.type!="path")return;if(this.node.getTotalLength)return this.node.getTotalLength();return cs(this.attrs.path)};bO.getPointAtLength=function(a){if(this.type!="path")return;return ct(this.attrs.path,a)};bO.getSubpath=function(a,b){if(this.type!="path")return;if(B(this.getTotalLength()-b)<"1e-6")return cu(this.attrs.path,a).end;var c=cu(this.attrs.path,b,1);return a?cu(c,a).end:c};a.easing_formulas={linear:function(a){return a},"<":function(a){return C(a,3)},">":function(a){return C(a-1,3)+1},"<>":function(a){a=a*2;if(a<1)return C(a,3)/2;a-=2;return(C(a,3)+2)/2},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==0||a==1)return a;var b=0.3,c=b/4;return C(2,-10*a)*y.sin((a-c)*(2*D)/b)+1},bounce:function(a){var b=7.5625,c=2.75,d;if(a<1/c)d=b*a*a;else if(a<2/c){a-=1.5/c;d=b*a*a+0.75}else if(a<2.5/c){a-=2.25/c;d=b*a*a+0.9375}else{a-=2.625/c;d=b*a*a+0.984375}return d}};var cv=[],cw=function(){var b=+(new Date);for(var c=0;c<cv[w];c++){var d=cv[c];if(d.stop||d.el.removed)continue;var e=b-d.start,g=d.ms,h=d.easing,i=d.from,j=d.diff,k=d.to,l=d.t,m=d.el,n={},o;if(e<g){var r=h(e/g);for(var s in i)if(i[f](s)){switch(X[s]){case"along":o=r*g*j[s];k.back&&(o=k.len-o);var t=ct(k[s],o);m.translate(j.sx-j.x||0,j.sy-j.y||0);j.x=t.x;j.y=t.y;m.translate(t.x-j.sx,t.y-j.sy);k.rot&&m.rotate(j.r+t.alpha,t.x,t.y);break;case E:o=+i[s]+r*g*j[s];break;case"colour":o="rgb("+[cy(Q(i[s].r+r*g*j[s].r)),cy(Q(i[s].g+r*g*j[s].g)),cy(Q(i[s].b+r*g*j[s].b))][v](",")+")";break;case"path":o=[];for(var u=0,x=i[s][w];u<x;u++){o[u]=[i[s][u][0]];for(var y=1,z=i[s][u][w];y<z;y++)o[u][y]=+i[s][u][y]+r*g*j[s][u][y];o[u]=o[u][v](q)}o=o[v](q);break;case"csv":switch(s){case"translation":var A=r*g*j[s][0]-l.x,B=r*g*j[s][1]-l.y;l.x+=A;l.y+=B;o=A+q+B;break;case"rotation":o=+i[s][0]+r*g*j[s][0];i[s][1]&&(o+=","+i[s][1]+","+i[s][2]);break;case"scale":o=[+i[s][0]+r*g*j[s][0],+i[s][1]+r*g*j[s][1],2 in k[s]?k[s][2]:p,3 in k[s]?k[s][3]:p][v](q);break;case"clip-rect":o=[];u=4;while(u--)o[u]=+i[s][u]+r*g*j[s][u];break}break;default:var C=[].concat(i[s]);o=[];u=m.paper.customAttributes[s].length;while(u--)o[u]=+C[u]+r*g*j[s][u];break}n[s]=o}m.attr(n);m._run&&m._run.call(m)}else{if(k.along){t=ct(k.along,k.len*!k.back);m.translate(j.sx-(j.x||0)+t.x-j.sx,j.sy-(j.y||0)+t.y-j.sy);k.rot&&m.rotate(j.r+t.alpha,t.x,t.y)}(l.x||l.y)&&m.translate(-l.x,-l.y);k.scale&&(k.scale+=p);m.attr(k);cv.splice(c--,1)}}a.svg&&m&&m.paper&&m.paper.safari();cv[w]&&setTimeout(cw)},cx=function(b,c,d,e,f){var g=d-e;c.timeouts.push(setTimeout(function(){a.is(f,"function")&&f.call(c);c.animate(b,g,b.easing)},e))},cy=function(a){return z(A(a,255),0)},cz=function(a,b){if(a==null)return{x:this._.tx,y:this._.ty,toString:co};this._.tx+=+a;this._.ty+=+b;switch(this.type){case"circle":case"ellipse":this.attr({cx:+a+this.attrs.cx,cy:+b+this.attrs.cy});break;case"rect":case"image":case"text":this.attr({x:+a+this.attrs.x,y:+b+this.attrs.y});break;case"path":var c=bp(this.attrs.path);c[0][1]+=+a;c[0][2]+=+b;this.attr({path:c});break}return this};bO.animateWith=function(a,b,c,d,e){for(var f=0,g=cv.length;f<g;f++)cv[f].el.id==a.id&&(b.start=cv[f].start);return this.animate(b,c,d,e)};bO.animateAlong=cA();bO.animateAlongBack=cA(1);function cA(b){return function(c,d,e,f){var g={back:b};a.is(e,"function")?f=e:g.rot=e;c&&c.constructor==bN&&(c=c.attrs.path);c&&(g.along=c);return this.animate(g,d,f)}}function cB(a,b,c,d,e,f){var g=3*b,h=3*(d-b)-g,i=1-g-h,j=3*c,k=3*(e-c)-j,l=1-j-k;function m(a){return((i*a+h)*a+g)*a}function n(a,b){var c=o(a,b);return((l*c+k)*c+j)*c}function o(a,b){var c,d,e,f,j,k;for(e=a,k=0;k<8;k++){f=m(e)-a;if(B(f)<b)return e;j=(3*i*e+2*h)*e+g;if(B(j)<0.000001)break;e=e-f/j}c=0;d=1;e=a;if(e<c)return c;if(e>d)return d;while(c<d){f=m(e);if(B(f-a)<b)return e;a>f?c=e:d=e;e=(d-c)/2+c}return e}return n(a,1/(200*f))}bO.onAnimation=function(a){this._run=a||0;return this};bO.animate=function(c,d,e,g){var h=this;h.timeouts=h.timeouts||[];if(a.is(e,"function")||!e)g=e||null;if(h.removed){g&&g.call(h);return h}var i={},j={},k=false,l={};for(var m in c)if(c[f](m)){if(X[f](m)||h.paper.customAttributes[f](m)){k=true;i[m]=h.attr(m);i[m]==null&&(i[m]=W[m]);j[m]=c[m];switch(X[m]){case"along":var n=cs(c[m]),o=ct(c[m],n*!(!c.back)),p=h.getBBox();l[m]=n/d;l.tx=p.x;l.ty=p.y;l.sx=o.x;l.sy=o.y;j.rot=c.rot;j.back=c.back;j.len=n;c.rot&&(l.r=S(h.rotate())||0);break;case E:l[m]=(j[m]-i[m])/d;break;case"colour":i[m]=a.getRGB(i[m]);var q=a.getRGB(j[m]);l[m]={r:(q.r-i[m].r)/d,g:(q.g-i[m].g)/d,b:(q.b-i[m].b)/d};break;case"path":var t=bw(i[m],j[m]);i[m]=t[0];var u=t[1];l[m]=[];for(var v=0,x=i[m][w];v<x;v++){l[m][v]=[0];for(var y=1,z=i[m][v][w];y<z;y++)l[m][v][y]=(u[v][y]-i[m][v][y])/d}break;case"csv":var A=r(c[m])[s](b),B=r(i[m])[s](b);switch(m){case"translation":i[m]=[0,0];l[m]=[A[0]/d,A[1]/d];break;case"rotation":i[m]=B[1]==A[1]&&B[2]==A[2]?B:[0,A[1],A[2]];l[m]=[(A[0]-i[m][0])/d,0,0];break;case"scale":c[m]=A;i[m]=r(i[m])[s](b);l[m]=[(A[0]-i[m][0])/d,(A[1]-i[m][1])/d,0,0];break;case"clip-rect":i[m]=r(i[m])[s](b);l[m]=[];v=4;while(v--)l[m][v]=(A[v]-i[m][v])/d;break}j[m]=A;break;default:A=[].concat(c[m]);B=[].concat(i[m]);l[m]=[];v=h.paper.customAttributes[m][w];while(v--)l[m][v]=((A[v]||0)-(B[v]||0))/d;break}}}if(k){var G=a.easing_formulas[e];if(!G){G=r(e).match(P);if(G&&G[w]==5){var H=G;G=function(a){return cB(a,+H[1],+H[2],+H[3],+H[4],d)}}else G=function(a){return a}}cv.push({start:c.start||+(new Date),ms:d,easing:G,from:i,diff:l,to:j,el:h,t:{x:0,y:0}});a.is(g,"function")&&(h._ac=setTimeout(function(){g.call(h)},d));cv[w]==1&&setTimeout(cw)}else{var C=[],D;for(var F in c)if(c[f](F)&&Z.test(F)){m={value:c[F]};F=="from"&&(F=0);F=="to"&&(F=100);m.key=T(F,10);C.push(m)}C.sort(be);C[0].key&&C.unshift({key:0,value:h.attrs});for(v=0,x=C[w];v<x;v++)cx(C[v].value,h,d/100*C[v].key,d/100*(C[v-1]&&C[v-1].key||0),C[v-1]&&C[v-1].value.callback);D=C[C[w]-1].value.callback;D&&h.timeouts.push(setTimeout(function(){D.call(h)},d))}return this};bO.stop=function(){for(var a=0;a<cv.length;a++)cv[a].el.id==this.id&&cv.splice(a--,1);for(a=0,ii=this.timeouts&&this.timeouts.length;a<ii;a++)clearTimeout(this.timeouts[a]);this.timeouts=[];clearTimeout(this._ac);delete this._ac;return this};bO.translate=function(a,b){return this.attr({translation:a+" "+b})};bO[H]=function(){return"Raphaël’s object"};a.ae=cv;var cC=function(a){this.items=[];this[w]=0;this.type="set";if(a)for(var b=0,c=a[w];b<c;b++){if(a[b]&&(a[b].constructor==bN||a[b].constructor==cC)){this[this.items[w]]=this.items[this.items[w]]=a[b];this[w]++}}};cC[e][L]=function(){var a,b;for(var c=0,d=arguments[w];c<d;c++){a=arguments[c];if(a&&(a.constructor==bN||a.constructor==cC)){b=this.items[w];this[b]=this.items[b]=a;this[w]++}}return this};cC[e].pop=function(){delete this[this[w]--];return this.items.pop()};for(var cD in bO)bO[f](cD)&&(cC[e][cD]=(function(a){return function(){for(var b=0,c=this.items[w];b<c;b++)this.items[b][a][m](this.items[b],arguments);return this}})(cD));cC[e].attr=function(b,c){if(b&&a.is(b,G)&&a.is(b[0],"object"))for(var d=0,e=b[w];d<e;d++)this.items[d].attr(b[d]);else for(var f=0,g=this.items[w];f<g;f++)this.items[f].attr(b,c);return this};cC[e].animate=function(b,c,d,e){(a.is(d,"function")||!d)&&(e=d||null);var f=this.items[w],g=f,h,i=this,j;e&&(j=function(){!(--f)&&e.call(i)});d=a.is(d,F)?d:j;h=this.items[--g].animate(b,c,d,j);while(g--)this.items[g]&&!this.items[g].removed&&this.items[g].animateWith(h,b,c,d,j);return this};cC[e].insertAfter=function(a){var b=this.items[w];while(b--)this.items[b].insertAfter(a);return this};cC[e].getBBox=function(){var a=[],b=[],c=[],d=[];for(var e=this.items[w];e--;){var f=this.items[e].getBBox();a[L](f.x);b[L](f.y);c[L](f.x+f.width);d[L](f.y+f.height)}a=A[m](0,a);b=A[m](0,b);return{x:a,y:b,width:z[m](0,c)-a,height:z[m](0,d)-b}};cC[e].clone=function(a){a=new cC;for(var b=0,c=this.items[w];b<c;b++)a[L](this.items[b].clone());return a};a.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[f](d)&&(b.face[d]=a.face[d]);this.fonts[c]?this.fonts[c][L](b):this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=T(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[f](e)){var g=a.glyphs[e];b.glyphs[e]={w:g.w,k:{},d:g.d&&"M"+g.d[Y](/[mlcxtrv]/g,function(a){return({l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"})[a]||"M"})+"z"};if(g.k)for(var h in g.k)g[f](h)&&(b.glyphs[e].k[h]=g.k[h])}}return a};k.getFont=function(b,c,d,e){e=e||"normal";d=d||"normal";c=+c||({normal:400,bold:700,lighter:300,bolder:800})[c]||400;if(!a.fonts)return;var g=a.fonts[b];if(!g){var h=new RegExp("(^|\\s)"+b[Y](/[^\w\d\s+!~.:_-]/g,p)+"(\\s|$)","i");for(var i in a.fonts)if(a.fonts[f](i)){if(h.test(i)){g=a.fonts[i];break}}}var j;if(g)for(var k=0,l=g[w];k<l;k++){j=g[k];if(j.face["font-weight"]==c&&(j.face["font-style"]==d||!j.face["font-style"])&&j.face["font-stretch"]==e)break}return j};k.print=function(c,d,e,f,g,h,i){h=h||"middle";i=z(A(i||0,1),-1);var j=this.set(),k=r(e)[s](p),l=0,m=p,n;a.is(f,e)&&(f=this.getFont(f));if(f){n=(g||16)/f.face["units-per-em"];var o=f.face.bbox.split(b),q=+o[0],t=+o[1]+(h=="baseline"?o[3]-o[1]+ +f.face.descent:(o[3]-o[1])/2);for(var u=0,v=k[w];u<v;u++){var x=u&&f.glyphs[k[u-1]]||{},y=f.glyphs[k[u]];l+=u?(x.w||f.w)+(x.k&&x.k[k[u]]||0)+f.w*i:0;y&&y.d&&j[L](this.path(y.d).attr({fill:"#000",stroke:"none",translation:[l,0]}))}j.scale(n,n,q,t).translate(c-q,d-t)}return j};a.format=function(b,c){var e=a.is(c,G)?[0][n](c):arguments;b&&a.is(b,F)&&e[w]-1&&(b=b[Y](d,function(a,b){return e[++b]==null?p:e[b]}));return b||p};a.ninja=function(){i.was?h.Raphael=i.is:delete Raphael;return a};a.el=bO;a.st=cC[e];i.was?h.Raphael=a:Raphael=a})()
\ No newline at end of file
--- /dev/null
+/** @license
+
+ SoundManager 2: JavaScript Sound for the Web
+ ----------------------------------------------
+ http://schillmania.com/projects/soundmanager2/
+
+ Copyright (c) 2007, Scott Schiller. All rights reserved.
+ Code provided under the BSD License:
+ http://schillmania.com/projects/soundmanager2/license.txt
+
+ V2.97a.20110424
+*/
+(function(Y){function M(M,X){function i(c){return function(a){return!this._t||!this._t._a?null:c.call(this,a)}}function pa(){if(c.debugURLParam.test(N))c.debugMode=!0}this.flashVersion=8;this.debugFlash=this.debugMode=!1;this.useConsole=!0;this.waitForWindowLoad=this.consoleOnly=!1;this.nullURL="about:blank";this.allowPolling=!0;this.useFastPolling=!1;this.useMovieStar=!0;this.bgColor="#ffffff";this.useHighPerformance=!1;this.flashPollingInterval=null;this.flashLoadTimeout=1E3;this.wmode=null;this.allowScriptAccess=
+"always";this.useHTML5Audio=this.useFlashBlock=!1;this.html5Test=/^probably$/i;this.useGlobalHTML5Audio=!0;this.requireFlash=!1;this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!0},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave",
+"audio/x-wav"],required:!1}};this.defaultOptions={autoLoad:!1,stream:!0,autoPlay:!1,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onstop:null,onfailure:null,onfinish:null,onbeforefinish:null,onbeforefinishtime:5E3,onbeforefinishcomplete:null,onjustbeforefinish:null,onjustbeforefinishtime:200,multiShot:!0,multiShotEvents:!1,position:null,pan:0,type:null,usePolicyFile:!1,volume:100};this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,
+useEQData:!1,onbufferchange:null,ondataerror:null};this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null};this.version=null;this.versionNumber="V2.97a.20110424";this.movieURL=null;this.url=M||null;this.altURL=null;this.enabled=this.swfLoaded=!1;this.o=null;this.movieID="sm2-container";this.id=X||"sm2movie";this.swfCSS={swfBox:"sm2-object-box",swfDefault:"movieContainer",swfError:"swf_error",swfTimedout:"swf_timedout",swfLoaded:"swf_loaded",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",
+highPerf:"high_performance",flashDebug:"flash_debug"};this.oMC=null;this.sounds={};this.soundIDs=[];this.muted=!1;this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.didFlashBlock=this.specialWmodeCase=!1;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.baseMimeTypes=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.netStreamMimeTypes=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.netStreamTypes=["aac","flv","mov","mp4","m4v",
+"f4v","m4a","mp4v","3gp","3g2"];this.netStreamPattern=RegExp("\\.("+this.netStreamTypes.join("|")+")(\\?.*)?$","i");this.mimePattern=this.baseMimeTypes;this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1};this.sandbox={};this.hasHTML5=null;this.html5={usingFlash:null};this.ignoreFlash=!1;var Z,c=this,y,n=navigator.userAgent,h=Y,N=h.location.href.toString(),k=this.flashVersion,g=document,$,O,r=[],E=!1,F=!1,m=!1,t=!1,qa=!1,G,o,aa,u,z,ba,P,ra,ca,v,sa,H,A,da,ea,Q,fa,ta,ua,R,
+va,I=null,ga=null,w,ha,B,S,T,ia,j,U=!1,ja=!1,wa,xa,x=null,ya,V,p=!1,J,s,ka,za,l,Da=Array.prototype.slice,K=!1,la,C,Aa,Ba=n.match(/pre\//i),Ea=n.match(/(ipad|iphone|ipod)/i);n.match(/mobile/i);var q=n.match(/msie/i),Fa=n.match(/webkit/i),L=n.match(/safari/i)&&!n.match(/chrome/i),Ga=n.match(/opera/i),ma=!N.match(/usehtml5audio/i)&&!N.match(/sm2\-ignorebadua/i)&&L&&n.match(/OS X 10_6_([3-9])/i),na=typeof g.hasFocus!=="undefined"?g.hasFocus():null,D=typeof g.hasFocus==="undefined"&&L,Ca=!D;this._use_maybe=
+N.match(/sm2\-useHTML5Maybe\=1/i);this._overHTTP=g.location?g.location.protocol.match(/http/i):null;this._http=!this._overHTTP?"http:":"";this.useAltURL=!this._overHTTP;this._global_a=null;if(Ea||Ba)c.useHTML5Audio=!0,c.ignoreFlash=!0,c.useGlobalHTML5Audio&&(K=!0);if(Ba||this._use_maybe)c.html5Test=/^(probably|maybe)$/i;this.supported=this.ok=function(){return x?m&&!t:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(c){return q?h[c]:L?y(c)||g[c]:y(c)};this.createSound=function(b){function a(){e=
+S(e);c.sounds[d.id]=new Z(d);c.soundIDs.push(d.id);return c.sounds[d.id]}var e=null,f=null,d=null;if(!m||!c.ok())return ia("soundManager.createSound(): "+w(!m?"notReady":"notOK")),!1;arguments.length===2&&(b={id:arguments[0],url:arguments[1]});d=e=o(b);if(j(d.id,!0))return c.sounds[d.id];if(V(d))f=a(),f._setup_html5(d);else{if(k>8&&c.useMovieStar){if(d.isMovieStar===null)d.isMovieStar=d.serverURL||d.type&&d.type.match(c.netStreamPattern)||d.url.match(c.netStreamPattern)?!0:!1;if(d.isMovieStar&&d.usePeakData)d.usePeakData=
+!1}d=T(d,"soundManager.createSound(): ");f=a();if(k===8)c.o._createSound(d.id,d.onjustbeforefinishtime,d.loops||1,d.usePolicyFile);else if(c.o._createSound(d.id,d.url,d.onjustbeforefinishtime,d.usePeakData,d.useWaveformData,d.useEQData,d.isMovieStar,d.isMovieStar?d.bufferTime:!1,d.loops||1,d.serverURL,d.duration||null,d.autoPlay,!0,d.autoLoad,d.usePolicyFile),!d.serverURL)f.connected=!0,d.onconnect&&d.onconnect.apply(f);(d.autoLoad||d.autoPlay)&&!d.serverURL&&f.load(d)}d.autoPlay&&!d.serverURL&&f.play();
+return f};this.destroySound=function(b,a){if(!j(b))return!1;var e=c.sounds[b],f;e._iO={};e.stop();e.unload();for(f=0;f<c.soundIDs.length;f++)if(c.soundIDs[f]===b){c.soundIDs.splice(f,1);break}a||e.destruct(!0);delete c.sounds[b];return!0};this.load=function(b,a){if(!j(b))return!1;return c.sounds[b].load(a)};this.unload=function(b){if(!j(b))return!1;return c.sounds[b].unload()};this.start=this.play=function(b,a){if(!m||!c.ok())return ia("soundManager.play(): "+w(!m?"notReady":"notOK")),!1;if(!j(b))return a instanceof
+Object||(a={url:a}),a&&a.url?(a.id=b,c.createSound(a).play()):!1;return c.sounds[b].play(a)};this.setPosition=function(b,a){if(!j(b))return!1;return c.sounds[b].setPosition(a)};this.stop=function(b){if(!j(b))return!1;return c.sounds[b].stop()};this.stopAll=function(){for(var b in c.sounds)c.sounds[b]instanceof Z&&c.sounds[b].stop()};this.pause=function(b){if(!j(b))return!1;return c.sounds[b].pause()};this.pauseAll=function(){for(var b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].pause()};this.resume=
+function(b){if(!j(b))return!1;return c.sounds[b].resume()};this.resumeAll=function(){for(var b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].resume()};this.togglePause=function(b){if(!j(b))return!1;return c.sounds[b].togglePause()};this.setPan=function(b,a){if(!j(b))return!1;return c.sounds[b].setPan(a)};this.setVolume=function(b,a){if(!j(b))return!1;return c.sounds[b].setVolume(a)};this.mute=function(b){var a=0;typeof b!=="string"&&(b=null);if(b){if(!j(b))return!1;return c.sounds[b].mute()}else{for(a=
+c.soundIDs.length;a--;)c.sounds[c.soundIDs[a]].mute();c.muted=!0}return!0};this.muteAll=function(){c.mute()};this.unmute=function(b){typeof b!=="string"&&(b=null);if(b){if(!j(b))return!1;return c.sounds[b].unmute()}else{for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].unmute();c.muted=!1}return!0};this.unmuteAll=function(){c.unmute()};this.toggleMute=function(b){if(!j(b))return!1;return c.sounds[b].toggleMute()};this.getMemoryUse=function(){if(k===8)return 0;if(c.o)return parseInt(c.o._getMemoryUse(),
+10)};this.disable=function(b){typeof b==="undefined"&&(b=!1);if(t)return!1;t=!0;for(var a=c.soundIDs.length;a--;)ua(c.sounds[c.soundIDs[a]]);G(b);l.remove(h,"load",z);return!0};this.canPlayMIME=function(b){var a;c.hasHTML5&&(a=J({type:b}));return!x||a?a:b?b.match(c.mimePattern)?!0:!1:null};this.canPlayURL=function(b){var a;c.hasHTML5&&(a=J(b));return!x||a?a:b?b.match(c.filePattern)?!0:!1:null};this.canPlayLink=function(b){if(typeof b.type!=="undefined"&&b.type&&c.canPlayMIME(b.type))return!0;return c.canPlayURL(b.href)};
+this.getSoundById=function(b){if(!b)throw Error("soundManager.getSoundById(): sID is null/undefined");return c.sounds[b]};this.onready=function(c,a){if(c&&c instanceof Function)return a||(a=h),aa("onready",c,a),u(),!0;else throw w("needFunction","onready");};this.ontimeout=function(c,a){if(c&&c instanceof Function)return a||(a=h),aa("ontimeout",c,a),u({type:"ontimeout"}),!0;else throw w("needFunction","ontimeout");};this.getMoviePercent=function(){return c.o&&typeof c.o.PercentLoaded!=="undefined"?
+c.o.PercentLoaded():null};this._wD=this._writeDebug=function(){return!0};this._debug=function(){};this.reboot=function(){var b,a;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].destruct();try{if(q)ga=c.o.innerHTML;I=c.o.parentNode.removeChild(c.o)}catch(e){}ga=I=null;c.enabled=m=U=ja=E=F=t=c.swfLoaded=!1;c.soundIDs=c.sounds=[];c.o=null;for(b in r)if(r.hasOwnProperty(b))for(a=r[b].length;a--;)r[b][a].fired=!1;h.setTimeout(function(){c.beginDelayedInit()},20)};this.destruct=function(){c.disable(!0)};
+this.beginDelayedInit=function(){qa=!0;A();setTimeout(sa,20);P()};this._html5_events={abort:i(function(){}),canplay:i(function(){this._t._onbufferchange(0);var c=!isNaN(this._t.position)?this._t.position/1E3:null;this._t._html5_canplay=!0;if(this._t.position&&this.currentTime!==c)try{this.currentTime=c}catch(a){}}),load:i(function(){this._t.loaded||(this._t._onbufferchange(0),this._t._whileloading(this._t.bytesTotal,this._t.bytesTotal,this._t._get_html5_duration()),this._t._onload(!0))}),emptied:i(function(){}),
+ended:i(function(){this._t._onfinish()}),error:i(function(){this._t._onload(!1)}),loadeddata:i(function(){}),loadedmetadata:i(function(){}),loadstart:i(function(){this._t._onbufferchange(1)}),play:i(function(){this._t._onbufferchange(0)}),playing:i(function(){this._t._onbufferchange(0)}),progress:i(function(b){if(this._t.loaded)return!1;var a,e=0,f=b.type==="progress",d=b.target.buffered;a=b.loaded||0;var oa=b.total||1;if(d&&d.length){for(a=d.length;a--;)e=d.end(a)-d.start(a);a=e/b.target.duration;
+f&&isNaN(a)}isNaN(a)||(this._t._onbufferchange(0),this._t._whileloading(a,oa,this._t._get_html5_duration()),a&&oa&&a===oa&&c._html5_events.load.call(this,b))}),ratechange:i(function(){}),suspend:i(function(b){c._html5_events.progress.call(this,b)}),stalled:i(function(){}),timeupdate:i(function(){this._t._onTimer()}),waiting:i(function(){this._t._onbufferchange(1)})};Z=function(b){var a=this,e,f,d;this.sID=b.id;this.url=b.url;this._iO=this.instanceOptions=this.options=o(b);this.pan=this.options.pan;
+this.volume=this.options.volume;this._lastURL=null;this.isHTML5=!1;this._a=null;this.id3={};this._debug=function(){};this._debug();this.load=function(b){var d=null;if(typeof b!=="undefined")a._iO=o(b,a.options),a.instanceOptions=a._iO;else if(b=a.options,a._iO=b,a.instanceOptions=a._iO,a._lastURL&&a._lastURL!==a.url)a._iO.url=a.url,a.url=null;if(!a._iO.url)a._iO.url=a.url;if(a._iO.url===a.url&&a.readyState!==0&&a.readyState!==2)return a;a._lastURL=a.url;a.loaded=!1;a.readyState=1;a.playState=0;if(V(a._iO)){if(d=
+a._setup_html5(a._iO),!d._called_load)d.load(),d._called_load=!0,a._iO.autoPlay&&a.play()}else try{a.isHTML5=!1,a._iO=T(S(a._iO)),k===8?c.o._load(a.sID,a._iO.url,a._iO.stream,a._iO.autoPlay,a._iO.whileloading?1:0,a._iO.loops||1,a._iO.usePolicyFile):c.o._load(a.sID,a._iO.url,a._iO.stream?!0:!1,a._iO.autoPlay?!0:!1,a._iO.loops||1,a._iO.autoLoad?!0:!1,a._iO.usePolicyFile)}catch(e){fa()}return a};this.unload=function(){if(a.readyState!==0){if(a.isHTML5){if(f(),a._a)a._a.pause(),a._a.src=""}else k===8?
+c.o._unload(a.sID,c.nullURL):c.o._unload(a.sID);e()}return a};this.destruct=function(b){if(a.isHTML5){if(f(),a._a)a._a.pause(),a._a.src="",K||a._remove_html5_events()}else a._iO.onfailure=null,c.o._destroySound(a.sID);b||c.destroySound(a.sID,!0)};this.start=this.play=function(b,W){var e,W=W===void 0?!0:W;b||(b={});a._iO=o(b,a._iO);a._iO=o(a._iO,a.options);a.instanceOptions=a._iO;if(a._iO.serverURL&&!a.connected)return a.getAutoPlay()||a.setAutoPlay(!0),a;V(a._iO)&&(a._setup_html5(a._iO),d());if(a.playState===
+1&&!a.paused)if(e=a._iO.multiShot)a.isHTML5&&a.setPosition(a._iO.position);else return a;if(!a.loaded)if(a.readyState===0){if(!a.isHTML5)a._iO.autoPlay=!0;a.load(a._iO)}else if(a.readyState===2)return a;if(a.paused&&a.position&&a.position>0)a.resume();else{a.playState=1;a.paused=!1;(!a.instanceCount||a._iO.multiShotEvents||k>8&&!a.isHTML5&&!a.getAutoPlay())&&a.instanceCount++;a.position=typeof a._iO.position!=="undefined"&&!isNaN(a._iO.position)?a._iO.position:0;if(!a.isHTML5)a._iO=T(S(a._iO));if(a._iO.onplay&&
+W)a._iO.onplay.apply(a),a._onplay_called=!0;a.setVolume(a._iO.volume,!0);a.setPan(a._iO.pan,!0);a.isHTML5?(d(),a._setup_html5().play()):c.o._start(a.sID,a._iO.loops||1,k===9?a.position:a.position/1E3)}return a};this.stop=function(b){if(a.playState===1){a._onbufferchange(0);a.resetOnPosition(0);if(!a.isHTML5)a.playState=0;a.paused=!1;a._iO.onstop&&a._iO.onstop.apply(a);if(a.isHTML5){if(a._a)a.setPosition(0),a._a.pause(),a.playState=0,a._onTimer(),f(),a.unload()}else c.o._stop(a.sID,b),a._iO.serverURL&&
+a.unload();a.instanceCount=0;a._iO={}}return a};this.setAutoPlay=function(b){a._iO.autoPlay=b;a.isHTML5?a._a&&b&&a.play():c.o._setAutoPlay(a.sID,b);b&&!a.instanceCount&&a.readyState===1&&a.instanceCount++};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition=function(b){b===void 0&&(b=0);var d=a.isHTML5?Math.max(b,0):Math.min(a.duration||a._iO.duration,Math.max(b,0));a.position=d;b=a.position/1E3;a.resetOnPosition(a.position);a._iO.position=d;if(a.isHTML5){if(a._a&&a._html5_canplay&&
+a._a.currentTime!==b)try{a._a.currentTime=b}catch(e){}}else b=k===9?a.position:b,a.readyState&&a.readyState!==2&&c.o._setPosition(a.sID,b,a.paused||!a.playState);a.isHTML5&&a.paused&&a._onTimer(!0);return a};this.pause=function(b){if(a.paused||a.playState===0&&a.readyState!==1)return a;a.paused=!0;a.isHTML5?(a._setup_html5().pause(),f()):(b||b===void 0)&&c.o._pause(a.sID);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){if(!a.paused)return a;a.paused=!1;a.playState=1;a.isHTML5?
+(a._setup_html5().play(),d()):(a._iO.isMovieStar&&a.setPosition(a.position),c.o._pause(a.sID));!a._onplay_called&&a._iO.onplay?(a._iO.onplay.apply(a),a._onplay_called=!0):a._iO.onresume&&a._iO.onresume.apply(a);return a};this.togglePause=function(){if(a.playState===0)return a.play({position:k===9&&!a.isHTML5?a.position:a.position/1E3}),a;a.paused?a.resume():a.pause();return a};this.setPan=function(b,d){typeof b==="undefined"&&(b=0);typeof d==="undefined"&&(d=!1);a.isHTML5||c.o._setPan(a.sID,b);a._iO.pan=
+b;if(!d)a.pan=b,a.options.pan=b;return a};this.setVolume=function(b,d){typeof b==="undefined"&&(b=100);typeof d==="undefined"&&(d=!1);if(a.isHTML5){if(a._a)a._a.volume=Math.max(0,Math.min(1,b/100))}else c.o._setVolume(a.sID,c.muted&&!a.muted||a.muted?0:b);a._iO.volume=b;if(!d)a.volume=b,a.options.volume=b;return a};this.mute=function(){a.muted=!0;if(a.isHTML5){if(a._a)a._a.muted=!0}else c.o._setVolume(a.sID,0);return a};this.unmute=function(){a.muted=!1;var b=typeof a._iO.volume!=="undefined";if(a.isHTML5){if(a._a)a._a.muted=
+!1}else c.o._setVolume(a.sID,b?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=function(c,b,d){a._onPositionItems.push({position:c,method:b,scope:typeof d!=="undefined"?d:a,fired:!1});return a};this.processOnPosition=function(){var b,d;b=a._onPositionItems.length;if(!b||!a.playState||a._onPositionFired>=b)return!1;for(;b--;)if(d=a._onPositionItems[b],!d.fired&&a.position>=d.position)d.method.apply(d.scope,[d.position]),d.fired=
+!0,c._onPositionFired++;return!0};this.resetOnPosition=function(b){var d,e;d=a._onPositionItems.length;if(!d)return!1;for(;d--;)if(e=a._onPositionItems[d],e.fired&&b<=e.position)e.fired=!1,c._onPositionFired--;return!0};this._onTimer=function(c){var b={};if(a._hasTimer||c)return a._a&&(c||(a.playState>0||a.readyState===1)&&!a.paused)?(a.duration=a._get_html5_duration(),a.durationEstimate=a.duration,c=a._a.currentTime?a._a.currentTime*1E3:0,a._whileplaying(c,b,b,b,b),!0):!1};this._get_html5_duration=
+function(){var c=a._a?a._a.duration*1E3:a._iO?a._iO.duration:void 0;return c&&!isNaN(c)&&c!==Infinity?c:a._iO?a._iO.duration:null};d=function(){a.isHTML5&&wa(a)};f=function(){a.isHTML5&&xa(a)};e=function(){a._onPositionItems=[];a._onPositionFired=0;a._hasTimer=null;a._onplay_called=!1;a._a=null;a._html5_canplay=!1;a.bytesLoaded=null;a.bytesTotal=null;a.position=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.failures=0;a.loaded=!1;a.playState=0;a.paused=!1;a.readyState=
+0;a.muted=!1;a.didBeforeFinish=!1;a.didJustBeforeFinish=!1;a.isBuffering=!1;a.instanceOptions={};a.instanceCount=0;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.eqData=[];a.eqData.left=[];a.eqData.right=[]};e();this._setup_html5=function(b){var b=o(a._iO,b),d=K?c._global_a:a._a;decodeURI(b.url);var f=d&&d._t?d._t.instanceOptions:null;if(d){if(d._t&&f.url===b.url&&(!a._lastURL||a._lastURL===f.url))return d;K&&d._t&&d._t.playState&&b.url!==f.url&&d._t.stop();e();d.src=b.url;a.url=
+b.url;a._lastURL=b.url;d._called_load=!1}else if(d=new Audio(b.url),d._called_load=!1,K)c._global_a=d;a.isHTML5=!0;a._a=d;d._t=a;a._add_html5_events();d.loop=b.loops>1?"loop":"";b.autoLoad||b.autoPlay?(d.autobuffer="auto",d.preload="auto",a.load(),d._called_load=!0):(d.autobuffer=!1,d.preload="none");d.loop=b.loops>1?"loop":"";return d};this._add_html5_events=function(){if(a._a._added_events)return!1;var b;a._a._added_events=!0;for(b in c._html5_events)c._html5_events.hasOwnProperty(b)&&a._a&&a._a.addEventListener(b,
+c._html5_events[b],!1);return!0};this._remove_html5_events=function(){a._a._added_events=!1;for(var b in c._html5_events)c._html5_events.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,c._html5_events[b],!1)};this._whileloading=function(c,b,d,e){a.bytesLoaded=c;a.bytesTotal=b;a.duration=Math.floor(d);a.bufferLength=e;if(a._iO.isMovieStar)a.durationEstimate=a.duration;else if(a.durationEstimate=a._iO.duration?a.duration>a._iO.duration?a.duration:a._iO.duration:parseInt(a.bytesTotal/a.bytesLoaded*
+a.duration,10),a.durationEstimate===void 0)a.durationEstimate=a.duration;a.readyState!==3&&a._iO.whileloading&&a._iO.whileloading.apply(a)};this._onid3=function(c,b){var d=[],e,f;e=0;for(f=c.length;e<f;e++)d[c[e]]=b[e];a.id3=o(a.id3,d);a._iO.onid3&&a._iO.onid3.apply(a)};this._whileplaying=function(b,d,e,f,g){if(isNaN(b)||b===null)return!1;a.playState===0&&b>0&&(b=0);a.position=b;a.processOnPosition();if(k>8&&!a.isHTML5){if(a._iO.usePeakData&&typeof d!=="undefined"&&d)a.peakData={left:d.leftPeak,right:d.rightPeak};
+if(a._iO.useWaveformData&&typeof e!=="undefined"&&e)a.waveformData={left:e.split(","),right:f.split(",")};if(a._iO.useEQData&&typeof g!=="undefined"&&g&&g.leftEQ&&(b=g.leftEQ.split(","),a.eqData=b,a.eqData.left=b,typeof g.rightEQ!=="undefined"&&g.rightEQ))a.eqData.right=g.rightEQ.split(",")}a.playState===1&&(!a.isHTML5&&c.flashVersion===8&&!a.position&&a.isBuffering&&a._onbufferchange(0),a._iO.whileplaying&&a._iO.whileplaying.apply(a),(a.loaded||!a.loaded&&a._iO.isMovieStar)&&a._iO.onbeforefinish&&
+a._iO.onbeforefinishtime&&!a.didBeforeFinish&&a.duration-a.position<=a._iO.onbeforefinishtime&&a._onbeforefinish());return!0};this._onconnect=function(b){b=b===1;if(a.connected=b)a.failures=0,j(a.sID)&&(a.getAutoPlay()?a.play(void 0,a.getAutoPlay()):a._iO.autoLoad&&a.load()),a._iO.onconnect&&a._iO.onconnect.apply(a,[b])};this._onload=function(b){b=b?!0:!1;a.loaded=b;a.readyState=b?3:2;a._onbufferchange(0);a._iO.onload&&a._iO.onload.apply(a,[b]);return!0};this._onfailure=function(b,c,d){a.failures++;
+if(a._iO.onfailure&&a.failures===1)a._iO.onfailure(a,b,c,d)};this._onbeforefinish=function(){if(!a.didBeforeFinish)a.didBeforeFinish=!0,a._iO.onbeforefinish&&a._iO.onbeforefinish.apply(a)};this._onjustbeforefinish=function(){if(!a.didJustBeforeFinish)a.didJustBeforeFinish=!0,a._iO.onjustbeforefinish&&a._iO.onjustbeforefinish.apply(a)};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0);a.resetOnPosition(0);a._iO.onbeforefinishcomplete&&a._iO.onbeforefinishcomplete.apply(a);a.didBeforeFinish=
+!1;a.didJustBeforeFinish=!1;if(a.instanceCount){a.instanceCount--;if(!a.instanceCount)a.playState=0,a.paused=!1,a.instanceCount=0,a.instanceOptions={},a._iO={},f();(!a.instanceCount||a._iO.multiShotEvents)&&b&&b.apply(a)}};this._onbufferchange=function(b){if(a.playState===0)return!1;if(b&&a.isBuffering||!b&&!a.isBuffering)return!1;a.isBuffering=b===1;a._iO.onbufferchange&&a._iO.onbufferchange.apply(a);return!0};this._ondataerror=function(){a.playState>0&&a._iO.ondataerror&&a._iO.ondataerror.apply(a)}};
+ea=function(){return g.body?g.body:g._docElement?g.documentElement:g.getElementsByTagName("div")[0]};y=function(b){return g.getElementById(b)};o=function(b,a){var e={},f,d;for(f in b)b.hasOwnProperty(f)&&(e[f]=b[f]);f=typeof a==="undefined"?c.defaultOptions:a;for(d in f)f.hasOwnProperty(d)&&typeof e[d]==="undefined"&&(e[d]=f[d]);return e};l=function(){function b(a){var a=Da.call(a),b=a.length;c?(a[1]="on"+a[1],b>3&&a.pop()):b===3&&a.push(!1);return a}function a(a,b){var g=a.shift(),h=[f[b]];if(c)g[h](a[0],
+a[1]);else g[h].apply(g,a)}var c=h.attachEvent,f={add:c?"attachEvent":"addEventListener",remove:c?"detachEvent":"removeEventListener"};return{add:function(){a(b(arguments),"add")},remove:function(){a(b(arguments),"remove")}}}();V=function(b){return!b.serverURL&&(b.type?J({type:b.type}):J(b.url)||p)};J=function(b){if(!c.useHTML5Audio||!c.hasHTML5)return!1;var a,e=c.audioFormats;if(!s){s=[];for(a in e)e.hasOwnProperty(a)&&(s.push(a),e[a].related&&(s=s.concat(e[a].related)));s=RegExp("\\.("+s.join("|")+
+")","i")}a=typeof b.type!=="undefined"?b.type:null;b=typeof b==="string"?b.toLowerCase().match(s):null;if(!b||!b.length)if(a)b=a.indexOf(";"),b=(b!==-1?a.substr(0,b):a).substr(6);else return!1;else b=b[0].substr(1);if(b&&typeof c.html5[b]!=="undefined")return c.html5[b];else{if(!a)if(b&&c.html5[b])return c.html5[b];else a="audio/"+b;a=c.html5.canPlayType(a);return c.html5[b]=a}};za=function(){function b(b){var d,e,f=!1;if(!a||typeof a.canPlayType!=="function")return!1;if(b instanceof Array){d=0;for(e=
+b.length;d<e&&!f;d++)if(c.html5[b[d]]||a.canPlayType(b[d]).match(c.html5Test))f=!0,c.html5[b[d]]=!0;return f}else return(b=a&&typeof a.canPlayType==="function"?a.canPlayType(b):!1)&&(b.match(c.html5Test)?!0:!1)}if(!c.useHTML5Audio||typeof Audio==="undefined")return!1;var a=typeof Audio!=="undefined"?Ga?new Audio(null):new Audio:null,e,f={},d,g;C();d=c.audioFormats;for(e in d)if(d.hasOwnProperty(e)&&(f[e]=b(d[e].type),d[e]&&d[e].related))for(g=d[e].related.length;g--;)c.html5[d[e].related[g]]=f[e];
+f.canPlayType=a?b:null;c.html5=o(c.html5,f);return!0};w=function(){};S=function(b){if(k===8&&b.loops>1&&b.stream)b.stream=!1;return b};T=function(b){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))b.usePolicyFile=!0;return b};ia=function(b){typeof console!=="undefined"&&typeof console.warn!=="undefined"&&console.warn(b)};$=function(){return!1};ua=function(b){for(var a in b)b.hasOwnProperty(a)&&typeof b[a]==="function"&&(b[a]=$)};R=function(b){typeof b==="undefined"&&
+(b=!1);(t||b)&&c.disable(b)};va=function(b){var a=null;if(b)if(b.match(/\.swf(\?.*)?$/i)){if(a=b.substr(b.toLowerCase().lastIndexOf(".swf?")+4))return b}else b.lastIndexOf("/")!==b.length-1&&(b+="/");return(b&&b.lastIndexOf("/")!==-1?b.substr(0,b.lastIndexOf("/")+1):"./")+c.movieURL};ca=function(){if(k!==8&&k!==9)c.flashVersion=8;var b=c.debugMode||c.debugFlash?"_debug.swf":".swf";if(c.useHTML5Audio&&!p&&c.audioFormats.mp4.required&&c.flashVersion<9)c.flashVersion=9;k=c.flashVersion;c.version=c.versionNumber+
+(p?" (HTML5-only mode)":k===9?" (AS3/Flash 9)":" (AS2/Flash 8)");if(k>8)c.defaultOptions=o(c.defaultOptions,c.flash9Options),c.features.buffering=!0;k>8&&c.useMovieStar?(c.defaultOptions=o(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+c.netStreamTypes.join("|")+")(\\?.*)?$","i"),c.mimePattern=c.netStreamMimeTypes,c.features.movieStar=!0):(c.useMovieStar=!1,c.features.movieStar=!1);c.filePattern=c.filePatterns[k!==8?"flash9":"flash8"];c.movieURL=(k===8?"soundmanager2.swf":
+"soundmanager2_flash9.swf").replace(".swf",b);c.features.peakData=c.features.waveformData=c.features.eqData=k>8};ta=function(b,a){if(!c.o||!c.allowPolling)return!1;c.o._setPolling(b,a)};Q=function(b,a){var e=a?a:c.url,f=c.altURL?c.altURL:e,d;d=ea();var h,k,i=B(),j,l=null,l=(l=g.getElementsByTagName("html")[0])&&l.dir&&l.dir.match(/rtl/i),b=typeof b==="undefined"?c.id:b;if(E&&F)return!1;if(p)return ca(),c.oMC=y(c.movieID),O(),F=E=!0,!1;E=!0;ca();c.url=va(c._overHTTP?e:f);a=c.url;c.wmode=!c.wmode&&
+c.useHighPerformance&&!c.useMovieStar?"transparent":c.wmode;if(c.wmode!==null&&(n.match(/msie 8/i)||!q&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))c.specialWmodeCase=!0,c.wmode=null;d={name:b,id:b,src:a,width:"100%",height:"100%",quality:"high",allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:c._http+"//www.macromedia.com/go/getflashplayer",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};if(c.debugFlash)d.FlashVars="debug=1";c.wmode||
+delete d.wmode;if(q)e=g.createElement("div"),k='<object id="'+b+'" data="'+a+'" type="'+d.type+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+c._http+'//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="'+d.width+'" height="'+d.height+'"><param name="movie" value="'+a+'" /><param name="AllowScriptAccess" value="'+c.allowScriptAccess+'" /><param name="quality" value="'+d.quality+'" />'+(c.wmode?'<param name="wmode" value="'+c.wmode+'" /> ':"")+
+'<param name="bgcolor" value="'+c.bgColor+'" />'+(c.debugFlash?'<param name="FlashVars" value="'+d.FlashVars+'" />':"")+"</object>";else for(h in e=g.createElement("embed"),d)d.hasOwnProperty(h)&&e.setAttribute(h,d[h]);pa();i=B();if(d=ea())if(c.oMC=y(c.movieID)?y(c.movieID):g.createElement("div"),c.oMC.id){j=c.oMC.className;c.oMC.className=(j?j+" ":c.swfCSS.swfDefault)+(i?" "+i:"");c.oMC.appendChild(e);if(q)h=c.oMC.appendChild(g.createElement("div")),h.className=c.swfCSS.swfBox,h.innerHTML=k;F=!0}else{c.oMC.id=
+c.movieID;c.oMC.className=c.swfCSS.swfDefault+" "+i;h=i=null;if(!c.useFlashBlock)if(c.useHighPerformance)i={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"};else if(i={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},l)i.left=Math.abs(parseInt(i.left,10))+"px";if(Fa)c.oMC.style.zIndex=1E4;if(!c.debugFlash)for(j in i)i.hasOwnProperty(j)&&(c.oMC.style[j]=i[j]);try{q||c.oMC.appendChild(e);d.appendChild(c.oMC);if(q)h=c.oMC.appendChild(g.createElement("div")),
+h.className=c.swfCSS.swfBox,h.innerHTML=k;F=!0}catch(m){throw Error(w("appXHTML"));}}return!0};j=this.getSoundById;H=function(){if(p)return Q(),!1;if(c.o)return!1;c.o=c.getMovie(c.id);if(!c.o)I?(q?c.oMC.innerHTML=ga:c.oMC.appendChild(I),I=null,E=!0):Q(c.id,c.url),c.o=c.getMovie(c.id);c.oninitmovie instanceof Function&&setTimeout(c.oninitmovie,1);return!0};ba=function(b){if(b)c.url=b;H()};P=function(){setTimeout(ra,500)};ra=function(){if(U)return!1;U=!0;l.remove(h,"load",P);if(D&&!na)return!1;var b;
+m||(b=c.getMoviePercent());setTimeout(function(){b=c.getMoviePercent();!m&&Ca&&(b===null?c.useFlashBlock||c.flashLoadTimeout===0?c.useFlashBlock&&ha():R(!0):c.flashLoadTimeout!==0&&R(!0))},c.flashLoadTimeout)};ba=function(b){if(b)c.url=b;H()};B=function(){var b=[];c.debugMode&&b.push(c.swfCSS.sm2Debug);c.debugFlash&&b.push(c.swfCSS.flashDebug);c.useHighPerformance&&b.push(c.swfCSS.highPerf);return b.join(" ")};ha=function(){w("fbHandler");var b=c.getMoviePercent(),a=c.swfCSS;if(c.ok()){if(c.oMC)c.oMC.className=
+[B(),a.swfDefault,a.swfLoaded+(c.didFlashBlock?" "+a.swfUnblocked:"")].join(" ")}else{if(x)c.oMC.className=B()+" "+a.swfDefault+" "+(b===null?a.swfTimedout:a.swfError);c.didFlashBlock=!0;u({type:"ontimeout",ignoreInit:!0});c.onerror instanceof Function&&c.onerror.apply(h)}};v=function(){function b(){l.remove(h,"focus",v);l.remove(h,"load",v)}if(na||!D)return b(),!0;na=Ca=!0;L&&D&&l.remove(h,"mousemove",v);U=!1;b();return!0};G=function(b){if(m)return!1;if(p)return m=!0,u(),z(),!0;c.useFlashBlock&&
+c.flashLoadTimeout&&!c.getMoviePercent()||(m=!0);if(t||b){if(c.useFlashBlock)c.oMC.className=B()+" "+(c.getMoviePercent()===null?c.swfCSS.swfTimedout:c.swfCSS.swfError);u({type:"ontimeout"});c.onerror instanceof Function&&c.onerror.apply(h);return!1}l.add(h,"unload",$);if(c.waitForWindowLoad&&!qa)return l.add(h,"load",z),!1;else z();return!0};aa=function(b,a,c){typeof r[b]==="undefined"&&(r[b]=[]);r[b].push({method:a,scope:c||null,fired:!1})};u=function(b){b||(b={type:"onready"});if(!m&&b&&!b.ignoreInit)return!1;
+var a={success:b&&b.ignoreInit?c.ok():!t},e=b&&b.type?r[b.type]||[]:[],b=[],f,d=x&&c.useFlashBlock&&!c.ok();for(f=0;f<e.length;f++)e[f].fired!==!0&&b.push(e[f]);if(b.length){f=0;for(e=b.length;f<e;f++)if(b[f].scope?b[f].method.apply(b[f].scope,[a]):b[f].method(a),!d)b[f].fired=!0}return!0};z=function(){h.setTimeout(function(){c.useFlashBlock&&ha();u();c.onload instanceof Function&&c.onload.apply(h);c.waitForWindowLoad&&l.add(h,"load",z)},1)};C=function(){if(la!==void 0)return la;var b=!1,a=navigator,
+c=a.plugins,f,d=h.ActiveXObject;if(c&&c.length)(a=a.mimeTypes)&&a["application/x-shockwave-flash"]&&a["application/x-shockwave-flash"].enabledPlugin&&a["application/x-shockwave-flash"].enabledPlugin.description&&(b=!0);else if(typeof d!=="undefined"){try{f=new d("ShockwaveFlash.ShockwaveFlash")}catch(g){}b=!!f}return la=b};ya=function(){var b,a;if(n.match(/iphone os (1|2|3_0|3_1)/i)){c.hasHTML5=!1;p=!0;if(c.oMC)c.oMC.style.display="none";return!1}if(c.useHTML5Audio){if(!c.html5||!c.html5.canPlayType)return c.hasHTML5=
+!1,!0;else c.hasHTML5=!0;if(ma&&C())return!0}else return!0;for(a in c.audioFormats)c.audioFormats.hasOwnProperty(a)&&c.audioFormats[a].required&&!c.html5.canPlayType(c.audioFormats[a].type)&&(b=!0);c.ignoreFlash&&(b=!1);p=c.useHTML5Audio&&c.hasHTML5&&!b&&!c.requireFlash;return C()&&b};O=function(){var b,a=[];if(m)return!1;if(c.hasHTML5)for(b in c.audioFormats)c.audioFormats.hasOwnProperty(b)&&a.push(b+": "+c.html5[b]);if(p){if(!m)l.remove(h,"load",c.beginDelayedInit),c.enabled=!0,G();return!0}H();
+try{c.o._externalInterfaceTest(!1),c.allowPolling&&ta(!0,c.flashPollingInterval?c.flashPollingInterval:c.useFastPolling?10:50),c.debugMode||c.o._disableDebug(),c.enabled=!0}catch(e){return R(!0),G(),!1}G();l.remove(h,"load",c.beginDelayedInit);return!0};sa=function(){if(ja)return!1;Q();H();return ja=!0};A=function(){if(da)return!1;da=!0;pa();if(!c.useHTML5Audio&&!C())c.useHTML5Audio=!0;za();c.html5.usingFlash=ya();x=c.html5.usingFlash;da=!0;g.removeEventListener&&g.removeEventListener("DOMContentLoaded",
+A,!1);ba();return!0};wa=function(b){if(!b._hasTimer)b._hasTimer=!0};xa=function(b){if(b._hasTimer)b._hasTimer=!1};fa=function(){if(c.onerror instanceof Function)c.onerror();c.disable()};Aa=function(){if(!ma||!C())return!1;var b=c.audioFormats,a,e;for(e in b)if(b.hasOwnProperty(e)&&(e==="mp3"||e==="mp4"))if(c.html5[e]=!1,b[e]&&b[e].related)for(a=b[e].related.length;a--;)c.html5[b[e].related[a]]=!1};this._setSandboxType=function(){};this._externalInterfaceOK=function(){if(c.swfLoaded)return!1;(new Date).getTime();
+c.swfLoaded=!0;D=!1;ma&&Aa();q?setTimeout(O,100):O()};ka=function(){g.readyState==="complete"&&(A(),g.detachEvent("onreadystatechange",ka));return!0};if(!c.hasHTML5||x)l.add(h,"focus",v),l.add(h,"load",v),l.add(h,"load",P),L&&D&&l.add(h,"mousemove",v);g.addEventListener?g.addEventListener("DOMContentLoaded",A,!1):g.attachEvent?g.attachEvent("onreadystatechange",ka):fa();g.readyState==="complete"&&setTimeout(A,100)}var X=null;if(typeof SM2_DEFER==="undefined"||!SM2_DEFER)X=new M;Y.SoundManager=M;Y.soundManager=
+X})(window);
\ No newline at end of file
--- /dev/null
+/** @license\r
+ * SoundManager 2: JavaScript Sound for the Web\r
+ * ----------------------------------------------\r
+ * http://schillmania.com/projects/soundmanager2/\r
+ *\r
+ * Copyright (c) 2007, Scott Schiller. All rights reserved.\r
+ * Code provided under the BSD License:\r
+ * http://schillmania.com/projects/soundmanager2/license.txt\r
+ *\r
+ * V2.97a.20110424\r
+ */\r
+\r
+/*jslint white: false, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: false, bitwise: true, regexp: false, newcap: true, immed: true */\r
+/*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */\r
+\r
+(function(window) {\r
+\r
+var soundManager = null;\r
+\r
+function SoundManager(smURL, smID) {\r
+\r
+ this.flashVersion = 8; // version of flash to require, either 8 or 9. Some API features require Flash 9.\r
+ this.debugMode = true; // enable debugging output (div#soundmanager-debug, OR console if available+configured)\r
+ this.debugFlash = false; // enable debugging output inside SWF, troubleshoot Flash/browser issues\r
+ this.useConsole = true; // use firebug/safari console.log()-type debug console if available\r
+ this.consoleOnly = false; // if console is being used, do not create/write to #soundmanager-debug\r
+ this.waitForWindowLoad = false; // force SM2 to wait for window.onload() before trying to call soundManager.onload()\r
+ this.nullURL = 'about:blank'; // path to "null" (empty) MP3 file, used to unload sounds (Flash 8 only)\r
+ this.allowPolling = true; // allow flash to poll for status update (required for whileplaying() events, peak, sound spectrum functions to work.)\r
+ this.useFastPolling = false; // uses lower flash timer interval for higher callback frequency, best combined with useHighPerformance\r
+ this.useMovieStar = true; // enable support for Flash 9.0r115+ (codename "MovieStar") MPEG4 audio formats (AAC, M4V, FLV, MOV etc.)\r
+ this.bgColor = '#ffffff'; // movie (.swf) background color, eg. '#000000'\r
+ this.useHighPerformance = false; // position:fixed flash movie can help increase js/flash speed, minimize lag\r
+ this.flashPollingInterval = null; // msec for polling interval. Defaults to 50 unless useFastPolling = true.\r
+ this.flashLoadTimeout = 1000; // msec to wait for flash movie to load before failing (0 = infinity)\r
+ this.wmode = null; // string: flash rendering mode - null, transparent, opaque (last two allow layering of HTML on top)\r
+ this.allowScriptAccess = 'always'; // for scripting the SWF (object/embed property), either 'always' or 'sameDomain'\r
+ this.useFlashBlock = false; // *requires flashblock.css, see demos* - allow recovery from flash blockers. Wait indefinitely and apply timeout CSS to SWF, if applicable.\r
+ this.useHTML5Audio = false; // Beta feature: Use HTML5 Audio() where API is supported (most Safari, Chrome versions), Firefox (no MP3/MP4.) Ideally, transparent vs. Flash API where possible.\r
+ this.html5Test = /^probably$/i; // HTML5 Audio().canPlayType() test. /^(probably|maybe)$/i if you want to be more liberal/risky.\r
+ this.useGlobalHTML5Audio = true; // (experimental) if true, re-use single HTML5 audio object across all sounds. Enabled by default on mobile devices/iOS.\r
+ this.requireFlash = false; // (experimental) if true, prevents "HTML5-only" mode when flash present. Allows flash to handle RTMP/serverURL, but HTML5 for other cases\r
+\r
+ this.audioFormats = {\r
+ // determines HTML5 support, flash requirements\r
+ // eg. if MP3 or MP4 required, Flash fallback is used if HTML5 can't play it\r
+ // shotgun approach to MIME testing due to browser variance\r
+ 'mp3': {\r
+ 'type': ['audio/mpeg; codecs="mp3"','audio/mpeg','audio/mp3','audio/MPA','audio/mpa-robust'],\r
+ 'required': true\r
+ },\r
+ 'mp4': {\r
+ 'related': ['aac','m4a'], // additional formats under the MP4 container\r
+ 'type': ['audio/mp4; codecs="mp4a.40.2"','audio/aac','audio/x-m4a','audio/MP4A-LATM','audio/mpeg4-generic'],\r
+ 'required': true\r
+ },\r
+ 'ogg': {\r
+ 'type': ['audio/ogg; codecs=vorbis'],\r
+ 'required': false\r
+ },\r
+ 'wav': {\r
+ 'type': ['audio/wav; codecs="1"','audio/wav','audio/wave','audio/x-wav'],\r
+ 'required': false\r
+ }\r
+ };\r
+\r
+ this.defaultOptions = {\r
+ 'autoLoad': false, // enable automatic loading (otherwise .load() will be called on demand with .play(), the latter being nicer on bandwidth - if you want to .load yourself, you also can)\r
+ 'stream': true, // allows playing before entire file has loaded (recommended)\r
+ 'autoPlay': false, // enable playing of file as soon as possible (much faster if "stream" is true)\r
+ 'loops': 1, // how many times to repeat the sound (position will wrap around to 0, setPosition() will break out of loop when >0)\r
+ 'onid3': null, // callback function for "ID3 data is added/available"\r
+ 'onload': null, // callback function for "load finished"\r
+ 'whileloading': null, // callback function for "download progress update" (X of Y bytes received)\r
+ 'onplay': null, // callback for "play" start\r
+ 'onpause': null, // callback for "pause"\r
+ 'onresume': null, // callback for "resume" (pause toggle)\r
+ 'whileplaying': null, // callback during play (position update)\r
+ 'onstop': null, // callback for "user stop"\r
+ 'onfailure': null, // callback function for when playing fails\r
+ 'onfinish': null, // callback function for "sound finished playing"\r
+ 'onbeforefinish': null, // callback for "before sound finished playing (at [time])"\r
+ 'onbeforefinishtime': 5000, // offset (milliseconds) before end of sound to trigger beforefinish (eg. 1000 msec = 1 second)\r
+ 'onbeforefinishcomplete': null,// function to call when said sound finishes playing\r
+ 'onjustbeforefinish': null, // callback for [n] msec before end of current sound\r
+ 'onjustbeforefinishtime': 200, // [n] - if not using, set to 0 (or null handler) and event will not fire.\r
+ 'multiShot': true, // let sounds "restart" or layer on top of each other when played multiple times, rather than one-shot/one at a time\r
+ 'multiShotEvents': false, // fire multiple sound events (currently onfinish() only) when multiShot is enabled\r
+ 'position': null, // offset (milliseconds) to seek to within loaded sound data.\r
+ 'pan': 0, // "pan" settings, left-to-right, -100 to 100\r
+ 'type': null, // MIME-like hint for file pattern / canPlay() tests, eg. audio/mp3\r
+ 'usePolicyFile': false, // enable crossdomain.xml request for audio on remote domains (for ID3/waveform access)\r
+ 'volume': 100 // self-explanatory. 0-100, the latter being the max.\r
+ };\r
+\r
+ this.flash9Options = { // flash 9-only options, merged into defaultOptions if flash 9 is being used\r
+ 'isMovieStar': null, // "MovieStar" MPEG4 audio mode. Null (default) = auto detect MP4, AAC etc. based on URL. true = force on, ignore URL\r
+ 'usePeakData': false, // enable left/right channel peak (level) data\r
+ 'useWaveformData': false, // enable sound spectrum (raw waveform data) - WARNING: CPU-INTENSIVE: may set CPUs on fire.\r
+ 'useEQData': false, // enable sound EQ (frequency spectrum data) - WARNING: Also CPU-intensive.\r
+ 'onbufferchange': null, // callback for "isBuffering" property change\r
+ 'ondataerror': null // callback for waveform/eq data access error (flash playing audio in other tabs/domains)\r
+ };\r
+\r
+ this.movieStarOptions = { // flash 9.0r115+ MPEG4 audio options, merged into defaultOptions if flash 9+movieStar mode is enabled\r
+ 'bufferTime': 3, // seconds of data to buffer before playback begins (null = flash default of 0.1 seconds - if AAC playback is gappy, try increasing.)\r
+ 'serverURL': null, // rtmp: FMS or FMIS server to connect to, required when requesting media via RTMP or one of its variants\r
+ 'onconnect': null, // rtmp: callback for connection to flash media server\r
+ 'duration': null // rtmp: song duration (msec)\r
+ };\r
+\r
+ this.version = null;\r
+ this.versionNumber = 'V2.97a.20110424';\r
+ this.movieURL = null;\r
+ this.url = (smURL || null);\r
+ this.altURL = null;\r
+ this.swfLoaded = false;\r
+ this.enabled = false;\r
+ this.o = null;\r
+ this.movieID = 'sm2-container';\r
+ this.id = (smID || 'sm2movie');\r
+ this.swfCSS = {\r
+ 'swfBox': 'sm2-object-box',\r
+ 'swfDefault': 'movieContainer',\r
+ 'swfError': 'swf_error', // SWF loaded, but SM2 couldn't start (other error)\r
+ 'swfTimedout': 'swf_timedout',\r
+ 'swfLoaded': 'swf_loaded',\r
+ 'swfUnblocked': 'swf_unblocked', // or loaded OK\r
+ 'sm2Debug': 'sm2_debug',\r
+ 'highPerf': 'high_performance',\r
+ 'flashDebug': 'flash_debug'\r
+ };\r
+ this.oMC = null;\r
+ this.sounds = {};\r
+ this.soundIDs = [];\r
+ this.muted = false;\r
+ this.debugID = 'soundmanager-debug';\r
+ this.debugURLParam = /([#?&])debug=1/i;\r
+ this.specialWmodeCase = false;\r
+ this.didFlashBlock = false;\r
+\r
+ this.filePattern = null;\r
+ this.filePatterns = {\r
+ 'flash8': /\.mp3(\?.*)?$/i,\r
+ 'flash9': /\.mp3(\?.*)?$/i\r
+ };\r
+\r
+ this.baseMimeTypes = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // mp3\r
+ this.netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // mp3, mp4, aac etc.\r
+ this.netStreamTypes = ['aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'mp4v', '3gp', '3g2']; // Flash v9.0r115+ "moviestar" formats\r
+ this.netStreamPattern = new RegExp('\\.(' + this.netStreamTypes.join('|') + ')(\\?.*)?$', 'i');\r
+ this.mimePattern = this.baseMimeTypes;\r
+\r
+ this.features = {\r
+ 'buffering': false,\r
+ 'peakData': false,\r
+ 'waveformData': false,\r
+ 'eqData': false,\r
+ 'movieStar': false\r
+ };\r
+\r
+ this.sandbox = {\r
+ // <d>\r
+ 'type': null,\r
+ 'types': {\r
+ 'remote': 'remote (domain-based) rules',\r
+ 'localWithFile': 'local with file access (no internet access)',\r
+ 'localWithNetwork': 'local with network (internet access only, no local access)',\r
+ 'localTrusted': 'local, trusted (local+internet access)'\r
+ },\r
+ 'description': null,\r
+ 'noRemote': null,\r
+ 'noLocal': null\r
+ // </d>\r
+ };\r
+\r
+ this.hasHTML5 = null; // switch for handling logic\r
+ this.html5 = { // stores canPlayType() results, etc. treat as read-only.\r
+ // mp3: boolean\r
+ // mp4: boolean\r
+ 'usingFlash': null // set if/when flash fallback is needed\r
+ };\r
+ this.ignoreFlash = false; // used for special cases (eg. iPad/iPhone/palm OS?)\r
+\r
+ // --- private SM2 internals ---\r
+\r
+ var SMSound,\r
+ _s = this, _sm = 'soundManager', _smc = _sm+'::', _h5 = 'HTML5::', _id, _ua = navigator.userAgent, _win = window, _wl = _win.location.href.toString(), _fV = this.flashVersion, _doc = document, _doNothing, _init, _on_queue = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnEvent, _processOnEvents, _initUserOnload, _go, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _beginInit, _strings, _initMovie, _dcLoaded, _didDCLoaded, _getDocument, _createMovie, _die, _setPolling, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _needsFlash = null, _featureCheck, _html5OK, _html5Only = false, _html5CanPlay, _html5Ext, _dcIE, _testHTML5, _event, _slice = Array.prototype.slice, _useGlobalHTML5Audio = false, _hasFlash, _detectFlash, _badSafariFix,\r
+ _is_pre = _ua.match(/pre\//i), _is_iDevice = _ua.match(/(ipad|iphone|ipod)/i), _isMobile = (_ua.match(/mobile/i) || _is_pre || _is_iDevice), _isIE = _ua.match(/msie/i), _isWebkit = _ua.match(/webkit/i), _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)), _isOpera = (_ua.match(/opera/i)), \r
+ _isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_([3-9])/i)), // Safari 4 and 5 occasionally fail to load/play HTML5 audio on Snow Leopard due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Known Apple "radar" bug. https://bugs.webkit.org/show_bug.cgi?id=32159\r
+ _hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'), _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null), _tryInitOnFocus = (typeof _doc.hasFocus === 'undefined' && _isSafari), _okToDisable = !_tryInitOnFocus;\r
+\r
+ this._use_maybe = (_wl.match(/sm2\-useHTML5Maybe\=1/i)); // temporary feature: #sm2-useHTML5Maybe=1 forces loose canPlay() check\r
+ this._overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null);\r
+ this._http = (!this._overHTTP ? 'http:' : '');\r
+ this.useAltURL = !this._overHTTP; // use altURL if not "online"\r
+ this._global_a = null;\r
+\r
+ if (_is_iDevice || _is_pre) {\r
+ // during HTML5 beta period (off by default), may as well force it on Apple + Palm, flash support unlikely\r
+ _s.useHTML5Audio = true;\r
+ _s.ignoreFlash = true;\r
+ if (_s.useGlobalHTML5Audio) {\r
+ _useGlobalHTML5Audio = true;\r
+ }\r
+ }\r
+\r
+ if (_is_pre || this._use_maybe) {\r
+ // less-strict canPlayType() checking option\r
+ _s.html5Test = /^(probably|maybe)$/i;\r
+ }\r
+\r
+ // Temporary feature: allow force of HTML5 via URL: #sm2-usehtml5audio=0 or 1\r
+ // <d>\r
+ (function(){\r
+ var a = '#sm2-usehtml5audio=', l = _wl, b = null;\r
+ if (l.indexOf(a) !== -1) {\r
+ b = (l.charAt(l.indexOf(a)+a.length) === '1');\r
+ if (typeof console !== 'undefined' && typeof console.log !== 'undefined') {\r
+ console.log((b?'Enabling ':'Disabling ')+'useHTML5Audio via URL parameter');\r
+ }\r
+ _s.useHTML5Audio = b;\r
+ }\r
+ }());\r
+ // </d>\r
+\r
+ // --- public API methods ---\r
+\r
+ this.ok = function() {\r
+ return (_needsFlash?(_didInit && !_disabled):(_s.useHTML5Audio && _s.hasHTML5));\r
+ };\r
+\r
+ this.supported = this.ok; // legacy\r
+\r
+ this.getMovie = function(smID) {\r
+ return _isIE?_win[smID]:(_isSafari?_id(smID) || _doc[smID]:_id(smID));\r
+ };\r
+\r
+ this.createSound = function(oOptions) {\r
+ var _cs = _sm+'.createSound(): ',\r
+ thisOptions = null, oSound = null, _tO = null;\r
+ if (!_didInit || !_s.ok()) {\r
+ _complain(_cs + _str(!_didInit?'notReady':'notOK'));\r
+ return false;\r
+ }\r
+ if (arguments.length === 2) {\r
+ // function overloading in JS! :) ..assume simple createSound(id,url) use case\r
+ oOptions = {\r
+ 'id': arguments[0],\r
+ 'url': arguments[1]\r
+ };\r
+ }\r
+ thisOptions = _mixin(oOptions); // inherit from defaultOptions\r
+ _tO = thisOptions; // alias\r
+ // <d>\r
+ if (_tO.id.toString().charAt(0).match(/^[0-9]$/)) {\r
+ _s._wD(_cs + _str('badID', _tO.id), 2);\r
+ }\r
+ _s._wD(_cs + _tO.id + ' (' + _tO.url + ')', 1);\r
+ // </d>\r
+ if (_idCheck(_tO.id, true)) {\r
+ _s._wD(_cs + _tO.id + ' exists', 1);\r
+ return _s.sounds[_tO.id];\r
+ }\r
+\r
+ function make() {\r
+ thisOptions = _loopFix(thisOptions);\r
+ _s.sounds[_tO.id] = new SMSound(_tO);\r
+ _s.soundIDs.push(_tO.id);\r
+ return _s.sounds[_tO.id];\r
+ }\r
+\r
+ if (_html5OK(_tO)) {\r
+ oSound = make();\r
+ _s._wD('Loading sound '+_tO.id+' via HTML5');\r
+ oSound._setup_html5(_tO);\r
+ } else {\r
+ if (_fV > 8 && _s.useMovieStar) {\r
+ if (_tO.isMovieStar === null) {\r
+ _tO.isMovieStar = ((_tO.serverURL || (_tO.type?_tO.type.match(_s.netStreamPattern):false)||_tO.url.match(_s.netStreamPattern))?true:false);\r
+ }\r
+ if (_tO.isMovieStar) {\r
+ _s._wD(_cs + 'using MovieStar handling');\r
+ }\r
+ if (_tO.isMovieStar) {\r
+ if (_tO.usePeakData) {\r
+ _wDS('noPeak');\r
+ _tO.usePeakData = false;\r
+ }\r
+ if (_tO.loops > 1) {\r
+ _wDS('noNSLoop');\r
+ }\r
+ }\r
+ }\r
+ _tO = _policyFix(_tO, _cs);\r
+ oSound = make();\r
+ if (_fV === 8) {\r
+ _s.o._createSound(_tO.id, _tO.onjustbeforefinishtime, _tO.loops||1, _tO.usePolicyFile);\r
+ } else {\r
+ _s.o._createSound(_tO.id, _tO.url, _tO.onjustbeforefinishtime, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.autoLoad, _tO.usePolicyFile);\r
+ if (!_tO.serverURL) {\r
+ // We are connected immediately\r
+ oSound.connected = true;\r
+ if (_tO.onconnect) {\r
+ _tO.onconnect.apply(oSound);\r
+ }\r
+ }\r
+ }\r
+\r
+ if ((_tO.autoLoad || _tO.autoPlay) && !_tO.serverURL) {\r
+ oSound.load(_tO); // call load for non-rtmp streams\r
+ }\r
+ }\r
+\r
+ if (_tO.autoPlay && !_tO.serverURL) { // rtmp will play in onconnect\r
+ oSound.play();\r
+ }\r
+ return oSound;\r
+ };\r
+\r
+ this.destroySound = function(sID, _bFromSound) {\r
+ // explicitly destroy a sound before normal page unload, etc.\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ var oS = _s.sounds[sID], i;\r
+ oS._iO = {}; // Disable all callbacks while the sound is being destroyed\r
+ oS.stop();\r
+ oS.unload();\r
+ for (i = 0; i < _s.soundIDs.length; i++) {\r
+ if (_s.soundIDs[i] === sID) {\r
+ _s.soundIDs.splice(i, 1);\r
+ break;\r
+ }\r
+ }\r
+ if (!_bFromSound) {\r
+ // ignore if being called from SMSound instance\r
+ oS.destruct(true);\r
+ }\r
+ oS = null;\r
+ delete _s.sounds[sID];\r
+ return true;\r
+ };\r
+\r
+ this.load = function(sID, oOptions) {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ return _s.sounds[sID].load(oOptions);\r
+ };\r
+\r
+ this.unload = function(sID) {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ return _s.sounds[sID].unload();\r
+ };\r
+\r
+ this.play = function(sID, oOptions) {\r
+ var fN = _sm+'.play(): ';\r
+ if (!_didInit || !_s.ok()) {\r
+ _complain(fN + _str(!_didInit?'notReady':'notOK'));\r
+ return false;\r
+ }\r
+ if (!_idCheck(sID)) {\r
+ if (!(oOptions instanceof Object)) {\r
+ oOptions = {\r
+ url: oOptions\r
+ }; // overloading use case: play('mySound','/path/to/some.mp3');\r
+ }\r
+ if (oOptions && oOptions.url) {\r
+ // overloading use case, create+play: .play('someID',{url:'/path/to.mp3'});\r
+ _s._wD(fN + 'attempting to create "' + sID + '"', 1);\r
+ oOptions.id = sID;\r
+ return _s.createSound(oOptions).play();\r
+ } else {\r
+ return false;\r
+ }\r
+ }\r
+ return _s.sounds[sID].play(oOptions);\r
+ };\r
+\r
+ this.start = this.play; // just for convenience\r
+\r
+ this.setPosition = function(sID, nMsecOffset) {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ return _s.sounds[sID].setPosition(nMsecOffset);\r
+ };\r
+\r
+ this.stop = function(sID) {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ _s._wD(_sm+'.stop(' + sID + ')', 1);\r
+ return _s.sounds[sID].stop();\r
+ };\r
+\r
+ this.stopAll = function() {\r
+ _s._wD(_sm+'.stopAll()', 1);\r
+ for (var oSound in _s.sounds) {\r
+ if (_s.sounds[oSound] instanceof SMSound) {\r
+ _s.sounds[oSound].stop(); // apply only to sound objects\r
+ }\r
+ }\r
+ };\r
+\r
+ this.pause = function(sID) {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ return _s.sounds[sID].pause();\r
+ };\r
+\r
+ this.pauseAll = function() {\r
+ for (var i = _s.soundIDs.length; i--;) {\r
+ _s.sounds[_s.soundIDs[i]].pause();\r
+ }\r
+ };\r
+\r
+ this.resume = function(sID) {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ return _s.sounds[sID].resume();\r
+ };\r
+\r
+ this.resumeAll = function() {\r
+ for (var i = _s.soundIDs.length; i--;) {\r
+ _s.sounds[_s.soundIDs[i]].resume();\r
+ }\r
+ };\r
+\r
+ this.togglePause = function(sID) {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ return _s.sounds[sID].togglePause();\r
+ };\r
+\r
+ this.setPan = function(sID, nPan) {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ return _s.sounds[sID].setPan(nPan);\r
+ };\r
+\r
+ this.setVolume = function(sID, nVol) {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ return _s.sounds[sID].setVolume(nVol);\r
+ };\r
+\r
+ this.mute = function(sID) {\r
+ var fN = _sm+'.mute(): ',\r
+ i = 0;\r
+ if (typeof sID !== 'string') {\r
+ sID = null;\r
+ }\r
+ if (!sID) {\r
+ _s._wD(fN + 'Muting all sounds');\r
+ for (i = _s.soundIDs.length; i--;) {\r
+ _s.sounds[_s.soundIDs[i]].mute();\r
+ }\r
+ _s.muted = true;\r
+ } else {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ _s._wD(fN + 'Muting "' + sID + '"');\r
+ return _s.sounds[sID].mute();\r
+ }\r
+ return true;\r
+ };\r
+\r
+ this.muteAll = function() {\r
+ _s.mute();\r
+ };\r
+\r
+ this.unmute = function(sID) {\r
+ var fN = _sm+'.unmute(): ', i;\r
+ if (typeof sID !== 'string') {\r
+ sID = null;\r
+ }\r
+ if (!sID) {\r
+ _s._wD(fN + 'Unmuting all sounds');\r
+ for (i = _s.soundIDs.length; i--;) {\r
+ _s.sounds[_s.soundIDs[i]].unmute();\r
+ }\r
+ _s.muted = false;\r
+ } else {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ _s._wD(fN + 'Unmuting "' + sID + '"');\r
+ return _s.sounds[sID].unmute();\r
+ }\r
+ return true;\r
+ };\r
+\r
+ this.unmuteAll = function() {\r
+ _s.unmute();\r
+ };\r
+\r
+ this.toggleMute = function(sID) {\r
+ if (!_idCheck(sID)) {\r
+ return false;\r
+ }\r
+ return _s.sounds[sID].toggleMute();\r
+ };\r
+\r
+ this.getMemoryUse = function() {\r
+ if (_fV === 8) {\r
+ return 0;\r
+ }\r
+ if (_s.o) {\r
+ return parseInt(_s.o._getMemoryUse(), 10);\r
+ }\r
+ };\r
+\r
+ this.disable = function(bNoDisable) {\r
+ // destroy all functions\r
+ if (typeof bNoDisable === 'undefined') {\r
+ bNoDisable = false;\r
+ }\r
+ if (_disabled) {\r
+ return false;\r
+ }\r
+ _disabled = true;\r
+ _wDS('shutdown', 1);\r
+ for (var i = _s.soundIDs.length; i--;) {\r
+ _disableObject(_s.sounds[_s.soundIDs[i]]);\r
+ }\r
+ _initComplete(bNoDisable); // fire "complete", despite fail\r
+ _event.remove(_win, 'load', _initUserOnload);\r
+ return true;\r
+ };\r
+\r
+ this.canPlayMIME = function(sMIME) {\r
+ var result;\r
+ if (_s.hasHTML5) {\r
+ result = _html5CanPlay({type:sMIME});\r
+ }\r
+ if (!_needsFlash || result) {\r
+ // no flash, or OK\r
+ return result;\r
+ } else {\r
+ return (sMIME?(sMIME.match(_s.mimePattern)?true:false):null);\r
+ }\r
+ };\r
+\r
+ this.canPlayURL = function(sURL) {\r
+ var result;\r
+ if (_s.hasHTML5) {\r
+ result = _html5CanPlay(sURL);\r
+ }\r
+ if (!_needsFlash || result) {\r
+ // no flash, or OK\r
+ return result;\r
+ } else {\r
+ return (sURL?(sURL.match(_s.filePattern)?true:false):null);\r
+ }\r
+ };\r
+\r
+ this.canPlayLink = function(oLink) {\r
+ if (typeof oLink.type !== 'undefined' && oLink.type) {\r
+ if (_s.canPlayMIME(oLink.type)) {\r
+ return true;\r
+ }\r
+ }\r
+ return _s.canPlayURL(oLink.href);\r
+ };\r
+\r
+ this.getSoundById = function(sID, suppressDebug) {\r
+ if (!sID) {\r
+ throw new Error(_sm+'.getSoundById(): sID is null/undefined');\r
+ }\r
+ var result = _s.sounds[sID];\r
+ if (!result && !suppressDebug) {\r
+ _s._wD('"' + sID + '" is an invalid sound ID.', 2);\r
+ }\r
+ return result;\r
+ };\r
+\r
+ this.onready = function(oMethod, oScope) {\r
+ var sType = 'onready';\r
+ if (oMethod && oMethod instanceof Function) {\r
+ if (_didInit) {\r
+ _wDS('queue', sType);\r
+ }\r
+ if (!oScope) {\r
+ oScope = _win;\r
+ }\r
+ _addOnEvent(sType, oMethod, oScope);\r
+ _processOnEvents();\r
+ return true;\r
+ } else {\r
+ throw _str('needFunction', sType);\r
+ }\r
+ };\r
+\r
+ this.ontimeout = function(oMethod, oScope) {\r
+ var sType = 'ontimeout';\r
+ if (oMethod && oMethod instanceof Function) {\r
+ if (_didInit) {\r
+ _wDS('queue');\r
+ }\r
+ if (!oScope) {\r
+ oScope = _win;\r
+ }\r
+ _addOnEvent(sType, oMethod, oScope);\r
+ _processOnEvents({type:sType});\r
+ return true;\r
+ } else {\r
+ throw _str('needFunction', sType);\r
+ }\r
+ };\r
+\r
+ this.getMoviePercent = function() {\r
+ return (_s.o && typeof _s.o.PercentLoaded !== 'undefined'?_s.o.PercentLoaded():null);\r
+ };\r
+\r
+ this._writeDebug = function(sText, sType, bTimestamp) {\r
+ // pseudo-private console.log()-style output\r
+ // <d>\r
+ var sDID = 'soundmanager-debug', o, oItem, sMethod;\r
+ if (!_s.debugMode) {\r
+ return false;\r
+ }\r
+ if (typeof bTimestamp !== 'undefined' && bTimestamp) {\r
+ sText = sText + ' | ' + new Date().getTime();\r
+ }\r
+ if (_hasConsole && _s.useConsole) {\r
+ sMethod = _debugLevels[sType];\r
+ if (typeof console[sMethod] !== 'undefined') {\r
+ console[sMethod](sText);\r
+ } else {\r
+ console.log(sText);\r
+ }\r
+ if (_s.useConsoleOnly) {\r
+ return true;\r
+ }\r
+ }\r
+ try {\r
+ o = _id(sDID);\r
+ if (!o) {\r
+ return false;\r
+ }\r
+ oItem = _doc.createElement('div');\r
+ if (++_wdCount % 2 === 0) {\r
+ oItem.className = 'sm2-alt';\r
+ }\r
+ if (typeof sType === 'undefined') {\r
+ sType = 0;\r
+ } else {\r
+ sType = parseInt(sType, 10);\r
+ }\r
+ oItem.appendChild(_doc.createTextNode(sText));\r
+ if (sType) {\r
+ if (sType >= 2) {\r
+ oItem.style.fontWeight = 'bold';\r
+ }\r
+ if (sType === 3) {\r
+ oItem.style.color = '#ff3333';\r
+ }\r
+ }\r
+ // o.appendChild(oItem); // top-to-bottom\r
+ o.insertBefore(oItem, o.firstChild); // bottom-to-top\r
+ } catch(e) {\r
+ // oh well\r
+ }\r
+ o = null;\r
+ // </d>\r
+ return true;\r
+ };\r
+ this._wD = this._writeDebug; // alias\r
+\r
+ this._debug = function() {\r
+ // <d>\r
+ _wDS('currentObj', 1);\r
+ for (var i = 0, j = _s.soundIDs.length; i < j; i++) {\r
+ _s.sounds[_s.soundIDs[i]]._debug();\r
+ }\r
+ // </d>\r
+ };\r
+\r
+ this.reboot = function() {\r
+ // attempt to reset and init SM2\r
+ _s._wD(_sm+'.reboot()');\r
+ if (_s.soundIDs.length) {\r
+ _s._wD('Destroying ' + _s.soundIDs.length + ' SMSound objects...');\r
+ }\r
+ var i, j;\r
+ for (i = _s.soundIDs.length; i--;) {\r
+ _s.sounds[_s.soundIDs[i]].destruct();\r
+ }\r
+ // trash ze flash\r
+ try {\r
+ if (_isIE) {\r
+ _oRemovedHTML = _s.o.innerHTML;\r
+ }\r
+ _oRemoved = _s.o.parentNode.removeChild(_s.o);\r
+ _s._wD('Flash movie removed.');\r
+ } catch(e) {\r
+ // uh-oh.\r
+ _wDS('badRemove', 2);\r
+ }\r
+ // actually, force recreate of movie.\r
+ _oRemovedHTML = _oRemoved = null;\r
+ _s.enabled = _didInit = _waitingForEI = _initPending = _didAppend = _appendSuccess = _disabled = _s.swfLoaded = false;\r
+ _s.soundIDs = _s.sounds = [];\r
+ _s.o = null;\r
+ for (i in _on_queue) {\r
+ if (_on_queue.hasOwnProperty(i)) {\r
+ for (j = _on_queue[i].length; j--;) {\r
+ _on_queue[i][j].fired = false;\r
+ }\r
+ }\r
+ }\r
+ _s._wD(_sm + ': Rebooting...');\r
+ _win.setTimeout(function() {\r
+ _s.beginDelayedInit();\r
+ }, 20);\r
+ };\r
+\r
+ this.destruct = function() {\r
+ _s._wD(_sm+'.destruct()');\r
+ _s.disable(true);\r
+ };\r
+\r
+ this.beginDelayedInit = function() {\r
+ // _s._wD(_sm+'.beginDelayedInit()');\r
+ _windowLoaded = true;\r
+ _dcLoaded();\r
+ setTimeout(_beginInit, 20);\r
+ _delayWaitForEI();\r
+ };\r
+\r
+\r
+ // Wrap html5 event handlers so we don't call them on destroyed sounds\r
+ function _html5_event(oFn) {\r
+ return function(e) {\r
+ if (!this._t || !this._t._a) {\r
+ if (this._t && this._t.sID) {\r
+ _s._wD(_h5+'ignoring '+e.type+': '+this._t.sID);\r
+ } else {\r
+ _s._wD(_h5+'ignoring '+e.type);\r
+ }\r
+ return null;\r
+ } else {\r
+ return oFn.call(this, e);\r
+ }\r
+ };\r
+ }\r
+\r
+ this._html5_events = {\r
+\r
+ // HTML5 event-name-to-handler map\r
+ abort: _html5_event(function(e) {\r
+ _s._wD(_h5+'abort: '+this._t.sID);\r
+ }),\r
+\r
+ // enough has loaded to play\r
+ canplay: _html5_event(function(e) {\r
+ _s._wD(_h5+'canplay: '+this._t.sID+', '+this._t.url);\r
+ this._t._onbufferchange(0);\r
+ var position1K = (!isNaN(this._t.position)?this._t.position/1000:null);\r
+ // set the position if position was set before the sound loaded\r
+ this._t._html5_canplay = true;\r
+ if (this._t.position && this.currentTime !== position1K) {\r
+ _s._wD(_h5+'canplay: setting position to '+position1K+'');\r
+ try {\r
+ this.currentTime = position1K;\r
+ } catch(ee) {\r
+ _s._wD(_h5+'setting position failed: '+ee.message, 2);\r
+ }\r
+ }\r
+ }),\r
+\r
+ load: _html5_event(function(e) {\r
+ if (!this._t.loaded) {\r
+ this._t._onbufferchange(0);\r
+ // should be 1, and the same\r
+ this._t._whileloading(this._t.bytesTotal, this._t.bytesTotal, this._t._get_html5_duration());\r
+ this._t._onload(true);\r
+ }\r
+ }),\r
+\r
+ emptied: _html5_event(function(e) {\r
+ _s._wD(_h5+'emptied: '+this._t.sID);\r
+ }),\r
+\r
+ ended: _html5_event(function(e) {\r
+ _s._wD(_h5+'ended: '+this._t.sID);\r
+ this._t._onfinish();\r
+ }),\r
+\r
+ error: _html5_event(function(e) {\r
+ _s._wD(_h5+'error: '+this.error.code);\r
+ // call load with error state?\r
+ this._t._onload(false);\r
+ }),\r
+\r
+ loadeddata: _html5_event(function(e) {\r
+ _s._wD(_h5+'loadeddata: '+this._t.sID);\r
+ }),\r
+\r
+ loadedmetadata: _html5_event(function(e) {\r
+ _s._wD(_h5+'loadedmetadata: '+this._t.sID);\r
+ }),\r
+\r
+ loadstart: _html5_event(function(e) {\r
+ _s._wD(_h5+'loadstart: '+this._t.sID);\r
+ // assume buffering at first\r
+ this._t._onbufferchange(1);\r
+ }),\r
+\r
+ play: _html5_event(function(e) {\r
+ _s._wD(_h5+'play: '+this._t.sID+', '+this._t.url);\r
+ // once play starts, no buffering\r
+ this._t._onbufferchange(0);\r
+ }),\r
+\r
+ // TODO: verify if this is actually implemented anywhere yet.\r
+ playing: _html5_event(function(e) {\r
+ _s._wD(_h5+'playing: '+this._t.sID+', '+this._t.url);\r
+ // once play starts, no buffering\r
+ this._t._onbufferchange(0);\r
+ }),\r
+\r
+ progress: _html5_event(function(e) {\r
+\r
+ if (this._t.loaded) {\r
+ return false;\r
+ }\r
+\r
+ var i, j, str, loadSum = 0, buffered = 0,\r
+ isProgress = (e.type === 'progress'),\r
+ ranges = e.target.buffered,\r
+ loaded = (e.loaded||0), // firefox 3.6 implements e.loaded/total (bytes)\r
+ total = (e.total||1);\r
+\r
+ if (ranges && ranges.length) {\r
+\r
+ // if loaded is 0, try TimeRanges implementation as % of load\r
+ // https://developer.mozilla.org/en/DOM/TimeRanges\r
+ for (i=ranges.length; i--;) {\r
+ buffered = (ranges.end(i) - ranges.start(i));\r
+ }\r
+\r
+ // linear case, buffer sum; does not account for seeking and HTTP partials / byte ranges\r
+ loaded = buffered/e.target.duration;\r
+\r
+ // <d>\r
+ if (isProgress && ranges.length > 1) {\r
+ str = [];\r
+ j = ranges.length;\r
+ for (i=0; i<j; i++) {\r
+ str.push(e.target.buffered.start(i) +'-'+ e.target.buffered.end(i));\r
+ }\r
+ _s._wD(_h5+'progress: timeRanges: '+str.join(', '));\r
+ }\r
+ // </d>\r
+\r
+ if (isProgress && !isNaN(loaded)) {\r
+ _s._wD(_h5+'progress: '+this._t.sID+': ' + Math.floor(loaded*100)+'% loaded');\r
+ }\r
+\r
+ }\r
+\r
+ if (!isNaN(loaded)) {\r
+\r
+ this._t._onbufferchange(0); // if progress, likely not buffering\r
+ this._t._whileloading(loaded, total, this._t._get_html5_duration());\r
+\r
+ if (loaded && total && loaded === total) {\r
+ // in case "onload" doesn't fire (eg. gecko 1.9.2)\r
+ _s._html5_events.load.call(this, e);\r
+ }\r
+\r
+ }\r
+\r
+ }),\r
+\r
+ ratechange: _html5_event(function(e) {\r
+ _s._wD(_h5+'ratechange: '+this._t.sID);\r
+ }),\r
+\r
+ suspend: _html5_event(function(e) {\r
+ // download paused/stopped, may have finished (eg. onload)\r
+ _s._wD(_h5+'suspend: '+this._t.sID);\r
+ _s._html5_events.progress.call(this, e);\r
+ }),\r
+\r
+ stalled: _html5_event(function(e) {\r
+ _s._wD(_h5+'stalled: '+this._t.sID);\r
+ }),\r
+\r
+ timeupdate: _html5_event(function(e) {\r
+ this._t._onTimer();\r
+ }),\r
+\r
+ waiting: _html5_event(function(e) { // see also: seeking\r
+ _s._wD(_h5+'waiting: '+this._t.sID);\r
+ // playback faster than download rate, etc.\r
+ this._t._onbufferchange(1);\r
+ })\r
+\r
+ };\r
+\r
+ // --- SMSound (sound object) instance ---\r
+\r
+ SMSound = function(oOptions) {\r
+ var _t = this, _resetProperties, _stop_html5_timer, _start_html5_timer;\r
+ this.sID = oOptions.id;\r
+ this.url = oOptions.url;\r
+ this.options = _mixin(oOptions);\r
+ this.instanceOptions = this.options; // per-play-instance-specific options\r
+ this._iO = this.instanceOptions; // short alias\r
+ // assign property defaults\r
+ this.pan = this.options.pan;\r
+ this.volume = this.options.volume;\r
+ this._lastURL = null;\r
+ this.isHTML5 = false;\r
+ this._a = null;\r
+\r
+ // --- public methods ---\r
+\r
+ this.id3 = {};\r
+\r
+ this._debug = function() {\r
+ // <d>\r
+ // pseudo-private console.log()-style output\r
+ if (_s.debugMode) {\r
+ var stuff = null, msg = [], sF, sfBracket, maxLength = 64;\r
+ for (stuff in _t.options) {\r
+ if (_t.options[stuff] !== null) {\r
+ if (_t.options[stuff] instanceof Function) {\r
+ // handle functions specially\r
+ sF = _t.options[stuff].toString();\r
+ sF = sF.replace(/\s\s+/g, ' '); // normalize spaces\r
+ sfBracket = sF.indexOf('{');\r
+ msg.push(' ' + stuff + ': {' + sF.substr(sfBracket + 1, (Math.min(Math.max(sF.indexOf('\n') - 1, maxLength), maxLength))).replace(/\n/g, '') + '... }');\r
+ } else {\r
+ msg.push(' ' + stuff + ': ' + _t.options[stuff]);\r
+ }\r
+ }\r
+ }\r
+ _s._wD('SMSound() merged options: {\n' + msg.join(', \n') + '\n}');\r
+ }\r
+ // </d>\r
+ };\r
+\r
+ this._debug();\r
+\r
+ this.load = function(oOptions) {\r
+ var oS = null;\r
+ if (typeof oOptions !== 'undefined') {\r
+ _t._iO = _mixin(oOptions, _t.options);\r
+ _t.instanceOptions = _t._iO;\r
+ } else {\r
+ oOptions = _t.options;\r
+ _t._iO = oOptions;\r
+ _t.instanceOptions = _t._iO;\r
+ if (_t._lastURL && _t._lastURL !== _t.url) {\r
+ _wDS('manURL');\r
+ _t._iO.url = _t.url;\r
+ _t.url = null;\r
+ }\r
+ }\r
+ if (!_t._iO.url) {\r
+ _t._iO.url = _t.url;\r
+ }\r
+ _s._wD('SMSound.load(): ' + _t._iO.url, 1);\r
+ if (_t._iO.url === _t.url && _t.readyState !== 0 && _t.readyState !== 2) {\r
+ _wDS('onURL', 1);\r
+ return _t;\r
+ }\r
+ _t._lastURL = _t.url;\r
+ _t.loaded = false;\r
+ _t.readyState = 1;\r
+ _t.playState = 0;\r
+ if (_html5OK(_t._iO)) {\r
+ oS = _t._setup_html5(_t._iO);\r
+ if (!oS._called_load) {\r
+ _s._wD(_h5+'load: '+_t.sID);\r
+ oS.load();\r
+ oS._called_load = true;\r
+ if (_t._iO.autoPlay) {\r
+ _t.play();\r
+ }\r
+ } else {\r
+ _s._wD('HTML5 ignoring request to load again: '+_t.sID);\r
+ }\r
+ } else {\r
+ try {\r
+ _t.isHTML5 = false;\r
+ _t._iO = _policyFix(_loopFix(_t._iO));\r
+ if (_fV === 8) {\r
+ _s.o._load(_t.sID, _t._iO.url, _t._iO.stream, _t._iO.autoPlay, (_t._iO.whileloading?1:0), _t._iO.loops||1, _t._iO.usePolicyFile);\r
+ } else {\r
+ _s.o._load(_t.sID, _t._iO.url, _t._iO.stream?true:false, _t._iO.autoPlay?true:false, _t._iO.loops||1, _t._iO.autoLoad?true:false, _t._iO.usePolicyFile);\r
+ }\r
+ } catch(e) {\r
+ _wDS('smError', 2);\r
+ _debugTS('onload', false);\r
+ _die();\r
+ }\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ this.unload = function() {\r
+ // Flash 8/AS2 can't "close" a stream - fake it by loading an empty MP3\r
+ // Flash 9/AS3: Close stream, preventing further load\r
+ if (_t.readyState !== 0) {\r
+ _s._wD('SMSound.unload(): "' + _t.sID + '"');\r
+ if (!_t.isHTML5) {\r
+ if (_fV === 8) {\r
+ _s.o._unload(_t.sID, _s.nullURL);\r
+ } else {\r
+ _s.o._unload(_t.sID);\r
+ }\r
+ } else {\r
+ _stop_html5_timer();\r
+ if (_t._a) {\r
+ // abort()-style method here, stop loading? (doesn't exist?)\r
+ _t._a.pause();\r
+// if (!_useGlobalHTML5Audio || (_useGlobalHTML5Audio && _t.playState)) { // if global audio, only unload if actively playing\r
+ _t._a.src = ''; // https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox#Stopping_the_download_of_media\r
+// }\r
+ }\r
+ }\r
+ // reset load/status flags\r
+ _resetProperties();\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ this.destruct = function(_bFromSM) {\r
+ _s._wD('SMSound.destruct(): "' + _t.sID + '"');\r
+ if (!_t.isHTML5) {\r
+ // kill sound within Flash\r
+ // Disable the onfailure handler\r
+ _t._iO.onfailure = null;\r
+ _s.o._destroySound(_t.sID);\r
+ } else {\r
+ _stop_html5_timer();\r
+ if (_t._a) {\r
+ // abort()-style method here, stop loading? (doesn't exist?)\r
+ _t._a.pause();\r
+ _t._a.src = ''; // https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox#Stopping_the_download_of_media\r
+ if (!_useGlobalHTML5Audio) {\r
+ _t._remove_html5_events();\r
+ }\r
+ }\r
+ }\r
+ if (!_bFromSM) {\r
+ _s.destroySound(_t.sID, true); // ensure deletion from controller\r
+ }\r
+ };\r
+\r
+ this.play = function(oOptions, _updatePlayState) {\r
+ var fN = 'SMSound.play(): ', allowMulti;\r
+ _updatePlayState = _updatePlayState === undefined ? true : _updatePlayState; // default true\r
+ if (!oOptions) {\r
+ oOptions = {};\r
+ }\r
+ _t._iO = _mixin(oOptions, _t._iO);\r
+ _t._iO = _mixin(_t._iO, _t.options);\r
+ _t.instanceOptions = _t._iO;\r
+ if (_t._iO.serverURL) {\r
+ if (!_t.connected) {\r
+ if (!_t.getAutoPlay()) {\r
+ _s._wD(fN+' Netstream not connected yet - setting autoPlay');\r
+ _t.setAutoPlay(true);\r
+ }\r
+ return _t; // play will be called in _onconnect()\r
+ }\r
+ }\r
+ if (_html5OK(_t._iO)) {\r
+ _t._setup_html5(_t._iO);\r
+ _start_html5_timer();\r
+ }\r
+ if (_t.playState === 1 && !_t.paused) {\r
+ allowMulti = _t._iO.multiShot;\r
+ if (!allowMulti) {\r
+ _s._wD(fN + '"' + _t.sID + '" already playing (one-shot)', 1);\r
+ return _t;\r
+ } else {\r
+ _s._wD(fN + '"' + _t.sID + '" already playing (multi-shot)', 1);\r
+ if (_t.isHTML5) {\r
+ // TODO: BUG?\r
+ _t.setPosition(_t._iO.position);\r
+ }\r
+ }\r
+ }\r
+ if (!_t.loaded) {\r
+ if (_t.readyState === 0) {\r
+ _s._wD(fN + 'Attempting to load "' + _t.sID + '"', 1);\r
+ // try to get this sound playing ASAP\r
+ if (!_t.isHTML5) {\r
+ _t._iO.autoPlay = true; // assign directly because setAutoPlay() increments the instanceCount\r
+ _t.load(_t._iO);\r
+ } else {\r
+ _t.load(_t._iO);\r
+ // _t.readyState = 1; // redundant\r
+ }\r
+ } else if (_t.readyState === 2) {\r
+ _s._wD(fN + 'Could not load "' + _t.sID + '" - exiting', 2);\r
+ return _t;\r
+ } else {\r
+ _s._wD(fN + '"' + _t.sID + '" is loading - attempting to play..', 1);\r
+ }\r
+ } else {\r
+ _s._wD(fN + '"' + _t.sID + '"');\r
+ }\r
+ // Streams will pause when their buffer is full if they are being loaded.\r
+ // In this case paused is true, but the song hasn't started playing yet. If\r
+ // we just call resume() the onplay() callback will never be called. So\r
+ // only call resume() if the position is > 0.\r
+ // Another reason is because options like volume won't have been applied yet.\r
+ if (_t.paused && _t.position && _t.position > 0) { // https://gist.github.com/37b17df75cc4d7a90bf6\r
+ _s._wD(fN + '"' + _t.sID + '" is resuming from paused state',1);\r
+ _t.resume();\r
+ } else {\r
+ _s._wD(fN+'"'+ _t.sID+'" is starting to play');\r
+ _t.playState = 1;\r
+ _t.paused = false;\r
+ if (!_t.instanceCount || _t._iO.multiShotEvents || (_fV > 8 && !_t.isHTML5 && !_t.getAutoPlay())) {\r
+ _t.instanceCount++;\r
+ }\r
+ _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0);\r
+ if (!_t.isHTML5) {\r
+ _t._iO = _policyFix(_loopFix(_t._iO));\r
+ }\r
+ if (_t._iO.onplay && _updatePlayState) {\r
+ _t._iO.onplay.apply(_t);\r
+ _t._onplay_called = true;\r
+ }\r
+ _t.setVolume(_t._iO.volume, true);\r
+ _t.setPan(_t._iO.pan, true);\r
+ if (!_t.isHTML5) {\r
+ _s.o._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t.position:_t.position / 1000));\r
+ } else {\r
+ _start_html5_timer();\r
+ _t._setup_html5().play();\r
+ }\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ this.start = this.play; // just for convenience\r
+\r
+ this.stop = function(bAll) {\r
+ if (_t.playState === 1) {\r
+ _t._onbufferchange(0);\r
+ _t.resetOnPosition(0);\r
+ if (!_t.isHTML5) {\r
+ _t.playState = 0;\r
+ }\r
+ _t.paused = false;\r
+ if (_t._iO.onstop) {\r
+ _t._iO.onstop.apply(_t);\r
+ }\r
+ if (!_t.isHTML5) {\r
+ _s.o._stop(_t.sID, bAll);\r
+ // hack for netStream: just unload\r
+ if (_t._iO.serverURL) {\r
+ _t.unload();\r
+ }\r
+ } else {\r
+ if (_t._a) {\r
+ _t.setPosition(0); // act like Flash, though\r
+ _t._a.pause(); // html5 has no stop()\r
+ _t.playState = 0;\r
+ _t._onTimer(); // and update UI\r
+ _stop_html5_timer();\r
+ _t.unload();\r
+ }\r
+ }\r
+ _t.instanceCount = 0;\r
+ _t._iO = {};\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ this.setAutoPlay = function(autoPlay) {\r
+ _s._wD('sound '+_t.sID+' turned autoplay ' + (autoPlay ? 'on' : 'off'));\r
+ _t._iO.autoPlay = autoPlay;\r
+ if (_t.isHTML5) {\r
+ if (_t._a && autoPlay) {\r
+ _t.play(); // HTML5 onload isn't reliable\r
+ }\r
+ } else {\r
+ _s.o._setAutoPlay(_t.sID, autoPlay);\r
+ }\r
+ if (autoPlay) {\r
+ // only increment the instanceCount if the sound isn't loaded (TODO: verify RTMP)\r
+ if (!_t.instanceCount && _t.readyState === 1) {\r
+ _t.instanceCount++;\r
+ _s._wD('sound '+_t.sID+' incremented instance count to '+_t.instanceCount);\r
+ }\r
+ }\r
+ };\r
+\r
+ this.getAutoPlay = function() {\r
+ return _t._iO.autoPlay;\r
+ };\r
+\r
+ this.setPosition = function(nMsecOffset, bNoDebug) {\r
+ if (nMsecOffset === undefined) {\r
+ nMsecOffset = 0;\r
+ }\r
+ // Use the duration from the instance options, if we don't have a track duration yet.\r
+ var original_pos, position, position1K, offset = (_t.isHTML5 ? Math.max(nMsecOffset,0) : Math.min(_t.duration || _t._iO.duration, Math.max(nMsecOffset, 0))); // position >= 0 and <= current available (loaded) duration\r
+ original_pos = _t.position;\r
+ _t.position = offset;\r
+ position1K = _t.position/1000;\r
+ _t.resetOnPosition(_t.position);\r
+ _t._iO.position = offset;\r
+ if (!_t.isHTML5) {\r
+ position = _fV === 9 ? _t.position : position1K;\r
+ if (_t.readyState && _t.readyState !== 2) {\r
+ _s.o._setPosition(_t.sID, position, (_t.paused || !_t.playState)); // if paused or not playing, will not resume (by playing)\r
+ }\r
+ } else if (_t._a) {\r
+ // Set the position in the canplay handler if the sound is not ready yet\r
+ if (_t._html5_canplay) {\r
+ if (_t._a.currentTime !== position1K) {\r
+ // Only set the position if we need to.\r
+ // DOM/JS errors/exceptions to watch out for:\r
+ // if seek is beyond (loaded?) position, "DOM exception 11"\r
+ // "INDEX_SIZE_ERR": DOM exception 1\r
+ _s._wD('setPosition('+position1K+'): setting position');\r
+ try {\r
+ _t._a.currentTime = position1K;\r
+ } catch(e) {\r
+ _s._wD('setPosition('+position1K+'): setting position failed: '+e.message, 2);\r
+ }\r
+ }\r
+ } else {\r
+ _s._wD('setPosition('+position1K+'): delaying, sound not ready');\r
+ }\r
+ }\r
+ if (_t.isHTML5) {\r
+ if (_t.paused) { // if paused, refresh UI right away\r
+ _t._onTimer(true); // force update\r
+ }\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ this.pause = function(bCallFlash) {\r
+ if (_t.paused || (_t.playState === 0 && _t.readyState !== 1)) {\r
+ return _t;\r
+ }\r
+ _s._wD('SMSound.pause()');\r
+ _t.paused = true;\r
+ if (!_t.isHTML5) {\r
+ if (bCallFlash || bCallFlash === undefined) {\r
+ _s.o._pause(_t.sID);\r
+ }\r
+ } else {\r
+ _t._setup_html5().pause();\r
+ _stop_html5_timer();\r
+ }\r
+ if (_t._iO.onpause) {\r
+ _t._iO.onpause.apply(_t);\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ // When auto-loaded streams pause on buffer full they have a playState of 0.\r
+ // We need to make sure that the playState is set to 1 when these streams "resume".\r
+ //\r
+ // When a paused stream is resumed, we need to trigger the onplay() callback if it\r
+ // hasn't been called already. In this case since the sound is being played for the\r
+ // first time, I think it's more appropriate to call onplay() rather than onresume().\r
+ this.resume = function() {\r
+ if (!_t.paused) {\r
+ return _t;\r
+ }\r
+ _s._wD('SMSound.resume()');\r
+ _t.paused = false;\r
+ _t.playState = 1;\r
+ if (!_t.isHTML5) {\r
+ if (_t._iO.isMovieStar) {\r
+ // Bizarre Webkit bug (Chrome reported via 8tracks.com dudes): AAC content paused for 30+ seconds(?) will not resume without a reposition.\r
+ _t.setPosition(_t.position);\r
+ }\r
+ _s.o._pause(_t.sID); // flash method is toggle-based (pause/resume)\r
+ } else {\r
+ _t._setup_html5().play();\r
+ _start_html5_timer();\r
+ }\r
+ if (!_t._onplay_called && _t._iO.onplay) {\r
+ _t._iO.onplay.apply(_t);\r
+ _t._onplay_called = true;\r
+ } else if (_t._iO.onresume) {\r
+ _t._iO.onresume.apply(_t);\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ this.togglePause = function() {\r
+ _s._wD('SMSound.togglePause()');\r
+ if (_t.playState === 0) {\r
+ _t.play({\r
+ position: (_fV === 9 && !_t.isHTML5 ? _t.position:_t.position / 1000)\r
+ });\r
+ return _t;\r
+ }\r
+ if (_t.paused) {\r
+ _t.resume();\r
+ } else {\r
+ _t.pause();\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ this.setPan = function(nPan, bInstanceOnly) {\r
+ if (typeof nPan === 'undefined') {\r
+ nPan = 0;\r
+ }\r
+ if (typeof bInstanceOnly === 'undefined') {\r
+ bInstanceOnly = false;\r
+ }\r
+ if (!_t.isHTML5) {\r
+ _s.o._setPan(_t.sID, nPan);\r
+ } // else { no HTML5 pan? }\r
+ _t._iO.pan = nPan;\r
+ if (!bInstanceOnly) {\r
+ _t.pan = nPan;\r
+ _t.options.pan = nPan;\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ this.setVolume = function(nVol, bInstanceOnly) {\r
+ if (typeof nVol === 'undefined') {\r
+ nVol = 100;\r
+ }\r
+ if (typeof bInstanceOnly === 'undefined') {\r
+ bInstanceOnly = false;\r
+ }\r
+ if (!_t.isHTML5) {\r
+ _s.o._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol);\r
+ } else if (_t._a) {\r
+ _t._a.volume = Math.max(0, Math.min(1, nVol/100)); // valid range: 0-1\r
+ }\r
+ _t._iO.volume = nVol;\r
+ if (!bInstanceOnly) {\r
+ _t.volume = nVol;\r
+ _t.options.volume = nVol;\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ this.mute = function() {\r
+ _t.muted = true;\r
+ if (!_t.isHTML5) {\r
+ _s.o._setVolume(_t.sID, 0);\r
+ } else if (_t._a) {\r
+ _t._a.muted = true;\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ this.unmute = function() {\r
+ _t.muted = false;\r
+ var hasIO = typeof _t._iO.volume !== 'undefined';\r
+ if (!_t.isHTML5) {\r
+ _s.o._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume);\r
+ } else if (_t._a) {\r
+ _t._a.muted = false;\r
+ }\r
+ return _t;\r
+ };\r
+\r
+ this.toggleMute = function() {\r
+ return (_t.muted?_t.unmute():_t.mute());\r
+ };\r
+\r
+ this.onposition = function(nPosition, oMethod, oScope) {\r
+ // TODO: allow for ranges, too? eg. (nPosition instanceof Array)\r
+ _t._onPositionItems.push({\r
+ position: nPosition,\r
+ method: oMethod,\r
+ scope: (typeof oScope !== 'undefined'?oScope:_t),\r
+ fired: false\r
+ });\r
+ return _t;\r
+ };\r
+\r
+ this.processOnPosition = function() {\r
+ var i, item, j = _t._onPositionItems.length;\r
+ if (!j || !_t.playState || _t._onPositionFired >= j) {\r
+ return false;\r
+ }\r
+ for (i=j; i--;) {\r
+ item = _t._onPositionItems[i];\r
+ if (!item.fired && _t.position >= item.position) {\r
+ item.method.apply(item.scope,[item.position]);\r
+ item.fired = true;\r
+ _s._onPositionFired++;\r
+ }\r
+ }\r
+ return true;\r
+ };\r
+\r
+ this.resetOnPosition = function(nPosition) {\r
+ // reset "fired" for items interested in this position\r
+ var i, item, j = _t._onPositionItems.length;\r
+ if (!j) {\r
+ return false;\r
+ }\r
+ for (i=j; i--;) {\r
+ item = _t._onPositionItems[i];\r
+ if (item.fired && nPosition <= item.position) {\r
+ item.fired = false;\r
+ _s._onPositionFired--;\r
+ }\r
+ }\r
+ return true;\r
+ };\r
+\r
+ // pseudo-private soundManager reference\r
+\r
+ this._onTimer = function(bForce) {\r
+ // HTML5-only _whileplaying() etc.\r
+ var time, x = {};\r
+ if (_t._hasTimer || bForce) {\r
+ if (_t._a && (bForce || ((_t.playState > 0 || _t.readyState === 1) && !_t.paused))) { // TODO: May not need to track readyState (1 = loading)\r
+ _t.duration = _t._get_html5_duration();\r
+ _t.durationEstimate = _t.duration;\r
+ time = _t._a.currentTime?_t._a.currentTime*1000:0;\r
+ _t._whileplaying(time,x,x,x,x);\r
+ return true;\r
+ } else {\r
+ _s._wD('_onTimer: Warn for "'+_t.sID+'": '+(!_t._a?'Could not find element. ':'')+(_t.playState === 0?'playState bad, 0?':'playState = '+_t.playState+', OK'));\r
+ return false;\r
+ }\r
+ }\r
+ };\r
+\r
+ // --- private internals ---\r
+\r
+ this._get_html5_duration = function() {\r
+ var d = (_t._a ? _t._a.duration*1000 : (_t._iO ? _t._iO.duration : undefined));\r
+ return (d && !isNaN(d) && d !== Infinity ? d : (_t._iO ? _t._iO.duration : null));\r
+ };\r
+\r
+ _start_html5_timer = function() {\r
+ if (_t.isHTML5) {\r
+ _startTimer(_t);\r
+ }\r
+ };\r
+\r
+ _stop_html5_timer = function() {\r
+ if (_t.isHTML5) {\r
+ _stopTimer(_t);\r
+ }\r
+ };\r
+\r
+ _resetProperties = function(bLoaded) {\r
+ _t._onPositionItems = [];\r
+ _t._onPositionFired = 0;\r
+ _t._hasTimer = null;\r
+ _t._onplay_called = false;\r
+ _t._a = null;\r
+ _t._html5_canplay = false;\r
+ _t.bytesLoaded = null;\r
+ _t.bytesTotal = null;\r
+ _t.position = null;\r
+ _t.duration = (_t._iO && _t._iO.duration?_t._iO.duration:null);\r
+ _t.durationEstimate = null;\r
+ _t.failures = 0;\r
+ _t.loaded = false;\r
+ _t.playState = 0;\r
+ _t.paused = false;\r
+ _t.readyState = 0; // 0 = uninitialised, 1 = loading, 2 = failed/error, 3 = loaded/success\r
+ _t.muted = false;\r
+ _t.didBeforeFinish = false;\r
+ _t.didJustBeforeFinish = false;\r
+ _t.isBuffering = false;\r
+ _t.instanceOptions = {};\r
+ _t.instanceCount = 0;\r
+ _t.peakData = {\r
+ left: 0,\r
+ right: 0\r
+ };\r
+ _t.waveformData = {\r
+ left: [],\r
+ right: []\r
+ };\r
+ _t.eqData = []; // legacy: 1D array\r
+ _t.eqData.left = [];\r
+ _t.eqData.right = [];\r
+ };\r
+\r
+ _resetProperties();\r
+\r
+ // pseudo-private methods used by soundManager\r
+\r
+ this._setup_html5 = function(oOptions) {\r
+ var _iO = _mixin(_t._iO, oOptions), d = decodeURI,\r
+ _a = _useGlobalHTML5Audio ? _s._global_a : _t._a,\r
+ _dURL = d(_iO.url),\r
+ _oldIO = (_a && _a._t ? _a._t.instanceOptions : null);\r
+ if (_a) {\r
+ if (_a._t && _oldIO.url === _iO.url && (!_t._lastURL || (_t._lastURL === _oldIO.url))) {\r
+ return _a; // same url, ignore request\r
+ }\r
+ _s._wD('setting new URL on existing object: ' + _dURL + (_t._lastURL ? ', old URL: ' + _t._lastURL : ''));\r
+ /*\r
+ * "First things first, I, Poppa.." (reset the previous state of the old sound, if playing)\r
+ * Fixes case with devices that can only play one sound at a time\r
+ * Otherwise, other sounds in mid-play will be terminated without warning and in a stuck state\r
+ */\r
+ if (_useGlobalHTML5Audio && _a._t && _a._t.playState && _iO.url !== _oldIO.url) {\r
+ _a._t.stop();\r
+ }\r
+ _resetProperties(); // new URL, so reset load/playstate and so on\r
+ _a.src = _iO.url;\r
+ _t.url = _iO.url;\r
+ _t._lastURL = _iO.url;\r
+ _a._called_load = false;\r
+ } else {\r
+ _s._wD('creating HTML5 Audio() element with URL: '+_dURL);\r
+ _a = new Audio(_iO.url);\r
+ _a._called_load = false;\r
+ if (_useGlobalHTML5Audio) {\r
+ _s._global_a = _a;\r
+ }\r
+ }\r
+ _t.isHTML5 = true;\r
+ _t._a = _a; // store a ref on the track\r
+ _a._t = _t; // store a ref on the audio\r
+ _t._add_html5_events();\r
+ _a.loop = (_iO.loops>1?'loop':'');\r
+ if (_iO.autoLoad || _iO.autoPlay) {\r
+ _a.autobuffer = 'auto'; // early HTML5 implementation (non-standard)\r
+ _a.preload = 'auto'; // standard\r
+ _t.load();\r
+ _a._called_load = true;\r
+ } else {\r
+ _a.autobuffer = false; // early HTML5 implementation (non-standard)\r
+ _a.preload = 'none'; // standard\r
+ }\r
+ _a.loop = (_iO.loops>1?'loop':''); // boolean instead of "loop", for webkit? - spec says string. http://www.w3.org/TR/html-markup/audio.html#audio.attrs.loop\r
+ return _a;\r
+ };\r
+\r
+ // related private methods\r
+\r
+ this._add_html5_events = function() {\r
+ if (_t._a._added_events) {\r
+ return false;\r
+ }\r
+\r
+ var f;\r
+\r
+ function add(oEvt, oFn, bCapture) {\r
+ return _t._a ? _t._a.addEventListener(oEvt, oFn, bCapture||false) : null;\r
+ }\r
+\r
+ _s._wD(_h5+'adding event listeners: '+_t.sID);\r
+ _t._a._added_events = true;\r
+\r
+ for (f in _s._html5_events) {\r
+ if (_s._html5_events.hasOwnProperty(f)) {\r
+ add(f, _s._html5_events[f]);\r
+ }\r
+ }\r
+\r
+ return true;\r
+ };\r
+\r
+ // Keep this externally accessible\r
+ this._remove_html5_events = function() {\r
+ // Remove event listeners\r
+ function remove(oEvt, oFn, bCapture) {\r
+ return (_t._a ? _t._a.removeEventListener(oEvt, oFn, bCapture||false) : null);\r
+ }\r
+ _s._wD(_h5+'removing event listeners: '+_t.sID);\r
+ _t._a._added_events = false;\r
+\r
+ for (var f in _s._html5_events) {\r
+ if (_s._html5_events.hasOwnProperty(f)) {\r
+ remove(f, _s._html5_events[f]);\r
+ }\r
+ }\r
+ };\r
+\r
+ // --- "private" methods called by Flash ---\r
+\r
+ this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) {\r
+ _t.bytesLoaded = nBytesLoaded;\r
+ _t.bytesTotal = nBytesTotal;\r
+ _t.duration = Math.floor(nDuration);\r
+ _t.bufferLength = nBufferLength;\r
+ if (!_t._iO.isMovieStar) {\r
+ if (_t._iO.duration) {\r
+ // use options, if specified and larger\r
+ _t.durationEstimate = (_t.duration > _t._iO.duration) ? _t.duration : _t._iO.duration;\r
+ } else {\r
+ _t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10);\r
+ }\r
+ if (_t.durationEstimate === undefined) {\r
+ _t.durationEstimate = _t.duration;\r
+ }\r
+ if (_t.readyState !== 3 && _t._iO.whileloading) {\r
+ _t._iO.whileloading.apply(_t);\r
+ }\r
+ } else {\r
+ _t.durationEstimate = _t.duration;\r
+ if (_t.readyState !== 3 && _t._iO.whileloading) {\r
+ _t._iO.whileloading.apply(_t);\r
+ }\r
+ }\r
+ };\r
+\r
+ this._onid3 = function(oID3PropNames, oID3Data) {\r
+ // oID3PropNames: string array (names)\r
+ // ID3Data: string array (data)\r
+ _s._wD('SMSound._onid3(): "' + this.sID + '" ID3 data received.');\r
+ var oData = [], i, j;\r
+ for (i = 0, j = oID3PropNames.length; i < j; i++) {\r
+ oData[oID3PropNames[i]] = oID3Data[i];\r
+ }\r
+ _t.id3 = _mixin(_t.id3, oData);\r
+ if (_t._iO.onid3) {\r
+ _t._iO.onid3.apply(_t);\r
+ }\r
+ };\r
+\r
+ this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) {\r
+ if (isNaN(nPosition) || nPosition === null) {\r
+ return false; // flash safety net\r
+ }\r
+ if (_t.playState === 0 && nPosition > 0) {\r
+ // invalid position edge case for end/stop\r
+ nPosition = 0;\r
+ }\r
+ _t.position = nPosition;\r
+ _t.processOnPosition();\r
+ if (_fV > 8 && !_t.isHTML5) {\r
+ if (_t._iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) {\r
+ _t.peakData = {\r
+ left: oPeakData.leftPeak,\r
+ right: oPeakData.rightPeak\r
+ };\r
+ }\r
+ if (_t._iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) {\r
+ _t.waveformData = {\r
+ left: oWaveformDataLeft.split(','),\r
+ right: oWaveformDataRight.split(',')\r
+ };\r
+ }\r
+ if (_t._iO.useEQData) {\r
+ if (typeof oEQData !== 'undefined' && oEQData && oEQData.leftEQ) {\r
+ var eqLeft = oEQData.leftEQ.split(',');\r
+ _t.eqData = eqLeft;\r
+ _t.eqData.left = eqLeft;\r
+ if (typeof oEQData.rightEQ !== 'undefined' && oEQData.rightEQ) {\r
+ _t.eqData.right = oEQData.rightEQ.split(',');\r
+ }\r
+ }\r
+ }\r
+ }\r
+ if (_t.playState === 1) {\r
+ // special case/hack: ensure buffering is false if loading from cache (and not yet started)\r
+ if (!_t.isHTML5 && _s.flashVersion === 8 && !_t.position && _t.isBuffering) {\r
+ _t._onbufferchange(0);\r
+ }\r
+ if (_t._iO.whileplaying) {\r
+ _t._iO.whileplaying.apply(_t); // flash may call after actual finish\r
+ }\r
+ if ((_t.loaded || (!_t.loaded && _t._iO.isMovieStar)) && _t._iO.onbeforefinish && _t._iO.onbeforefinishtime && !_t.didBeforeFinish && _t.duration - _t.position <= _t._iO.onbeforefinishtime) {\r
+ _t._onbeforefinish();\r
+ }\r
+ }\r
+ return true;\r
+ };\r
+\r
+ // Only applies to RTMP\r
+ this._onconnect = function(bSuccess) {\r
+ var fN = 'SMSound._onconnect(): ';\r
+ bSuccess = (bSuccess === 1);\r
+ _s._wD(fN+'"'+_t.sID+'"'+(bSuccess?' connected.':' failed to connect? - '+_t.url), (bSuccess?1:2));\r
+ _t.connected = bSuccess;\r
+ if (bSuccess) {\r
+ _t.failures = 0;\r
+ if (_idCheck(_t.sID)) {\r
+ if (_t.getAutoPlay()) {\r
+ _t.play(undefined, _t.getAutoPlay()); // only update the play state if auto playing\r
+ } else if (_t._iO.autoLoad) {\r
+ _t.load();\r
+ }\r
+ }\r
+ if (_t._iO.onconnect) {\r
+ _t._iO.onconnect.apply(_t,[bSuccess]);\r
+ }\r
+ }\r
+ };\r
+\r
+ this._onload = function(nSuccess) {\r
+ var fN = 'SMSound._onload(): ', loadOK = (nSuccess?true:false);\r
+ _s._wD(fN + '"' + _t.sID + '"' + (loadOK?' loaded.':' failed to load? - ' + _t.url), (loadOK?1:2));\r
+ // <d>\r
+ if (!loadOK && !_t.isHTML5) {\r
+ if (_s.sandbox.noRemote === true) {\r
+ _s._wD(fN + _str('noNet'), 1);\r
+ }\r
+ if (_s.sandbox.noLocal === true) {\r
+ _s._wD(fN + _str('noLocal'), 1);\r
+ }\r
+ }\r
+ // </d>\r
+ _t.loaded = loadOK;\r
+ _t.readyState = loadOK?3:2;\r
+ _t._onbufferchange(0);\r
+ if (_t._iO.onload) {\r
+ _t._iO.onload.apply(_t, [loadOK]);\r
+ }\r
+ return true;\r
+ };\r
+\r
+ // fire onfailure() only once at most\r
+ // at this point we just recreate failed sounds rather than trying to reconnect.\r
+ this._onfailure = function(msg, level, code) {\r
+ _t.failures++;\r
+ _s._wD('SMSound._onfailure(): "'+_t.sID+'" count '+_t.failures);\r
+ if (_t._iO.onfailure && _t.failures === 1) {\r
+ _t._iO.onfailure(_t, msg, level, code);\r
+ } else {\r
+ _s._wD('SMSound._onfailure(): ignoring');\r
+ }\r
+ };\r
+\r
+ this._onbeforefinish = function() {\r
+ if (!_t.didBeforeFinish) {\r
+ _t.didBeforeFinish = true;\r
+ if (_t._iO.onbeforefinish) {\r
+ _s._wD('SMSound._onbeforefinish(): "' + _t.sID + '"');\r
+ _t._iO.onbeforefinish.apply(_t);\r
+ }\r
+ }\r
+ };\r
+\r
+ this._onjustbeforefinish = function(msOffset) {\r
+ if (!_t.didJustBeforeFinish) {\r
+ _t.didJustBeforeFinish = true;\r
+ if (_t._iO.onjustbeforefinish) {\r
+ _s._wD('SMSound._onjustbeforefinish(): "' + _t.sID + '"');\r
+ _t._iO.onjustbeforefinish.apply(_t);\r
+ }\r
+ }\r
+ };\r
+\r
+ this._onfinish = function() {\r
+ // _s._wD('SMSound._onfinish(): "' + _t.sID + '" got instanceCount '+_t.instanceCount);\r
+ var _io_onfinish = _t._iO.onfinish; // store local copy before it gets trashed..\r
+ _t._onbufferchange(0);\r
+ _t.resetOnPosition(0);\r
+ if (_t._iO.onbeforefinishcomplete) {\r
+ _t._iO.onbeforefinishcomplete.apply(_t);\r
+ }\r
+ // reset some state items\r
+ _t.didBeforeFinish = false;\r
+ _t.didJustBeforeFinish = false;\r
+ if (_t.instanceCount) {\r
+ _t.instanceCount--;\r
+ if (!_t.instanceCount) {\r
+ // reset instance options\r
+ _t.playState = 0;\r
+ _t.paused = false;\r
+ _t.instanceCount = 0;\r
+ _t.instanceOptions = {};\r
+ _t._iO = {};\r
+ _stop_html5_timer();\r
+ }\r
+ if (!_t.instanceCount || _t._iO.multiShotEvents) {\r
+ // fire onfinish for last, or every instance\r
+ if (_io_onfinish) {\r
+ _s._wD('SMSound._onfinish(): "' + _t.sID + '"');\r
+ _io_onfinish.apply(_t);\r
+ }\r
+ }\r
+ }\r
+ };\r
+\r
+ this._onbufferchange = function(nIsBuffering) {\r
+ var fN = 'SMSound._onbufferchange()';\r
+ if (_t.playState === 0) {\r
+ // ignore if not playing\r
+ return false;\r
+ }\r
+ if ((nIsBuffering && _t.isBuffering) || (!nIsBuffering && !_t.isBuffering)) {\r
+ return false;\r
+ }\r
+ _t.isBuffering = (nIsBuffering === 1);\r
+ if (_t._iO.onbufferchange) {\r
+ _s._wD(fN + ': ' + nIsBuffering);\r
+ _t._iO.onbufferchange.apply(_t);\r
+ }\r
+ return true;\r
+ };\r
+\r
+ this._ondataerror = function(sError) {\r
+ // flash 9 wave/eq data handler\r
+ if (_t.playState > 0) { // hack: called at start, and end from flash at/after onfinish()\r
+ _s._wD('SMSound._ondataerror(): ' + sError);\r
+ if (_t._iO.ondataerror) {\r
+ _t._iO.ondataerror.apply(_t);\r
+ }\r
+ }\r
+ };\r
+\r
+ }; // SMSound()\r
+\r
+ // --- private SM2 internals ---\r
+\r
+ _getDocument = function() {\r
+ return (_doc.body?_doc.body:(_doc._docElement?_doc.documentElement:_doc.getElementsByTagName('div')[0]));\r
+ };\r
+\r
+ _id = function(sID) {\r
+ return _doc.getElementById(sID);\r
+ };\r
+\r
+ _mixin = function(oMain, oAdd) {\r
+ // non-destructive merge\r
+ var o1 = {}, i, o2, o;\r
+ for (i in oMain) { // clone c1\r
+ if (oMain.hasOwnProperty(i)) {\r
+ o1[i] = oMain[i];\r
+ }\r
+ }\r
+ o2 = (typeof oAdd === 'undefined'?_s.defaultOptions:oAdd);\r
+ for (o in o2) {\r
+ if (o2.hasOwnProperty(o) && typeof o1[o] === 'undefined') {\r
+ o1[o] = o2[o];\r
+ }\r
+ }\r
+ return o1;\r
+ };\r
+\r
+ _event = (function() {\r
+\r
+ var old = (_win.attachEvent),\r
+ evt = {\r
+ add: (old?'attachEvent':'addEventListener'),\r
+ remove: (old?'detachEvent':'removeEventListener')\r
+ };\r
+\r
+ function getArgs(oArgs) {\r
+ var args = _slice.call(oArgs), len = args.length;\r
+ if (old) {\r
+ args[1] = 'on' + args[1]; // prefix\r
+ if (len > 3) {\r
+ args.pop(); // no capture\r
+ }\r
+ } else if (len === 3) {\r
+ args.push(false);\r
+ }\r
+ return args;\r
+ }\r
+\r
+ function apply(args, sType) {\r
+ var element = args.shift(),\r
+ method = [evt[sType]];\r
+ if (old) {\r
+ element[method](args[0], args[1]);\r
+ } else {\r
+ element[method].apply(element, args);\r
+ }\r
+ }\r
+\r
+ function add() {\r
+ apply(getArgs(arguments), 'add');\r
+ }\r
+\r
+ function remove() {\r
+ apply(getArgs(arguments), 'remove');\r
+ }\r
+\r
+ return {\r
+ 'add': add,\r
+ 'remove': remove\r
+ };\r
+\r
+ }());\r
+\r
+ _html5OK = function(iO) {\r
+ return (!iO.serverURL && (iO.type?_html5CanPlay({type:iO.type}):_html5CanPlay(iO.url)||_html5Only)); // Use type, if specified. If HTML5-only mode, no other options, so just give 'er\r
+ };\r
+\r
+ _html5CanPlay = function(sURL) {\r
+ // try to find MIME, test and return truthiness\r
+ if (!_s.useHTML5Audio || !_s.hasHTML5) {\r
+ return false;\r
+ }\r
+ var result, mime, offset, fileExt, item, aF = _s.audioFormats;\r
+ if (!_html5Ext) {\r
+ _html5Ext = [];\r
+ for (item in aF) {\r
+ if (aF.hasOwnProperty(item)) {\r
+ _html5Ext.push(item);\r
+ if (aF[item].related) {\r
+ _html5Ext = _html5Ext.concat(aF[item].related);\r
+ }\r
+ }\r
+ }\r
+ _html5Ext = new RegExp('\\.('+_html5Ext.join('|')+')','i');\r
+ }\r
+ mime = (typeof sURL.type !== 'undefined'?sURL.type:null);\r
+ fileExt = (typeof sURL === 'string'?sURL.toLowerCase().match(_html5Ext):null); // TODO: Strip URL queries, etc.\r
+ if (!fileExt || !fileExt.length) {\r
+ if (!mime) {\r
+ return false;\r
+ } else {\r
+ // audio/mp3 -> mp3, result should be known\r
+ offset = mime.indexOf(';');\r
+ fileExt = (offset !== -1?mime.substr(0,offset):mime).substr(6); // strip "audio/X; codecs.."\r
+ }\r
+ } else {\r
+ fileExt = fileExt[0].substr(1); // "mp3", for example\r
+ }\r
+ if (fileExt && typeof _s.html5[fileExt] !== 'undefined') {\r
+ // result known\r
+ return _s.html5[fileExt];\r
+ } else {\r
+ if (!mime) {\r
+ if (fileExt && _s.html5[fileExt]) {\r
+ return _s.html5[fileExt];\r
+ } else {\r
+ // best-case guess, audio/whatever-dot-filename-format-you're-playing\r
+ mime = 'audio/'+fileExt;\r
+ }\r
+ }\r
+ result = _s.html5.canPlayType(mime);\r
+ _s.html5[fileExt] = result;\r
+ // _s._wD('canPlayType, found result: '+result);\r
+ return result;\r
+ }\r
+ };\r
+\r
+ _testHTML5 = function() {\r
+ if (!_s.useHTML5Audio || typeof Audio === 'undefined') {\r
+ return false;\r
+ }\r
+ // double-whammy: Opera 9.64 throws WRONG_ARGUMENTS_ERR if no parameter passed to Audio(), and Webkit + iOS happily tries to load "null" as a URL. :/\r
+ var a = (typeof Audio !== 'undefined' ? (_isOpera ? new Audio(null) : new Audio()) : null), item, support = {}, aF, i, _hasFlash = _detectFlash();\r
+ function _cp(m) {\r
+ var canPlay, i, j, isOK = false;\r
+ if (!a || typeof a.canPlayType !== 'function') {\r
+ return false;\r
+ }\r
+ if (m instanceof Array) {\r
+ // iterate through all mime types, return any successes\r
+ for (i=0, j=m.length; i<j && !isOK; i++) {\r
+ if (_s.html5[m[i]] || a.canPlayType(m[i]).match(_s.html5Test)) {\r
+ isOK = true;\r
+ _s.html5[m[i]] = true;\r
+ }\r
+ }\r
+ return isOK;\r
+ } else {\r
+ canPlay = (a && typeof a.canPlayType === 'function' ? a.canPlayType(m) : false);\r
+ return (canPlay && (canPlay.match(_s.html5Test)?true:false));\r
+ }\r
+ }\r
+ // test all registered formats + codecs\r
+ aF = _s.audioFormats;\r
+ for (item in aF) {\r
+ if (aF.hasOwnProperty(item)) {\r
+ support[item] = _cp(aF[item].type);\r
+ // assign result to related formats, too\r
+ if (aF[item] && aF[item].related) {\r
+ for (i=aF[item].related.length; i--;) {\r
+ _s.html5[aF[item].related[i]] = support[item];\r
+ }\r
+ }\r
+ }\r
+ }\r
+ support.canPlayType = (a?_cp:null);\r
+ _s.html5 = _mixin(_s.html5, support);\r
+ return true;\r
+ };\r
+\r
+ _strings = {\r
+ // <d>\r
+ notReady: 'Not loaded yet - wait for soundManager.onload()/onready()',\r
+ notOK: 'Audio support is not available.',\r
+ appXHTML: _smc + 'createMovie(): appendChild/innerHTML set failed. May be app/xhtml+xml DOM-related.',\r
+ spcWmode: _smc + 'createMovie(): Removing wmode, preventing known SWF loading issue(s)',\r
+ swf404: _sm + ': Verify that %s is a valid path.',\r
+ tryDebug: 'Try ' + _sm + '.debugFlash = true for more security details (output goes to SWF.)',\r
+ checkSWF: 'See SWF output for more debug info.',\r
+ localFail: _sm + ': Non-HTTP page (' + _doc.location.protocol + ' URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/',\r
+ waitFocus: _sm + ': Special case: Waiting for focus-related event..',\r
+ waitImpatient: _sm + ': Getting impatient, still waiting for Flash%s...',\r
+ waitForever: _sm + ': Waiting indefinitely for Flash (will recover if unblocked)...',\r
+ needFunction: _sm + ': Function object expected for %s',\r
+ badID: 'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',\r
+ noMS: 'MovieStar mode not enabled. Exiting.',\r
+ currentObj: '--- ' + _sm + '._debug(): Current sound objects ---',\r
+ waitEI: _smc + 'initMovie(): Waiting for ExternalInterface call from Flash..',\r
+ waitOnload: _sm + ': Waiting for window.onload()',\r
+ docLoaded: _sm + ': Document already loaded',\r
+ onload: _smc + 'initComplete(): calling soundManager.onload()',\r
+ onloadOK: _sm + '.onload() complete',\r
+ init: '-- ' + _smc + 'init() --',\r
+ didInit: _smc + 'init(): Already called?',\r
+ flashJS: _sm + ': Attempting to call Flash from JS..',\r
+ noPolling: _sm + ': Polling (whileloading()/whileplaying() support) is disabled.',\r
+ secNote: 'Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html',\r
+ badRemove: 'Warning: Failed to remove flash movie.',\r
+ noPeak: 'Warning: peakData features unsupported for movieStar formats',\r
+ shutdown: _sm + '.disable(): Shutting down',\r
+ queue: _sm + ': Queueing %s handler',\r
+ smFail: _sm + ': Failed to initialise.',\r
+ smError: 'SMSound.load(): Exception: JS-Flash communication failed, or JS error.',\r
+ fbTimeout: 'No flash response, applying .'+_s.swfCSS.swfTimedout+' CSS..',\r
+ fbLoaded: 'Flash loaded',\r
+ fbHandler: _smc+'flashBlockHandler()',\r
+ manURL: 'SMSound.load(): Using manually-assigned URL',\r
+ onURL: _sm + '.load(): current URL already assigned.',\r
+ badFV: _sm + '.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.',\r
+ as2loop: 'Note: Setting stream:false so looping can work (flash 8 limitation)',\r
+ noNSLoop: 'Note: Looping not implemented for MovieStar formats',\r
+ needfl9: 'Note: Switching to flash 9, required for MP4 formats.',\r
+ mfTimeout: 'Setting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case',\r
+ mfOn: 'mobileFlash::enabling on-screen flash repositioning',\r
+ policy: 'Enabling usePolicyFile for data access'\r
+ // </d>\r
+ };\r
+\r
+ _str = function() { // o [,items to replace]\r
+ // <d>\r
+ var args = _slice.call(arguments), // real array, please\r
+ o = args.shift(), // first arg\r
+ str = (_strings && _strings[o]?_strings[o]:''), i, j;\r
+ if (str && args && args.length) {\r
+ for (i = 0, j = args.length; i < j; i++) {\r
+ str = str.replace('%s', args[i]);\r
+ }\r
+ }\r
+ return str;\r
+ // </d>\r
+ };\r
+\r
+ _loopFix = function(sOpt) {\r
+ // flash 8 requires stream = false for looping to work\r
+ if (_fV === 8 && sOpt.loops > 1 && sOpt.stream) {\r
+ _wDS('as2loop');\r
+ sOpt.stream = false;\r
+ }\r
+ return sOpt;\r
+ };\r
+\r
+ _policyFix = function(sOpt, sPre) {\r
+ if (sOpt && !sOpt.usePolicyFile && (sOpt.onid3 || sOpt.usePeakData || sOpt.useWaveformData || sOpt.useEQData)) {\r
+ _s._wD((sPre?sPre+':':'') + _str('policy'));\r
+ sOpt.usePolicyFile = true;\r
+ }\r
+ return sOpt;\r
+ };\r
+\r
+ _complain = function(sMsg) {\r
+ if (typeof console !== 'undefined' && typeof console.warn !== 'undefined') {\r
+ console.warn(sMsg);\r
+ } else {\r
+ _s._wD(sMsg);\r
+ }\r
+ };\r
+\r
+ _doNothing = function() {\r
+ return false;\r
+ };\r
+\r
+ _disableObject = function(o) {\r
+ for (var oProp in o) {\r
+ if (o.hasOwnProperty(oProp) && typeof o[oProp] === 'function') {\r
+ o[oProp] = _doNothing;\r
+ }\r
+ }\r
+ oProp = null;\r
+ };\r
+\r
+ _failSafely = function(bNoDisable) {\r
+ // general failure exception handler\r
+ if (typeof bNoDisable === 'undefined') {\r
+ bNoDisable = false;\r
+ }\r
+ if (_disabled || bNoDisable) {\r
+ _wDS('smFail', 2);\r
+ _s.disable(bNoDisable);\r
+ }\r
+ };\r
+\r
+ _normalizeMovieURL = function(smURL) {\r
+ var urlParams = null;\r
+ if (smURL) {\r
+ if (smURL.match(/\.swf(\?.*)?$/i)) {\r
+ urlParams = smURL.substr(smURL.toLowerCase().lastIndexOf('.swf?') + 4);\r
+ if (urlParams) {\r
+ return smURL; // assume user knows what they're doing\r
+ }\r
+ } else if (smURL.lastIndexOf('/') !== smURL.length - 1) {\r
+ smURL = smURL + '/';\r
+ }\r
+ }\r
+ return (smURL && smURL.lastIndexOf('/') !== - 1?smURL.substr(0, smURL.lastIndexOf('/') + 1):'./') + _s.movieURL;\r
+ };\r
+\r
+ _setVersionInfo = function() {\r
+ if (_fV !== 8 && _fV !== 9) {\r
+ _s._wD(_str('badFV', _fV, _defaultFlashVersion));\r
+ _s.flashVersion = _defaultFlashVersion;\r
+ }\r
+ var isDebug = (_s.debugMode || _s.debugFlash?'_debug.swf':'.swf'); // debug flash movie, if applicable\r
+ if (_s.useHTML5Audio && !_html5Only && _s.audioFormats.mp4.required && _s.flashVersion < 9) {\r
+ _s._wD(_str('needfl9'));\r
+ _s.flashVersion = 9;\r
+ }\r
+ _fV = _s.flashVersion; // short-hand for internal use\r
+ _s.version = _s.versionNumber + (_html5Only?' (HTML5-only mode)':(_fV === 9?' (AS3/Flash 9)':' (AS2/Flash 8)'));\r
+ // set up default options\r
+ if (_fV > 8) {\r
+ _s.defaultOptions = _mixin(_s.defaultOptions, _s.flash9Options);\r
+ _s.features.buffering = true;\r
+ }\r
+ if (_fV > 8 && _s.useMovieStar) {\r
+ // flash 9+ support for movieStar formats as well as MP3\r
+ _s.defaultOptions = _mixin(_s.defaultOptions, _s.movieStarOptions);\r
+ _s.filePatterns.flash9 = new RegExp('\\.(mp3|' + _s.netStreamTypes.join('|') + ')(\\?.*)?$', 'i');\r
+ _s.mimePattern = _s.netStreamMimeTypes;\r
+ _s.features.movieStar = true;\r
+ } else {\r
+ _s.useMovieStar = false;\r
+ _s.features.movieStar = false;\r
+ }\r
+ _s.filePattern = _s.filePatterns[(_fV !== 8?'flash9':'flash8')];\r
+ _s.movieURL = (_fV === 8?'soundmanager2.swf':'soundmanager2_flash9.swf').replace('.swf',isDebug);\r
+ _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_fV > 8);\r
+ };\r
+\r
+ _setPolling = function(bPolling, bHighPerformance) {\r
+ if (!_s.o || !_s.allowPolling) {\r
+ return false;\r
+ }\r
+ _s.o._setPolling(bPolling, bHighPerformance);\r
+ };\r
+\r
+ function _initDebug() {\r
+ if (_s.debugURLParam.test(_wl)) {\r
+ _s.debugMode = true; // allow force of debug mode via URL\r
+ }\r
+ // <d>\r
+ if (_id(_s.debugID)) {\r
+ return false;\r
+ }\r
+ var oD, oDebug, oTarget, oToggle, tmp;\r
+ if (_s.debugMode && !_id(_s.debugID) && ((!_hasConsole || !_s.useConsole) || (_s.useConsole && _hasConsole && !_s.consoleOnly))) {\r
+ oD = _doc.createElement('div');\r
+ oD.id = _s.debugID + '-toggle';\r
+ oToggle = {\r
+ 'position': 'fixed',\r
+ 'bottom': '0px',\r
+ 'right': '0px',\r
+ 'width': '1.2em',\r
+ 'height': '1.2em',\r
+ 'lineHeight': '1.2em',\r
+ 'margin': '2px',\r
+ 'textAlign': 'center',\r
+ 'border': '1px solid #999',\r
+ 'cursor': 'pointer',\r
+ 'background': '#fff',\r
+ 'color': '#333',\r
+ 'zIndex': 10001\r
+ };\r
+ oD.appendChild(_doc.createTextNode('-'));\r
+ oD.onclick = _toggleDebug;\r
+ oD.title = 'Toggle SM2 debug console';\r
+ if (_ua.match(/msie 6/i)) {\r
+ oD.style.position = 'absolute';\r
+ oD.style.cursor = 'hand';\r
+ }\r
+ for (tmp in oToggle) {\r
+ if (oToggle.hasOwnProperty(tmp)) {\r
+ oD.style[tmp] = oToggle[tmp];\r
+ }\r
+ }\r
+ oDebug = _doc.createElement('div');\r
+ oDebug.id = _s.debugID;\r
+ oDebug.style.display = (_s.debugMode?'block':'none');\r
+ if (_s.debugMode && !_id(oD.id)) {\r
+ try {\r
+ oTarget = _getDocument();\r
+ oTarget.appendChild(oD);\r
+ } catch(e2) {\r
+ throw new Error(_str('appXHTML'));\r
+ }\r
+ oTarget.appendChild(oDebug);\r
+ }\r
+ }\r
+ oTarget = null;\r
+ // </d>\r
+ }\r
+\r
+ _createMovie = function(smID, smURL) {\r
+\r
+ var specialCase = null,\r
+ remoteURL = (smURL?smURL:_s.url),\r
+ localURL = (_s.altURL?_s.altURL:remoteURL),\r
+ oEmbed, oMovie, oTarget = _getDocument(), tmp, movieHTML, oEl, extraClass = _getSWFCSS(), s, x, sClass, side = '100%', isRTL = null, html = _doc.getElementsByTagName('html')[0];\r
+ isRTL = (html && html.dir && html.dir.match(/rtl/i));\r
+ smID = (typeof smID === 'undefined'?_s.id:smID);\r
+\r
+ if (_didAppend && _appendSuccess) {\r
+ return false; // ignore if already succeeded\r
+ }\r
+\r
+ function _initMsg() {\r
+ _s._wD('-- SoundManager 2 ' + _s.version + (!_html5Only && _s.useHTML5Audio?(_s.hasHTML5?' + HTML5 audio':', no HTML5 audio support'):'') + (!_html5Only ? (_s.useMovieStar?', MovieStar mode':'') + (_s.useHighPerformance?', high performance mode, ':', ') + (( _s.flashPollingInterval ? 'custom (' + _s.flashPollingInterval + 'ms)' : (_s.useFastPolling?'fast':'normal')) + ' polling') + (_s.wmode?', wmode: ' + _s.wmode:'') + (_s.debugFlash?', flash debug mode':'') + (_s.useFlashBlock?', flashBlock mode':'') : '') + ' --', 1);\r
+ }\r
+\r
+ if (_html5Only) {\r
+ _setVersionInfo();\r
+ _initMsg();\r
+ _s.oMC = _id(_s.movieID);\r
+ _init();\r
+ // prevent multiple init attempts\r
+ _didAppend = true;\r
+ _appendSuccess = true;\r
+ return false;\r
+ }\r
+\r
+ _didAppend = true;\r
+\r
+ // safety check for legacy (change to Flash 9 URL)\r
+ _setVersionInfo();\r
+ _s.url = _normalizeMovieURL(_s._overHTTP?remoteURL:localURL);\r
+ smURL = _s.url;\r
+\r
+ _s.wmode = (!_s.wmode && _s.useHighPerformance && !_s.useMovieStar?'transparent':_s.wmode);\r
+\r
+ if (_s.wmode !== null && (_ua.match(/msie 8/i) || (!_isIE && !_s.useHighPerformance)) && navigator.platform.match(/win32|win64/i)) {\r
+ _s.specialWmodeCase = true;\r
+ // extra-special case: movie doesn't load until scrolled into view when using wmode = anything but 'window' here\r
+ // does not apply when using high performance (position:fixed means on-screen), OR infinite flash load timeout\r
+ // wmode breaks IE 8 on Vista + Win7 too in some cases, as of Jan.2011 (?)\r
+ _wDS('spcWmode');\r
+ _s.wmode = null;\r
+ }\r
+\r
+ oEmbed = {\r
+ 'name': smID,\r
+ 'id': smID,\r
+ 'src': smURL,\r
+ 'width': side,\r
+ 'height': side,\r
+ 'quality': 'high',\r
+ 'allowScriptAccess': _s.allowScriptAccess,\r
+ 'bgcolor': _s.bgColor,\r
+ 'pluginspage': _s._http+'//www.macromedia.com/go/getflashplayer',\r
+ 'type': 'application/x-shockwave-flash',\r
+ 'wmode': _s.wmode,\r
+ 'hasPriority': 'true' // http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-7ffd.html\r
+ };\r
+\r
+ if (_s.debugFlash) {\r
+ oEmbed.FlashVars = 'debug=1';\r
+ }\r
+\r
+ if (!_s.wmode) {\r
+ delete oEmbed.wmode; // don't write empty attribute\r
+ }\r
+\r
+ if (_isIE) {\r
+ // IE is "special".\r
+ oMovie = _doc.createElement('div');\r
+ movieHTML = '<object id="' + smID + '" data="' + smURL + '" type="' + oEmbed.type + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+_s._http+'//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="' + oEmbed.width + '" height="' + oEmbed.height + '"><param name="movie" value="' + smURL + '" /><param name="AllowScriptAccess" value="' + _s.allowScriptAccess + '" /><param name="quality" value="' + oEmbed.quality + '" />' + (_s.wmode?'<param name="wmode" value="' + _s.wmode + '" /> ':'') + '<param name="bgcolor" value="' + _s.bgColor + '" />' + (_s.debugFlash?'<param name="FlashVars" value="' + oEmbed.FlashVars + '" />':'') + '</object>';\r
+ } else {\r
+ oMovie = _doc.createElement('embed');\r
+ for (tmp in oEmbed) {\r
+ if (oEmbed.hasOwnProperty(tmp)) {\r
+ oMovie.setAttribute(tmp, oEmbed[tmp]);\r
+ }\r
+ }\r
+ }\r
+\r
+ _initDebug();\r
+ extraClass = _getSWFCSS();\r
+ oTarget = _getDocument();\r
+\r
+ if (oTarget) {\r
+ _s.oMC = _id(_s.movieID)?_id(_s.movieID):_doc.createElement('div');\r
+ if (!_s.oMC.id) {\r
+ _s.oMC.id = _s.movieID;\r
+ _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass;\r
+ // "hide" flash movie\r
+ s = null;\r
+ oEl = null;\r
+ if (!_s.useFlashBlock) {\r
+ if (_s.useHighPerformance) {\r
+ s = {\r
+ 'position': 'fixed',\r
+ 'width': '8px',\r
+ 'height': '8px',\r
+ // >= 6px for flash to run fast, >= 8px to start up under Firefox/win32 in some cases. odd? yes.\r
+ 'bottom': '0px',\r
+ 'left': '0px',\r
+ 'overflow': 'hidden'\r
+ };\r
+ } else {\r
+ s = {\r
+ 'position': 'absolute',\r
+ 'width': '6px',\r
+ 'height': '6px',\r
+ 'top': '-9999px',\r
+ 'left': '-9999px'\r
+ };\r
+ if (isRTL) {\r
+ s.left = Math.abs(parseInt(s.left,10))+'px';\r
+ }\r
+ }\r
+ }\r
+ if (_isWebkit) {\r
+ _s.oMC.style.zIndex = 10000; // soundcloud-reported render/crash fix, safari 5\r
+ }\r
+ if (!_s.debugFlash) {\r
+ for (x in s) {\r
+ if (s.hasOwnProperty(x)) {\r
+ _s.oMC.style[x] = s[x];\r
+ }\r
+ }\r
+ }\r
+ try {\r
+ if (!_isIE) {\r
+ _s.oMC.appendChild(oMovie);\r
+ }\r
+ oTarget.appendChild(_s.oMC);\r
+ if (_isIE) {\r
+ oEl = _s.oMC.appendChild(_doc.createElement('div'));\r
+ oEl.className = _s.swfCSS.swfBox;\r
+ oEl.innerHTML = movieHTML;\r
+ }\r
+ _appendSuccess = true;\r
+ } catch(e) {\r
+ throw new Error(_str('appXHTML'));\r
+ }\r
+ } else {\r
+ // it's already in the document.\r
+ sClass = _s.oMC.className;\r
+ _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:'');\r
+ _s.oMC.appendChild(oMovie);\r
+ if (_isIE) {\r
+ oEl = _s.oMC.appendChild(_doc.createElement('div'));\r
+ oEl.className = _s.swfCSS.swfBox;\r
+ oEl.innerHTML = movieHTML;\r
+ }\r
+ _appendSuccess = true;\r
+ }\r
+ }\r
+\r
+ if (specialCase) {\r
+ _s._wD(specialCase);\r
+ }\r
+\r
+ _initMsg();\r
+ _s._wD(_smc+'createMovie(): Trying to load ' + smURL + (!_s._overHTTP && _s.altURL?' (alternate URL)':''), 1);\r
+\r
+ return true;\r
+ };\r
+\r
+ _idCheck = this.getSoundById;\r
+\r
+ _initMovie = function() {\r
+ if (_html5Only) {\r
+ _createMovie();\r
+ return false;\r
+ }\r
+ // attempt to get, or create, movie\r
+ if (_s.o) {\r
+ return false; // may already exist\r
+ }\r
+ _s.o = _s.getMovie(_s.id); // inline markup\r
+ if (!_s.o) {\r
+ if (!_oRemoved) {\r
+ // try to create\r
+ _createMovie(_s.id, _s.url);\r
+ } else {\r
+ // try to re-append removed movie after reboot()\r
+ if (!_isIE) {\r
+ _s.oMC.appendChild(_oRemoved);\r
+ } else {\r
+ _s.oMC.innerHTML = _oRemovedHTML;\r
+ }\r
+ _oRemoved = null;\r
+ _didAppend = true;\r
+ }\r
+ _s.o = _s.getMovie(_s.id);\r
+ }\r
+ if (_s.o) {\r
+ _s._wD(_smc+'initMovie(): Got '+_s.o.nodeName+' element ('+(_didAppend?'created via JS':'static HTML')+')');\r
+ _wDS('waitEI');\r
+ }\r
+ if (_s.oninitmovie instanceof Function) {\r
+ setTimeout(_s.oninitmovie, 1);\r
+ }\r
+ return true;\r
+ };\r
+\r
+ _go = function(sURL) {\r
+ // where it all begins.\r
+ if (sURL) {\r
+ _s.url = sURL;\r
+ }\r
+ _initMovie();\r
+ };\r
+\r
+ _delayWaitForEI = function() {\r
+ setTimeout(_waitForEI, 500);\r
+ };\r
+\r
+ _waitForEI = function() {\r
+ if (_waitingForEI) {\r
+ return false;\r
+ }\r
+ _waitingForEI = true;\r
+ _event.remove(_win, 'load', _delayWaitForEI);\r
+ if (_tryInitOnFocus && !_isFocused) {\r
+ _wDS('waitFocus');\r
+ return false;\r
+ }\r
+ var p;\r
+ if (!_didInit) {\r
+ p = _s.getMoviePercent();\r
+ _s._wD(_str('waitImpatient', (p === 100?' (SWF loaded)':(p > 0?' (SWF ' + p + '% loaded)':''))));\r
+ }\r
+ setTimeout(function() {\r
+ p = _s.getMoviePercent();\r
+ if (!_didInit) {\r
+ _s._wD(_sm + ': No Flash response within expected time.\nLikely causes: ' + (p === 0?'Loading ' + _s.movieURL + ' may have failed (and/or Flash ' + _fV + '+ not present?), ':'') + 'Flash blocked or JS-Flash security error.' + (_s.debugFlash?' ' + _str('checkSWF'):''), 2);\r
+ if (!_s._overHTTP && p) {\r
+ _wDS('localFail', 2);\r
+ if (!_s.debugFlash) {\r
+ _wDS('tryDebug', 2);\r
+ }\r
+ }\r
+ if (p === 0) {\r
+ // if 0 (not null), probably a 404.\r
+ _s._wD(_str('swf404', _s.url));\r
+ }\r
+ _debugTS('flashtojs', false, ': Timed out' + _s._overHTTP?' (Check flash security or flash blockers)':' (No plugin/missing SWF?)');\r
+ }\r
+ // give up / time-out, depending\r
+ if (!_didInit && _okToDisable) {\r
+ if (p === null) {\r
+ // SWF failed. Maybe blocked.\r
+ if (_s.useFlashBlock || _s.flashLoadTimeout === 0) {\r
+ if (_s.useFlashBlock) {\r
+ _flashBlockHandler();\r
+ }\r
+ _wDS('waitForever');\r
+ } else {\r
+ // old SM2 behaviour, simply fail\r
+ _failSafely(true);\r
+ }\r
+ } else {\r
+ // flash loaded? Shouldn't be a blocking issue, then.\r
+ if (_s.flashLoadTimeout === 0) {\r
+ _wDS('waitForever');\r
+ } else {\r
+ _failSafely(true);\r
+ }\r
+ }\r
+ }\r
+ }, _s.flashLoadTimeout);\r
+ };\r
+\r
+ _go = function(sURL) {\r
+ // where it all begins.\r
+ if (sURL) {\r
+ _s.url = sURL;\r
+ }\r
+ _initMovie();\r
+ };\r
+\r
+ // <d>\r
+ _wDS = function(o, errorLevel) {\r
+ if (!o) {\r
+ return '';\r
+ } else {\r
+ return _s._wD(_str(o), errorLevel);\r
+ }\r
+ };\r
+\r
+ if (_wl.indexOf('debug=alert') + 1 && _s.debugMode) {\r
+ _s._wD = function(sText) {window.alert(sText);};\r
+ }\r
+\r
+ _toggleDebug = function() {\r
+ var o = _id(_s.debugID),\r
+ oT = _id(_s.debugID + '-toggle');\r
+ if (!o) {\r
+ return false;\r
+ }\r
+ if (_debugOpen) {\r
+ // minimize\r
+ oT.innerHTML = '+';\r
+ o.style.display = 'none';\r
+ } else {\r
+ oT.innerHTML = '-';\r
+ o.style.display = 'block';\r
+ }\r
+ _debugOpen = !_debugOpen;\r
+ };\r
+\r
+ _debugTS = function(sEventType, bSuccess, sMessage) {\r
+ // troubleshooter debug hooks\r
+ if (typeof sm2Debugger !== 'undefined') {\r
+ try {\r
+ sm2Debugger.handleEvent(sEventType, bSuccess, sMessage);\r
+ } catch(e) {\r
+ // oh well\r
+ }\r
+ }\r
+ return true;\r
+ };\r
+ // </d>\r
+\r
+ _getSWFCSS = function() {\r
+ var css = [];\r
+ if (_s.debugMode) {\r
+ css.push(_s.swfCSS.sm2Debug);\r
+ }\r
+ if (_s.debugFlash) {\r
+ css.push(_s.swfCSS.flashDebug);\r
+ }\r
+ if (_s.useHighPerformance) {\r
+ css.push(_s.swfCSS.highPerf);\r
+ }\r
+ return css.join(' ');\r
+ };\r
+\r
+ _flashBlockHandler = function() {\r
+ // *possible* flash block situation.\r
+ var name = _str('fbHandler'), p = _s.getMoviePercent(), css = _s.swfCSS;\r
+ if (!_s.ok()) {\r
+ if (_needsFlash) {\r
+ // make the movie more visible, so user can fix\r
+ _s.oMC.className = _getSWFCSS() + ' ' + css.swfDefault + ' ' + (p === null?css.swfTimedout:css.swfError);\r
+ _s._wD(name+': '+_str('fbTimeout')+(p?' ('+_str('fbLoaded')+')':''));\r
+ }\r
+ _s.didFlashBlock = true;\r
+ _processOnEvents({type:'ontimeout',ignoreInit:true}); // fire onready(), complain lightly\r
+ if (_s.onerror instanceof Function) {\r
+ _s.onerror.apply(_win);\r
+ }\r
+ } else {\r
+ // SM2 loaded OK (or recovered)\r
+ if (_s.didFlashBlock) {\r
+ _s._wD(name+': Unblocked');\r
+ }\r
+ if (_s.oMC) {\r
+ _s.oMC.className = [_getSWFCSS(), css.swfDefault, css.swfLoaded + (_s.didFlashBlock?' '+css.swfUnblocked:'')].join(' ');\r
+ }\r
+ }\r
+ };\r
+\r
+ _handleFocus = function() {\r
+ function cleanup() {\r
+ _event.remove(_win, 'focus', _handleFocus);\r
+ _event.remove(_win, 'load', _handleFocus);\r
+ }\r
+ if (_isFocused || !_tryInitOnFocus) {\r
+ cleanup();\r
+ return true;\r
+ }\r
+ _okToDisable = true;\r
+ _isFocused = true;\r
+ _s._wD(_smc+'handleFocus()');\r
+ if (_isSafari && _tryInitOnFocus) {\r
+ // giant Safari 3.1 hack - assume mousemove = focus given lack of focus event\r
+ _event.remove(_win, 'mousemove', _handleFocus);\r
+ }\r
+ // allow init to restart\r
+ _waitingForEI = false;\r
+ cleanup();\r
+ return true;\r
+ };\r
+\r
+ _initComplete = function(bNoDisable) {\r
+ if (_didInit) {\r
+ return false;\r
+ }\r
+ if (_html5Only) {\r
+ // all good.\r
+ _s._wD('-- SoundManager 2: loaded --');\r
+ _didInit = true;\r
+ _processOnEvents();\r
+ _initUserOnload();\r
+ return true;\r
+ }\r
+ var sClass = _s.oMC.className,\r
+ wasTimeout = (_s.useFlashBlock && _s.flashLoadTimeout && !_s.getMoviePercent());\r
+ if (!wasTimeout) {\r
+ _didInit = true;\r
+ }\r
+ _s._wD('-- SoundManager 2 ' + (_disabled?'failed to load':'loaded') + ' (' + (_disabled?'security/load error':'OK') + ') --', 1);\r
+ if (_disabled || bNoDisable) {\r
+ if (_s.useFlashBlock) {\r
+ _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError);\r
+ }\r
+ _processOnEvents({type:'ontimeout'});\r
+ _debugTS('onload', false);\r
+ if (_s.onerror instanceof Function) {\r
+ _s.onerror.apply(_win);\r
+ }\r
+ return false;\r
+ } else {\r
+ _debugTS('onload', true);\r
+ }\r
+ _event.add(_win, 'unload', _doNothing); // prevent browser from showing cached state via back button, because flash will be dead\r
+ if (_s.waitForWindowLoad && !_windowLoaded) {\r
+ _wDS('waitOnload');\r
+ _event.add(_win, 'load', _initUserOnload);\r
+ return false;\r
+ } else {\r
+ if (_s.waitForWindowLoad && _windowLoaded) {\r
+ _wDS('docLoaded');\r
+ }\r
+ _initUserOnload();\r
+ }\r
+ return true;\r
+ };\r
+\r
+ _addOnEvent = function(sType, oMethod, oScope) {\r
+ if (typeof _on_queue[sType] === 'undefined') {\r
+ _on_queue[sType] = [];\r
+ }\r
+ _on_queue[sType].push({\r
+ 'method': oMethod,\r
+ 'scope': (oScope || null),\r
+ 'fired': false\r
+ });\r
+ };\r
+\r
+ _processOnEvents = function(oOptions) {\r
+ if (!oOptions) { // assume onready, if unspecified\r
+ oOptions = {\r
+ type: 'onready'\r
+ };\r
+ }\r
+ if (!_didInit && oOptions && !oOptions.ignoreInit) {\r
+ // not ready yet.\r
+ return false;\r
+ }\r
+ var status = {\r
+ success: (oOptions && oOptions.ignoreInit?_s.ok():!_disabled)\r
+ },\r
+ srcQueue = (oOptions && oOptions.type?_on_queue[oOptions.type]||[]:[]), // queue specified by type, or none\r
+ queue = [], i, j,\r
+ canRetry = (_needsFlash && _s.useFlashBlock && !_s.ok());\r
+ for (i = 0; i < srcQueue.length; i++) {\r
+ if (srcQueue[i].fired !== true) {\r
+ queue.push(srcQueue[i]);\r
+ }\r
+ }\r
+ if (queue.length) {\r
+ _s._wD(_sm + ': Firing ' + queue.length + ' '+oOptions.type+'() item' + (queue.length === 1?'':'s'));\r
+ for (i = 0, j = queue.length; i < j; i++) {\r
+ if (queue[i].scope) {\r
+ queue[i].method.apply(queue[i].scope, [status]);\r
+ } else {\r
+ queue[i].method(status);\r
+ }\r
+ if (!canRetry) { // flashblock case doesn't count here\r
+ queue[i].fired = true;\r
+ }\r
+ }\r
+ }\r
+ return true;\r
+ };\r
+\r
+ _initUserOnload = function() {\r
+ _win.setTimeout(function() {\r
+ if (_s.useFlashBlock) {\r
+ _flashBlockHandler();\r
+ }\r
+ _processOnEvents();\r
+ // call user-defined "onload", scoped to window\r
+ if (_s.onload instanceof Function) {\r
+ _wDS('onload', 1);\r
+ _s.onload.apply(_win);\r
+ _wDS('onloadOK', 1);\r
+ }\r
+ if (_s.waitForWindowLoad) {\r
+ _event.add(_win, 'load', _initUserOnload);\r
+ }\r
+ },1);\r
+ };\r
+\r
+ _detectFlash = function() {\r
+\r
+ // hat tip: Flash Detect library (BSD, (C) 2007) by Carl "DocYes" S. Yestrau - http://featureblend.com/javascript-flash-detection-library.html / http://featureblend.com/license.txt\r
+\r
+ if (_hasFlash !== undefined) {\r
+ // this work has already been done.\r
+ return _hasFlash;\r
+ }\r
+\r
+ var hasPlugin = false, n = navigator, nP = n.plugins, obj, type, types, AX = _win.ActiveXObject;\r
+\r
+ if (nP && nP.length) {\r
+\r
+ type = 'application/x-shockwave-flash';\r
+ types = n.mimeTypes;\r
+ if (types && types[type] && types[type].enabledPlugin && types[type].enabledPlugin.description) {\r
+ hasPlugin = true;\r
+ }\r
+\r
+ } else if (typeof AX !== 'undefined') {\r
+\r
+ try {\r
+ obj = new AX('ShockwaveFlash.ShockwaveFlash');\r
+ } catch(e) {\r
+ // oh well\r
+ }\r
+ hasPlugin = (!!obj);\r
+\r
+ }\r
+\r
+ _hasFlash = hasPlugin;\r
+\r
+ return hasPlugin;\r
+\r
+ };\r
+\r
+ _featureCheck = function() {\r
+ var needsFlash, item,\r
+ isSpecial = (_ua.match(/iphone os (1|2|3_0|3_1)/i)?true:false); // iPhone <= 3.1 has broken HTML5 audio(), but firmware 3.2 (iPad) + iOS4 works.\r
+ if (isSpecial) {\r
+ _s.hasHTML5 = false; // has Audio(), but is broken; let it load links directly.\r
+ _html5Only = true; // ignore flash case, however\r
+ if (_s.oMC) {\r
+ _s.oMC.style.display = 'none';\r
+ }\r
+ return false;\r
+ }\r
+ if (_s.useHTML5Audio) {\r
+ if (!_s.html5 || !_s.html5.canPlayType) {\r
+ _s._wD('SoundManager: No HTML5 Audio() support detected.');\r
+ _s.hasHTML5 = false;\r
+ return true;\r
+ } else {\r
+ _s.hasHTML5 = true;\r
+ }\r
+ if (_isBadSafari) {\r
+ _s._wD(_smc+'Note: Buggy HTML5 Audio in Safari on this OS X release, see https://bugs.webkit.org/show_bug.cgi?id=32159 - '+(!_hasFlash?' would use flash fallback for MP3/MP4, but none detected.':'will use flash fallback for MP3/MP4, if available'),1);\r
+ if (_detectFlash()) {\r
+ return true;\r
+ }\r
+ }\r
+ } else {\r
+ // flash required.\r
+ return true;\r
+ }\r
+ for (item in _s.audioFormats) {\r
+ if (_s.audioFormats.hasOwnProperty(item) && _s.audioFormats[item].required && !_s.html5.canPlayType(_s.audioFormats[item].type)) {\r
+ // may need flash for this format?\r
+ needsFlash = true;\r
+ }\r
+ }\r
+ // sanity check..\r
+ if (_s.ignoreFlash) {\r
+ needsFlash = false;\r
+ }\r
+ _html5Only = (_s.useHTML5Audio && _s.hasHTML5 && !needsFlash && !_s.requireFlash);\r
+ return (_detectFlash() && needsFlash);\r
+ };\r
+\r
+ _init = function() {\r
+ var item, tests = [];\r
+ _wDS('init');\r
+\r
+ // called after onload()\r
+ if (_didInit) {\r
+ _wDS('didInit');\r
+ return false;\r
+ }\r
+\r
+ function _cleanup() {\r
+ _event.remove(_win, 'load', _s.beginDelayedInit);\r
+ }\r
+\r
+ if (_s.hasHTML5) {\r
+ for (item in _s.audioFormats) {\r
+ if (_s.audioFormats.hasOwnProperty(item)) {\r
+ tests.push(item+': '+_s.html5[item]);\r
+ }\r
+ }\r
+ _s._wD('-- SoundManager 2: HTML5 support tests ('+_s.html5Test+'): '+tests.join(', ')+' --',1);\r
+ }\r
+\r
+ if (_html5Only) {\r
+ if (!_didInit) {\r
+ // we don't need no steenking flash!\r
+ _cleanup();\r
+ _s.enabled = true;\r
+ _initComplete();\r
+ }\r
+ return true;\r
+ }\r
+\r
+ // flash path\r
+ _initMovie();\r
+ try {\r
+ _wDS('flashJS');\r
+ _s.o._externalInterfaceTest(false); // attempt to talk to Flash\r
+ if (!_s.allowPolling) {\r
+ _wDS('noPolling', 1);\r
+ } else {\r
+ _setPolling(true, _s.flashPollingInterval ? _s.flashPollingInterval : (_s.useFastPolling ? 10 : 50));\r
+ }\r
+ if (!_s.debugMode) {\r
+ _s.o._disableDebug();\r
+ }\r
+ _s.enabled = true;\r
+ _debugTS('jstoflash', true);\r
+ } catch(e) {\r
+ _s._wD('js/flash exception: ' + e.toString());\r
+ _debugTS('jstoflash', false);\r
+ _failSafely(true); // don't disable, for reboot()\r
+ _initComplete();\r
+ return false;\r
+ }\r
+ _initComplete();\r
+ // event cleanup\r
+ _cleanup();\r
+ return true;\r
+ };\r
+\r
+ _beginInit = function() {\r
+ if (_initPending) {\r
+ return false;\r
+ }\r
+ _createMovie();\r
+ _initMovie();\r
+ _initPending = true;\r
+ return true;\r
+ };\r
+\r
+ _dcLoaded = function() {\r
+ if (_didDCLoaded) {\r
+ return false;\r
+ }\r
+ _didDCLoaded = true;\r
+ _initDebug();\r
+ if (!_s.useHTML5Audio) {\r
+ if (!_detectFlash()) {\r
+ _s._wD('SoundManager: No Flash detected, trying HTML5');\r
+ _s.useHTML5Audio = true;\r
+ }\r
+ }\r
+ _testHTML5();\r
+ _s.html5.usingFlash = _featureCheck();\r
+ _needsFlash = _s.html5.usingFlash;\r
+ _didDCLoaded = true;\r
+ if (_doc.removeEventListener) {\r
+ _doc.removeEventListener('DOMContentLoaded', _dcLoaded, false);\r
+ }\r
+ _go();\r
+ return true;\r
+ };\r
+\r
+ _startTimer = function(oSound) {\r
+ if (!oSound._hasTimer) {\r
+ oSound._hasTimer = true;\r
+ }\r
+ };\r
+\r
+ _stopTimer = function(oSound) {\r
+ if (oSound._hasTimer) {\r
+ oSound._hasTimer = false;\r
+ }\r
+ };\r
+\r
+ _die = function() {\r
+ if (_s.onerror instanceof Function) {\r
+ _s.onerror();\r
+ }\r
+ _s.disable();\r
+ };\r
+\r
+ _badSafariFix = function() {\r
+ // special case: "bad" Safari can fall back to flash for MP3/MP4\r
+ if (!_isBadSafari || !_detectFlash()) {\r
+ return false; // doesn't apply\r
+ }\r
+ var aF = _s.audioFormats, i, item;\r
+ for (item in aF) {\r
+ if (aF.hasOwnProperty(item)) {\r
+ // special case: "bad" Safari can fall back to flash for MP3/MP4\r
+ if (item === 'mp3' || item === 'mp4') {\r
+ _s._wD(_sm+': Using flash fallback for '+item+' format');\r
+ _s.html5[item] = false;\r
+ // assign result to related formats, too\r
+ if (aF[item] && aF[item].related) {\r
+ for (i = aF[item].related.length; i--;) {\r
+ _s.html5[aF[item].related[i]] = false;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ };\r
+\r
+ // pseudo-private methods called by Flash\r
+\r
+ this._setSandboxType = function(sandboxType) {\r
+ // <d>\r
+ var sb = _s.sandbox;\r
+ sb.type = sandboxType;\r
+ sb.description = sb.types[(typeof sb.types[sandboxType] !== 'undefined'?sandboxType:'unknown')];\r
+ _s._wD('Flash security sandbox type: ' + sb.type);\r
+ if (sb.type === 'localWithFile') {\r
+ sb.noRemote = true;\r
+ sb.noLocal = false;\r
+ _wDS('secNote', 2);\r
+ } else if (sb.type === 'localWithNetwork') {\r
+ sb.noRemote = false;\r
+ sb.noLocal = true;\r
+ } else if (sb.type === 'localTrusted') {\r
+ sb.noRemote = false;\r
+ sb.noLocal = false;\r
+ }\r
+ // </d>\r
+ };\r
+\r
+ this._externalInterfaceOK = function(flashDate) {\r
+ // flash callback confirming flash loaded, EI working etc.\r
+ // flashDate = approx. timing/delay info for JS/flash bridge\r
+ if (_s.swfLoaded) {\r
+ return false;\r
+ }\r
+ var eiTime = new Date().getTime();\r
+ _s._wD(_smc+'externalInterfaceOK()' + (flashDate?' (~' + (eiTime - flashDate) + ' ms)':''));\r
+ _debugTS('swf', true);\r
+ _debugTS('flashtojs', true);\r
+ _s.swfLoaded = true;\r
+ _tryInitOnFocus = false;\r
+ if (_isBadSafari) {\r
+ _badSafariFix();\r
+ }\r
+ if (_isIE) {\r
+ // IE needs a timeout OR delay until window.onload - may need TODO: investigating\r
+ setTimeout(_init, 100);\r
+ } else {\r
+ _init();\r
+ }\r
+ };\r
+\r
+ _dcIE = function() {\r
+ if (_doc.readyState === 'complete') {\r
+ _dcLoaded();\r
+ _doc.detachEvent('onreadystatechange', _dcIE);\r
+ }\r
+ return true;\r
+ };\r
+\r
+ // focus and window load, init\r
+ if (!_s.hasHTML5 || _needsFlash) {\r
+ // only applies to Flash mode\r
+ _event.add(_win, 'focus', _handleFocus);\r
+ _event.add(_win, 'load', _handleFocus);\r
+ _event.add(_win, 'load', _delayWaitForEI);\r
+ if (_isSafari && _tryInitOnFocus) {\r
+ _event.add(_win, 'mousemove', _handleFocus); // massive Safari focus hack\r
+ }\r
+ }\r
+\r
+ if (_doc.addEventListener) {\r
+ _doc.addEventListener('DOMContentLoaded', _dcLoaded, false);\r
+ } else if (_doc.attachEvent) {\r
+ _doc.attachEvent('onreadystatechange', _dcIE);\r
+ } else {\r
+ // no add/attachevent support - safe to assume no JS -> Flash either\r
+ _debugTS('onload', false);\r
+ _die();\r
+ }\r
+\r
+ if (_doc.readyState === 'complete') {\r
+ setTimeout(_dcLoaded,100);\r
+ }\r
+\r
+} // SoundManager()\r
+\r
+// SM2_DEFER details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading\r
+if (typeof SM2_DEFER === 'undefined' || !SM2_DEFER) {\r
+ soundManager = new SoundManager();\r
+}\r
+\r
+// public interfaces\r
+window.SoundManager = SoundManager; // constructor\r
+window.soundManager = soundManager; // public API, flash callbacks etc\r
+\r
+}(window));\r
--- /dev/null
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ */
+
+/**
+ * class fior managing markers in the player. This class extends TimesideArray (see timeside.js), and communicates with the other
+ * two TimesideArrays of the player which receive edit events (click, keys events etcetera): the ruler (ruler.js) and the markermapdiv (divmarker.js)
+ * All bindings between these three classes are set in in the player (See player.js , in particular loadMarkers method)
+ */
+Timeside.classes.MarkerMap = Timeside.classes.TimesideArray.extend({
+
+ init: function() {
+ this._super();
+ },
+
+ pFloat: parseFloat, //reference to function parseFloat for faster lookup
+ //overridden
+ add: function(newMarker) {
+ if(!('offset' in newMarker)){
+ return -1;
+ }
+
+ if(typeof newMarker.offset != 'number'){ //check to be sure:
+ newMarker.offset = this.pFloat(newMarker.offset);
+ }
+ if(!('id' in newMarker)){
+ newMarker.id = this.$TU.uniqid(); //Timeside.utils.uniqid();
+ }
+ if(!('isEditable' in newMarker)){
+ newMarker.isEditable = false;
+ }
+ var marker = newMarker;
+ var idx = this.insertionIndex(marker);
+ if(idx>=0){ //it exists? there is a problem....
+ this.debug('markermap.add: adding an already existing marker!!'); //should not happen. however...
+ return -1;
+ }
+
+ idx = -idx-1;
+ //we do not call the super add cause we want to insert at a specified index
+ this._super(marker,idx);
+ //notifies controller.onMarkerMapAdd
+
+ this.fire('add', {
+ marker: marker,
+ index: idx
+ });
+
+ return idx;
+ },
+
+ //overridden method. Contrarily to super method,
+ //where the first argument is the index (integer), here the
+ //the first argument can also be a marker. Its index will be found and, if valid, the super method will be called
+ //RETURNS -1 IF SOMETHING HAS GONE WRONG, OTHERWISE THE
+ remove: function(markerOrMarkerIndex) {
+ var idx = -1;
+ if(typeof markerOrMarkerIndex == 'number'){
+ idx = markerOrMarkerIndex;
+ }else if('id' in markerOrMarkerIndex && 'offset' in markerOrMarkerIndex){
+ idx = this.insertionIndex(markerOrMarkerIndex);
+ //idx>=0 ONLY if marker has been found
+ }
+ if(idx<0 || idx>=this.length){
+ this.debug('markermap.remove: index out of bounds or marker not found');
+ return -1;
+ }
+ var marker = this._super(idx);
+ this.fire('remove',{
+ 'index':idx,
+ 'marker':marker
+ });
+ return idx;
+ },
+
+ //overridden method. Contrarily to super method,
+ //where the first argument is the 'from' index, here the
+ //the first argument can also be a marker
+ move: function(markerOrMarkerIndex, newOffset){
+ var oldIndex = -1;
+ if(typeof markerOrMarkerIndex == 'number'){
+ oldIndex = markerOrMarkerIndex;
+ }else if('id' in markerOrMarkerIndex && 'offset' in markerOrMarkerIndex){
+ oldIndex = this.insertionIndex(markerOrMarkerIndex);
+ //oldIndex>=0 ONLY if marker has been found
+ }
+ if(oldIndex<0 || oldIndex>=this.length){
+ this.debug('markermap.move: index out of bounds or marker not found');
+ return -1;
+ }
+
+ var newIndex = this.insertionIndex(newOffset);
+ //select the case:
+ if(newIndex<0){ //newindex should ALWAYS be lower than zero, as insertionIndex(number) should not match any marker
+ //we didn't move the marker on another marker (newOffset does not correspond to any marker)
+ //just return the real insertionIndex
+ newIndex = -newIndex-1;
+ }
+
+ //now: if the isnertionIndex is greater than the marker index (oldIndex),
+ //we decrement newIndex cause super.move will first REMOVE the marker and then set it at newIndex
+ if(newIndex > oldIndex){
+ newIndex--;
+ }
+ newIndex = this._super(oldIndex,newIndex);
+
+ if(newIndex <0){
+ this.debug('markermap.move: new index out of bounds');
+ return -1;
+ }
+
+ var markers = this.toArray();
+ var marker = markers[newIndex];
+ var oldOffset = marker.offset;
+ marker.offset = newOffset;
+ this.fire('move', {
+ marker: marker,
+ fromIndex: oldIndex,
+ toIndex: newIndex,
+ oldOffset: oldOffset
+ });
+ return newIndex;
+ },
+
+
+ //returns the insertion index of object in this sorted array by means of a binary search algorithm.
+ // A) If object is a marker and:
+ // a1) Is found (ie, there is a marker in this map
+ // with same offset and same id), returns the index of the marker found, in the range [0, this.length-1]. Otherwise, if
+ // a2) Is not found, then returns -(insertionIndex-1), where insertionIndex is the
+ // index at which object would be inserted preserving the array order. Note that this assures that a
+ // number lower than zero means that object is not present in the array, and viceversa
+ // B) If object is a number or a string number (eg, "12.567"), then a marker with offset = object is built and compared
+ // against the markers in the map. Note however that in this case that equality between marker's offset is sufficient,
+ // as object is not provided with an id. THEREFORE, IF THE MAP CONTAINS SEVERAL MARKERS AT INDICES i, i+1, ... i+n
+ // WITH SAME OFFSET == object, THERE IS NO WAY TO DETERMINE WHICH INDEX IN [i, i+1, ... i+n] WILL BE RETURNED.
+ // See player.forward and player.rewind for an example of the B) case.
+ //LAST NOTE: BE SURE object is either a number (float) or object.offset is a number (float).
+ //In case it is not known, If it is a string number such as
+ //"4.562" the comparison falis (eg, "2.567" > "10.544") but obviously, no error is thrown in javascript
+ //
+ insertionIndex: function(object){
+ //default comparator function:
+ //returns 1 as the first argument is greater than the second
+ //returns -1 as the first argument is lower than the second
+ //returns 0 if the arguments are equal
+ var comparatorFunction = function(markerInMap,newMarker){
+ var a = markerInMap.offset;
+ var b = newMarker.offset;
+ if(a<b){
+ return -1;
+ }else if(a >b){
+ return 1;
+ }else{
+ var a1 = markerInMap.id;
+ var b1 = newMarker.id;
+ if(a1<b1){
+ return -1;
+ }else if(a1>b1){
+ return 1;
+ }
+ }
+ return 0;
+ };
+ if(!(typeof object == 'object')){
+ var offset;
+ if(typeof object == 'number'){
+ offset = object;
+ }else{ //to be sure...
+ offset = parseFloat(object);
+ }
+ object = {
+ 'offset':offset
+ };
+ //key will never be found, so return either 1 or -1:
+ comparatorFunction = function(markerInMap,newMarker){
+ var a = markerInMap.offset;
+ var b = newMarker.offset;
+ return a < b ? -1 : (a>b ? 1 : 0);
+ };
+ }
+
+ var data = this.toArray();
+ var low = 0;
+ var high = data.length-1;
+
+ while (low <= high) {
+ var mid = (low + high) >>> 1;
+ //biwise operation is not as fast as in compiled languages such as C and java (see Jslint web page)
+ //However (tested on a PC in Chrome, IE and FF), it is faster than the equivalent:
+ //var mid = parseInt((low + high)/2);
+ //even if we reference parseInt before this loop and we call the variable assigned to it
+ var midVal = data[mid];
+ var cmp = comparatorFunction(midVal,object);
+ if (cmp < 0){
+ //the midvalue is lower than the searched index element
+ low = mid + 1;
+ }else if (cmp > 0){
+ //the midvalue is greater than the searched index element
+ high = mid - 1;
+ }else{
+ return mid; // key found
+ }
+ }
+ return -(low + 1); // key not found
+ },
+
+ //sets isEditable to value
+ setEditable: function(markerOrMarkerIndex, value) {
+ var idx = -1;
+ if(typeof markerOrMarkerIndex == 'number'){
+ idx = markerOrMarkerIndex;
+ }else if('id' in markerOrMarkerIndex && 'offset' in markerOrMarkerIndex){
+ idx = this.insertionIndex(markerOrMarkerIndex);
+ //idx>=0 ONLY if marker has been found
+ }
+ if(idx<0 || idx>=this.length){
+ this.debug('markermap.setEditable: index out of bounds or marker not found');
+ return -1;
+ }
+ var marker = this.toArray()[idx];
+ var oldVal = marker.isEditable ? true : false;
+ marker.isEditable = value;
+ this.fire('markerEditStateChanged',{
+ 'index':idx,
+ 'marker':marker,
+ 'oldValue':oldVal,
+ 'value':value
+ });
+ return idx;
+ }
+
+}
+);
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Olivier Guilyardi <olivier@samalyse.com>
+ */
+
+/**
+ * The player class to instantiate a new player. Requires all necessary js (timeside, ruler, markermap etcetera...) and
+ * jQuery
+ */
+
+//playerDiv, sound, durationInMsec, visualizers, markerMap);
+Timeside.classes.Player = Timeside.classes.TimesideClass.extend({
+
+ //sound duration is in milliseconds because the soundmanager has that unit,
+ //player (according to timeside syntax) has durations in seconds
+ // newMarkerCallback must be either a string or a function, the necessary checks is done in Timeside.load
+ // (which calls this method)
+ //if markersArray is not an array, it defaults to []
+ init: function(configObject) {
+ this._super();
+ var $J = this.$J;
+ var me=this;
+
+ var msgs = configObject.messages;
+ if(msgs){
+ for(var k in msgs){
+ if(msgs.hasOwnProperty(k)){
+ var ms = msgs[k];
+ if(typeof ms === 'string'){
+ this.msgs[k] = ms;
+ }
+ }
+ }
+ }
+
+ var onError = configObject.onError;
+ if(typeof onError !== 'function'){
+ onError = function(msg){};
+ }
+
+ var onReady = configObject.onReady;
+ if(typeof onReady !== 'function'){
+ onReady = function(player){};
+ }
+
+ var onReadyWithImage = configObject.onReadyWithImage;
+
+ if(typeof onReadyWithImage === 'function'){
+ var onReadyWithImageNamespace = 'imgRefreshed.temp_'+new Date().getTime(); //get an unique namespace
+ this.bind(onReadyWithImageNamespace,function(data){
+ onReadyWithImage(me);
+ me.unbind(onReadyWithImageNamespace);
+ });
+ }
+
+ var container = configObject.container;
+ container = container instanceof $J ? container : $J(container);
+ container = container.length ? container.eq(0) : undefined;
+ if (!container || !container.length){
+ onError('container not defined or invalid');
+ return;
+ }
+
+ var sMan = soundManager;
+ var sound = configObject.sound;
+ var createSound = false;
+ if(this.$TU.flashFailed){
+ this.soundErrorMsg = 'soundManager error. If your browser does not support HTML5, Flash player (version '+sMan.flashVersion+'+) must be installed.\nIf flash is installed, try to:\n - Reload the page\n - Empty the cache (see browser preferences/options/tools) and reload the page\n - Restart the browser';
+ }else{
+ if(typeof sound !== 'string' && typeof sound !== 'object'){
+ this.soundErrorMsg ='bad sound parameter: specify a a valid soundManager sound-object, an object with at least two properties, url and id, or URL as string';
+ }else if(typeof sound === 'string'){
+ createSound = true;
+ var soundURL = sound;
+ sound = {
+ id: 'ts-sound',
+ autoLoad: false,
+ url: soundURL,
+ multiShot: false
+ };
+ //do a raw check to see if it is a soundmanager object
+ }else if(!sound.hasWonProperty('sID') || !sound.hasWonProperty('_iO') || !sound.hasWonProperty('url')){
+ if(!sound.hasWonProperty('url') || !sound.hasWonProperty('id')){ //it is not a soundManager object, has at least an url???
+ this.soundErrorMsg = 'bad sound parameter: object requires properties url and id at minimum';
+ }else{
+ createSound = true;
+ }
+ }
+ if(createSound){
+ var soundOptions = sound;
+ if(sMan.canPlayURL(soundOptions.url)){ //this actually checks only if the url is well formed, not if the file is there
+ //check if we specified a valid sound duration, otherwise the sound must be loaded
+ sound = sMan.createSound(soundOptions);
+ }else{
+ this.soundErrorMsg = 'bad sound parameter (soundManager.canPlayURL returned false)';
+ }
+ }
+ }
+ if(this.soundErrorMsg){
+ this.getSound = function(){
+ return undefined;
+ };
+ }else{
+ this.getSound = function(){
+ return sound;
+ };
+ }
+ var soundDurationInMsec = configObject.soundDuration;
+ if(typeof soundDurationInMsec !== 'number' || soundDurationInMsec<=0){
+ onError('invalid soundDurationInMsec: NaN or not positive');
+ return;
+ }
+
+
+ var soundImgFcn = configObject.soundImage;
+
+ if(!(typeof soundImgFcn === 'string' || typeof soundImgFcn === 'function')){
+ onError('invalid sound soundImgFcn. Provide a callback(width,height) or a string denoting a valid URL');
+ return;
+ }else{
+ if(typeof soundImgFcn === 'string'){
+ var url = soundImgFcn;
+ this.imageCallback = new function(w,h){
+ return url;
+ };
+ }else{ //surely a function
+ this.imageCallback = soundImgFcn;
+ }
+ }
+
+ var soundImgSize = configObject.imageSize;
+ var markersArray = configObject.markersArray;
+ var newMarker = configObject.newMarker;
+
+
+
+ this.playState = 0; //0: not playing, 1: loading, 2:buffering, 3 playing (sound heard)
+ //container is the div #player
+
+ this.getContainer = function(){
+ return container;
+ };
+
+
+
+ var sd = this.toSec(soundDurationInMsec);
+ this.getSoundDuration = function(){
+ return sd;
+ };
+
+ this.soundPosition = sound.position ? this.toSec(sound.position) : 0;
+ this.soundVolume = 100; //set to maximum
+
+
+ //
+
+ //initializing markermap and markerui
+ var map = new Timeside.classes.MarkerMap();
+ this.getMarkerMap = function(){
+ return map;
+ };
+
+ var canAddMarkers = false;
+ if(newMarker === true || (typeof newMarker === 'function')){
+ canAddMarkers = true;
+ if(typeof newMarker === 'function'){
+ this.newMarker = newMarker;
+ }
+ }
+
+ //build the innerHTML as array, then join it. This is usually faster than string concatenation in some browsers.
+ //Note that the player image (see below) is not created now, however, if it was, it should be given a src
+ //as NOT specifying any src for image tags can be harmful,
+ //see http://www.nczonline.net/blog/2009/11/30/empty-image-src-can-destroy-your-site/ and
+ //http://geekswithblogs.net/bcaraway/archive/2007/08/24/114945.aspx for details
+ var html = [
+ "<div class='ts-ruler'></div>",
+ "<div class='ts-wave'>",
+ "<div class='ts-image-canvas'></div>",
+ "<div class='ts-image-container'>",
+ //lazily created: "<img class='ts-image' src='xyz.png' alt='' />", //not providing a src attribute is harmful. Dummy src attribute
+ "</div>",
+ "</div>",
+ "<div class='ts-control'>",
+ "<a class='ts-play ts-button'></a>",
+ "<a class='ts-pause ts-button'></a>",
+ "<a class='ts-rewind ts-button'></a>",
+ "<a class='ts-forward ts-button'></a>",
+ "<a class='ts-set-marker ts-button'></a>",
+ "<a class='ts-volume-speaker ts-button'></a>",
+ "<div class='ts-volume-wrapper-div'>",
+ "<a class='ts-volume-bar-container'>",
+ "<span class='ts-volume-bar'></span>",
+ "</a>",
+ "</div>",
+ "<div class='ts-wait'></div>",
+ "</div>"];
+
+ container.html(html.join(''));
+
+ var control = container.find('.ts-control');
+
+ //bind events to buttons:
+ var rewind = control.find('.ts-rewind');
+ rewind.attr('href', '#').click(function(e){
+ me.rewind.apply(me);
+ return false;
+ });
+
+ var forward = control.find('.ts-forward');
+ forward.attr('href', '#').click(function(e){
+ me.forward.apply(me);
+ return false;
+ });
+
+ var pause = control.find('.ts-pause');
+ pause.attr('href', '#').bind('click', function(){
+ me.pause.apply(me);
+ return false;
+ });
+
+ var play = control.find('.ts-play');
+ play.attr('href', '#').bind('click', function(){
+ me.play.apply(me);
+ return false;
+ });
+
+ var setMarkerButton = control.find('.ts-set-marker');
+
+ if(canAddMarkers){
+ setMarkerButton.show().attr('href','#').unbind('click').bind('click', function(){
+ me.addMarker(me.soundPosition);
+ return false;
+ });
+ }else{
+ setMarkerButton.hide().unbind('click');
+ }
+
+
+ //volume:
+ var volumeSpeaker = control.find('.ts-volume-speaker');
+ var volumeBarContainer = control.find('.ts-volume-bar-container');
+ var volumeBar = volumeBarContainer.find('.ts-volume-bar');
+
+ var getVol = function(x){
+ var vol = 100*x/volumeBarContainer.width();
+ //allow click to easily set to zero or 100, ie set a margin to 5%:
+ var margin = 5;
+ if (vol < margin){
+ vol=0;
+ }else if(vol >100-margin){
+ vol = 100;
+ }
+ return vol;
+ };
+ function setVolume(event,volumeElement){
+ var x = event.pageX - volumeElement.offset().left; //using absolute coordinates allows us to
+ //avoid using layerX (not supported in all browsers) and clientX (which needs the window scrollLeft variable)
+ me.setSoundVolume(getVol(x));
+ return false;
+ }
+ volumeBarContainer.attr('href', '#').click(function(event){
+ return setVolume(event,volumeBar);
+ });
+ volumeSpeaker.attr('href', '#').click(function(){
+ me.setSoundVolume(me.soundVolume>0 ? 0 : getVol(volumeBar.outerWidth()));
+ return false;
+ });
+ this.setSoundVolume(this.soundVolume);
+
+ control.find('a').attr('href', '#') ;
+
+ //SET NECESSARY CSS (THIS WILL OVERRIDE CSS SET IN STYLESHEETS):
+ //var viewer = container.find('.ts-viewer');
+ var wave = container.find('.ts-wave');
+ var ruler_ = container.find('.ts-ruler');
+ wave.add(control).add(ruler_).css({
+ 'position':'relative',
+ 'overflow':'hidden'
+ });
+ //assigning display and title to all anchors
+ var subcontrolsToBeSetVisible = control.find('*');
+ if(!canAddMarkers){
+ subcontrolsToBeSetVisible = subcontrolsToBeSetVisible.filter(':not(a.ts-set-marker)');
+ }
+ subcontrolsToBeSetVisible.css({
+ 'display':'inline-block',
+ 'overflow':'hidden'
+ });
+
+ var waitImg = control.find('.ts-wait');
+ waitImg.html('wait').css({
+ 'position':'absolute'
+ });
+
+ var div = control.find('.ts-volume-wrapper-div');
+ div.css({
+ 'position':'absolute',
+ 'left':(volumeSpeaker.position().left+volumeSpeaker.outerWidth(true))+'px',
+ 'top':0,
+ 'width':'auto',
+ 'height':'100%'
+ });
+ //END NECESSARY CSS
+
+ //creating the ruler
+ var waveImage = container.find('.ts-image-canvas');
+ var ruler = new Timeside.classes.Ruler(ruler_, waveImage, this.getSoundDuration());
+ //var ruler = new Timeside.classes.Ruler(viewer, this.getSoundDuration());
+ this.getRuler = function(){
+ return ruler;
+ };
+ //bind mouse events:
+ ruler.bind('rulermarkermouseevent', function(data){
+ var idx = data.index;
+ data.marker = idx > -1 ? me.getMarker(idx) : undefined;
+ me.fire('markerMouseEvent',data);
+ });
+
+ //setting image size (if provided) and resize player. Note that _setImageSize (with underscore) is intended to be
+ //a private method (faster). setImageSize (without underscore) is the public method to use outside of player object
+ if(soundImgSize){
+ this._setImageSize(soundImgSize.width,soundImgSize.height,container, wave,true); //calls this.resize which calls ruler.resize
+ }else{
+ this._setImageSize('','',container, wave,true); //calls this.resize which calls ruler.resize
+ }
+
+ //binds click for the pointer:
+ var v = wave; //.add(ruler);
+ v.unbind('click').click(function(evt){
+ var w = v.width();
+ var x = evt.pageX - v.offset().left; //using absolute coordinates allows us to
+ //avoid checking whether or not we are clicking on a vertical marker line, on a subdiv etcetera
+ var sd = me.getSoundDuration();
+ me.setSoundPosition(sd*x/w);
+ });
+
+
+
+ //finally, load markers and bind events for markers (see method below):
+ //NOTE: loadMarkers ASYNCHRONOUSLY CALLS THE SERVER, SO METHODS WRITTEN AFTER IT MIGHT BE EXECUTED BEFORE
+ //loadMarkers has finished its job
+ //this.loadMarkers(callback);
+ if(!(markersArray) || !(markersArray.length)){
+ markersArray = [];
+ }
+ this.loadMarkers(markersArray);
+
+
+ //IE7 BUG: the divs wave and control do not shift downwards after canvas is drawn and covers part of the rulrer.
+ //Weird enough (with IE it isn't actually), we have just to set the property we already set in the css:
+ //ie, top: auto. This is however useful even if somebody specified a top property on the divs
+ ruler_.add(wave).add(control).css('top','auto');
+ onReady(this);
+ },
+
+ //functions for converting seconds (player unit) to milliseconds (sound manager unit) and viceversa:
+ toSec: function(milliseconds){
+ return milliseconds/1000;
+ },
+ toMsec : function(seconds){ //this function has less performances than toSec, as it calls Math.round
+ return Math.round(1000*seconds); //however, it is assumed that it is NOT called in loops
+ },
+
+ setSoundPosition: function(newPositionInSeconds){
+ //if the player is playing and NOT yet fully loaded, simply calling:
+ //this.getSound().setPosition(this.toMsec(newPositionInSeconds));
+ //resets the position to zero. So we use this workaround:
+ // this.getSound().stop(); //calling this.pause() hides the waiting bar, which is not the case here
+ // this.soundPosition = newPositionInSeconds;
+ // this.play();
+ //however, that causes fast pointer move effect is undesiderable
+ //So:
+ var wasPlaying = this.playState > 0;
+ if(wasPlaying){
+ this.getSound().stop(); //dont call this.pause cause it hides the waitbar, if visible and resets the playState
+ }
+ //update pointer position. If this call is due to a pointer move (mouse release),
+ //ruler.isPointerMovingFromMouse=true and the following code has no effect (the pointer is already at the good position)
+ var ruler = this.getRuler();
+ if(ruler){
+ ruler.movePointer(newPositionInSeconds);
+ }
+ //set sound position:
+ var oldSoundPosition = this.soundPosition;
+ this.soundPosition = newPositionInSeconds;
+
+ //resume playing if it was playing:
+ if(wasPlaying){
+ var player = this;
+
+ //delay a little bit the play resume, this might avoid fast pointer repositioning
+ //(it should not be the case, but it happens. why??)
+ setTimeout(function(){
+ player.play.apply(player);
+ },100);
+ }
+ this.fire('soundPositionSet',{
+ player:this,
+ oldSoundPosition:oldSoundPosition
+ });
+
+ },
+ showSoundErroMessage: function(){
+ alert(this.soundErrorMsg);
+ },
+ readyState : function(){
+ var s = this.getSound();
+ return s ? s.readyState : 2;
+ //attach onload event only if the sound is NOT already loaded:
+ /*sound.readyState
+ * Numeric value indicating a sound's current load status
+ * -1: sound error on construcotr, sound is undefined
+ * 0 = uninitialised
+ * 1 = loading
+ * 2 = failed/error
+ * 3 = loaded/success
+ */
+ },
+ //given a marker at index I, specifies that a marker corss event is fired whenever the sound position (pointer)
+ //is in the interval ]markerCrossedOffsetMargin-I,I+markerCrossedOffsetMargin[
+ //the value is in seconds
+ //markerCrossedOffsetMargin : 0.5,
+ play : function(){
+
+ if(this.soundErrorMsg){
+ alert(this.soundErrorMsg);
+ return false;
+ }
+
+ var player = this;
+ var sound = player.getSound();
+
+ if(!player || !sound){ //just check. The cases here (especially, sound = undefined, should be
+ //together with this.soundErrorMsg != "", so we should have catch the case above
+ return false;
+ }
+
+
+ var playOptions = {}; //the play options to be passed to the play method
+
+ var readyState = this.readyState();
+
+ //create event loadErrorFunction only if the sound is NOT already loaded:
+ /*
+ * Numeric value indicating a sound's current load status
+ * 0 = uninitialised
+ * 1 = loading
+ * 2 = failed/error
+ * 3 = loaded/success
+ */
+ if(readyState !== 3){
+ playOptions.onload = function(success){
+ if(!success){
+ sound.stop();
+ player.playState = 0;
+ player.setWait(player.isImgRefreshing ? player.msgs.imgRefreshing : '');
+ player.soundErrorMsg = 'Error while loading sound: check sound url';
+ player.showSoundErroMessage();
+ }
+ };
+
+ if(sound.readyState === 2){
+ playOptions.onload(false);
+ return false;
+ }
+ }
+
+
+ var fireOnMarkerPosition = function(seconds){}; //does nothing by default
+ var map = player.getMarkerMap();
+ var markerCrossListeners = player.listenersMap['markerCrossed'];
+ //optimizing: if no listeners associated to markerCrossListeners, avoid creating a function
+ if(map && map.length && markerCrossListeners){
+ var idx = 0;
+ if(player.soundPosition>0){
+ idx = map.insertionIndex(player.soundPosition);
+ if(idx<0){
+ idx=-idx-1;
+ }
+ }
+ var len = map.length;
+ if(idx>-1 && idx < len){
+ var markers = map.toArray();
+ var marker = markers[idx];
+ var margin = 0.5; //1 second (0.5*2) of margin (before+after)
+ var offs = marker.offset;
+ var intervalUpperBound = offs+margin;
+ var intervalLowerBound = offs-margin;
+ var data = { //if you change data, change it also below
+ index:idx,
+ marker:marker,
+ currentSoundPosition: player.soundPosition,
+ nextMarkerTimeInterval: undefined
+ };
+ fireOnMarkerPosition = function(seconds){
+ if(marker){
+ if(seconds>intervalLowerBound && seconds < intervalUpperBound){
+ idx++;
+ marker = idx < len ? markers[idx] : undefined;
+ offs = marker ? marker.offset : undefined;
+ data.currentSoundPosition = seconds;
+ data.nextMarkerTimeInterval = marker ? [offs-margin, offs+margin] : undefined;
+ player.fire('markerCrossed',data);
+
+ if(idx<len){
+ intervalUpperBound = offs+margin;
+ intervalLowerBound = offs-margin;
+ data.index = idx;
+ data.marker = marker;
+ }
+ }
+ }
+ };
+ }
+ }
+
+ var toSec = player.toSec;
+ var ruler = player.getRuler();
+ var sPosInMsec = player.toMsec(player.soundPosition);
+ var bufferingString = this.msgs.buffering;
+ var loadingString = this.msgs.loading;
+
+ var updateWaitBar = this.setWait;
+ //building immediately data events to be passed instead of bulding them in the loop whileplaying
+ var loadData = {
+ player:this,
+ oldPlayState:0,
+ endOfPlayback:false
+ };
+ var bufferData = {
+ player:this,
+ oldPlayState:0,
+ endOfPlayback:false
+ };
+ var playData = {
+ player:this,
+ oldPlayState:0,
+ endOfPlayback:false
+ };
+ var endData = {
+ player:this,
+ oldPlayState:0,
+ endOfPlayback:true
+ };
+ //done
+ var playState = this.playState;
+ if(!playState){
+ if(loadingString){
+ updateWaitBar.apply(this,[loadingString]); //calling setWait of an empty string hides the wait, we dont want it here
+ //ps: without apply this in updateWait is the dom window
+ }
+ loadData.oldPlayState = playState;
+ playState = this.playState = 1;
+ this.fire('playStateChanged',loadData);
+ }
+ //setting playOptions properties:
+ playOptions.position = sPosInMsec;
+ playOptions.whileplaying = function(){
+
+ var sPos = this.position;
+ var buffering = this.isBuffering || typeof sPos != 'number' || sPos < sPosInMsec;
+
+ //var buffering = this.isBuffering; //this refers to the soundmanager sound obj
+ //Now, what are we doing here below? we could simply check whether is buffering or not..
+ //Unfortunately, when buffering some playState (isBuffering = false) are also fired, randomly
+ //ONCE in a while
+ //the result is a blinking 'isBuffering' 'isPlaying' state in the wait element displaying the state (not so nice),
+ //which is also costly in terms of computation. So, we wait for at least N playstate fired SUBSEQUENTLY, without
+ //NO bufferingState fired between them. N is set to minimumNumberOfSubsequentPlayCall. When this happens, we can start moving the
+ //pointer as a result of a real play state, and we avoid blinking of the wait element
+ switch(buffering){
+ case true:
+ switch(playState){
+ case 2: //do nothing (wait element already displaying)
+ break;
+ default: //update the wait element showing it:
+ bufferData.oldPlayState = playState;
+ player.playState = playState = 2;
+ player.fire('playStateChanged',bufferData);
+ if(bufferingString){
+ updateWaitBar.apply(player,[bufferingString]);
+ }
+ }
+ break;
+ default:
+ switch(playState){
+ case 0:
+ case 1:
+ case 2:
+ playData.oldPlayState = playState;
+ //currentState = isPlayingId; //set state for future subsequent calls of this case
+ player.playState = playState = 3;
+ player.fire('playStateChanged',playData);
+ //update waitbar
+ updateWaitBar.apply(player,[player.isImgRefreshing ? player.msgs.imgRefreshing : '']);
+ default: //move pointer
+ var sPosInSec = toSec(sPos);
+ player.soundPosition = sPosInSec;
+ ruler.movePointer(sPosInSec);
+ }
+ fireOnMarkerPosition(sPosInSec);
+ }
+
+ };
+ playOptions.onfinish = function() {
+
+ //whileplaying is NOT called onsinfish. We must update the pointer:
+ //note that for small length sounds (wg, 5 secs) the pointer shifts abruptly from the last
+ //whileplaying position to the end. We tried with a setTimeout function but the visual effect is not
+ //removed. So we leave this small 'bug'
+ endData.oldPlayState = playState;
+ player.playState = playState = 0;
+ player.fire('playStateChanged',endData);
+ ruler.movePointer(player.getSoundDuration());
+ updateWaitBar.apply(player,[player.isImgRefreshing ? player.msgs.imgRefreshing : '']);
+ };
+
+
+ //if the pointer is already at the end of sound, soundmanager does not fire onfinish but starts buffering
+ //forever. Therefore, we must check this case here.
+ //We use a margin of time of 20 milliseconds (.2 seconds) to indicate that inside this margin the sound is at its end
+ if(this.soundPosition + 0.2 >= this.getSoundDuration()){
+ playOptions.onfinish();
+ }else{
+ sound.setVolume(this.soundVolume); //workaround. Just to be sure. Sometimes it fails when we re-play
+ sound.play(playOptions);
+ // soundManager.play(sound.sId,{
+ // onload: function(success){
+ // alert(success);
+ // }
+ // });
+ }
+
+ return false;
+ },
+
+ msgs : {
+ loading : 'loading',
+ buffering: 'buffering',
+ imgRefreshing : 'refreshing img'
+ },
+ pause: function(){
+ var sound = this.getSound();
+ //we don't check if it's playing, as the stop must really stop anyway
+ //if(sound && this.isPlaying()){
+ if(sound){
+ //var v = this.isPlaying();
+ sound.stop();
+ var data = {
+ player:this,
+ oldPlayState:this.playState,
+ endOfPlayback:false
+ };
+ this.playState = 0;
+ this.fire('playStateChanged',data);
+ this.setWait(this.isImgRefreshing ? this.msgs.imgRefreshing : '');
+ }
+ return false;
+ },
+
+ getWaitElement: function(){
+ return this.getContainer().find('.ts-control').find('.ts-wait');
+ },
+
+ setWait: function(msg){
+ var wait = undefined;
+
+ wait = this.getWaitElement();
+ if(!wait || msg === undefined){
+ return;
+ }
+ if(wait.html()!=msg){
+ wait.html(msg);
+ }
+
+ var visible = wait.css('display') != 'none';
+
+ if(msg && !visible){
+ wait.show();
+ this.fire('waitShown');
+ }else if(!msg && visible){
+ wait.hide();
+ this.fire('waitHidden');
+ }
+ },
+
+ /**
+ * sets whether or not window resize resizes also this player. When true, a variable _dynamicResize =setInterval(...) is attached to
+ * this class. When false, if _dynamicResize is in this class, clearInterval(_dynamicResize) is called and then the key is deleted
+ */
+ setDynamicResize: function(value){
+ var key = '_dynamicResize';
+ if(!value && key in this){
+ clearInterval(this[key]);
+ delete this[key];
+ return;
+ }
+ var wdw = this.$J(window);
+ var w = wdw.width();
+ //var h = wdw.height();
+ var me = this;
+ this.dynamicResize = setInterval(function(){
+ var newW = wdw.width();
+ if(w!=newW){
+ w = newW;
+ //still wait a second: are we still adjusting the window? (call resize just once):
+ setTimeout(function(){
+ if(wdw.width()==newW){
+ me.resize.apply(me);
+ }
+ },200);
+ }
+ },100);
+ },
+
+ resize: function() {
+ var height;
+ var container = this.getContainer();
+
+ var wave = container.find('.ts-wave');
+
+ height = wave.height();
+ // if(!height){
+ // height = this.minWaveHeight;
+ // wave.css('height',height+'px');
+ // }
+ //if (height) {
+ //set image, imagecontainer and canvas (container on imagecontainer for lines and pointer triangles) css
+ var elements = wave.find('.ts-image-container').css('zIndex','0')
+ .add(wave.find('.ts-image-canvas').css('zIndex','1')); //the two children of ts-wave. Set also the zIndex
+ //in order to visualize the canvas OVER the wav image
+ var style = {
+ width: wave.width(),
+ height: height,
+ border: 0,
+ padding:0,
+ margin:0,
+ top:0,
+ left:0
+ };
+ elements.css(style);
+ elements.css('position','absolute');
+ //}
+
+ //refreshing images:
+ this.refreshImage();
+ this.getRuler().resize();
+ },
+ getImageUrl : function(){
+ var image = this.getContainer().find('.ts-image');
+ if(image && image.length){
+ return image.attr('src');
+ }
+ return '';
+ },
+ refreshImage: function(){
+ var container = this.getContainer();
+ var imageC = container.find('.ts-image-container');
+ var image = imageC.find('.ts-image');
+
+
+ var size = this.getImageSize();
+
+ if(!size.width || !size.height){
+ return;
+ }
+ var imgSrc = this.imageCallback(size.width,size.height);
+ var imageNotYetCreated = image.length == 0;
+ if(!imageNotYetCreated && image.attr('src')==imgSrc){
+ return;
+ }
+
+ var player= this;
+
+ if(imageNotYetCreated){
+ image = this.$J('<img/>');
+ }
+
+ //image inside ts-image-container:
+ image.css({
+ 'width':'100%',
+ 'height':'100%'
+ }); // for IE7. Does not seem to hurt IE8, FF, Chrome
+
+ var updateWait = function(){};
+ var ir = player.msgs.imgRefreshing;
+ var we = player.getWaitElement();
+ if(ir && we){
+ updateWait = function(){
+ if(!player.playState || player.playState==3){
+ player.setWait('');
+ }
+ }
+ }
+ image.load(function(){
+ image.unbind('load');
+ if(imageNotYetCreated){
+ imageC.append(image.addClass('ts-image'));
+ }
+ updateWait();
+ player.isImgRefreshing = false;
+ player.fire('imgRefreshed');
+ });
+ if(ir && we && (!this.playState || this.playState===3)){ //if loading (1) or buffering (2) do not update wait.
+ //If not playing (undefined or 0) playing (3) update wait
+ this.setWait(ir);
+ }
+ this.isImgRefreshing = true;
+ this.fire('imgRefreshing');
+ image.attr('src', imgSrc);
+
+ },
+ getImageSize: function(){
+ var wave = this.getContainer().find('.ts-wave');
+ return {
+ width: wave.width(),
+ height:wave.height()
+ }
+ },
+
+ setImageSize: function(width,height){
+ var container = this.getContainer();
+ var wave = container.find('.ts-wave');
+ this._setImageSize(width,height,container, wave,true);
+ },
+ //this is intended to be a private method, use setImageSize from outside the player object)
+ _setImageSize: function(width,height,jQueryContainerElement, jQueryWaveElement, resize){
+ if(width || height){
+ var re = /(?:px|ex|em|%)$/;
+ if(width){
+ width+='';
+ width = re.exec(width) ? width : width+'px';
+ jQueryContainerElement.css('width',width);
+ }
+ if(height){
+ height+='';
+ height = re.exec(height) ? height : height+'px';
+ jQueryWaveElement.css('height',height);
+ }
+ }
+ if(resize){
+ this.resize();
+ }
+ },
+
+ //moves the pointer (and sound position) forward till the next marker or the end of sound
+ forward: function() {
+ var map = this.getMarkerMap();
+ var markers = map.toArray();
+ var len = markers.length;
+ var offset = this.getSoundDuration();
+ var position = this.soundPosition; //parseFloat(this.getSoundPosition());
+ var idx = map.insertionIndex(position);
+ if(idx<0){
+ idx = -idx-1; //cursor is not on a a marker, get the insertion index
+ }else{
+ //cursor is on a marker. As there might be several markers with the same offset
+ //(see MarkerMap.insertionIndex), move to the outmost right
+ while(idx<len && markers[idx].offset == position){
+ idx++;
+ }
+ }
+
+ if(idx< len){
+ offset = markers[idx].offset;
+ }
+ this.setSoundPosition(offset);
+ return false;
+ },
+ //moves the pointer (and sound position) backward till the previous marker or the start of sound
+ rewind: function() {
+ var map = this.getMarkerMap();
+ var markers = map.toArray();
+ var offset = 0;
+ var position = this.soundPosition; //parseFloat(this.getSoundPosition());
+ var idx = map.insertionIndex(position);
+ if(idx<0){
+ idx = -idx-1; //cursor is not on a a marker, get the insertion index
+ }else{
+ //cursor is on a marker. As there might be several markers with the same offset
+ //(see MarkerMap.insertionIndex), move to the outmost left
+ while(idx>0 && markers[idx-1].offset == position){
+ idx--;
+ }
+ }
+ idx--; //move backward (rewind)
+ if(idx>=0){
+ offset = markers[idx].offset;
+ }
+ this.setSoundPosition(offset);
+ return false;
+ },
+
+ setSoundVolume: function(volume){
+
+ if(typeof volume != 'number'){ //note: typeof for primitive values, instanceof for the rest
+ //see topic http://stackoverflow.com/questions/472418/why-is-4-not-an-instance-of-number
+ volume = 100;
+ }
+
+ if(volume<0){
+ volume = 0;
+ }else if(volume>100){
+ volume = 100;
+ }
+ volume = Math.round(volume);
+ this.soundVolume = volume;
+ if(this.playState>0){
+ var s = this.getSound();
+ if(s){
+ s.setVolume(volume);
+ }
+ }
+ var control = this.getContainer().find('.ts-control');
+ var volumeSpeaker = control.find('.ts-volume-speaker');
+ var volumeBarContainer = control.find('.ts-volume-bar-container');
+ var volumeBar = volumeBarContainer.find('.ts-volume-bar');
+ if(volume==0){
+ volumeSpeaker.removeClass('ts-volume-speaker-on').addClass('ts-volume-speaker-off');
+ volumeBar.css('visibility','hidden');
+ }else{
+ volumeSpeaker.removeClass('ts-volume-speaker-off').addClass('ts-volume-speaker-on');
+ volumeBar.css('visibility','visible');
+ volumeBar.css({
+ 'height':'100%',
+ 'width':volume+'%'
+ });
+ }
+ },
+
+ each: function(){
+ var map = this.getMarkerMap();
+ if(map){
+ map.each.apply(map,arguments);
+ }
+ },
+
+ newMarker: function(offset){
+ return {
+ offset:offset
+ };
+ },
+ addMarker: function(offset){
+ var map = this.getMarkerMap();
+ if(map){
+ map.add(this.newMarker(offset));
+ }
+ },
+
+ removeMarker: function(identifier){ //identifier can be an number (marker index) or a marker (the index will be aearched)
+ //see marlermap.remove
+ var map = this.getMarkerMap();
+ if(map){
+ map.remove(identifier);
+ }
+ },
+
+ moveMarker: function(identifier, newOffset){ //identifier can be an number (marker index) or a marker (the index will be aearched)
+ var map = this.getMarkerMap();
+ if(map){
+ map.move(identifier,newOffset);
+ }
+ },
+
+ getMarker: function(index){
+ var map = this.getMarkerMap();
+ if(map){
+ return map.toArray()[index];
+ }
+ return undefined;
+ },
+
+ setMarkerEditable: function(identifier, value){
+ var map = this.getMarkerMap();
+ if(map){
+ return map.setEditable(identifier,value);
+ }
+ return undefined;
+ },
+
+ //markers is an array of objects with at least the field offset:sconds.milliseconds
+ loadMarkers: function(markers){
+ //ruler.bind('markermoved',this.markerMoved,this);
+ //var $J = this.$J; //reference to jQuery
+
+ var player = this;
+ //initialize the map.
+ var map = this.getMarkerMap();
+ //var mapUI = this.getMarkersUI();
+ var ruler = this.getRuler();
+
+ //TODO: think about if clearing or not: we assign some bindings in the constructor, too:
+ // map.clear();
+ // ruler.clear();
+
+
+ var rulerAdd = ruler.add;
+
+ if(markers){
+ //add markers to the map. No listeners associated to it (for the moment)
+ for(var i =0; i< markers.length; i++){
+ map.add.apply(map,[markers[i]]);
+ }
+ //add markers to ruler and div
+ map.each(function(i,marker){
+ //isEditable and id are added if not present
+ rulerAdd.apply(ruler,[marker.offset, i, marker.isEditable]);
+ });
+ }
+
+
+
+ //the function above calls map.add:
+ //add bindings when adding a marker:
+ map.bind('add',function(data){
+ //mapuiAdd.apply(mapUI,[data.marker, data.index,data.isNew]);
+ rulerAdd.apply(ruler,[data.marker.offset, data.index,data.marker.isEditable]);
+ player.fire('markerAdded',data);
+ });
+
+ //2) MOVE
+
+ //add the binding when we move a marker on the ruler:
+ ruler.bind('markermoved',function(data){
+ var soundPos = data.soundPosition;
+ var isPointer = data.isPointer;
+ if(isPointer){
+ player.setSoundPosition(soundPos);
+ }else{
+ map.move(data.markerElement.getIndex(), soundPos);
+ }
+ });
+
+ //and now add a binding to the map when we move a marker:
+
+ map.bind('move', function(data){
+ var from = data.fromIndex;
+ var to = data.toIndex;
+ ruler.move.apply(ruler,[from,to,data.marker.offset]);
+ player.fire('markerMoved',data);
+ });
+
+
+ //remove
+ map.bind('remove',function(data){
+ ruler.remove.apply(ruler, [data.index]);
+ player.fire('markerRemoved',data);
+ });
+
+ //edit state changed
+ map.bind('markerEditStateChanged',function(data){
+ ruler.setEditable.apply(ruler, [data.index, data.value]);
+ player.fire('markerEditStateChanged',data);
+ });
+
+ }
+
+});
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Olivier Guilyardi <olivier@samalyse.com>
+ */
+
+/**
+ * Class representing the ruler (upper part) of the player. Requires jQuery
+ * and Raphael
+ */
+Timeside.classes.Ruler = Timeside.classes.TimesideArray.extend({
+ //init constructor: soundDuration is IN SECONDS!!! (float)
+ init: function(rulerContainer, waveContainer, soundDuration){
+ this._super();
+
+ this.getSoundDuration= function(){
+ return soundDuration;
+ };
+
+ this.getWaveContainer =function(){
+ return waveContainer;
+ };
+
+ this.getContainerWidth =function(){
+ return waveContainer.width();
+ };
+
+ this.getRulerContainer = function(){
+ return rulerContainer;
+ }
+ },
+
+ resize : function(){
+ var duration = this.getSoundDuration(); //in seconds
+ if (!duration) {
+ this.debug("ruler.resize: Can't draw ruler with a duration of 0");
+ return;
+ }
+
+ var $J = this.$J;
+ var rulerContainer = this.getRulerContainer();
+
+ //remove all elements not pointer or marker
+ rulerContainer.find(':not(a.ts-pointer,a.ts-marker,a.ts-pointer>*,a.ts-marker>*)').remove();
+
+ //calculate h with an artifice: create a span (that will be reused later) with the "standard" label
+ var firstSpan = $J('<span/>').css({
+ 'display':'block',
+ 'position':'absolute'
+ }).html('00000'); //typical timelabel should be '00:00', with '00000' we assure a bit of extra safety space
+ //note also that display and position must be set as below to calculate the proper outerHeight
+ rulerContainer.append(firstSpan); //to calculate height, element must be in the document, append it
+ var verticalMargin = 1;
+ var h = 2*(verticalMargin+firstSpan.outerHeight());
+ //h is the default height of the ruler svg (according to ruler font size)
+ //to accomodate the necessary space for the labels
+ //however, if we set a custom height on the ruler, ie h2 is nonzero:
+ var h2 = rulerContainer.height();
+ //then, set the custom height as height for the canvas:
+ //note that, as markers and pointer have position: absolute, they do not affect div height
+ if(h2){
+ h = h2;
+ }
+ var obj = this.calculateRulerElements(rulerContainer.width(),h,firstSpan.outerWidth());
+ this.drawRuler(rulerContainer,h,obj.path);
+
+ var labels = obj.labels;
+ if(labels && labels.length){
+ for(var i=0; i <labels.length;i++){
+ var span = (i==0 ? firstSpan : $J('<span/>'));
+ span.html(labels[i][0]).css({
+ 'display':'block',
+ 'position':'absolute',
+ 'width':'',
+ 'height':'',
+ 'right':'',
+ 'bottom':'',
+ 'top':'0',
+ 'left':labels[i][1]+'px'
+ });
+ rulerContainer.append(span);
+ }
+ }else{
+ firstSpan.html(this.makeTimeLabel(0));
+ }
+
+ var pointer = undefined;
+ if('getPointer' in this){
+ pointer = this.getPointer();
+ }
+ if(!pointer){
+ pointer = this.add(0,-1);
+ this.getPointer = function(){
+ return pointer;
+ };
+ }else{
+ pointer.refreshPosition();
+
+ }
+ this.each(function(i,rulermarker){
+ rulermarker.refreshPosition();
+ });
+
+
+ },
+
+ drawRuler: function(rulerContainer,h,rulerLinesPath){
+ var cssPref = this.cssPrefix;
+ var upperRectClass = cssPref + 'svg-' + 'ruler-upper-rect';
+ var rulerLinesClass = cssPref + 'svg-' + 'ruler-lines';
+
+ var vml = this.$TU.vml;
+ if(vml){
+ //we create each time a new Raphael object. This is not a big performance issue
+ var paper = Raphael(rulerContainer[0], rulerContainer.width(), h);
+ var rect = paper.rect(0,0, rulerContainer.width(), h/2);
+ var path = paper.path(rulerLinesPath);
+ var attr = vml.getVmlAttr;
+ rect.attr(attr(upperRectClass));
+ path.attr(attr(rulerLinesClass));
+ return;
+ }
+ //create svg. Note that elements must be created within a namespace (createElementNS)
+ //and attributes must be set via .setAttributeNS(null,name,value)
+ //in other words, jQuery does not work (maybe in future releases)
+ var $J = this.$J;
+ var svgNS = "http://www.w3.org/2000/svg";
+ var d = document;
+ var svg = d.createElementNS(svgNS, "svg:svg");
+ svg.setAttributeNS( null, "width", rulerContainer.width()); //TODO: optimize width is called also below
+ svg.setAttributeNS( null, "height", h);
+ rulerContainer.append($J(svg));
+
+ var rect = d.createElementNS(svgNS, "svg:rect");
+ rect.setAttributeNS( null, "x", 0);
+ rect.setAttributeNS( null, "y", 0);
+ rect.setAttributeNS( null, "width", rulerContainer.width());
+ rect.setAttributeNS( null, "height", (h/2));
+ rect.setAttributeNS( null, "class", upperRectClass);
+ svg.appendChild(rect);
+ var lines = d.createElementNS(svgNS, "svg:path");
+ lines.setAttributeNS( null, "d", rulerLinesPath);
+ lines.setAttributeNS( null, "class", rulerLinesClass);
+ svg.appendChild(lines);
+ },
+ /**
+ * returns an object with the following properties:
+ * path: (string) the path of the ruler to be drawn
+ * labels (array) an array of arrays ['text',x,y]
+ */
+ calculateRulerElements: function(w,h,timeLabelWidth){
+
+ var duration = this.getSoundDuration();
+
+ var fontLeftMargin = 2; //should be eual or greater to the ruler stroke width, so that
+ //the labels are not overlapping the vertical ruler lines
+ timeLabelWidth+=fontLeftMargin;
+
+ var timeLabelDuration = timeLabelWidth*duration/w;
+
+ //determine the ticks:
+ var sectionDurations = [1,2,5,10,30,60,120,300,1800,3600,7200,18000,36000];
+ //sectionDurations in seconds. Note that 60=1 minute, 3600=1 hour (so the maximum sectionDuration is 36000=10hours)
+ var i=0;
+ var len = sectionDurations.length;
+ while(i<len && timeLabelDuration>sectionDurations[i]){
+ i++;
+ }
+ var sectionDuration = sectionDurations[i];
+ var sectionNums = parseInt(0.5+(duration/sectionDurations[i])); //ceil
+ var sectionWidth = w*sectionDuration/duration;
+
+
+ var tickCounts = [10,5,2,1];
+ i=0;
+ var tickCount = tickCounts[0];
+ while(i<tickCounts.length-1 && tickCounts[i]*2>sectionWidth){
+ i++;
+ }
+ var tickAtHalfSectionWidthHigher = i==0 || i==2; //draw tick at half section higher if ticks are even
+ tickCount = tickCounts[i];
+ var tickWidth = sectionWidth/tickCount;
+ var makeTimeLabel = this.makeTimeLabel;
+ var h_1 = h-1; //TODO: use line tickness instead of 1
+ var path = new Array(parseInt(0.5+(w/tickWidth)));
+ path[0] = ['M 0 '+h_1];
+ len = path.length;
+ for(i=0; i < len; i+=tickCount){
+ for(var j=1; j<tickCount+1; j++){
+ var k = i+j;
+ var x = (k*tickWidth);
+ var y = (j==tickCount ? 0 : tickAtHalfSectionWidthHigher && j==(tickCount)/2 ? .5*h : .75*h);
+ var baseline = ' L '+x+' '+h_1;
+ path[k] = baseline;
+ path[k] += ' L '+x+' '+y;
+ path[k] += baseline;
+ }
+ }
+ var labels = new Array(sectionNums);
+ for(i=0; i<sectionNums; i++){
+ labels[i] = [makeTimeLabel(sectionDuration*i),fontLeftMargin+i*sectionWidth];
+ }
+ return {
+ 'path': path.join(''),
+ 'labels':labels
+ };
+ },
+
+ //overridden: Note that the pointer is NOT cleared!!!!!
+ clear: function(){
+ var markers = this._super();
+ //now remove also the labels in the player ruler:
+ for( var i=0; i<markers.length; i++){
+ markers[i].remove();
+ }
+ return markers;
+ },
+
+ //overridden
+ remove: function(index){
+ var rulermarker = this._super(index);
+ rulermarker.remove();
+ this.each(index, function(i,rulermarker){
+ rulermarker.setIndex(i, true);
+ });
+ },
+
+ //overridden: do not call directly this method, use markermap.move
+ move: function(from, to, newOffset){
+ to = this._super(from,to);
+ if(to <0){ //no move (some error)
+ return -1;
+ }
+ //update label if it is the case:
+ var rulermarker = this.toArray()[to];
+ var pixelOffset = this.toPixelOffset(newOffset);
+ if(rulermarker.positionInPixels != pixelOffset){ //should not be the case if this method is called from a mouse event
+ rulermarker.move(pixelOffset);
+ }
+
+ if(to!=from){
+ var i1 = Math.min(from,to);
+ var i2 = Math.max(from,to)+1;
+ this.each(i1,i2, function(index,rulermarker){
+ rulermarker.setIndex(index, true);
+ });
+ }
+ return to;
+ },
+ //overridden
+ //add(offset.-1) adds the pointer, isMovable is ingored
+ //add(offset, index, isMovable) adds a marker, movable if isMovable == true
+ add: function(offset, index, isMovable){
+ var soundPosition;
+ var markerClass;
+
+ if(index<0){
+ soundPosition = offset;
+ isMovable = true;
+ markerClass='pointer';
+ }else{
+ soundPosition = offset;
+ //isMovable = offset.isEditable;
+ markerClass='marker';
+ }
+
+
+ var pointerOrMarker = new Timeside.classes.RulerMarker(this,this.getWaveContainer(),markerClass);
+
+ //call super constructor
+ //if it is a pointer, dont add it
+ if(markerClass != 'pointer'){
+ this._super(pointerOrMarker,index); //add at the end
+ //note that setText is called BEFORE move as move must have the proper label width
+ this.each(index, function(i,rulermarker){
+ rulermarker.setIndex(i,i!=index);//update label width only if it is not this marker added
+ });
+ }else{
+ //note that setText is called BEFORE move as move must have the proper label width
+ pointerOrMarker.setText(this.makeTimeLabel(0));
+ }
+ //proceed with events and other stuff: move (called AFTER setText or setText)
+ pointerOrMarker.move(this.toPixelOffset(soundPosition));
+ //set mouse events:
+ var isPointer = markerClass === 'pointer';
+ this._setEditable(pointerOrMarker, isMovable, isPointer);
+ return pointerOrMarker;
+
+ },
+
+ eventNamespace : 'rulerMouseEvent', //namespace for mouse events
+ mouseEventType : 'rulermarkermouseevent', //event type for fire TO THE PLAYER. The player then fires markerMouseEvent to outside
+
+ setEditable: function(index, value){
+ var a = this.toArray();
+ if(index>=0 && index < a.length){
+ this._setEditable(a[index],value,false);
+ }
+ },
+ //do not call, use setEditable(index,value) instead
+ _setEditable: function(pointerOrMarker, value, isPointer){
+ var eventNamespace = this.eventNamespace;
+ var doc = this.$J(document);
+ var lbl = pointerOrMarker.getLabel();
+ var me = this;
+ var mme = this.mouseEventType;
+
+
+ lbl.unbind('.'+eventNamespace); //this should delete all previous events
+
+ lbl.bind('mouseenter.'+eventNamespace,function(evt){
+ me.fire(mme,{
+ eventName: 'mouseenter',
+ eventObj: evt,
+ index: isPointer ? -1 : pointerOrMarker.getIndex()
+ });
+ return false;
+ });
+ lbl.bind('mouseleave.'+eventNamespace,function(evt){
+ me.fire(mme,{
+ eventName: 'mouseleave',
+ eventObj: evt,
+ index: isPointer ? -1 : pointerOrMarker.getIndex()
+ });
+ return false;
+ });
+
+ //to prevent page scrolling after mouseup, as click is also fired
+ lbl.bind('click.'+this.eventNamespace, function(evt){
+ return false;
+ });
+
+
+ lbl.bind('mousedown.'+eventNamespace,function(evt) {
+ if(evt.which===1){
+ if(value){
+ pointerOrMarker.isMovedByMouse = true;
+ }
+
+ var launchDragStart = true;
+
+ var startX = evt.pageX;
+ var startPos = lbl.position().left+lbl.width()/2;
+
+ evt.stopPropagation(); //dont notify the ruler or other elements;
+ var newPos = startPos;
+ doc.bind('mousemove.'+eventNamespace, function(evt_){
+ //preventClickFire=true;
+ if(value){
+ var x = evt_.pageX;
+ newPos = startPos+(x-startX);
+ pointerOrMarker.move(newPos);
+ //update the text if pointer
+ if(isPointer){
+ pointerOrMarker.setText(me.makeTimeLabel(me.toSoundPosition(newPos)));
+ }
+ }
+ if(launchDragStart){
+ launchDragStart = false;
+ me.fire(mme,{
+ eventName: 'dragstart',
+ eventObj: evt_,
+ index: isPointer ? -1 : pointerOrMarker.getIndex()
+ });
+ }
+ return false;
+
+ });
+ //to avoid scrolling
+ ////TODO: check IE bug on mouseup on the ruler (pointer is moving too)
+ //TODO: what happens if the user releases the mouse OUTSIDE the browser???? check bug in IE (mouse release)
+ var mouseup = function(evt_){
+
+ doc.unbind('mousemove.'+eventNamespace);
+ doc.unbind('mouseup.'+eventNamespace);
+ evt_.stopPropagation();
+ if(value){
+ if(newPos !== startPos){
+
+ var data = {
+ 'markerElement':pointerOrMarker,
+ 'soundPosition': me.toSoundPosition.apply(me,[newPos]),
+ 'isPointer':isPointer
+ };
+ me.fire('markermoved',data);
+ }
+ pointerOrMarker.isMovedByMouse = false;
+ }
+ if(evt_.pageX !== startX){
+ me.fire(mme,{
+ eventName: 'dragend',
+ eventObj: evt_,
+ index: isPointer ? -1 : pointerOrMarker.getIndex()
+ });
+ }else{
+ me.fire(mme,{
+ eventName: 'click',
+ eventObj: evt_,
+ index: isPointer ? -1 : pointerOrMarker.getIndex()
+ });
+ }
+ return false;
+ };
+ doc.bind('mouseup.'+eventNamespace, mouseup);
+ }
+
+ me.fire(mme,{
+ eventName: 'mousedown',
+ eventObj: evt,
+ index: isPointer ? -1 : pointerOrMarker.getIndex()
+ });
+
+
+ return false;
+ });
+ },
+
+ //moves the pointer, does not notify any listener.
+ //soundPosition is in seconds (float)
+ movePointer : function(soundPosition) {
+ var pointer = this.getPointer();
+ if (pointer && !pointer.isMovedByMouse) {
+ var pixelOffset = this.toPixelOffset(soundPosition);
+ //first set text, so the label width is set, then call move:
+ pointer.setText(this.makeTimeLabel(soundPosition));
+ pointer.move(pixelOffset); //does NOT fire any move method
+ }
+ return soundPosition;
+ },
+
+ //soundPosition is in seconds (float)
+ toPixelOffset: function(soundPosition) {
+ var duration = this.getSoundDuration();
+ if (soundPosition < 0){
+ soundPosition = 0;
+ }else if (soundPosition > duration){
+ soundPosition = duration;
+ }
+ var width = this.getContainerWidth();
+ var pixelOffset = (soundPosition / duration) * width;
+ return pixelOffset;
+ },
+
+ //returns the soundPosition is in seconds (float)
+ toSoundPosition: function(pixelOffset) {
+ var width = this.getContainerWidth();
+
+ if (pixelOffset < 0){
+ pixelOffset = 0;
+ }else if (pixelOffset > width){
+ pixelOffset = width;
+ }
+ var duration = this.getSoundDuration();
+ var soundPosition = (pixelOffset / width) *duration;
+ return soundPosition;
+ }
+});
--- /dev/null
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Olivier Guilyardi <olivier@samalyse.com>
+ */
+
+/**
+ * Class representing a RulerMarker in TimesideUI
+ * Requires jQuery Raphael and all associated player classes. rulerDiv position MUST be relative
+ * (if this class is called from within player, it is)
+ */
+
+Timeside.classes.RulerMarker = Timeside.classes.TimesideClass.extend({
+
+
+ init: function(ruler, waveImgDiv, className) {
+ this._super();
+ var rulerDiv = ruler.getRulerContainer();
+ var $J = this.$J;
+
+ var tooltip = '';
+
+ var cssPref = this.cssPrefix;
+
+ var label = $J('<a/>')
+ .addClass(cssPref + className)
+ .css({
+ display: 'block',
+ textAlign: 'center',
+ position: 'absolute',
+ zIndex: 1000
+ }).append($J('<span/>')).attr('href', '#');
+
+ if (tooltip){
+ label.attr('title', tooltip);
+ }
+ rulerDiv.append(label);
+
+ //rulerDiv MUST HAVE POSITON relative or absolute (it is relative, see player.resize)
+ if(className != "pointer"){
+ label.css('bottom','0');
+ }else{
+ label.css('top','0');
+ }
+
+ //set the index,
+ var index = -1;
+ this.setIndex = function(idx, optionalUpdateLabelWidth){
+ index = idx;
+ this.setText(idx+1, optionalUpdateLabelWidth ? true : false);
+ };
+ this.getIndex = function(){
+ return index;
+ };
+
+ //end=======================================================
+ //creating public methods:
+ this.getLabel = function(){
+ return label;
+ };
+
+
+ this.getRulerWidth = function(){
+ return rulerDiv.width();
+ };
+ this.getWaveHeight = function(){
+ return waveImgDiv.height();
+ };
+
+ this.positionInPixels = 0;
+ this.positionAsViewerRatio = 0;
+
+ var arrowBaselineWidth = 9;
+
+ var canvas = undefined;
+ var canvasClass = cssPref + 'svg-'+className+'-line';
+ var vml = this.$TU.vml; //if vml, this class is populated with methods and NOT undefined
+ var round = Math.round;
+ if(!vml){
+ canvas = this.createCanvasSvg(waveImgDiv, arrowBaselineWidth);
+ var path = canvas.childNodes[0]; //note that $J(canvas).find('path') does not work in FF at least 3.5
+ path.setAttributeNS(null,'class',canvasClass);
+ this.moveCanvas = function(pixelOffset){
+ pixelOffset = round(pixelOffset);
+ canvas.setAttributeNS( null, "transform", "translate("+pixelOffset+",0)");
+ };
+ this.jQueryCanvas = $J(canvas);
+ }else{
+ canvas = this.createCanvasVml(waveImgDiv, arrowBaselineWidth);
+ this.jQueryCanvas = $J(canvas.node);
+ var attributes = vml.getVmlAttr(canvasClass);
+ canvas.attr(attributes); //Raphael method
+ this.moveCanvas = function(pixelOffset){
+ pixelOffset = round(pixelOffset);
+ //for some reason, coordinates inside the VML object are stored by raphael with a zoom of 10:
+ this.jQueryCanvas.css('left',(10*pixelOffset)+'px');
+ };
+ //apparently, when resizing the markers loose their attributes. Therefore:
+ var r = this.refreshPosition; //reference to current refreshPosition
+ this.refreshPosition = function(){
+ r.apply(this);
+ canvas.attr(attributes);
+ }
+ }
+ },
+
+ //sets the text of the marker, if the text changes the marker width and optionalUpdateLabelPosition=true,
+ //re-arranges the marker position to be center-aligned with its vertical line (the one lying on the wav image)
+ setText: function(text, optionalUpdateLabelPosition) {
+ var label = this.getLabel();
+ if (label) {
+ var oldWidth = label.width();
+ label.find('span').html(text);
+ var labelWidth = label.width();
+ if(oldWidth != labelWidth && optionalUpdateLabelPosition){
+ this.refreshLabelPosition();
+ }
+ }
+ return this;
+ },
+
+ //these methods are executed only if marker is movable (see Ruler.js)
+ move : function(pixelOffset) {
+ var width = this.getRulerWidth();
+ if (this.positionInPixels != pixelOffset) {
+ if (pixelOffset < 0) {
+ pixelOffset = 0;
+ } else if (pixelOffset >= width) {
+ pixelOffset = width - 1;
+ }
+ //defined in the init method (it depends on wehter the current browser supports SVG or not)
+ this.moveCanvas(pixelOffset);
+
+ this.positionInPixels = pixelOffset;
+ this.refreshLabelPosition(width);
+ //store relative position (see refreshPosition below)
+ this.positionAsViewerRatio = pixelOffset == width-1 ? 1 : pixelOffset/width;
+ }
+ return this;
+ },
+
+ refreshLabelPosition : function(optionalContainerWidth){
+ if(!(optionalContainerWidth)){
+ optionalContainerWidth = this.getRulerWidth();
+ }
+ var label = this.getLabel();
+ var width = optionalContainerWidth;
+ var pixelOffset = this.positionInPixels;
+ var labelWidth = label.outerWidth(); //consider margins and padding
+ var labelPixelOffset = pixelOffset - labelWidth / 2;
+ if (labelPixelOffset < 0){
+ labelPixelOffset = 0;
+ }else if (labelPixelOffset + labelWidth > width){
+ labelPixelOffset = width - labelWidth;
+ }
+ label.css({
+ left: this.mRound(labelPixelOffset) + 'px'
+ });
+
+ },
+
+ //function called on ruler.resize. Instead of recreating all markers, simply redraw them
+ refreshPosition : function(){
+ var width = this.getRulerWidth();
+ //store relativePosition:
+ var rp = this.positionAsViewerRatio;
+ this.move(this.mRound(this.positionAsViewerRatio*width));
+ //reset relative position, which does not have to change
+ //but in move might have been rounded:
+ this.positionAsViewerRatio = rp;
+ },
+
+
+ remove : function() {
+ var label = this.getLabel();
+ label.remove();
+ this.jQueryCanvas.remove(); //defined in the constructor
+ return this;
+ },
+
+
+ createCanvasSvg: function(container, arrowBaseWidth){
+ //create svg. Note that elements must be created within a namespace (createElementNS)
+ //and attributes must be set via .setAttributeNS(null,name,value)
+ //in other words, jQuery does not work (maybe in future releases)
+ var $J = this.$J;
+ var svgNS = "http://www.w3.org/2000/svg";
+ var d = document;
+ var svg = undefined;
+ if(container.children().length>0){
+ svg = container.children().get(0);
+ }else{
+ svg = d.createElementNS(svgNS, "svg:svg");
+ container.append($J(svg));
+ }
+ var group = d.createElementNS(svgNS, "svg:g");
+ group.setAttributeNS( null, "transform", "translate(0,0)");
+
+ var path = d.createElementNS(svgNS, "svg:path");
+ path.setAttributeNS( null, "d", this.createCanvasPath(0,arrowBaseWidth));
+
+ group.appendChild(path);
+ svg.appendChild(group);
+
+ return group; //return the group, not the path, as it is the group that will be translated when moving
+ },
+
+ createCanvasVml: function(container, arrowBaseWidth){
+ var vml = this.$TU.vml;
+ var paper = vml.Raphael(container.get(0),container.width(),container.height());
+ var shape = paper.path(this.createCanvasPath(0, arrowBaseWidth));
+ return shape;
+ },
+
+ //w must be odd. Cause the central line must be centered. Example:
+ //
+ // xxxxx
+ // xxx
+ // x
+ // x
+ // x
+ //
+ createCanvasPath: function(x,w){
+ var halfW = w >>> 1;
+ //in order to calculate the line height, we could simply set the wave height. However, due to potential
+ //resizing afterwards, the line could not stretch till the bottom (if it overflows it's fine, as the wave div container has
+ //overflow = hidden). As we do not want to rebuild the canvas on resize,
+ //we assess an height which will 99% overflow the wave height in any case.
+ //We use the wave height and the window height, and take 2 times
+ //the maximum of those heights:
+ var wdwH = this.$J(window).height();
+ var waveH = this.getWaveHeight();
+ var h = 2* (wdwH > waveH ? wdwH : waveH);
+ return 'M '+(x-halfW)+' 0 L '+(x)+' '+(halfW)+' L '+x+' '+h+
+ ' L '+ (x+1)+' '+h+' L '+(x+1)+ ' '+(halfW)+' L '+(x+halfW+1)+' 0 z';
+ },
+
+ //used for faster lookup
+ mRound: Math.round
+
+});
--- /dev/null
+/*
+ * Copyright (C) 2007-2011 Parisson
+ * Copyright (c) 2011 Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Copyright (c) 2010 Olivier Guilyardi <olivier@samalyse.com>
+ *
+ * This file is part of TimeSide.
+ *
+ * TimeSide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * TimeSide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with TimeSide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Riccardo Zaccarelli <riccardo.zaccarelli@gmail.com>
+ * Olivier Guilyardi <olivier@samalyse.com>
+ */
+
+/**
+ * Root javascript file for TimesideUI, to be manually included in your web page (see online doc)
+ */
+
+/**
+ *global variable housing all Timeside variables/mathods/classes:
+ */
+var Timeside = {
+ Class:undefined,
+ classes:{},
+ player:undefined,
+ config: {
+
+ /**
+ *set to true to see debug messages on the console (only error or warning messages shown)
+ */
+ debug: false,
+ /*
+ * timeside scripts to be loaded when Timeside.load is called. URL paths are relative to the timeside folder, which
+ * will be determined according to the src attribute of the timeside.js script path (to be included in the <head> of the page)
+ */
+ timesideScripts: ['rulermarker.js','markermap.js', 'player.js', 'ruler.js'],
+ //vml config variables. Used only if svg is NOT supported
+ vml : {
+ /*
+ * raphael script to be loaded when Timeside.load is called and svg is not supported. It will be prepended to the
+ * timesideScripts array defined above in config. URL paths are relative to the timeside folder, which
+ * will be determined according to the src attribute of the timeside.js script path (to be included in the <head> of the page)
+ */
+ raphaelScript : 'libs/raphael-min.js',
+ /*
+ * available attributes which can be converted from css-svg to Raphael attributes (see Raphael.js):
+ */
+ raphaelAttributes : ["clip-rect", "cursor",'fill', "fill-opacity",'opacity', 'stroke', "stroke-dasharray", "stroke-linecap", "stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width", "text-anchor"]
+ }
+ },
+ utils:{
+ /**
+ * Returns an uniqid by creating the current local time in millisecond + a random number.
+ * Used for markers in markermap. The method is kind of public in order to be more accessible for other functions
+ * by calling Timeside.utils.uniqid(), in case it is needed
+ */
+ uniqid : function() {
+ var d = new Date();
+ return new String(d.getTime() + '' + Math.floor(Math.random() * 1000000)).substr(0, 18);
+ },
+ /**
+ * vml object which will be populated by vml functions to interface timeside and raphael. See timeside.load.
+ * We could implement functions here for code readability, however,
+ * we delegate Timeside.load so that if svg is supported memory is free from unused vml methods.
+ * IN ANY CASE, svg support can be detected anywhere by calling, eg:
+ * var svg = !Timeside.utils.vml;
+ */
+ vml: undefined,
+
+ /**
+ * property that will be set to true if soundManager fails to initialize flash
+ */
+ flashFailed : false
+ }
+};
+
+
+/* Simple JavaScript Inheritance
+ * By John Resig http://ejohn.org/
+ * MIT Licensed.
+ * (Inspired by base2 and Prototype)
+ */
+
+/*
+ * In few words: the lightest and most-comprehensive way to implement inhertance and OOP in javascript. Usages can be found below.
+ * Basically,
+ * 1) a new Class is instantiated with Class.extend(). This function takes a dictionary
+ * of properties/methods which will be put IN THE PROTOTYPE of the class, so that each instance will share the same properties/methods
+ * and the latter don't have to be created for each instance separately.
+ * 2) If var A = Class.extend({...}) and var B = A.extend({..}), then methods which are found in B will override the same methods in A.
+ * In this case, the variable this._super inside the overridden methods will refers to the super-method and can thus be called safely.
+ * Consequently, if a _super property/method is implemented in the extend dictionary, it WILL NOT be accessible
+ * to the overriding methods of B. Basically, don't use _super as a key of the argument of extend.
+ * 3) AFTER the prototype has been populated, the init function, if exists, is called. The latter can be seen as a class constructor in java,
+ * with a substantial difference: when executing the init() method the class prototype has already been populated with all inherited methods.
+ * Private variable can be declared in the init function, as well as
+ * relative getters and setters, if needed. Downside is that the privileged getters and setters can’t be put in the prototype,
+ * i.e. they are created for each instance separately, and the _super keyword does not apply to them. Another issue is the overhead of closures in general (basically, write as less as possible
+ * in the init function, in particular if the class has to be declared several times)
+ * Of course, the this._super keyword of methods implemented in the init constructor does not work
+ *
+ * EXAMPLE:
+ * var MyClass = Class.extend({
+ * init: function(optionalArray){ //constructor
+ * this._super(); //!!!ERROR: Class is the base class and does not have a super construcor
+ * var me = []; //private variable
+ * this.count = 6; //set the value of the public property defined below
+ * this.getMe = function(){ //public method
+ * this._super(); //!!!ERROR: methods defined in the init function don't have acces to _super
+ * }
+ * this.alert = function(){ //another public method, !!!WARNING: this will be put in the MyClass scope (NOT in the prototype)
+ * alert('ok');
+ * }
+ * },
+ * count:0, //public property
+ * alert: function(){ //public method. !!!WARNING: this method will be put in the prototype BEFORE the init is called,
+ * alert('no'); // so the alert defined above will be actually called
+ * }
+ * });
+ * var MyClass2 = MyClass.extend({
+ * init: function(){
+ * this._super(); //call the super constructor
+ * }
+ * alert: function(){ //override a method
+ * this._super(); //call the super method, ie alerts 'no'. WARNING: However, as long as there is an alert written
+ * //in the init method of the superclass (see above), THAT method will be called
+ * }
+ * });
+ *
+ */
+
+
+(function(parent){
+
+ var initializing = false, fnTest = /xyz/.test(function(){
+ xyz;
+ }) ? /\b_super\b/ : /.*/;
+
+ /*The xyz test above determines whether the browser can inspect the textual body of a function.
+ *If it can, you can perform an optimization by only wrapping an overridden method if it
+ *actually calls this._super() somewhere in its body.
+ *Since it requires an additional closure and function call overhead to support _super,
+ *it’s nice to skip that step if it isn’t needed.
+ */
+
+ //ADDED BY ME:
+ // before was: this.Class = function(){}, where this here is the DomWindow
+ // In order to chose where to attach the Class object, we added the argument parent (see above):
+ //if parent is undefined, attach Class to the DomWindow (same as before):
+ if(!parent){
+ parent= window;
+ }
+ parent.Class = function(){};
+
+ //from here on, the code is untouched:
+ //
+ //We have the base Class implementation (does nothing)
+ //and we write here below the method extend which returns the Class with inhertance implemented:
+ // Create a new Class that inherits from this class
+ parent.Class.extend = function(prop) {
+ var _super = this.prototype;
+
+ // Instantiate a base class (but only create the instance,
+ // don't run the init constructor)
+ initializing = true;
+ var prototype = new this();
+ initializing = false;
+
+ // Copy the properties over onto the new prototype
+ for (var name in prop) {
+ // Check if we're overwriting an existing function
+ prototype[name] = typeof prop[name] == "function" &&
+ typeof _super[name] == "function" && fnTest.test(prop[name]) ?
+ (function(name, fn){
+ return function() {
+ var tmp = this._super;
+
+ // Add a new ._super() method that is the same method
+ // but on the super-class
+ this._super = _super[name];
+
+ // The method only need to be bound temporarily, so we
+ // remove it when we're done executing
+ var ret = fn.apply(this, arguments);
+ this._super = tmp;
+
+ return ret;
+ };
+ })(name, prop[name]) :
+ prop[name];
+ }
+
+ // The dummy class constructor
+ function Class() {
+ // All construction is actually done in the init method
+ if ( !initializing && this.init ){
+ this.init.apply(this, arguments);
+ }
+ }
+
+ // Populate our constructed prototype object
+ Class.prototype = prototype;
+
+ // Enforce the constructor to be what we expect
+ Class.constructor = Class;
+
+ // And make this class extendable
+ Class.extend = arguments.callee;
+
+ return Class;
+ };
+})(Timeside);
+
+
+
+//Defining the base TimeClass class. Timeside.classes.[Player, Ruler, MarkerMap...] are typical implementations (see js files)
+//Basically we store here static methods which must be accessible in several timside sub-classes
+Timeside.classes.TimesideClass = Timeside.Class.extend({
+ //init constructor. Define the 'bind' and 'fire' (TODO: rename as 'trigger'?) methods
+ //we do it in the init function so that we can set a private variable storing all
+ //listeners. This means we have to re-write all methods
+ init: function(){
+ //the map for listeners. Must be declared in the init as it's private and NOT shared by all instances
+ //(ie, every instance has its own copy)
+ this.listenersMap={};
+ },
+
+ cssPrefix : 'ts-', //actually almost uneuseful, still here for backward compatibility with old code (TODO: remove?)
+ $J : jQuery, //reference to jQuery for faster lookup inside methods
+ $TU : Timeside.utils, //reference to Timeside variable for faster lookup inside methods
+ debugging : false,
+ debug : Timeside.config.debug ? function(message) {
+ var C = console;
+ if (C && C.log) {
+ C.log(message);
+ }
+ } : function(message){},
+
+ /**
+ * 3 methods defining listeners, events fire and bind (aloing the lines of jQuery.bind, unbind and trigger.
+ * the only difference is that 'trigger' is 'fire' here). namespaces are allowed as in jQuery
+ */
+ bind : function(eventType, callback, optionalThisArgInCallback){
+ if(!callback || typeof callback !== 'function'){
+ this.debug('TimesideClass.bind: cannot bind '+eventType+' to callback: the latter is null or not a function');
+ return;
+ }
+ if(!eventType){
+ this.debug('TimesideClass.bind: eventType is empty in bind');
+ return;
+ }
+ var listenersMap = this.listenersMap;
+ if(optionalThisArgInCallback){
+ var cb = callback;
+ callback = function(data){
+ cb.apply(optionalThisArgInCallback,[data]);
+ };
+ }
+
+ if(listenersMap.hasOwnProperty(eventType)){
+ listenersMap[eventType].push(callback);
+ }else{
+ listenersMap[eventType] = [callback];
+ }
+
+ var idx = eventType.indexOf('.');
+ if(idx <= 0 || idx >= eventType.length-1){
+ return;
+ }
+
+ eventType = eventType.substring(0,idx);
+
+
+ if(listenersMap.hasOwnProperty(eventType)){
+ listenersMap[eventType].push(callback);
+ }else{
+ listenersMap[eventType] = [callback];
+ }
+
+ },
+ unbind : function(){
+ var listenersMap = this.listenersMap;
+ var key,keyPlusDot;
+ if(arguments.length>0){
+ key = arguments[0];
+ if(listenersMap.hasOwnProperty(key)){
+ var callbacks = listenersMap[key];
+ var idx = key.indexOf('.');
+ if(idx>0 && idx < key.length-1){
+ //key is "eventtype.namespace", delete also functions stored in "eventType", if any
+ var baseKey = key.substring(0,idx);
+ var baseCallbacks = listenersMap[baseKey];
+ if(baseCallbacks){
+ for( var i = baseCallbacks.length; i>-1; i--){
+ var bc = baseCallbacks[i];
+ for( var j = callbacks.length; j>-1; j--){
+ if(bc === callbacks[j]){
+ baseCallbacks.splice(i,1);
+ }
+ }
+ }
+ }
+ }else if(idx<0){
+ //key is "eventtype", delete also all functions stored in "eventType.namespace", if any
+ keyPlusDot = key+'.';
+ for(var k in listenersMap){
+ if(listenersMap.hasOwnProperty(k) && k.indexOf(keyPlusDot)==0 && k.length > keyPlusDot.length){
+ delete listenersMap[k];
+ }
+ }
+ }
+ delete listenersMap[key];
+ }
+ }else{
+ for(key in listenersMap){
+ if(listenersMap.hasOwnProperty(key)){
+ delete listenersMap[key];
+ }
+ }
+ }
+ },
+ fire : function(key, dataArgument){
+ var listenersMap = this.listenersMap;
+ if(!(listenersMap.hasOwnProperty(key))){
+ return;
+ }
+ if(arguments.length < 2 || !dataArgument){
+ dataArgument = {};
+ }
+ var callbacks = listenersMap[key];
+ var len = callbacks && callbacks.length ? callbacks.length : 0;
+ for(var i=0; i<len; i++){
+ callbacks[i](dataArgument);
+ }
+ },
+
+ /*
+ *formats (ie returns a string representation of) a time which is in the form seconds,milliseconds (eg 07.6750067)
+ * formatArray is an array of strings which can be:
+ * 'h' hours. Use 'hh' for a zero-padding to 10 (so that 6 hours is rendered as '06')
+ * 'm' hours. Use 'mm' for a zero-padding to 10 (so that 6 minutes is rendered as '06')
+ * 's' hours. Use 'ss' foar a zero-padding to 10 (so that 6 seconds is rendered as '06')
+ * 'D' deciseconds
+ * 'C' centiseconds (it will be padded to 10, so that 5 centiseconds will be rendered as '05')
+ * 'S' milliseconds (it will be padded to 100, so that 5 milliseconds will be rendered as '005')
+ * If formatArray is null or undefined or zero-length, it defaults to ['mm','ss']
+ * 'h','m' and 's' will be prepended the separator ':'. For the others, the prepended separator is '.'
+ * Examples:
+ * makeTimeLabel(607,087) returns '10:07' (formatArray defaults to ['mm','ss'])
+ * makeTimeLabel(607,087,['m':'s']) returns '10:7'
+ * makeTimeLabel(607,087,['m':'s','C']) returns '10:7.09'
+ */
+ makeTimeLabel: function(time, formatArray){
+ if(!(formatArray)){
+ formatArray = ['mm','ss'];
+ }
+
+ //marker offset is in float format second.decimalPart
+ var pInt = parseInt;
+ var round = Math.round;
+ var factor = 3600;
+ var hours = pInt(time/factor);
+ time-=hours*factor;
+ factor = 60;
+ var minutes = pInt(time/factor);
+ time-=minutes*factor;
+ var seconds = pInt(time);
+ time-=seconds;
+
+ //here below the function to format a number
+ //ceilAsPowerOfTen is the ceil specifiedas integer indicating the relative power of ten
+ //(0: return the number as it is, 1: format as "0#" and so on)
+ //Examples: format(6) = "6", format(6,1)= "06", format(23,1)= "23"
+
+ //first of all, instantiate the power function once (and not inside the function or function's loop):
+ //note that minimumNumberOfDigits lower to 2 returns integer as it is
+ var mpow = Math.pow; //instantiate mpow once
+ var format = function(integer,minimumNumberOfDigits){
+ var n = ""+integer;
+ var zero = "0"; //instantiating once increases performances???
+ for(var i=1; i< minimumNumberOfDigits; i++){
+ if(integer<mpow(10,i)){
+ n = zero+n;
+ }
+ }
+ return n;
+ };
+ var ret = [];
+ for(var i =0; i<formatArray.length; i++){
+ var f = formatArray[i];
+ var separator = ":";
+ if(f=='h'){
+ ret[i]=hours;
+ }else if(f=='hh'){
+ ret[i]=format(hours,2);
+ }else if(f=='m'){
+ ret[i]=minutes;
+ }else if(f=='mm'){
+ ret[i]=format(minutes,2);
+ }else if(f=='s'){
+ ret[i]=seconds;
+ }else if(f=='ss'){
+ ret[i]=format(seconds,2);
+ }else if(f=='S'){
+ separator = ".";
+ ret[i]=format(round(time*1000),3);
+ }else if(f=='C'){
+ separator = ".";
+ ret[i]=format(round(time*100),2);
+ }else if(f=='D'){
+ separator = ".";
+ ret[i]= round(time*10);
+ }
+ if(i>0){
+ ret[i] = separator+ret[i];
+ }
+ }
+ return ret.join("");
+ }
+});
+
+/**
+ * An Array-like implementation that suits the need of Marker mnanagement
+ * Ruler, MarkerMap and MarkerMapDiv implement this class
+ */
+Timeside.classes.TimesideArray = Timeside.classes.TimesideClass.extend({
+ init: function(optionalArray){
+ this._super();
+ //here methods that CANNOT be overridden
+ var me= optionalArray ? optionalArray : [];
+ //note that this method written here OVERRIDES the same method written outside init in the children!!!!
+ this.toArray = function(returnACopy){
+ if(returnACopy){
+ var ret = [];
+ for(var i=0; i<me.length; i++){
+ ret.push(me[i]);
+ }
+ return ret;
+ }
+ return me;
+ };
+ this.length = me.length; //in order to match the javascript array property
+ },
+ //adds at the end of the array. If index is missing the object is appended at the end
+ add : function(object, index){
+ var array = this.toArray();
+ if(arguments.length<2){
+ index = array.length;
+ }
+ array.splice(index,0,object);
+ this.length = array.length; //note that length is a property and must be updated!!!
+ return object;
+ },
+ //removes item at index, returns the removed element
+ remove : function(index){
+ var array = this.toArray();
+ var ret = array.splice(index,1)[0];
+ this.length = array.length; //note that length is a property and must be updated!!!
+ return ret;
+ },
+ //Iterate over the array, with the same syntax of jQuery.each, ie, executes a function(index,element)
+ //for each element from startIndexInclusive to
+ //endIndexExclusive.
+ //The only required argument is callback:
+ //1) each(callback) iterates over all elements executing callback
+ //2) each(m, callback) iterates over the elements from m executing callback
+ //3) each(m,n,callback) iterates over the elements from m (inclusive) to n-1 (inclusive) executing callback
+
+ //NOTE: writing each : function(startInclusive, endExclusive, callback) throws an error in chrome, as the last
+ //argument (even if it is a function) is a number. Why?????
+ //Anyway, we write the function arguments as empty
+ each : function(){
+ var startInclusive, endExclusive, callback;
+
+ var arg = arguments;
+ var len = arg.length;
+ var l = this.length;
+ switch(len){
+ case 0:
+ this.debug('TimesideClass.each: each called without arguments!!!');
+ return;
+ case 1:
+ startInclusive = 0;
+ endExclusive = l;
+ break;
+ case 2:
+ if(arg[0] >= l){
+ return;
+ }
+ startInclusive = arg[0]=== undefined ? 0 : arg[0];
+ endExclusive = l;
+ break;
+ default:
+ startInclusive = arg[0]=== undefined ? 0 : arg[0];
+ endExclusive = arg[1]=== undefined ? l : arg[1];
+ }
+ callback = arg[len-1];
+ if(!(callback instanceof Function)){
+ this.debug('TimesideClass.each: callback NOT a function!!!');
+ return;
+ }
+ var me =this.toArray();
+ for(var i = startInclusive; i<endExclusive; i++){
+ callback(i,me[i]);
+ }
+
+ },
+
+ //clears the array and the events associated to it, ie removes all its elements and calls unbind(). Returns the array of the removed elements
+ clear: function(){
+ this.unbind();
+ var me = this.toArray();
+ var l = me.length;
+ this.length = 0;
+ if(l==0){
+ return [];
+ }
+ return me.splice(0,l);
+ },
+ //moves the element at position from into position to
+ //the element that was at from will be at position to
+ //returns:
+ //-1 if from or to not integers, or from or to not within the array bounds (lower than zero or greater or equal to this.length)
+ //from if from === to (no move)
+ //to otherwise (move succesful)
+ move : function(from, to){
+
+ var pInt = parseInt;
+ if(pInt(from)!==from || pInt(to)!==to){ //just a check
+ return -1;
+ }
+ if(from === to){
+ return from;
+ }
+ var me =this.toArray();
+ var len = me.length;
+ if((from<0 || from>=len)||(to<0 || to>=len)){
+ return -1;
+ }
+ var elm = me.splice(from,1)[0];
+ me.splice(to,0,elm);
+
+ return to;
+ }
+});
+
+
+
+/**
+ *Main Timeside method to load player (see Timeside online doc)
+ */
+
+Timeside.load =function(config){
+
+ var $J = jQuery;
+ var win = window;
+ var doc = document;
+ //function to be called onready or onerror:
+ var loadAll = function() {
+
+
+ //get the current script path (this file name is timeside.js?... or simplt timeside.js)
+ var scripts = $J('script');
+ var thisScriptPath = '';
+ scripts.each(function(i,s){
+ var src = $J(s).attr('src');
+ if(src){
+ var srcName = src.split(/\//);
+ if(srcName.length){
+ srcName = srcName[srcName.length-1];
+ //is this script ? consider the case here we are loading timeside.js?....
+ if(srcName.replace(/\.js(?:\?[^\?]*)*$/,'.js') == 'timeside.js'){
+ src[src.length-1] = '';
+ thisScriptPath = src.replace(/\/[^\/]+$/, '');
+ }
+ }
+ }
+ });
+
+ var ts = Timeside;
+ var ts_scripts = ts.config.timesideScripts;
+ //detect SVG support and load Raphael in case. Copied from Raphael code v 1.5.2:
+ var svg = (win.SVGAngle || doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
+ if(!svg){
+ //add the raphael path. Raphael will be loaded in Timeside.load (see below)
+ ts_scripts.splice(0,0,ts.config.vml.raphaelScript);
+ //populate the vml object with methods to be used in ruler and rulermarker:
+
+ //global private variable:
+ //map to store each class name to the relative dictionary for raphael attr function (VML only)
+ var classToRaphaelAttr = {};
+ //get the raphael attributes for which a conversion css -> raphael_attribute is possible:
+ var availableAttrs = ts.config.vml.raphaelAttributes;
+ //here below we store Raphael paper objects. var paper = Raphael(htmlElement) is the raphel method to build
+ //a new paper object. Internally, the method builds a div embedding vmls inside htmlElement, retriavable via the
+ //paper.node property.
+ //However, calling again var paper = Raphael(htmlElement) does not use the already created paper,
+ //but creates a new paper with a new paper.node (div). Too bad. The possibility to wrap existing paper node
+ //into a Raphael paper would be a nice and almost necessary feature, which however is not even
+ //planned to be implemented according to raphael developers (see raphael forums).
+ //In case of markers lines, we want to draw a new marker
+ //on the same raphael paper. Therefore, we store here raphael papers in a map htmlElement -> paper
+ var raphael_papers = {};
+ ts.utils.vml = {
+ getVmlAttr: function(className){
+
+ if(classToRaphaelAttr.hasOwnProperty(className)){
+ //if(className in classToRaphaelAttr){
+ return classToRaphaelAttr[className];
+ }
+ var d = document;
+ var dottedclassName = className.replace(/^\.*/,'.'); //add a dot if not present
+ var ssheets = d.styleSheets;
+ var len = ssheets.length-1;
+
+ var attr = {};
+ for(var i=0; i<len; i++){
+ var rules = ssheets[i].rules;
+ var l = rules.length;
+ for(var j=0; j <l; j++){
+ var rule = rules[j];
+
+ if(rule.selectorText === dottedclassName){
+
+ var style = rule.style;
+ for(var k =0; k<availableAttrs.length; k++){
+ var val = style[availableAttrs[k]];
+ if(val){
+ attr[availableAttrs[k]] = val;
+ }
+ }
+ }
+ }
+ }
+ classToRaphaelAttr[className] = attr;
+ return attr;
+ },
+
+ Raphael: function(element,w,h){
+ //pass jQueryElm.get(0) as first argument, in case)
+ if(raphael_papers[element]){
+ return raphael_papers[element];
+ }
+ var paper = Raphael(element,w,h);
+ raphael_papers[element] = paper;
+ //paper canvas is a div with weird dimensions. You can check it by printing paper.canvas.outerHTML in IE.
+ //We set them to 100% so we dont have clipping regions when resizing (maximizing)
+ paper.canvas.style.width='100%';
+ paper.canvas.style.height='100%';
+ paper.canvas.width='100%';
+ paper.canvas.height='100%';
+ //apparently, there is also a clip style declaration made by raphael. The following code trhows an error in IE7:
+ //paper.canvas.style.clip = 'auto';
+ //however, even leaving the clip style declaration as it is, it seems to work (the div spans the whole width)
+ return paper;
+ }
+
+ };
+ }
+
+ ts.player = undefined;
+ if(config.onReady && typeof config.onReady === 'function'){
+ var oR = config.onReady;
+ config.onReady = function(player){
+ ts.player = player;
+ oR(player);
+ };
+ }else{
+ config.onReady = function(player){
+ ts.player = player;
+ };
+ }
+ //assigning soundManager swf path:
+
+ //finally,define the error function
+ ts.utils.loadScripts(thisScriptPath,ts_scripts, function() {
+ new ts.classes.Player(config); //do not assign it to any variable, we do it only onready
+ },config.onError);
+ };
+
+ $J(win).ready(function(){
+ var s = soundManager;
+
+
+
+ //grab the case of soundManager init errors:
+ s.onerror = function() {
+ Timeside.utils.flashFailed = true;
+ //end('SoundManager error. If your browser does not support HTML5, Flash player (version '+soundManager.flashVersion+'+) must be installed.\nIf flash is installed, try to:\n - Reload the page\n - Empty the cache (see browser preferences/options/tools) and reload the page\n - Restart the browser');
+
+ //and load all anyway:
+ loadAll();
+ };
+
+ //if soundmanager is ready, the callback is executed immetiately
+ //onready is executed BEFORE onload, it basically queues several onload events.
+ //It it is executed immetiately if soundmanager has already been loaded
+ s.onready(function(){loadAll();});
+ });
+};
+
+/**
+* Loads scripts asynchronously
+* can take up to four arguments:
+* scriptsOptionalRoot (optional): a string specifying the root (such as '/usr/local/'). IF IT IS A NONEMPTY STRING AND
+* DOES NOT END WITH A SLASH, A SLASH WILL B APPENDED
+* scriptArray: a string array of js script filenames, such as ['script1.js','script2.js']
+* optionalOnOkCallback (optional): callback to be executed when ALL scripts are succesfully loaded
+* optionalOnErrorCallback (optional) a callback receiving a string as argument to be called if some script is not found
+* optionalSynchroLoad (optional): if true scripts are loaded in synchronously, ie each script is loaded only once the
+* previous has been loaded. Otherise (including missing argument) an asynchronous load is performed
+* and the optional onOkCallback is executed once ALL scripts are loaded
+*/
+Timeside.utils.loadScripts = function(scriptsOptionalRoot,scriptArray, optionalOnOkCallback, optionalOnErrorCallback, optionalSynchroLoad){
+ //var optionalRoot='', callback=undefined, loadInSeries=false;
+ if(!optionalOnOkCallback || typeof optionalOnOkCallback !== 'function'){
+ optionalOnOkCallback = function(){};
+ }
+ if(!optionalOnErrorCallback || typeof optionalOnErrorCallback !== 'function'){
+ optionalOnErrorCallback = function(msg){};
+ }
+
+ if(!scriptArray || !scriptArray.length){
+ optionalOnOkCallback();
+ return;
+ }
+ var len = scriptArray.length;
+ var i=0;
+ if(scriptsOptionalRoot){
+ scriptsOptionalRoot = scriptsOptionalRoot.replace(/\/*$/,"/"); //add slash at end if not present
+ for(i =0; i<len; i++){
+ scriptArray[i] = scriptsOptionalRoot+scriptArray[i];
+ }
+ }
+
+ var $J = jQuery;
+ //there is a handy getScript function in jQuery, which however does NOT manage the onError case (script load error)
+ //looking at jQuery doc, getScript is the same as the followig ajax request,
+ //to which we added the error property to manage errors:
+ var loadScript = function(url,onSuccess,onError){
+ $J.ajax({
+ url: url,
+ dataType: 'script',
+ success: onSuccess,
+ error: function(a,b,errorThrown){
+ onError('file "'+url+'" error: '+errorThrown);
+ }
+ });
+ };
+ if(optionalSynchroLoad){
+ var load = function(index){
+ if(index<len){
+ loadScript(scriptArray[index],function(){
+ load(index+1);
+ }, function(msg){
+ optionalOnErrorCallback(msg);
+ });
+ }else if(index==len){
+ optionalOnOkCallback();
+ }
+ };
+ load(0);
+ }else{
+ var count=0;
+ var s;
+ for(i=0; i <len; i++){
+ s = scriptArray[i];
+ //this means that onError all scripts will be loaded.
+ //However, if everything works fine, asynchornous load (here) should be faster
+ loadScript(s, function(){
+ count++;
+ if(count===len){
+ optionalOnOkCallback();
+ }
+ },function(msg){
+ count = len+1; //avoid calling optionalOkOnCallback
+ optionalOnErrorCallback(msg);
+ });
+ }
+ }
+};
\ No newline at end of file
--- /dev/null
+/*
+* Style for the timeside player. The player div is supposed to be of class .ts-player. Change if needed
+* For details, see http://code.google.com/p/timeside/wiki/UiGuide?ts=1308677096&updated=UiGuide#CSS_and_skins
+*/
+
+.ts-player {
+ padding: 0;
+ border: solid 1px #ADADAD;
+ margin-top: 2px;
+}
+
+
+.ts-player .ts-ruler{
+ color: #ADADAD;
+ background-color: #F2F2F2;
+ font-size: 10px;
+ line-height: 13px;
+}
+/*svg style, MUST BE A SINGLE SELECTOR. FOR INSTANCE, THIS DOES NOT WORK WHEN SVG IS NOT SUPPORTED:
+ ".ts-player .ts-ruler .ts-svg-ruler-upper-rect" */
+.ts-svg-ruler-upper-rect{
+ fill: #FFFFFF;
+ stroke-width:0;
+ stroke: #FFFFFF; /*to be sure...*/
+}
+/*svg style, MUST BE A SINGLE SELECTOR. FOR INSTANCE, THIS DOES NOT WORK WHEN SVG IS NOT SUPPORTED:
+ ".ts-player .ts-ruler .ts-svg-ruler-lines"*/
+.ts-svg-ruler-lines{
+ stroke-width:1;
+ stroke: #ADADAD;
+}
+
+/*wave:*/
+.ts-player .ts-wave {
+ height: 130px;
+}
+
+/*.ts-player .ts-viewer .ts-marker {*/
+.ts-player .ts-ruler .ts-marker {
+ padding: 0 0.5em;
+ background: #fff;
+ border: 1px solid #92bdd4;
+ color: #92bdd4;
+ text-decoration: none;
+}
+/*svg style, MUST BE A SINGLE SELECTOR. FOR INSTANCE, THIS DOES NOT WORK WHEN SVG IS NOT SUPPORTED:
+ ".ts-player .ts-wave .ts-image-canvas .ts-svg-marker-line" */
+.ts-svg-marker-line {
+ fill: #92bdd4;
+ stroke-width:0;
+}
+
+/*.ts-player .ts-viewer a.ts-pointer {*/
+.ts-player .ts-ruler a.ts-pointer {
+ color: white ;
+ background-color: #92bde4;
+ padding: 0 0.5em;
+ /*border: solid 1px #92bde4;*/
+
+ text-decoration: none;
+ -moz-border-radius: .3em;
+ -webkit-border-radius: .3em;
+ border-radius: .3em;
+ /*color: #3c4251; #6A0307 !important;*/
+}
+/*svg style, MUST BE A SINGLE SELECTOR. FOR INSTANCE, THIS DOES NOT WORK WHEN SVG IS NOT SUPPORTED:
+ ".ts-player .ts-wave .ts-image-canvas .ts-svg-pointer-line" */
+.ts-svg-pointer-line {
+ fill: #92bde4;
+ stroke-width:0;
+}
+
+.ts-player .ts-wave .ts-image {
+ background: #090e0d ;
+}
+
+.ts-player .ts-control {
+ background: url('img/player_controlbg.png');
+}
+
+ /** display (inline-block) and overflow of a is set inside javascript*/
+.ts-player .ts-control .ts-button {
+ background-repeat: no-repeat;
+ margin:4px;
+ height:21px;
+ width:21px;
+ /* background-position: 0px 0px;*/
+}
+.ts-player .ts-control .ts-button:hover {
+ background-position: 0px -21px;
+}
+.ts-player .ts-control .ts-play {
+ background-image: url('img/play.png');
+}
+
+.ts-player .ts-control .ts-pause {
+ background-image: url('img/pause.png');
+}
+
+.ts-player .ts-control .ts-rewind {
+ background-image: url('img/rewind.png');
+}
+
+.ts-player .ts-control .ts-forward {
+ background-image: url('img/forward.png');
+}
+
+.ts-player .ts-control .ts-set-marker {
+ background-image: url('img/setmarker.png');
+}
+
+.ts-player .ts-control .ts-volume-speaker-on {
+ background-image: url('img/volumeon.png');
+ width:24px;
+}
+.ts-player .ts-control .ts-volume-speaker-off {
+ background-image: url('img/volumeoff.png');
+ width:24px;
+}
+.ts-player .ts-control .ts-volume-bar-container {
+ /*background: url('img/controlbg-inverted.png');
+ background-position: -3px left;
+ background-repeat: repeat-x;*/
+ border: 1px solid #a3a4a7;
+ height:10px;
+ width:42px;
+ margin-top:9px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+
+}
+.ts-player .ts-control .ts-volume-bar { /*width will be changed inside the code*/
+ background-color: #ccc;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+}
+/*position is set to absolute inside javascript*/
+.ts-player .ts-control .ts-wait {
+ background-repeat: no-repeat;
+ background-image: url('img/wait.gif');
+ text-align: right;
+ right:0;
+ height:28px;
+ line-height:28px;
+ top:0;
+ background-position: right center;
+ padding-right: 30px;
+ font-size: 80%;
+ color: #000;
+}
--- /dev/null
+/*
+* Style for the timeside player. The player div is supposed to be of class .ts-player. Change if needed
+* For details, see http://code.google.com/p/timeside/wiki/UiGuide?ts=1308677096&updated=UiGuide#CSS_and_skins
+*/
+
+.ts-player {
+ padding: 0;
+ border: solid 1px #ADADAD;
+ margin-top: 2px;
+}
+
+
+.ts-player .ts-ruler{
+ color: white;
+ background-color: #2E2E2E;
+ font-size: 10px;
+ line-height: 13px;
+}
+/*svg style, MUST BE A SINGLE SELECTOR. FOR INSTANCE, THIS DOES NOT WORK WHEN SVG IS NOT SUPPORTED:
+ ".ts-player .ts-ruler .ts-svg-ruler-upper-rect" */
+.ts-svg-ruler-upper-rect{
+ fill: #595959;
+ stroke-width:0;
+ stroke: #595959; /*to be sure...*/
+}
+/*svg style, MUST BE A SINGLE SELECTOR. FOR INSTANCE, THIS DOES NOT WORK WHEN SVG IS NOT SUPPORTED:
+ ".ts-player .ts-ruler .ts-svg-ruler-lines"*/
+.ts-svg-ruler-lines{
+ stroke-width:1;
+ stroke: #ADADAD;
+}
+
+/*wave:*/
+.ts-player .ts-wave {
+ height: 130px;
+}
+
+/*.ts-player .ts-viewer .ts-marker {*/
+.ts-player .ts-ruler .ts-marker {
+ padding: 0 0.5em;
+ background: #e65911;
+ color: #FFF;
+ text-decoration: none;
+}
+/*svg style, MUST BE A SINGLE SELECTOR. FOR INSTANCE, THIS DOES NOT WORK WHEN SVG IS NOT SUPPORTED:
+ ".ts-player .ts-wave .ts-image-canvas .ts-svg-marker-line" */
+.ts-svg-marker-line {
+ fill: #e65911;
+ stroke-width:0;
+}
+
+/*.ts-player .ts-viewer a.ts-pointer {*/
+.ts-player .ts-ruler a.ts-pointer {
+ color: #BB0000;
+ background-color: white;
+ padding: 0 0.5em;
+ border: solid 1px #BB0000;
+
+ text-decoration: none;
+ -moz-border-radius: .3em;
+ -webkit-border-radius: .3em;
+ border-radius: .3em;
+ /*color: #3c4251; #6A0307 !important;*/
+}
+/*svg style, MUST BE A SINGLE SELECTOR. FOR INSTANCE, THIS DOES NOT WORK WHEN SVG IS NOT SUPPORTED:
+ ".ts-player .ts-wave .ts-image-canvas .ts-svg-pointer-line" */
+.ts-svg-pointer-line {
+ fill: #BB0000;
+ stroke-width:0;
+}
+
+.ts-player .ts-wave .ts-image {
+ background: #090e0d ;
+}
+
+.ts-player .ts-control {
+ background: url('img/controlbg.png');
+}
+
+ /** display (inline-block) and overflow of a is set inside javascript*/
+.ts-player .ts-control .ts-button {
+ background-repeat: no-repeat;
+ height:28px;
+ width:28px;
+}
+.ts-player .ts-control .ts-play {
+ background-image: url('img/play.png');
+}
+
+.ts-player .ts-control .ts-pause {
+ background-image: url('img/pause.png');
+}
+
+.ts-player .ts-control .ts-rewind {
+ background-image: url('img/rewind.png');
+}
+
+.ts-player .ts-control .ts-forward {
+ background-image: url('img/forward.png');
+}
+
+.ts-player .ts-control .ts-set-marker {
+ background-image: url('img/setmarker.png');
+}
+
+.ts-player .ts-control .ts-volume-speaker-on {
+ background-image: url('img/volumeon.png');
+ width:24px;
+}
+.ts-player .ts-control .ts-volume-speaker-off {
+ background-image: url('img/volumeoff.png');
+ width:24px;
+}
+.ts-player .ts-control .ts-volume-bar-container {
+ background: url('img/controlbg-inverted.png');
+ background-position: -3px left;
+ background-repeat: repeat-x;
+ height:10px;
+ width:42px;
+ margin-top:9px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+
+}
+.ts-player .ts-control .ts-volume-bar { /*width will be changed inside the code*/
+ background-color: #e4eaf1;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+}
+/*position is set to absolute inside javascript*/
+.ts-player .ts-control .ts-wait {
+ background-repeat: no-repeat;
+ background-image: url('img/wait3.gif');
+ text-align: right;
+ right:0;
+ height:28px;
+ line-height:28px;
+ top:0;
+ background-position: right center;
+ padding-right: 60px;
+ font-size: 80%;
+ color:white;
+}
\ No newline at end of file