+++ /dev/null
-/* FIXME: These CSS styles are essential and non intrusive. They should be
- * dynamically assigned in javascript, and this file removed. */
-
-.ts-player .ts-ruler .ts-section .ts-canvas {
- position: relative;
-}
-
-.ts-player .ts-wave {
- position: relative;
- clear: both;
- overflow: hidden;
-}
-
-.ts-player .ts-wave .ts-image-container {
- position: relative;
-}
-
-.ts-image-container {
- background-color: #000000;
-}
-
-.ts-player .ts-wave .ts-image {
- position: absolute;
- left: 0;
- clear: both;
-}
-
-.ts-player .ts-wave .ts-image-canvas {
- position: absolute;
- z-index: 100;
- overflow: hidden;
-}
-
+++ /dev/null
-<html>
-
-<head>
-<link type="text/css" href="../css/timeside.css" rel="stylesheet" media="screen" />
-<link type="text/css" href="../skins/lab/style.css" rel="stylesheet" media="screen" />
-<style type="text/css">
-.ts-player { width: 360px; }
-</style>
-<!--
-<script type="text/javascript" src="../lib/firebug-lite-compressed.js"></script>
--->
-<script type="text/javascript">
-function get_globals() {
- var g = [];
- for (var v in window)
- g = g.concat([v]);
- return g;
-}
-function diff_array(a1, a2) {
- var diff = [];
- var i, ii = a2.length;
- for (i = 0; i < ii; i++) {
- if (a1.indexOf(a2[i]) == -1) {
- diff = diff.concat([a2[i]]);
- }
- }
- return diff;
-}
-
-function log_globals(label) {
- var g = get_globals();
- if (log_globals.cache && label && typeof console != 'undefined') {
- console.log(label + ':');
- console.log(diff_array(log_globals.cache, g));
- }
- log_globals.cache = g;
-}
-</script>
-<script>log_globals(false);</script>
-<script type="text/javascript" src="../lib/jquery.js"></script>
-<script type="text/javascript">
-jQuery.noConflict();
-jQuery(window).bind('load', function() {if (jQuery.browser.mozilla) jQuery('#Firebug').hide()});
-log_globals('jquery globals');
-</script>
-
-<!--
-<script type="text/javascript" src="jquery-ui.js"></script>
--->
-<script>log_globals('jquery ui globals');</script>
-<script type="text/javascript" src="../lib/wz_jsgraphics.js"></script>
-<script>log_globals('jsgraphics globals');</script>
-<script type="text/javascript" src="../lib/soundmanager2.js"></script>
-<script>log_globals('soundmanager globals');</script>
-<script type="text/javascript" src="../src/timeside.js"></script>
-
-<script type="text/javascript">
-var sound = null;
-var map;
-var provider = null;
-var player = null;
-
-function shiftSize(delta) {
- jQuery('#player').width(jQuery('#player').width() + delta);
- player.resize();
-}
-
-function fullSize() {
- jQuery('#player').css({width: 'auto'});
- player.resize();
-}
-
-TimeSide.debug(true);
-TimeSide.load(function() {
- map = new TimeSide.MarkerMap();
- provider = new TimeSide.SoundProvider({source: sound});
- player = new TimeSide.Player('#player', {
- image: 'waveform.png'
- });
- controller = new TimeSide.Controller({
- player: player,
- soundProvider: provider,
- map: map
- });
-
- jQuery('#skinner').get(0).className=jQuery('#skin').get(0).value; player.resize();
-});
-if (typeof soundManager != 'undefined') {
- soundManager.url = '../lib/';
- soundManager.flashVersion = 9;
- soundManager.consoleOnly = true;
- if (typeof console == 'undefined') {
- soundManager.debugMode = false;
- }
-
- soundManager.onload = function() {
- sound = soundManager.createSound({
- id: 'test',
- url: 'http://ns22997.ovh.net/tmp/crem.mp3'
- //autoLoad: true
- });
-
- if (provider) {
- provider.setSource(sound);
- } else {
- TimeSide.load(function () {
- provider.setSource(sound);
- });
- }
- }
-}
-
-</script>
-
-</head>
-
-<body>
-
-<h2>TimeSide Player</h2>
-
-<div id="skinner" class="">
- <div id="player" class="ts-player">
- </div>
-</div>
-
-<p>
-<!--
- <button onclick="setup()">Setup</button>
--->
- <button onclick="shiftSize(-10)">Smaller</button>
- <button onclick="shiftSize(10)">Bigger</button>
- <button onclick="fullSize()">Full size</button>
- <br />
- Skin:
- <select id="skin" onchange="jQuery('#skinner').get(0).className=this.value; player.resize(); ">
- <option selected value="">None</option>
- <option value="ts-skin-lab">Lab</option>
- </select>
-</p>
-</body>
-</html>
--- /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
-(function(_scope){_scope.pi=Object(3.14159265358979323846);var pi=_scope.pi;pi.version=1.0;pi.env={ie:/MSIE/i.test(navigator.userAgent),ie6:/MSIE 6/i.test(navigator.userAgent),ie7:/MSIE 7/i.test(navigator.userAgent),ie8:/MSIE 8/i.test(navigator.userAgent),firefox:/Firefox/i.test(navigator.userAgent),opera:/Opera/i.test(navigator.userAgent),webkit:/Webkit/i.test(navigator.userAgent)};pi.util={IsArray:function(_object){return _object&&_object!=window&&(_object instanceof Array||(typeof _object.length=="number"&&typeof _object.item=="function"))},IsHash:function(_object){return _object&&typeof _object=="object"&&(_object==window||_object instanceof Object)&&!_object.nodeName&&!pi.util.IsArray(_object)},DOMContentLoaded:[],AddEvent:function(_element,_eventName,_fn,_useCapture){_element[pi.env.ie.toggle("attachEvent","addEventListener")](pi.env.ie.toggle("on","")+_eventName,_fn,_useCapture||false);return pi.util.AddEvent.curry(this,_element)},RemoveEvent:function(_element,_eventName,_fn,_useCapture){return _element[pi.env.ie.toggle("detachEvent","removeEventListener")](pi.env.ie.toggle("on","")+_eventName,_fn,_useCapture||false)},GetWindowSize:function(){return{height:pi.env.ie?Math.max(document.documentElement.clientHeight,document.body.clientHeight):window.innerHeight,width:pi.env.ie?Math.max(document.documentElement.clientWidth,document.body.clientWidth):window.innerWidth}},Include:function(_url,_callback){var script=new pi.element("script").attribute.set("src",_url),callback=_callback||new Function,done=false,head=pi.get.byTag("head")[0];script.environment.getElement().onload=script.environment.getElement().onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){callback.call(this);done=true;head.removeChild(script.environment.getElement())}};script.insert(head)},Element:{addClass:function(_element,_class){if(!pi.util.Element.hasClass(_element,_class))pi.util.Element.setClass(_element,pi.util.Element.getClass(_element)+" "+_class)},getClass:function(_element){return _element.getAttribute(pi.env.ie.toggle("className","class"))||""},hasClass:function(_element,_class){return pi.util.Element.getClass(_element).split(" ").indexOf(_class)>-1},removeClass:function(_element,_class){if(pi.util.Element.hasClass(_element,_class))pi.util.Element.setClass(_element,pi.util.Element.getClass(_element,_class).split(" ").removeValue(_class).join(" "))},setClass:function(_element,_value){_element.setAttribute(pi.env.ie.toggle("className","class"),_value)},toggleClass:function(){if(pi.util.Element.hasClass.apply(this,arguments))pi.util.Element.removeClass.apply(this,arguments);else pi.util.Element.addClass.apply(this,arguments)},getOpacity:function(_styleObject){var styleObject=_styleObject;if(!pi.env.ie)return styleObject["opacity"];var alpha=styleObject["filter"].match(/opacity\=(\d+)/i);return alpha?alpha[1]/100:1},setOpacity:function(_element,_value){if(!pi.env.ie)return pi.util.Element.addStyle(_element,{"opacity":_value});_value*=100;pi.util.Element.addStyle(_element,{"filter":"alpha(opacity="+_value+")"});return this._parent_},getPosition:function(_element){var parent=_element,offsetLeft=0,offsetTop=0,view=pi.util.Element.getView(_element);while(parent&&parent!=document.body&&parent!=document.firstChild){offsetLeft+=parseInt(parent.offsetLeft);offsetTop+=parseInt(parent.offsetTop);parent=parent.offsetParent};return{"bottom":view["bottom"],"left":view["left"],"marginTop":view["marginTop"],"marginLeft":view["marginLeft"],"offsetLeft":offsetLeft,"offsetTop":offsetTop,"position":view["position"],"right":view["right"],"top":view["top"],"z-index":view["zIndex"]}},getSize:function(_element){var view=pi.util.Element.getView(_element);return{"height":view["height"],"offsetHeight":_element.offsetHeight,"offsetWidth":_element.offsetWidth,"width":view["width"]}},addStyle:function(_element,_style){for(var key in _style){key=key=="float"?pi.env.ie.toggle("styleFloat","cssFloat"):key;if(key=="opacity"&&pi.env.ie){pi.util.Element.setOpacity(_element,_style[key]);continue}_element.style[key]=_style[key]}},getStyle:function(_element,_property){_property=_property=="float"?pi.env.ie.toggle("styleFloat","cssFloat"):_property;if(_property=="opacity"&&pi.env.ie)return pi.util.Element.getOpacity(_element.style);return typeof _property=="string"?_element.style[_property]:_element.style},getView:function(_element,_property){var view=document.defaultView?document.defaultView.getComputedStyle(_element,null):_element.currentStyle;_property=_property=="float"?pi.env.ie.toggle("styleFloat","cssFloat"):_property;if(_property=="opacity"&&pi.env.ie)return pi.util.Element.getOpacity(_element,view);return typeof _property=="string"?view[_property]:view}},CloneObject:function(_object,_fn){var tmp={};for(var key in _object){if(pi.util.IsArray(_object[key])){tmp[key]=Array.prototype.clone.apply(_object[key])}else if(pi.util.IsHash(_object[key])){tmp[key]=pi.util.CloneObject(_object[key]);if(_fn)_fn.call(tmp,key,_object)}else tmp[key]=_object[key]}return tmp},MergeObjects:function(_object,_source){for(var key in _source){var value=_source[key];if(pi.util.IsArray(_source[key])){if(pi.util.IsArray(_object[key])){Array.prototype.push.apply(_source[key],_object[key])}else value=_source[key].clone()}else if(pi.util.IsHash(_source[key])){if(pi.util.IsHash(_object[key])){value=pi.util.MergeObjects(_object[key],_source[key])}else{value=pi.util.CloneObject(_source[key])}}_object[key]=value};return _object}};pi.get=function(){return document.getElementById(arguments[0])};pi.get.byTag=function(){return document.getElementsByTagName(arguments[0])};pi.get.byClass=function(){return document.getElementsByClassName.apply(document,arguments)};pi.base=function(){this.body={};this.constructor=null;this.build=function(_skipClonning){var base=this,skipClonning=_skipClonning||false,_private={},fn=function(){var _p=pi.util.CloneObject(_private);if(!skipClonning){for(var key in this){if(pi.util.IsArray(this[key])){this[key]=Array.prototype.clone.apply(this[key])}else if(pi.util.IsHash(this[key])){this[key]=pi.util.CloneObject(this[key],function(_key,_object){this[_key]._parent_=this});this[key]._parent_=this}}};base.createAccessors(_p,this);if(base.constructor)return base.constructor.apply(this,arguments);return this};this.movePrivateMembers(this.body,_private);if(this.constructor){fn["$Constructor"]=this.constructor}fn.prototype=this.body;return fn};this.createAccessors=function(_p,_branch){var getter=function(_property){return this[_property]},setter=function(_property,_value){this[_property]=_value;return _branch._parent_||_branch};for(var name in _p){var isPrivate=name.substring(0,1)=="_",title=name.substring(1,2).toUpperCase()+name.substring(2);if(isPrivate){_branch["get"+title]=getter.curry(_p,name);_branch["set"+title]=setter.curry(_p,name)}else if(pi.util.IsHash(_p[name])){if(!_branch[name])_branch[name]={};this.createAccessors(_p[name],_branch[name])}}};this.movePrivateMembers=function(_object,_branch){for(var name in _object){var isPrivate=name.substring(0,1)=="_";if(isPrivate){_branch[name]=_object[name];delete _object[name]}else if(pi.util.IsHash(_object[name])){_branch[name]={};this.movePrivateMembers(_object[name],_branch[name])}}}};Function.prototype.extend=function(_prototype,_skipClonning){var object=new pi.base,superClass=this;if(_prototype["$Constructor"]){object.constructor=_prototype["$Constructor"];delete _prototype["$Constructor"]};object.body=superClass==pi.base?_prototype:pi.util.MergeObjects(_prototype,superClass.prototype,2);object.constructor=object.constructor||function(){if(superClass!=pi.base)superClass.apply(this,arguments)};return object.build(_skipClonning)};Function.prototype.curry=function(_scope){var fn=this,scope=_scope||window,args=Array.prototype.slice.call(arguments,1);return function(){return fn.apply(scope,args.concat(Array.prototype.slice.call(arguments,0)))}};pi.element=pi.base.extend({"$Constructor":function(_tag){this.environment.setElement(document.createElement(_tag||"DIV"));this.environment.getElement().pi=this;return this},"clean":function(){var childs=this.child.get();while(childs.length){childs[0].parentNode.removeChild(childs[0])}},"clone":function(_deep){return this.environment.getElement().cloneNode(_deep)},"insert":function(_element){_element=_element.environment?_element.environment.getElement():_element;_element.appendChild(this.environment.getElement());return this},"insertAfter":function(_referenceElement){_referenceElement=_referenceElement.environment?_referenceElement.environment.getElement():_referenceElement;_referenceElement.nextSibling?this.insertBefore(_referenceElement.nextSibling):this.insert(_referenceElement.parentNode);return this},"insertBefore":function(_referenceElement){_referenceElement=_referenceElement.environment?_referenceElement.environment.getElement():_referenceElement;_referenceElement.parentNode.insertBefore(this.environment.getElement(),_referenceElement);return this},"query":function(_expression,_resultType,namespaceResolver,_result){return pi.xpath(_expression,_resultType||"ORDERED_NODE_SNAPSHOT_TYPE",this.environment.getElement(),_namespaceResolver,_result)},"remove":function(){this.environment.getParent().removeChild(this.environment.getElement())},"update":function(_value){["TEXTAREA","INPUT"].indexOf(this.environment.getName())>-1?(this.environment.getElement().value=_value):(this.environment.getElement().innerHTML=_value);return this},"attribute":{"getAll":function(_name){return this._parent_.environment.getElement().attributes},"clear":function(_name){this.set(_name,"");return this._parent_},"get":function(_name){return this._parent_.environment.getElement().getAttribute(_name)},"has":function(_name){return pi.env.ie?(this.get(_name)!=null):this._parent_.environment.getElement().hasAttribute(_name)},"remove":function(_name){this._parent_.environment.getElement().removeAttribute(_name);return this._parent_},"set":function(_name,_value){this._parent_.environment.getElement().setAttribute(_name,_value);return this._parent_},"addClass":function(_classes){for(var i=0;i<arguments.length;i++){pi.util.Element.addClass(this._parent_.environment.getElement(),arguments[i])};return this._parent_},"clearClass":function(){this.setClass("");this._parent_},"getClass":function(){return pi.util.Element.getClass(this._parent_.environment.getElement())},"hasClass":function(_class){return pi.util.Element.hasClass(this._parent_.environment.getElement(),_class)},"setClass":function(_value){return pi.util.Element.setClass(this._parent_.environment.getElement(),_value)},"removeClass":function(_class){pi.util.Element.removeClass(this._parent_.environment.getElement(),_class);return this._parent_},"toggleClass":function(_class){pi.util.Element.toggleClass(this._parent_.environment.getElement(),_class)}},"child":{"get":function(){return this._parent_.environment.getElement().childNodes},"add":function(_elements){for(var i=0;i<arguments.length;i++){var el=arguments[i];this._parent_.environment.getElement().appendChild(el.environment?el.environment.getElement():el)}return this._parent_},"addAfter":function(_element,_referenceElement){this.addBefore(_element.environment?_element.environment.getElement():_element,(_referenceElement.environment?_referenceElement.environment.getElement():_referenceElement).nextSibling);return this._parent_},"addBefore":function(_element,_referenceElement){this._parent_.environment.getElement().insertBefore(_element.environment?_element.environment.getElement():_element,_referenceElement.environment?_referenceElement.environment.getElement():_referenceElement);return this._parent_},"query":function(_tag,_attributeName,_attributeValue){return this._parent_.query("{0}{1}".format((_tag?"{0}".format(_tag):"/*"),_attributeName||_attributeValue?"[contains(concat(' ', @{0}, ' '),' {1} ')]".format(_attributeName||"",_attributeValue||""):""))},"remove":function(_element){this._parent_.environment.getElement().removeChild(_element.environment?_element.environment.getElement():_element)}},"environment":{"_element":null,"getParent":function(){return this.getElement().parentNode},"getPosition":function(){return pi.util.Element.getPosition(this.getElement())},"getSize":function(){return pi.util.Element.getSize(this.getElement())},"addStyle":function(_styleObject){pi.util.Element.addStyle(this.getElement(),_styleObject);return this._parent_},"getStyle":function(_property){return pi.util.Element.getStyle(_property)},"getName":function(){return this.getElement().nodeName},"getType":function(){return this.getElement().nodeType},"getView":function(_property){return pi.util.Element.getView(this.getElement(),_property)}},"event":{"addListener":function(_event,_fn,_useCapture){pi.util.AddEvent(this._parent_.environment.getElement(),_event,_fn,_useCapture);return this._parent_},"removeListener":function(_event,_fn,_useCapture){pi.util.RemoveEvent(this._parent_.environment.getElement(),_event,_fn,_useCapture);return this._parent_}}});pi.xhr=new pi.base;pi.xhr.constructor=function(){var api;if(!window.XMLHttpRequest){var names=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(var i=0;i<names.length;i++){try{this.environment.setApi(new ActiveXObject(names[i]));break}catch(e){continue}}}else this.environment.setApi(new XMLHttpRequest());this.environment.getApi().onreadystatechange=this.event.readystatechange.curry(this);return this};pi.xhr.body={"abort":function(){this.environment.getApi().abort()},"send":function(){var url=this.environment.getUrl(),data=this.environment.getData(),dataUrl="";for(var key in data)dataUrl+="{0}={1}&".format(key,data[key]);if(this.environment.getType()=="GET")url+=(url.search("\\?")==-1?"?":"&")+"{0}".format(dataUrl);this.environment.getApi().open(this.environment.getType(),url,this.environment.getAsync());for(var key in this.environment.getHeader())this.environment.getApi().setRequestHeader(key,this.environment.getHeader()[key]);this.environment.getApi().send(this.environment.getType()=="GET"?"":dataUrl)}};pi.xhr.body.environment={"_async":true,"_api":null,"_cache":true,"_callback":[],"_channel":null,"_data":{},"_header":{},"_mimeType":null,"_multipart":false,"_type":"GET","_timeout":0,"_url":"","addCallback":function(_options,_fn){this.getCallback().push({"fn":_fn,"options":_options})},"addHeader":function(_key,_value){this.getHeader()[_key]=_value},"addData":function(_key,_value){this.getData()[_key]=_value},"changeCache":function(_value){if(_value==false){this.addData("forceCache",Math.round(Math.random()*10000))}this.setCache(_value)},"changeType":function(_value){if(_value=="POST"){this.addHeader("Content-Type","application/x-www-form-urlencoded")}this.setType(_value)}};pi.xhr.body.event={"readystatechange":function(){var readyState=this.environment.getApi().readyState;var callback=this.environment.getCallback();for(var i=0;i<callback.length;i++){if(callback[i].options.readyState.indexOf(readyState)>-1)callback[i].fn.apply(this)}}};pi.xhr=pi.xhr.build();pi.xhr.get=function(_url,_returnPiObject){var request=new pi.xhr();request.environment.setAsync(false);request.environment.setUrl(_url);request.send();return _returnPiObject?request:request.environment.getApi()};pi.xpath=function(_expression,_resultType,_contextNode,_namespaceResolver,_result){var contextNode=_contextNode||document,expression=_expression||"",namespaceResolver=_namespaceResolver||null,result=_result||null,resultType=_resultType||"ANY_TYPE";return document.evaluate(expression,contextNode,namespaceResolver,XPathResult[resultType],result)};Array.prototype.clone=function(){var tmp=[];Array.prototype.push.apply(tmp,this);tmp.forEach(function(item,index,object){if(item instanceof Array)object[index]=object[index].clone()});return tmp};Array.prototype.count=function(_value){var count=0;this.forEach(function(){count+=Number(arguments[0]==_value)});return count};Array.prototype.forEach=Array.prototype.forEach||function(_function){for(var i=0;i<this.length;i++)_function.apply(this,[this[i],i,this])};Array.prototype.getLastItem=function(){return this[this.length-1]};Array.prototype.indexOf=Array.prototype.indexOf||function(_value){var index=-1;for(var i=0;i<this.length;i++)if(this[i]==_value){index=i;break}return index};Array.prototype.remove=function(_index){var array=this.slice(0,_index);Array.prototype.push.apply(array,this.slice(_index+1));return array};Array.prototype.removeValue=function(_value){return this.remove(this.indexOf(_value))};Boolean.prototype.toggle=function(){return this==true?arguments[0]:arguments[1]};Number.prototype.base=function(_system){var remain=this%_system;if(this==remain)return String.fromCharCode(this+(this>9?87:48));return((this-remain)/_system).base(_system)+String.fromCharCode(remain+(remain>9?87:48))};Number.prototype.decimal=function(_system){var result=0,digit=String(this).split("");for(var i=0;i<digit.length;i++){digit[i]=parseInt((digit[i].charCodeAt(0)>58)?digit[i].charCodeAt(0)-87:digit[i]);result+=digit[i]*(Math.pow(_system,digit.length-1-i))}return result};Number.prototype.range=function(_pattern){for(var value=String(this),isFloat=/\./i.test(value),i=isFloat.toggle(parseInt(value.split(".")[0]),0),end=parseInt(value.split(".")[isFloat.toggle(1,0)]),array=[];i<end;i++){array.push(Boolean(_pattern)==false?i:(typeof _pattern=="function"?_pattern(i):_pattern[i]))}return array};String.prototype.escape=function(){return escape(this)};String.prototype.format=function(){var values=arguments;return this.replace(/\{(\d)\}/g,function(){return values[arguments[1]]})};String.prototype.leftpad=function(_len,_ch){var str=this;var ch=Boolean(_ch)==false?" ":_ch;while(str.length<_len)str=ch+str;return str};String.prototype.toggle=function(_value,_other){return this==_value?_value:_other};String.prototype.unicode=function(){var str="",obj=this.split("");for(var i=obj.length-1;i>=0;i--)str="\\u{0}{1}".format(String(obj[i].charCodeAt(0).base(16)).leftpad(4,"0"),str);return str};pi.util.AddEvent(pi.env.ie?window:document,pi.env.ie?"load":"DOMContentLoaded",function(){for(var i=0;i<pi.util.DOMContentLoaded.length;i++){pi.util.DOMContentLoaded[i]()}})})(window);
-var firebug={env:{"cache":{},"ctmp":[],"dIndex":"console","init":false,"ml":false,"objCn":[]},init:function(){firebug.el={};firebug.el.content={};with(firebug){document.documentElement.childNodes[0].appendChild(new pi.element("link").attribute.set("rel","stylesheet").attribute.set("href","http://firebuglite.appspot.com/firebug-lite.css").environment.getElement());el.main=new pi.element("DIV").attribute.set("id","Firebug").environment.addStyle({"width":pi.util.GetWindowSize().width+"px"}).insert(document.body);el.header=new pi.element("DIV").attribute.addClass("Header").insert(el.main);el.left={};el.left.container=new pi.element("DIV").attribute.addClass("Left").insert(el.main);el.right={};el.right.container=new pi.element("DIV").attribute.addClass("Right").insert(el.main);el.main.child.add(new pi.element("DIV").environment.addStyle({"clear":"both"}));el.button={};el.button.container=new pi.element("DIV").attribute.addClass("ButtonContainer").insert(el.header);el.button.logo=new pi.element("A").attribute.set("title","Firebug Lite").attribute.set("target","_blank").attribute.set("href","http://getfirebug.com/lite.html").update(" ").attribute.addClass("Button Logo").insert(el.button.container);el.button.inspect=new pi.element("A").attribute.addClass("Button").event.addListener("click",d.inspector.toggle).update("Inspect").insert(el.button.container);el.button.maximize=new pi.element("A").attribute.addClass("Button Maximize").event.addListener("click",win.maximize).insert(el.button.container);el.button.minimize=new pi.element("A").attribute.addClass("Button Minimize").event.addListener("click",win.minimize).insert(el.button.container);el.button.close=new pi.element("A").attribute.addClass("Button Close").event.addListener("click",win.close).insert(el.button.container);if(pi.env.ie||pi.env.webkit){el.button.container.environment.addStyle({"paddingTop":"12px"})}el.nav={};el.nav.container=new pi.element("DIV").attribute.addClass("Nav").insert(el.left.container);el.nav.console=new pi.element("A").attribute.addClass("Tab Selected").event.addListener("click",d.navigate.curry(window,"console")).update("Console").insert(el.nav.container);el.nav.html=new pi.element("A").attribute.addClass("Tab").update("HTML").event.addListener("click",d.navigate.curry(window,"html")).insert(el.nav.container);el.nav.css=new pi.element("A").attribute.addClass("Tab").update("CSS").event.addListener("click",d.navigate.curry(window,"css")).insert(el.nav.container);el.nav.scripts=new pi.element("A").attribute.addClass("Tab").update("Script").event.addListener("click",d.navigate.curry(window,"scripts")).insert(el.nav.container);el.nav.dom=new pi.element("A").attribute.addClass("Tab").update("DOM").event.addListener("click",d.navigate.curry(window,"dom")).insert(el.nav.container);el.nav.xhr=new pi.element("A").attribute.addClass("Tab").update("XHR").event.addListener("click",d.navigate.curry(window,"xhr")).insert(el.nav.container);el.borderInspector=new pi.element("DIV").attribute.set("id","FirebugBorderInspector").event.addListener("click",listen.inspector).insert(document.body);el.bgInspector=new pi.element("DIV").attribute.set("id","FirebugBGInspector").insert(document.body);el.left.console={};el.left.console.container=new pi.element("DIV").attribute.addClass("Console").insert(el.left.container);el.left.console.mlButton=new pi.element("A").attribute.addClass("MLButton").event.addListener("click",d.console.toggleML).insert(el.left.console.container);el.left.console.monitor=new pi.element("DIV").insert(new pi.element("DIV").attribute.addClass("Monitor").insert(el.left.console.container));el.left.console.container.child.add(new pi.element("DIV").attribute.addClass("InputArrow").update(">>>"));el.left.console.input=new pi.element("INPUT").attribute.set("type","text").attribute.addClass("Input").event.addListener("keydown",listen.consoleTextbox).insert(new pi.element("DIV").attribute.addClass("InputContainer").insert(el.left.console.container));el.right.console={};el.right.console.container=new pi.element("DIV").attribute.addClass("Console Container").insert(el.right.container);el.right.console.mlButton=new pi.element("A").attribute.addClass("MLButton CloseML").event.addListener("click",d.console.toggleML).insert(el.right.console.container);el.right.console.input=new pi.element("TEXTAREA").attribute.addClass("Input").insert(el.right.console.container);el.right.console.run=new pi.element("A").attribute.addClass("Button").event.addListener("click",listen.runMultiline).update("Run").insert(el.right.console.container);el.right.console.clear=new pi.element("A").attribute.addClass("Button").event.addListener("click",d.clean.curry(window,el.right.console.input)).update("Clear").insert(el.right.console.container);el.button.console={};el.button.console.container=new pi.element("DIV").attribute.addClass("ButtonSet").insert(el.button.container);el.button.console.clear=new pi.element("A").attribute.addClass("Button").event.addListener("click",d.clean.curry(window,el.left.console.monitor)).update("Clear").insert(el.button.console.container);el.left.html={};el.left.html.container=new pi.element("DIV").attribute.addClass("HTML").insert(el.left.container);el.right.html={};el.right.html.container=new pi.element("DIV").attribute.addClass("HTML Container").insert(el.right.container);el.right.html.nav={};el.right.html.nav.container=new pi.element("DIV").attribute.addClass("Nav").insert(el.right.html.container);el.right.html.nav.computedStyle=new pi.element("A").attribute.addClass("Tab Selected").event.addListener("click",d.html.navigate.curry(firebug,"computedStyle")).update("Computed Style").insert(el.right.html.nav.container);if(!pi.env.ie6)el.right.html.nav.dom=new pi.element("A").attribute.addClass("Tab").event.addListener("click",d.html.navigate.curry(firebug,"dom")).update("DOM").insert(el.right.html.nav.container);el.right.html.content=new pi.element("DIV").attribute.addClass("Content").insert(el.right.html.container);el.button.html={};el.button.html.container=new pi.element("DIV").attribute.addClass("ButtonSet HTML").insert(el.button.container);el.left.css={};el.left.css.container=new pi.element("DIV").attribute.addClass("CSS").insert(el.left.container);el.right.css={};el.right.css.container=new pi.element("DIV").attribute.addClass("CSS Container").insert(el.right.container);el.right.css.nav={};el.right.css.nav.container=new pi.element("DIV").attribute.addClass("Nav").insert(el.right.css.container);el.right.css.nav.runCSS=new pi.element("A").attribute.addClass("Tab Selected").update("Run CSS").insert(el.right.css.nav.container);el.right.css.mlButton=new pi.element("A").attribute.addClass("MLButton CloseML").event.addListener("click",d.console.toggleML).insert(el.right.css.container);el.right.css.input=new pi.element("TEXTAREA").attribute.addClass("Input").insert(el.right.css.container);el.right.css.run=new pi.element("A").attribute.addClass("Button").event.addListener("click",listen.runCSS).update("Run").insert(el.right.css.container);el.right.css.clear=new pi.element("A").attribute.addClass("Button").event.addListener("click",d.clean.curry(window,el.right.css.input)).update("Clear").insert(el.right.css.container);el.button.css={};el.button.css.container=new pi.element("DIV").attribute.addClass("ButtonSet CSS").insert(el.button.container);el.button.css.selectbox=new pi.element("SELECT").event.addListener("change",listen.cssSelectbox).insert(el.button.css.container);el.left.scripts={};el.left.scripts.container=new pi.element("DIV").attribute.addClass("Scripts").insert(el.left.container);el.right.scripts={};el.right.scripts.container=new pi.element("DIV").attribute.addClass("Scripts Container").insert(el.right.container);el.button.scripts={};el.button.scripts.container=new pi.element("DIV").attribute.addClass("ButtonSet Scripts").insert(el.button.container);el.button.scripts.selectbox=new pi.element("SELECT").event.addListener("change",listen.scriptsSelectbox).insert(el.button.scripts.container);el.button.scripts.lineNumbers=new pi.element("A").attribute.addClass("Button").event.addListener("click",d.scripts.toggleLineNumbers).update("Show Line Numbers").insert(el.button.scripts.container);el.left.dom={};el.left.dom.container=new pi.element("DIV").attribute.addClass("DOM").insert(el.left.container);el.right.dom={};el.right.dom.container=new pi.element("DIV").attribute.addClass("DOM Container").insert(el.right.container);el.button.dom={};el.button.dom.container=new pi.element("DIV").attribute.addClass("ButtonSet DOM").insert(el.button.container);el.button.dom.label=new pi.element("LABEL").update("Object Path:").insert(el.button.dom.container);el.button.dom.textbox=new pi.element("INPUT").event.addListener("keydown",listen.domTextbox).update("window").insert(el.button.dom.container);el.left.str={};el.left.str.container=new pi.element("DIV").attribute.addClass("STR").insert(el.left.container);el.right.str={};el.right.str.container=new pi.element("DIV").attribute.addClass("STR").insert(el.left.container);el.button.str={};el.button.str.container=new pi.element("DIV").attribute.addClass("ButtonSet XHR").insert(el.button.container);el.button.str.watch=new pi.element("A").attribute.addClass("Button").event.addListener("click",d.navigate.curry(window,"xhr")).update("Back").insert(el.button.str.container);el.left.xhr={};el.left.xhr.container=new pi.element("DIV").attribute.addClass("XHR").insert(el.left.container);el.right.xhr={};el.right.xhr.container=new pi.element("DIV").attribute.addClass("XHR").insert(el.left.container);el.button.xhr={};el.button.xhr.container=new pi.element("DIV").attribute.addClass("ButtonSet XHR").insert(el.button.container);el.button.xhr.label=new pi.element("LABEL").update("XHR Path:").insert(el.button.xhr.container);el.button.xhr.textbox=new pi.element("INPUT").event.addListener("keydown",listen.xhrTextbox).insert(el.button.xhr.container);el.button.xhr.watch=new pi.element("A").attribute.addClass("Button").event.addListener("click",listen.addXhrObject).update("Watch").insert(el.button.xhr.container);if(pi.env.ie6){var buttons=[el.button.inspect,el.button.close,el.button.inspect,el.button.console.clear,el.right.console.run,el.right.console.clear,el.right.css.run,el.right.css.clear];for(var i=0;i<buttons.length;i++)buttons[i].attribute.set("href","#")}env.init=true;for(var i=0;i<env.ctmp.length;i++){d.console.log.apply(window,env.ctmp[i])}}},win:{close:function(){with(firebug){el.main.update("");el.main.remove()}},minimize:function(){with(firebug){el.main.environment.addStyle({"height":"35px"});el.button.maximize.environment.addStyle({"display":"block"});el.button.minimize.environment.addStyle({"display":"none"});d.refreshSize()}},maximize:function(){with(firebug){el.main.environment.addStyle({"height":"295px"});el.button.minimize.environment.addStyle({"display":"block"});el.button.maximize.environment.addStyle({"display":"none"});d.refreshSize()}}},watchXHR:function(){with(firebug){d.xhr.addObject.apply(window,arguments);if(env.dIndex!="xhr"){d.navigate("xhr")}}},d:{clean:function(_element){with(firebug){_element.update("")}},console:{dir:function(_value){with(firebug){d.console.addLine().attribute.addClass("Arrow").update(">>> console.dir("+_value+")");d.dom.open(_value,d.console.addLine())}},addLine:function(){with(firebug){return new pi.element("DIV").attribute.addClass("Row").insert(el.left.console.monitor)}},openObject:function(_index){with(firebug){d.dom.open(env.objCn[_index],el.left.dom.container,pi.env.ie);d.navigate("dom")}},historyIndex:0,history:[],log:function(_values){with(firebug){if(env.init==false){env.ctmp.push(arguments);return}var value="";for(var i=0;i<arguments.length;i++){value+=(i>0?" ":"")+d.highlight(arguments[i],false,false,true)}d.console.addLine().update(value);d.console.scroll()}},print:function(_cmd,_text){with(firebug){d.console.addLine().attribute.addClass("Arrow").update(">>> "+_cmd);d.console.addLine().update(d.highlight(_text,false,false,true));d.console.scroll();d.console.historyIndex=d.console.history.push(_cmd)}},run:function(cmd){with(firebug){if(cmd.length==0)return;el.left.console.input.environment.getElement().value="";try{var result=eval.call(window,cmd);d.console.print(cmd,result)}catch(e){d.console.addLine().attribute.addClass("Arrow").update(">>> "+cmd);if(!pi.env.ff){d.console.scroll();return d.console.addLine().attribute.addClass("Error").update("<strong>Error: </strong>"+(e.description||e),true)}if(e.fileName==null){d.console.addLine().attribute.addClass("Error").update("<strong>Error: </strong>"+e.message,true)}var fileName=e.fileName.split("\/").getLastItem();d.console.addLine().attribute.addClass("Error").update("<strong>Error: </strong>"+e.message+" (<em>"+fileName+"</em>,"+e.lineNumber+")",true);d.console.scroll()}d.console.scroll()}},scroll:function(){with(firebug){el.left.console.monitor.environment.getElement().parentNode.scrollTop=Math.abs(el.left.console.monitor.environment.getSize().offsetHeight-200)}},toggleML:function(){with(firebug){var open=!env.ml;env.ml=!env.ml;d.navigateRightColumn("console",open);el[open?"left":"right"].console.mlButton.environment.addStyle({display:"none"});el[!open?"left":"right"].console.mlButton.environment.addStyle({display:"block"});el.left.console.monitor.environment.addStyle({"height":(open?233:210)+"px"});el.left.console.mlButton.attribute[(open?"add":"remove")+"Class"]("CloseML")}}},css:{index:-1,open:function(_index){with(firebug){var item=document.styleSheets[_index];var uri=item.href;if(uri.indexOf("http:\/\/")>-1&&getDomain(uri)!=document.domain){el.left.css.container.update("<em>Access to restricted URI denied</em>");return}var rules=item[pi.env.ie?"rules":"cssRules"];var str="";for(var i=0;i<rules.length;i++){var item=rules[i];var selector=item.selectorText;var cssText=pi.env.ie?item.style.cssText:item.cssText.match(/\{(.*)\}/)[1];str+=d.css.printRule(selector,cssText.split(";"),el.left.css.container)}el.left.css.container.update(str)}},printRule:function(_selector,_css,_layer){with(firebug){var str="<div class='Selector'>"+_selector+" {</div>";for(var i=0;i<_css.length;i++){var item=_css[i];str+="<div class='CSSText'>"+item.replace(/(.+\:)(.+)/,"<span class='CSSProperty'>$1</span><span class='CSSValue'>$2;</span>")+"</div>"}str+="<div class='Selector'>}</div>";return str}},refresh:function(){with(firebug){el.button.css.selectbox.update("");var collection=document.styleSheets;for(var i=0;i<collection.length;i++){var uri=collection[i].href;d.css.index=d.css.index<0?i:d.css.index;el.button.css.selectbox.child.add(new pi.element("OPTION").attribute.set("value",i).update(uri))};d.css.open(d.css.index)}}},dom:{open:function(_object,_layer){with(firebug){_layer.clean();var container=new pi.element("DIV").attribute.addClass("DOMContent").insert(_layer);d.dom.print(_object,container)}},print:function(_object,_parent,_inTree){with(firebug){var obj=_object||window,parentElement=_parent;parentElement.update("");if(parentElement.opened&&parentElement!=el.left.dom.container){parentElement.environment.getParent().pi.child.get()[0].pi.child.get()[0].pi.attribute.removeClass("Opened");parentElement.opened=false;parentElement.environment.addStyle({"display":"none"});return}if(_inTree)parentElement.environment.getParent().pi.child.get()[0].pi.child.get()[0].pi.attribute.addClass("Opened");parentElement.opened=true;for(var key in obj){try{var value=obj[key],property=key,container=new pi.element("DIV").attribute.addClass("DOMRow").insert(parentElement),left=new pi.element("DIV").attribute.addClass("DOMRowLeft").insert(container),right=new pi.element("DIV").attribute.addClass("DOMRowRight").insert(container);container.child.add(new pi.element("DIV").environment.addStyle({"clear":"both"}));var link=new pi.element("A").attribute.addClass(typeof value=="object"&&Boolean(value)?"Property Object":"Property").update(property).insert(left);right.update(d.highlight(value,false,true));var subContainer=new pi.element("DIV").attribute.addClass("DOMRowSubContainer").insert(container);if(typeof value!="object"||Boolean(value)==false)continue;link.event.addListener("click",d.dom.print.curry(window,value,subContainer,true))}catch(e){}}parentElement.environment.addStyle({"display":"block"})}}},highlight:function(_value,_inObject,_inArray,_link){with(firebug){var isArray=false,isElement=false;try{isArray=pi.util.IsArray(_value);isElement=_value!=undefined&&Boolean(_value.nodeName)&&Boolean(_value.nodeType)}catch(e){};if(_value==null||["boolean","function","number","string"].indexOf(typeof _value)>-1){if(_value==null){return"<span class='Null'>null</span>"}if(["boolean","number"].indexOf(typeof _value)>-1){return"<span class='DarkBlue'>"+_value+"</span>"}if(typeof _value=="function"){return"<span class='"+(_inObject?"Italic Gray":"Green")+"'>function()</span>"}return"<span class='Red'>\""+(!_inObject&&!_inArray?_value:_value.substring(0,35)).replace(/\n/g,"\\n").replace(/\s/g," ").replace(/>/g,">").replace(/</g,"<")+"\"</span>"}else if(isElement){if(_value.nodeType==3)return d.highlight(_value.nodeValue);if(_inArray||_inObject){var result="<span class='Blue'>"+_value.nodeName.toLowerCase();if(_value.getAttribute&&_value.getAttribute("id"))result+="<span class='DarkBlue'>#"+_value.getAttribute("id")+"</span>";var elClass=_value.getAttribute?_value.getAttribute(pi.env.ie?"className":"class"):"";if(elClass)result+="<span class='Red'>."+elClass.split(" ")[0]+"</span>";return result+"</span>"}var result="<span class='Blue'><"+_value.nodeName.toLowerCase()+"";if(_value.attributes)for(var i=0;i<_value.attributes.length;i++){var item=_value.attributes[i];if(pi.env.ie&&Boolean(item.nodeValue)==false)continue;result+=" <span class='DarkBlue'>"+item.nodeName+"=\"<span class='Red'>"+item.nodeValue+"</span>\"</span>"}result+="></span>";return result}else if(isArray||["object","array"].indexOf(typeof _value)>-1){var result="";if(isArray||_value instanceof Array){if(_inObject)return"<span class='Gray Italic'>["+_value.length+"]</span>";result+="<span class='Strong'>[ ";for(var i=0;i<_value.length;i++){if((_inObject||_inArray)&&pi.env.ie&&i>3)break;result+=(i>0?", ":"")+d.highlight(_value[i],false,true,true)}result+=" ]</span>";return result}if(_inObject)return"<span class='Gray Italic'>Object</span>";result+="<span class='Strong Green"+(!_link?"'":" ObjectLink' onmouseover='this.className=this.className.replace(\"ObjectLink\",\"ObjectLinkHover\")' onmouseout='this.className=this.className.replace(\"ObjectLinkHover\",\"ObjectLink\")' onclick='firebug.d.console.openObject("+(env.objCn.push(_value)-1)+")'")+">Object";var i=0;for(var key in _value){var value=_value[key];if((_inObject||_inArray)&&pi.env.ie&&i>3)break;result+=" "+key+"="+d.highlight(value,true);i++};result+="</span>";return result}else{if(_inObject)return"<span class='Gray Italic'>"+_value+"</span>";return _value}}},html:{nIndex:"computedStyle",current:null,highlight:function(_element,_clear,_event){with(firebug){if(_clear){el.bgInspector.environment.addStyle({"display":"none"});return}d.inspector.inspect(_element,true)}},inspect:function(_element){var el=_element,map=[],parent=_element;while(parent){map.push(parent);if(parent==document.body)break;parent=parent.parentNode}map=map.reverse();with(firebug){d.inspector.toggle();var parentLayer=el.left.html.container.child.get()[1].childNodes[1].pi;for(var t=0;map[t];){if(t==map.length-1){var link=parentLayer.environment.getElement().previousSibling.pi;link.attribute.addClass("Selected");if(d.html.current)d.html.current[1].attribute.removeClass("Selected");d.html.current=[_element,link];return;t}parentLayer=d.html.openHtmlTree(map[t],parentLayer,map[t+1]);t++}}},navigate:function(_index,_element){with(firebug){el.right.html.nav[d.html.nIndex].attribute.removeClass("Selected");el.right.html.nav[_index].attribute.addClass("Selected");d.html.nIndex=_index;d.html.openProperties()}},openHtmlTree:function(_element,_parent,_returnParentElementByElement,_event){with(firebug){var element=_element||document.documentElement,parent=_parent||el.left.html.container,returnParentEl=_returnParentElementByElement||null,returnParentVal=null;if(parent!=el.left.html.container){var nodeLink=parent.environment.getParent().pi.child.get()[0].pi;if(d.html.current)d.html.current[1].attribute.removeClass("Selected");nodeLink.attribute.addClass("Selected");d.html.current=[_element,nodeLink];d.html.openProperties()}if(element.childNodes&&(element.childNodes.length==0||(element.childNodes.length==1&&element.childNodes[0].nodeType==3)))return;parent.clean();if(parent.opened&&Boolean(_returnParentElementByElement)==false){parent.opened=false;parent.environment.getParent().pi.child.get()[0].pi.attribute.removeClass("Open");return}if(parent!=el.left.html.container){parent.environment.getParent().pi.child.get()[0].pi.attribute.addClass("Open");parent.opened=true}for(var i=0;i<element.childNodes.length;i++){var item=element.childNodes[i];if(item.nodeType==3)continue;var container=new pi.element().attribute.addClass("Block").insert(parent);var link=new pi.element("A").attribute.addClass("Link").update(d.highlight(item)).insert(container);var subContainer=new pi.element("DIV").attribute.addClass("SubContainer").insert(container);link.event.addListener("click",d.html.openHtmlTree.curry(window,item,subContainer,false));link.event.addListener("mouseover",d.html.highlight.curry(window,item,false));link.event.addListener("mouseout",d.html.highlight.curry(window,item,true));returnParentVal=returnParentEl==item?subContainer:returnParentVal;if(d.html.current==null&&item==document.body){link.attribute.addClass("Selected");d.html.current=[item,link];d.html.openHtmlTree(item,subContainer)}if(item.childNodes&&item.childNodes.length==1&&item.childNodes[0].nodeType==3){link.child.get()[0].appendChild(document.createTextNode(item.childNodes[0].nodeValue.substring(0,100)));link.child.get()[0].appendChild(document.createTextNode("</"));link.child.get()[0].appendChild(new pi.element("span").attribute.addClass("Blue").update(item.nodeName.toLowerCase()).environment.getElement());link.child.get()[0].appendChild(document.createTextNode(">"));continue}else if(item.childNodes&&item.childNodes.length==0)continue;link.attribute.addClass("ParentLink")}return returnParentVal}},openProperties:function(){with(firebug){var index=d.html.nIndex;var node=d.html.current[0];d.clean(el.right.html.content);var str="";switch(index){case"computedStyle":var property=["opacity","filter","azimuth","background","backgroundAttachment","backgroundColor","backgroundImage","backgroundPosition","backgroundRepeat","border","borderCollapse","borderColor","borderSpacing","borderStyle","borderTop","borderRight","borderBottom","borderLeft","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderWidth","bottom","captionSide","clear","clip","color","content","counterIncrement","counterReset","cue","cueAfter","cueBefore","cursor","direction","display","elevation","emptyCells","cssFloat","font","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","height","left","letterSpacing","lineHeight","listStyle","listStyleImage","listStylePosition","listStyleType","margin","marginTop","marginRight","marginBottom","marginLeft","markerOffset","marks","maxHeight","maxWidth","minHeight","minWidth","orphans","outline","outlineColor","outlineStyle","outlineWidth","overflow","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","page","pageBreakAfter","pageBreakBefore","pageBreakInside","pause","pauseAfter","pauseBefore","pitch","pitchRange","playDuring","position","quotes","richness","right","size","speak","speakHeader","speakNumeral","speakPunctuation","speechRate","stress","tableLayout","textAlign","textDecoration","textIndent","textShadow","textTransform","top","unicodeBidi","verticalAlign","visibility","voiceFamily","volume","whiteSpace","widows","width","wordSpacing","zIndex"].sort();var view=document.defaultView?document.defaultView.getComputedStyle(node,null):node.currentStyle;for(var i=0;i<property.length;i++){var item=property[i];if(!view[item])continue;str+="<div class='CSSItem'><div class='CSSProperty'>"+item+"</div><div class='CSSValue'>"+d.highlight(view[item])+"</div></div>"}el.right.html.content.update(str);break;case"dom":d.dom.open(node,el.right.html.content,pi.env.ie);break}}}},inspector:{enabled:false,el:null,inspect:function(_element,_bgInspector){var el=_element,top=el.offsetTop,left=el.offsetLeft,parent=_element.offsetParent;while(Boolean(parent)&&parent!=document.firstChild){top+=parent.offsetTop;left+=parent.offsetLeft;parent=parent.offsetParent;if(parent==document.body)break};with(firebug){el[_bgInspector?"bgInspector":"borderInspector"].environment.addStyle({"width":_element.offsetWidth+"px","height":_element.offsetHeight+"px","top":top-(_bgInspector?0:2)+"px","left":left-(_bgInspector?0:2)+"px","display":"block"});if(!_bgInspector){d.inspector.el=_element}}},toggle:function(){with(firebug){d.inspector.enabled=!d.inspector.enabled;el.button.inspect.attribute[(d.inspector.enabled?"add":"remove")+"Class"]("Enabled");if(d.inspector.enabled==false){el.borderInspector.environment.addStyle({"display":"none"});d.inspector.el=null}else if(pi.env.dIndex!="html"){d.navigate("html")}}}},scripts:{index:-1,lineNumbers:false,open:function(_index){with(firebug){d.scripts.index=_index;el.left.scripts.container.update("");var script=document.getElementsByTagName("script")[_index],uri=script.src||document.location.href,source;if(uri.indexOf("http:\/\/")>-1&&getDomain(uri)!=document.domain){el.left.scripts.container.update("<em>Access to restricted URI denied</em>");return}if(uri!=document.location.href){source=env.cache[uri]||pi.xhr.get(uri).responseText;env.cache[uri]=source}else source=script.innerHTML;source=source.replace(/\n|\t|<|>/g,function(_ch){return({"<":"<",">":">","\t":" ","\n":"<br />"})[_ch]});if(!d.scripts.lineNumbers)el.left.scripts.container.child.add(new pi.element("DIV").attribute.addClass("CodeContainer").update(source));else{source=source.split("<br />");for(var i=0;i<source.length;i++){el.left.scripts.container.child.add(new pi.element("DIV").child.add(new pi.element("DIV").attribute.addClass("LineNumber").update(i+1),new pi.element("DIV").attribute.addClass("Code").update(" "+source[i]),new pi.element("DIV").environment.addStyle({"clear":"both"})))}}}},toggleLineNumbers:function(){with(firebug){d.scripts.lineNumbers=!d.scripts.lineNumbers;el.button.scripts.lineNumbers.attribute[(d.scripts.lineNumbers?"add":"remove")+"Class"]("Enabled");d.scripts.open(d.scripts.index)}},refresh:function(){with(firebug){el.button.scripts.selectbox.clean();var collection=document.getElementsByTagName("script");for(var i=0;i<collection.length;i++){var item=collection[i];d.scripts.index=d.scripts.index<0?i:d.scripts.index;el.button.scripts.selectbox.child.add(new pi.element("OPTION").attribute.set("value",i).update(item.src||item.baseURI||".."))}d.scripts.open(d.scripts.index)}}},str:{open:function(_str){with(firebug){d.navigate("str");el.left.str.container.update(_str.replace(/\n/g,"<br />"))}}},xhr:{objects:[],addObject:function(){with(firebug){for(var i=0;i<arguments.length;i++){try{var item=arguments[i];var val=eval(item);d.xhr.objects.push([item,val])}catch(e){continue}}}},open:function(){with(firebug){el.left.xhr.container.update("");el.left.xhr.name=new pi.element("DIV").attribute.addClass("BlockContent").insert(new pi.element("DIV").attribute.addClass("Block").environment.addStyle({"width":"20%"}).insert(el.left.xhr.container));el.left.xhr.nameTitle=new pi.element("STRONG").update("Object Name:").insert(el.left.xhr.name);el.left.xhr.nameContent=new pi.element("DIV").insert(el.left.xhr.name);el.left.xhr.status=new pi.element("DIV").attribute.addClass("BlockContent").insert(new pi.element("DIV").attribute.addClass("Block").environment.addStyle({"width":"10%"}).insert(el.left.xhr.container));el.left.xhr.statusTitle=new pi.element("STRONG").update("Status:").insert(el.left.xhr.status);el.left.xhr.statusContent=new pi.element("DIV").insert(el.left.xhr.status);el.left.xhr.readystate=new pi.element("DIV").attribute.addClass("BlockContent").insert(new pi.element("DIV").environment.addStyle({"width":"15%"}).attribute.addClass("Block").insert(el.left.xhr.container));el.left.xhr.readystateTitle=el.left.xhr.nameTitle=new pi.element("STRONG").update("Ready State:").insert(el.left.xhr.readystate);el.left.xhr.readystateContent=new pi.element("DIV").insert(el.left.xhr.readystate);el.left.xhr.response=new pi.element("DIV").attribute.addClass("BlockContent").insert(new pi.element("DIV").environment.addStyle({"width":(pi.env.ie?"50":"55")+"%"}).attribute.addClass("Block").insert(el.left.xhr.container));el.left.xhr.responseTitle=new pi.element("STRONG").update("Response:").insert(el.left.xhr.response);el.left.xhr.responseContent=new pi.element("DIV").insert(el.left.xhr.response);setTimeout(d.xhr.refresh,500)}},refresh:function(){with(firebug){el.left.xhr.nameContent.update("");el.left.xhr.statusContent.update("");el.left.xhr.readystateContent.update("");el.left.xhr.responseContent.update("");for(var i=0;i<d.xhr.objects.length;i++){var item=d.xhr.objects[i];var response=item[1].responseText;if(Boolean(item[1])==false)continue;el.left.xhr.nameContent.child.add(new pi.element("span").update(item[0]));try{el.left.xhr.statusContent.child.add(new pi.element("span").update(item[1].status))}catch(e){el.left.xhr.statusContent.child.add(new pi.element("span").update(" "))}el.left.xhr.readystateContent.child.add(new pi.element("span").update(item[1].readyState));el.left.xhr.responseContent.child.add(new pi.element("span").child.add(new pi.element("A").event.addListener("click",d.str.open.curry(window,response)).update(" "+response.substring(0,50))))};if(env.dIndex=="xhr")setTimeout(d.xhr.refresh,500)}}},navigateRightColumn:function(_index,_open){with(firebug){el.left.container.environment.addStyle({"width":_open?"70%":"100%"});el.right.container.environment.addStyle({"display":_open?"block":"none"})}},navigate:function(_index){with(firebug){var open=_index,close=env.dIndex;env.dIndex=open;el.button[close].container.environment.addStyle({"display":"none"});el.left[close].container.environment.addStyle({"display":"none"});el.right[close].container.environment.addStyle({"display":"none"});el.button[open].container.environment.addStyle({"display":"inline"});el.left[open].container.environment.addStyle({"display":"block"});el.right[open].container.environment.addStyle({"display":"block"});if(el.nav[close])el.nav[close].attribute.removeClass("Selected");if(el.nav[open])el.nav[open].attribute.addClass("Selected");switch(open){case"console":d.navigateRightColumn(_index);break;case"html":d.navigateRightColumn(_index,true);d.html.openHtmlTree();break;case"css":d.navigateRightColumn(_index,true);d.css.refresh();break;case"scripts":d.navigateRightColumn(_index);d.scripts.refresh();break;case"dom":d.navigateRightColumn(_index);if(el.left.dom.container.environment.getElement().innerHTML=="")d.dom.open(eval(el.button.dom.textbox.environment.getElement().value),el.left.dom.container);break;case"xhr":d.navigateRightColumn(_index);d.xhr.open();break}}},refreshSize:function(){with(firebug){el.main.environment.addStyle({"width":pi.util.GetWindowSize().width+"px"});if(pi.env.ie6)el.main.environment.addStyle({"top":pi.util.GetWindowSize().height-el.main.environment.getSize().offsetHeight+"px"})}}},getDomain:function(_url){return _url.match(/http:\/\/(www.)?([\.\w]+)/)[2]},listen:{addXhrObject:function(){with(firebug){d.xhr.addObject.apply(window,el.button.xhr.textbox.environment.getElement().value.split(","))}},consoleTextbox:function(_event){with(firebug){if(_event.keyCode==13&&(env.multilinemode==false||_event.shiftKey==false)){d.console.historyIndex=d.console.history.length;d.console.run(el.left.console.input.environment.getElement().value);return false}if([13,38,40].indexOf(_event.keyCode)==-1)return;d.console.historyIndex+=_event.keyCode!=40?0:d.console.historyIndex==d.console.history.length?0:1;d.console.historyIndex-=_event.keyCode!=38?0:d.console.historyIndex==0?0:1;el.left.console.input.update(d.console.history.length>d.console.historyIndex?d.console.history[d.console.historyIndex]:"")}},cssSelectbox:function(){with(firebug){d.css.open(el.button.css.selectbox.environment.getElement().selectedIndex)}},domTextbox:function(_event){with(firebug){if(_event.keyCode==13){d.dom.open(eval(el.button.dom.textbox.environment.getElement().value),el.left.dom.container)}}},inspector:function(){with(firebug){d.html.inspect(d.inspector.el)}},keyboard:function(_event){with(firebug){if(_event.keyCode==27&&d.inspector.enabled)d.inspector.toggle()}},mouse:function(_event){with(firebug){var target=_event[pi.env.ie?"srcElement":"target"];if(d.inspector.enabled&&target!=document.body&&target!=document.firstChild&&target!=document.childNodes[1]&&target!=el.borderInspector.environment.getElement()&&target!=el.main.environment.getElement()&&target.offsetParent!=el.main.environment.getElement())d.inspector.inspect(target)}},runMultiline:function(){with(firebug){d.console.run.call(window,el.right.console.input.environment.getElement().value)}},runCSS:function(){with(firebug){var source=el.right.css.input.environment.getElement().value.replace(/\n|\t/g,"").split("}");for(var i=0;i<source.length;i++){var item=source[i]+"}",rule=!pi.env.ie?item:item.split(/{|}/),collection=document.getElementsByTagName("style"),style=collection.length>0?collection[0]:document.body.appendChild(document.createElement("style"));if(!item.match(/.+\{.+\}/))continue;if(pi.env.ie)style.styleSheet.addRule(rule[0],rule[1]);else style.sheet.insertRule(rule,style.sheet.cssRules.length)}}},scriptsSelectbox:function(){with(firebug){d.scripts.open(parseInt(el.button.scripts.selectbox.environment.getElement().value))}},xhrTextbox:function(_event){with(firebug){if(_event.keyCode==13){d.xhr.addObject.apply(window,el.button.xhr.textbox.environment.getElement().value.split(","))}}}}};window.console=firebug.d.console;pi.util.AddEvent(window,"resize",firebug.d.refreshSize);pi.util.AddEvent(document,"mousemove",firebug.listen.mouse);pi.util.AddEvent(document,"keydown",firebug.listen.keyboard);pi.util.DOMContentLoaded.push(firebug.init);
\ No newline at end of file
+++ /dev/null
-(function(){
-/*
- * jQuery 1.2.6 - New Wave Javascript
- *
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
- * $Rev: 5685 $
- */
-
-// Map over jQuery in case of overwrite
-var _jQuery = window.jQuery,
-// Map over the $ in case of overwrite
- _$ = window.$;
-
-var jQuery = window.jQuery = window.$ = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.fn.init( selector, context );
-};
-
-// A simple way to check for HTML strings or ID strings
-// (both of which we optimize for)
-var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
-
-// Is it a simple selector
- isSimple = /^.[^:#\[\.]*$/,
-
-// Will speed up references to undefined, and allows munging its name.
- undefined;
-
-jQuery.fn = jQuery.prototype = {
- init: function( selector, context ) {
- // Make sure that a selection was provided
- selector = selector || document;
-
- // Handle $(DOMElement)
- if ( selector.nodeType ) {
- this[0] = selector;
- this.length = 1;
- return this;
- }
- // Handle HTML strings
- if ( typeof selector == "string" ) {
- // Are we dealing with HTML string or an ID?
- var match = quickExpr.exec( selector );
-
- // Verify a match, and that no context was specified for #id
- if ( match && (match[1] || !context) ) {
-
- // HANDLE: $(html) -> $(array)
- if ( match[1] )
- selector = jQuery.clean( [ match[1] ], context );
-
- // HANDLE: $("#id")
- else {
- var elem = document.getElementById( match[3] );
-
- // Make sure an element was located
- if ( elem ){
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id != match[3] )
- return jQuery().find( selector );
-
- // Otherwise, we inject the element directly into the jQuery object
- return jQuery( elem );
- }
- selector = [];
- }
-
- // HANDLE: $(expr, [context])
- // (which is just equivalent to: $(content).find(expr)
- } else
- return jQuery( context ).find( selector );
-
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) )
- return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
-
- return this.setArray(jQuery.makeArray(selector));
- },
-
- // The current version of jQuery being used
- jquery: "1.2.6",
-
- // The number of elements contained in the matched element set
- size: function() {
- return this.length;
- },
-
- // The number of elements contained in the matched element set
- length: 0,
-
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function( num ) {
- return num == undefined ?
-
- // Return a 'clean' array
- jQuery.makeArray( this ) :
-
- // Return just the object
- this[ num ];
- },
-
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function( elems ) {
- // Build a new jQuery matched element set
- var ret = jQuery( elems );
-
- // Add the old object onto the stack (as a reference)
- ret.prevObject = this;
-
- // Return the newly-formed element set
- return ret;
- },
-
- // Force the current matched set of elements to become
- // the specified array of elements (destroying the stack in the process)
- // You should use pushStack() in order to do this, but maintain the stack
- setArray: function( elems ) {
- // Resetting the length to 0, then using the native Array push
- // is a super-fast way to populate an object with array-like properties
- this.length = 0;
- Array.prototype.push.apply( this, elems );
-
- return this;
- },
-
- // Execute a callback for every element in the matched set.
- // (You can seed the arguments with an array of args, but this is
- // only used internally.)
- each: function( callback, args ) {
- return jQuery.each( this, callback, args );
- },
-
- // Determine the position of an element within
- // the matched set of elements
- index: function( elem ) {
- var ret = -1;
-
- // Locate the position of the desired element
- return jQuery.inArray(
- // If it receives a jQuery object, the first element is used
- elem && elem.jquery ? elem[0] : elem
- , this );
- },
-
- attr: function( name, value, type ) {
- var options = name;
-
- // Look for the case where we're accessing a style value
- if ( name.constructor == String )
- if ( value === undefined )
- return this[0] && jQuery[ type || "attr" ]( this[0], name );
-
- else {
- options = {};
- options[ name ] = value;
- }
-
- // Check to see if we're setting style values
- return this.each(function(i){
- // Set all the styles
- for ( name in options )
- jQuery.attr(
- type ?
- this.style :
- this,
- name, jQuery.prop( this, options[ name ], type, i, name )
- );
- });
- },
-
- css: function( key, value ) {
- // ignore negative width and height values
- if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
- value = undefined;
- return this.attr( key, value, "curCSS" );
- },
-
- text: function( text ) {
- if ( typeof text != "object" && text != null )
- return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
-
- var ret = "";
-
- jQuery.each( text || this, function(){
- jQuery.each( this.childNodes, function(){
- if ( this.nodeType != 8 )
- ret += this.nodeType != 1 ?
- this.nodeValue :
- jQuery.fn.text( [ this ] );
- });
- });
-
- return ret;
- },
-
- wrapAll: function( html ) {
- if ( this[0] )
- // The elements to wrap the target around
- jQuery( html, this[0].ownerDocument )
- .clone()
- .insertBefore( this[0] )
- .map(function(){
- var elem = this;
-
- while ( elem.firstChild )
- elem = elem.firstChild;
-
- return elem;
- })
- .append(this);
-
- return this;
- },
-
- wrapInner: function( html ) {
- return this.each(function(){
- jQuery( this ).contents().wrapAll( html );
- });
- },
-
- wrap: function( html ) {
- return this.each(function(){
- jQuery( this ).wrapAll( html );
- });
- },
-
- append: function() {
- return this.domManip(arguments, true, false, function(elem){
- if (this.nodeType == 1)
- this.appendChild( elem );
- });
- },
-
- prepend: function() {
- return this.domManip(arguments, true, true, function(elem){
- if (this.nodeType == 1)
- this.insertBefore( elem, this.firstChild );
- });
- },
-
- before: function() {
- return this.domManip(arguments, false, false, function(elem){
- this.parentNode.insertBefore( elem, this );
- });
- },
-
- after: function() {
- return this.domManip(arguments, false, true, function(elem){
- this.parentNode.insertBefore( elem, this.nextSibling );
- });
- },
-
- end: function() {
- return this.prevObject || jQuery( [] );
- },
-
- find: function( selector ) {
- var elems = jQuery.map(this, function(elem){
- return jQuery.find( selector, elem );
- });
-
- return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
- jQuery.unique( elems ) :
- elems );
- },
-
- clone: function( events ) {
- // Do the clone
- var ret = this.map(function(){
- if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
- // IE copies events bound via attachEvent when
- // using cloneNode. Calling detachEvent on the
- // clone will also remove the events from the orignal
- // In order to get around this, we use innerHTML.
- // Unfortunately, this means some modifications to
- // attributes in IE that are actually only stored
- // as properties will not be copied (such as the
- // the name attribute on an input).
- var clone = this.cloneNode(true),
- container = document.createElement("div");
- container.appendChild(clone);
- return jQuery.clean([container.innerHTML])[0];
- } else
- return this.cloneNode(true);
- });
-
- // Need to set the expando to null on the cloned set if it exists
- // removeData doesn't work here, IE removes it from the original as well
- // this is primarily for IE but the data expando shouldn't be copied over in any browser
- var clone = ret.find("*").andSelf().each(function(){
- if ( this[ expando ] != undefined )
- this[ expando ] = null;
- });
-
- // Copy the events from the original to the clone
- if ( events === true )
- this.find("*").andSelf().each(function(i){
- if (this.nodeType == 3)
- return;
- var events = jQuery.data( this, "events" );
-
- for ( var type in events )
- for ( var handler in events[ type ] )
- jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
- });
-
- // Return the cloned set
- return ret;
- },
-
- filter: function( selector ) {
- return this.pushStack(
- jQuery.isFunction( selector ) &&
- jQuery.grep(this, function(elem, i){
- return selector.call( elem, i );
- }) ||
-
- jQuery.multiFilter( selector, this ) );
- },
-
- not: function( selector ) {
- if ( selector.constructor == String )
- // test special case where just one selector is passed in
- if ( isSimple.test( selector ) )
- return this.pushStack( jQuery.multiFilter( selector, this, true ) );
- else
- selector = jQuery.multiFilter( selector, this );
-
- var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
- return this.filter(function() {
- return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
- });
- },
-
- add: function( selector ) {
- return this.pushStack( jQuery.unique( jQuery.merge(
- this.get(),
- typeof selector == 'string' ?
- jQuery( selector ) :
- jQuery.makeArray( selector )
- )));
- },
-
- is: function( selector ) {
- return !!selector && jQuery.multiFilter( selector, this ).length > 0;
- },
-
- hasClass: function( selector ) {
- return this.is( "." + selector );
- },
-
- val: function( value ) {
- if ( value == undefined ) {
-
- if ( this.length ) {
- var elem = this[0];
-
- // We need to handle select boxes special
- if ( jQuery.nodeName( elem, "select" ) ) {
- var index = elem.selectedIndex,
- values = [],
- options = elem.options,
- one = elem.type == "select-one";
-
- // Nothing was selected
- if ( index < 0 )
- return null;
-
- // Loop through all the selected options
- for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
- var option = options[ i ];
-
- if ( option.selected ) {
- // Get the specifc value for the option
- value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
-
- // We don't need an array for one selects
- if ( one )
- return value;
-
- // Multi-Selects return an array
- values.push( value );
- }
- }
-
- return values;
-
- // Everything else, we just grab the value
- } else
- return (this[0].value || "").replace(/\r/g, "");
-
- }
-
- return undefined;
- }
-
- if( value.constructor == Number )
- value += '';
-
- return this.each(function(){
- if ( this.nodeType != 1 )
- return;
-
- if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
- this.checked = (jQuery.inArray(this.value, value) >= 0 ||
- jQuery.inArray(this.name, value) >= 0);
-
- else if ( jQuery.nodeName( this, "select" ) ) {
- var values = jQuery.makeArray(value);
-
- jQuery( "option", this ).each(function(){
- this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
- jQuery.inArray( this.text, values ) >= 0);
- });
-
- if ( !values.length )
- this.selectedIndex = -1;
-
- } else
- this.value = value;
- });
- },
-
- html: function( value ) {
- return value == undefined ?
- (this[0] ?
- this[0].innerHTML :
- null) :
- this.empty().append( value );
- },
-
- replaceWith: function( value ) {
- return this.after( value ).remove();
- },
-
- eq: function( i ) {
- return this.slice( i, i + 1 );
- },
-
- slice: function() {
- return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
- },
-
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function(elem, i){
- return callback.call( elem, i, elem );
- }));
- },
-
- andSelf: function() {
- return this.add( this.prevObject );
- },
-
- data: function( key, value ){
- var parts = key.split(".");
- parts[1] = parts[1] ? "." + parts[1] : "";
-
- if ( value === undefined ) {
- var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
-
- if ( data === undefined && this.length )
- data = jQuery.data( this[0], key );
-
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
- } else
- return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
- jQuery.data( this, key, value );
- });
- },
-
- removeData: function( key ){
- return this.each(function(){
- jQuery.removeData( this, key );
- });
- },
-
- domManip: function( args, table, reverse, callback ) {
- var clone = this.length > 1, elems;
-
- return this.each(function(){
- if ( !elems ) {
- elems = jQuery.clean( args, this.ownerDocument );
-
- if ( reverse )
- elems.reverse();
- }
-
- var obj = this;
-
- if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
- obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
-
- var scripts = jQuery( [] );
-
- jQuery.each(elems, function(){
- var elem = clone ?
- jQuery( this ).clone( true )[0] :
- this;
-
- // execute all scripts after the elements have been injected
- if ( jQuery.nodeName( elem, "script" ) )
- scripts = scripts.add( elem );
- else {
- // Remove any inner scripts for later evaluation
- if ( elem.nodeType == 1 )
- scripts = scripts.add( jQuery( "script", elem ).remove() );
-
- // Inject the elements into the document
- callback.call( obj, elem );
- }
- });
-
- scripts.each( evalScript );
- });
- }
-};
-
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
-
-function evalScript( i, elem ) {
- if ( elem.src )
- jQuery.ajax({
- url: elem.src,
- async: false,
- dataType: "script"
- });
-
- else
- jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
-
- if ( elem.parentNode )
- elem.parentNode.removeChild( elem );
-}
-
-function now(){
- return +new Date;
-}
-
-jQuery.extend = jQuery.fn.extend = function() {
- // copy reference to target object
- var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
-
- // Handle a deep copy situation
- if ( target.constructor == Boolean ) {
- deep = target;
- target = arguments[1] || {};
- // skip the boolean and the target
- i = 2;
- }
-
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target != "object" && typeof target != "function" )
- target = {};
-
- // extend jQuery itself if only one argument is passed
- if ( length == i ) {
- target = this;
- --i;
- }
-
- for ( ; i < length; i++ )
- // Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null )
- // Extend the base object
- for ( var name in options ) {
- var src = target[ name ], copy = options[ name ];
-
- // Prevent never-ending loop
- if ( target === copy )
- continue;
-
- // Recurse if we're merging object values
- if ( deep && copy && typeof copy == "object" && !copy.nodeType )
- target[ name ] = jQuery.extend( deep,
- // Never move original objects, clone them
- src || ( copy.length != null ? [ ] : { } )
- , copy );
-
- // Don't bring in undefined values
- else if ( copy !== undefined )
- target[ name ] = copy;
-
- }
-
- // Return the modified object
- return target;
-};
-
-var expando = "jQuery" + now(), uuid = 0, windowData = {},
- // exclude the following css properties to add px
- exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
- // cache defaultView
- defaultView = document.defaultView || {};
-
-jQuery.extend({
- noConflict: function( deep ) {
- window.$ = _$;
-
- if ( deep )
- window.jQuery = _jQuery;
-
- return jQuery;
- },
-
- // See test/unit/core.js for details concerning this function.
- isFunction: function( fn ) {
- return !!fn && typeof fn != "string" && !fn.nodeName &&
- fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
- },
-
- // check if an element is in a (or is an) XML document
- isXMLDoc: function( elem ) {
- return elem.documentElement && !elem.body ||
- elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
- },
-
- // Evalulates a script in a global context
- globalEval: function( data ) {
- data = jQuery.trim( data );
-
- if ( data ) {
- // Inspired by code by Andrea Giammarchi
- // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
- var head = document.getElementsByTagName("head")[0] || document.documentElement,
- script = document.createElement("script");
-
- script.type = "text/javascript";
- if ( jQuery.browser.msie )
- script.text = data;
- else
- script.appendChild( document.createTextNode( data ) );
-
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
- // This arises when a base node is used (#2709).
- head.insertBefore( script, head.firstChild );
- head.removeChild( script );
- }
- },
-
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
- },
-
- cache: {},
-
- data: function( elem, name, data ) {
- elem = elem == window ?
- windowData :
- elem;
-
- var id = elem[ expando ];
-
- // Compute a unique ID for the element
- if ( !id )
- id = elem[ expando ] = ++uuid;
-
- // Only generate the data cache if we're
- // trying to access or manipulate it
- if ( name && !jQuery.cache[ id ] )
- jQuery.cache[ id ] = {};
-
- // Prevent overriding the named cache with undefined values
- if ( data !== undefined )
- jQuery.cache[ id ][ name ] = data;
-
- // Return the named cache data, or the ID for the element
- return name ?
- jQuery.cache[ id ][ name ] :
- id;
- },
-
- removeData: function( elem, name ) {
- elem = elem == window ?
- windowData :
- elem;
-
- var id = elem[ expando ];
-
- // If we want to remove a specific section of the element's data
- if ( name ) {
- if ( jQuery.cache[ id ] ) {
- // Remove the section of cache data
- delete jQuery.cache[ id ][ name ];
-
- // If we've removed all the data, remove the element's cache
- name = "";
-
- for ( name in jQuery.cache[ id ] )
- break;
-
- if ( !name )
- jQuery.removeData( elem );
- }
-
- // Otherwise, we want to remove all of the element's data
- } else {
- // Clean up the element expando
- try {
- delete elem[ expando ];
- } catch(e){
- // IE has trouble directly removing the expando
- // but it's ok with using removeAttribute
- if ( elem.removeAttribute )
- elem.removeAttribute( expando );
- }
-
- // Completely remove the data cache
- delete jQuery.cache[ id ];
- }
- },
-
- // args is for internal usage only
- each: function( object, callback, args ) {
- var name, i = 0, length = object.length;
-
- if ( args ) {
- if ( length == undefined ) {
- for ( name in object )
- if ( callback.apply( object[ name ], args ) === false )
- break;
- } else
- for ( ; i < length; )
- if ( callback.apply( object[ i++ ], args ) === false )
- break;
-
- // A special, fast, case for the most common use of each
- } else {
- if ( length == undefined ) {
- for ( name in object )
- if ( callback.call( object[ name ], name, object[ name ] ) === false )
- break;
- } else
- for ( var value = object[0];
- i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
- }
-
- return object;
- },
-
- prop: function( elem, value, type, i, name ) {
- // Handle executable functions
- if ( jQuery.isFunction( value ) )
- value = value.call( elem, i );
-
- // Handle passing in a number to a CSS property
- return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
- value + "px" :
- value;
- },
-
- className: {
- // internal only, use addClass("class")
- add: function( elem, classNames ) {
- jQuery.each((classNames || "").split(/\s+/), function(i, className){
- if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
- elem.className += (elem.className ? " " : "") + className;
- });
- },
-
- // internal only, use removeClass("class")
- remove: function( elem, classNames ) {
- if (elem.nodeType == 1)
- elem.className = classNames != undefined ?
- jQuery.grep(elem.className.split(/\s+/), function(className){
- return !jQuery.className.has( classNames, className );
- }).join(" ") :
- "";
- },
-
- // internal only, use hasClass("class")
- has: function( elem, className ) {
- return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
- }
- },
-
- // A method for quickly swapping in/out CSS properties to get correct calculations
- swap: function( elem, options, callback ) {
- var old = {};
- // Remember the old values, and insert the new ones
- for ( var name in options ) {
- old[ name ] = elem.style[ name ];
- elem.style[ name ] = options[ name ];
- }
-
- callback.call( elem );
-
- // Revert the old values
- for ( var name in options )
- elem.style[ name ] = old[ name ];
- },
-
- css: function( elem, name, force ) {
- if ( name == "width" || name == "height" ) {
- var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
-
- function getWH() {
- val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
- var padding = 0, border = 0;
- jQuery.each( which, function() {
- padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
- border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
- });
- val -= Math.round(padding + border);
- }
-
- if ( jQuery(elem).is(":visible") )
- getWH();
- else
- jQuery.swap( elem, props, getWH );
-
- return Math.max(0, val);
- }
-
- return jQuery.curCSS( elem, name, force );
- },
-
- curCSS: function( elem, name, force ) {
- var ret, style = elem.style;
-
- // A helper method for determining if an element's values are broken
- function color( elem ) {
- if ( !jQuery.browser.safari )
- return false;
-
- // defaultView is cached
- var ret = defaultView.getComputedStyle( elem, null );
- return !ret || ret.getPropertyValue("color") == "";
- }
-
- // We need to handle opacity special in IE
- if ( name == "opacity" && jQuery.browser.msie ) {
- ret = jQuery.attr( style, "opacity" );
-
- return ret == "" ?
- "1" :
- ret;
- }
- // Opera sometimes will give the wrong display answer, this fixes it, see #2037
- if ( jQuery.browser.opera && name == "display" ) {
- var save = style.outline;
- style.outline = "0 solid black";
- style.outline = save;
- }
-
- // Make sure we're using the right name for getting the float value
- if ( name.match( /float/i ) )
- name = styleFloat;
-
- if ( !force && style && style[ name ] )
- ret = style[ name ];
-
- else if ( defaultView.getComputedStyle ) {
-
- // Only "float" is needed here
- if ( name.match( /float/i ) )
- name = "float";
-
- name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
-
- var computedStyle = defaultView.getComputedStyle( elem, null );
-
- if ( computedStyle && !color( elem ) )
- ret = computedStyle.getPropertyValue( name );
-
- // If the element isn't reporting its values properly in Safari
- // then some display: none elements are involved
- else {
- var swap = [], stack = [], a = elem, i = 0;
-
- // Locate all of the parent display: none elements
- for ( ; a && color(a); a = a.parentNode )
- stack.unshift(a);
-
- // Go through and make them visible, but in reverse
- // (It would be better if we knew the exact display type that they had)
- for ( ; i < stack.length; i++ )
- if ( color( stack[ i ] ) ) {
- swap[ i ] = stack[ i ].style.display;
- stack[ i ].style.display = "block";
- }
-
- // Since we flip the display style, we have to handle that
- // one special, otherwise get the value
- ret = name == "display" && swap[ stack.length - 1 ] != null ?
- "none" :
- ( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
-
- // Finally, revert the display styles back
- for ( i = 0; i < swap.length; i++ )
- if ( swap[ i ] != null )
- stack[ i ].style.display = swap[ i ];
- }
-
- // We should always get a number back from opacity
- if ( name == "opacity" && ret == "" )
- ret = "1";
-
- } else if ( elem.currentStyle ) {
- var camelCase = name.replace(/\-(\w)/g, function(all, letter){
- return letter.toUpperCase();
- });
-
- ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
-
- // From the awesome hack by Dean Edwards
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
-
- // If we're not dealing with a regular pixel number
- // but a number that has a weird ending, we need to convert it to pixels
- if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
- // Remember the original values
- var left = style.left, rsLeft = elem.runtimeStyle.left;
-
- // Put in the new values to get a computed value out
- elem.runtimeStyle.left = elem.currentStyle.left;
- style.left = ret || 0;
- ret = style.pixelLeft + "px";
-
- // Revert the changed values
- style.left = left;
- elem.runtimeStyle.left = rsLeft;
- }
- }
-
- return ret;
- },
-
- clean: function( elems, context ) {
- var ret = [];
- context = context || document;
- // !context.createElement fails in IE with an error but returns typeof 'object'
- if (typeof context.createElement == 'undefined')
- context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
-
- jQuery.each(elems, function(i, elem){
- if ( !elem )
- return;
-
- if ( elem.constructor == Number )
- elem += '';
-
- // Convert html string into DOM nodes
- if ( typeof elem == "string" ) {
- // Fix "XHTML"-style tags in all browsers
- elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
- return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
- all :
- front + "></" + tag + ">";
- });
-
- // Trim whitespace, otherwise indexOf won't work as expected
- var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
-
- var wrap =
- // option or optgroup
- !tags.indexOf("<opt") &&
- [ 1, "<select multiple='multiple'>", "</select>" ] ||
-
- !tags.indexOf("<leg") &&
- [ 1, "<fieldset>", "</fieldset>" ] ||
-
- tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
- [ 1, "<table>", "</table>" ] ||
-
- !tags.indexOf("<tr") &&
- [ 2, "<table><tbody>", "</tbody></table>" ] ||
-
- // <thead> matched above
- (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
- [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
-
- !tags.indexOf("<col") &&
- [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
-
- // IE can't serialize <link> and <script> tags normally
- jQuery.browser.msie &&
- [ 1, "div<div>", "</div>" ] ||
-
- [ 0, "", "" ];
-
- // Go to html and back, then peel off extra wrappers
- div.innerHTML = wrap[1] + elem + wrap[2];
-
- // Move to the right depth
- while ( wrap[0]-- )
- div = div.lastChild;
-
- // Remove IE's autoinserted <tbody> from table fragments
- if ( jQuery.browser.msie ) {
-
- // String was a <table>, *may* have spurious <tbody>
- var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
- div.firstChild && div.firstChild.childNodes :
-
- // String was a bare <thead> or <tfoot>
- wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
- div.childNodes :
- [];
-
- for ( var j = tbody.length - 1; j >= 0 ; --j )
- if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
- tbody[ j ].parentNode.removeChild( tbody[ j ] );
-
- // IE completely kills leading whitespace when innerHTML is used
- if ( /^\s/.test( elem ) )
- div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
-
- }
-
- elem = jQuery.makeArray( div.childNodes );
- }
-
- if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
- return;
-
- if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
- ret.push( elem );
-
- else
- ret = jQuery.merge( ret, elem );
-
- });
-
- return ret;
- },
-
- attr: function( elem, name, value ) {
- // don't set attributes on text and comment nodes
- if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
- return undefined;
-
- var notxml = !jQuery.isXMLDoc( elem ),
- // Whether we are setting (or getting)
- set = value !== undefined,
- msie = jQuery.browser.msie;
-
- // Try to normalize/fix the name
- name = notxml && jQuery.props[ name ] || name;
-
- // Only do all the following if this is a node (faster for style)
- // IE elem.getAttribute passes even for style
- if ( elem.tagName ) {
-
- // These attributes require special treatment
- var special = /href|src|style/.test( name );
-
- // Safari mis-reports the default selected property of a hidden option
- // Accessing the parent's selectedIndex property fixes it
- if ( name == "selected" && jQuery.browser.safari )
- elem.parentNode.selectedIndex;
-
- // If applicable, access the attribute via the DOM 0 way
- if ( name in elem && notxml && !special ) {
- if ( set ){
- // We can't allow the type property to be changed (since it causes problems in IE)
- if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
- throw "type property can't be changed";
-
- elem[ name ] = value;
- }
-
- // browsers index elements by id/name on forms, give priority to attributes.
- if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
- return elem.getAttributeNode( name ).nodeValue;
-
- return elem[ name ];
- }
-
- if ( msie && notxml && name == "style" )
- return jQuery.attr( elem.style, "cssText", value );
-
- if ( set )
- // convert the value to a string (all browsers do this but IE) see #1070
- elem.setAttribute( name, "" + value );
-
- var attr = msie && notxml && special
- // Some attributes require a special call on IE
- ? elem.getAttribute( name, 2 )
- : elem.getAttribute( name );
-
- // Non-existent attributes return null, we normalize to undefined
- return attr === null ? undefined : attr;
- }
-
- // elem is actually elem.style ... set the style
-
- // IE uses filters for opacity
- if ( msie && name == "opacity" ) {
- if ( set ) {
- // IE has trouble with opacity if it does not have layout
- // Force it by setting the zoom level
- elem.zoom = 1;
-
- // Set the alpha filter to set the opacity
- elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
- (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
- }
-
- return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
- (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
- "";
- }
-
- name = name.replace(/-([a-z])/ig, function(all, letter){
- return letter.toUpperCase();
- });
-
- if ( set )
- elem[ name ] = value;
-
- return elem[ name ];
- },
-
- trim: function( text ) {
- return (text || "").replace( /^\s+|\s+$/g, "" );
- },
-
- makeArray: function( array ) {
- var ret = [];
-
- if( array != null ){
- var i = array.length;
- //the window, strings and functions also have 'length'
- if( i == null || array.split || array.setInterval || array.call )
- ret[0] = array;
- else
- while( i )
- ret[--i] = array[i];
- }
-
- return ret;
- },
-
- inArray: function( elem, array ) {
- for ( var i = 0, length = array.length; i < length; i++ )
- // Use === because on IE, window == document
- if ( array[ i ] === elem )
- return i;
-
- return -1;
- },
-
- merge: function( first, second ) {
- // We have to loop this way because IE & Opera overwrite the length
- // expando of getElementsByTagName
- var i = 0, elem, pos = first.length;
- // Also, we need to make sure that the correct elements are being returned
- // (IE returns comment nodes in a '*' query)
- if ( jQuery.browser.msie ) {
- while ( elem = second[ i++ ] )
- if ( elem.nodeType != 8 )
- first[ pos++ ] = elem;
-
- } else
- while ( elem = second[ i++ ] )
- first[ pos++ ] = elem;
-
- return first;
- },
-
- unique: function( array ) {
- var ret = [], done = {};
-
- try {
-
- for ( var i = 0, length = array.length; i < length; i++ ) {
- var id = jQuery.data( array[ i ] );
-
- if ( !done[ id ] ) {
- done[ id ] = true;
- ret.push( array[ i ] );
- }
- }
-
- } catch( e ) {
- ret = array;
- }
-
- return ret;
- },
-
- grep: function( elems, callback, inv ) {
- var ret = [];
-
- // Go through the array, only saving the items
- // that pass the validator function
- for ( var i = 0, length = elems.length; i < length; i++ )
- if ( !inv != !callback( elems[ i ], i ) )
- ret.push( elems[ i ] );
-
- return ret;
- },
-
- map: function( elems, callback ) {
- var ret = [];
-
- // Go through the array, translating each of the items to their
- // new value (or values).
- for ( var i = 0, length = elems.length; i < length; i++ ) {
- var value = callback( elems[ i ], i );
-
- if ( value != null )
- ret[ ret.length ] = value;
- }
-
- return ret.concat.apply( [], ret );
- }
-});
-
-var userAgent = navigator.userAgent.toLowerCase();
-
-// Figure out what browser is being used
-jQuery.browser = {
- version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
- safari: /webkit/.test( userAgent ),
- opera: /opera/.test( userAgent ),
- msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
- mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
-};
-
-var styleFloat = jQuery.browser.msie ?
- "styleFloat" :
- "cssFloat";
-
-jQuery.extend({
- // Check to see if the W3C box model is being used
- boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
-
- props: {
- "for": "htmlFor",
- "class": "className",
- "float": styleFloat,
- cssFloat: styleFloat,
- styleFloat: styleFloat,
- readonly: "readOnly",
- maxlength: "maxLength",
- cellspacing: "cellSpacing"
- }
-});
-
-jQuery.each({
- parent: function(elem){return elem.parentNode;},
- parents: function(elem){return jQuery.dir(elem,"parentNode");},
- next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
- prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
- nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
- prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
- siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
- children: function(elem){return jQuery.sibling(elem.firstChild);},
- contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
-}, function(name, fn){
- jQuery.fn[ name ] = function( selector ) {
- var ret = jQuery.map( this, fn );
-
- if ( selector && typeof selector == "string" )
- ret = jQuery.multiFilter( selector, ret );
-
- return this.pushStack( jQuery.unique( ret ) );
- };
-});
-
-jQuery.each({
- appendTo: "append",
- prependTo: "prepend",
- insertBefore: "before",
- insertAfter: "after",
- replaceAll: "replaceWith"
-}, function(name, original){
- jQuery.fn[ name ] = function() {
- var args = arguments;
-
- return this.each(function(){
- for ( var i = 0, length = args.length; i < length; i++ )
- jQuery( args[ i ] )[ original ]( this );
- });
- };
-});
-
-jQuery.each({
- removeAttr: function( name ) {
- jQuery.attr( this, name, "" );
- if (this.nodeType == 1)
- this.removeAttribute( name );
- },
-
- addClass: function( classNames ) {
- jQuery.className.add( this, classNames );
- },
-
- removeClass: function( classNames ) {
- jQuery.className.remove( this, classNames );
- },
-
- toggleClass: function( classNames ) {
- jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
- },
-
- remove: function( selector ) {
- if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
- // Prevent memory leaks
- jQuery( "*", this ).add(this).each(function(){
- jQuery.event.remove(this);
- jQuery.removeData(this);
- });
- if (this.parentNode)
- this.parentNode.removeChild( this );
- }
- },
-
- empty: function() {
- // Remove element nodes and prevent memory leaks
- jQuery( ">*", this ).remove();
-
- // Remove any remaining nodes
- while ( this.firstChild )
- this.removeChild( this.firstChild );
- }
-}, function(name, fn){
- jQuery.fn[ name ] = function(){
- return this.each( fn, arguments );
- };
-});
-
-jQuery.each([ "Height", "Width" ], function(i, name){
- var type = name.toLowerCase();
-
- jQuery.fn[ type ] = function( size ) {
- // Get window width or height
- return this[0] == window ?
- // Opera reports document.body.client[Width/Height] properly in both quirks and standards
- jQuery.browser.opera && document.body[ "client" + name ] ||
-
- // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
- jQuery.browser.safari && window[ "inner" + name ] ||
-
- // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
- document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
-
- // Get document width or height
- this[0] == document ?
- // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
- Math.max(
- Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
- Math.max(document.body["offset" + name], document.documentElement["offset" + name])
- ) :
-
- // Get or set width or height on the element
- size == undefined ?
- // Get width or height on the element
- (this.length ? jQuery.css( this[0], type ) : null) :
-
- // Set the width or height on the element (default to pixels if value is unitless)
- this.css( type, size.constructor == String ? size : size + "px" );
- };
-});
-
-// Helper function used by the dimensions and offset modules
-function num(elem, prop) {
- return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
-}var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
- "(?:[\\w*_-]|\\\\.)" :
- "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
- quickChild = new RegExp("^>\\s*(" + chars + "+)"),
- quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
- quickClass = new RegExp("^([#.]?)(" + chars + "*)");
-
-jQuery.extend({
- expr: {
- "": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
- "#": function(a,i,m){return a.getAttribute("id")==m[2];},
- ":": {
- // Position Checks
- lt: function(a,i,m){return i<m[3]-0;},
- gt: function(a,i,m){return i>m[3]-0;},
- nth: function(a,i,m){return m[3]-0==i;},
- eq: function(a,i,m){return m[3]-0==i;},
- first: function(a,i){return i==0;},
- last: function(a,i,m,r){return i==r.length-1;},
- even: function(a,i){return i%2==0;},
- odd: function(a,i){return i%2;},
-
- // Child Checks
- "first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
- "last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
- "only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},
-
- // Parent Checks
- parent: function(a){return a.firstChild;},
- empty: function(a){return !a.firstChild;},
-
- // Text Check
- contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},
-
- // Visibility
- visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
- hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},
-
- // Form attributes
- enabled: function(a){return !a.disabled;},
- disabled: function(a){return a.disabled;},
- checked: function(a){return a.checked;},
- selected: function(a){return a.selected||jQuery.attr(a,"selected");},
-
- // Form elements
- text: function(a){return "text"==a.type;},
- radio: function(a){return "radio"==a.type;},
- checkbox: function(a){return "checkbox"==a.type;},
- file: function(a){return "file"==a.type;},
- password: function(a){return "password"==a.type;},
- submit: function(a){return "submit"==a.type;},
- image: function(a){return "image"==a.type;},
- reset: function(a){return "reset"==a.type;},
- button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
- input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},
-
- // :has()
- has: function(a,i,m){return jQuery.find(m[3],a).length;},
-
- // :header
- header: function(a){return /h\d/i.test(a.nodeName);},
-
- // :animated
- animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
- }
- },
-
- // The regular expressions that power the parsing engine
- parse: [
- // Match: [@value='test'], [@foo]
- /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
-
- // Match: :contains('foo')
- /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
-
- // Match: :even, :last-child, #id, .class
- new RegExp("^([:.#]*)(" + chars + "+)")
- ],
-
- multiFilter: function( expr, elems, not ) {
- var old, cur = [];
-
- while ( expr && expr != old ) {
- old = expr;
- var f = jQuery.filter( expr, elems, not );
- expr = f.t.replace(/^\s*,\s*/, "" );
- cur = not ? elems = f.r : jQuery.merge( cur, f.r );
- }
-
- return cur;
- },
-
- find: function( t, context ) {
- // Quickly handle non-string expressions
- if ( typeof t != "string" )
- return [ t ];
-
- // check to make sure context is a DOM element or a document
- if ( context && context.nodeType != 1 && context.nodeType != 9)
- return [ ];
-
- // Set the correct context (if none is provided)
- context = context || document;
-
- // Initialize the search
- var ret = [context], done = [], last, nodeName;
-
- // Continue while a selector expression exists, and while
- // we're no longer looping upon ourselves
- while ( t && last != t ) {
- var r = [];
- last = t;
-
- t = jQuery.trim(t);
-
- var foundToken = false,
-
- // An attempt at speeding up child selectors that
- // point to a specific element tag
- re = quickChild,
-
- m = re.exec(t);
-
- if ( m ) {
- nodeName = m[1].toUpperCase();
-
- // Perform our own iteration and filter
- for ( var i = 0; ret[i]; i++ )
- for ( var c = ret[i].firstChild; c; c = c.nextSibling )
- if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
- r.push( c );
-
- ret = r;
- t = t.replace( re, "" );
- if ( t.indexOf(" ") == 0 ) continue;
- foundToken = true;
- } else {
- re = /^([>+~])\s*(\w*)/i;
-
- if ( (m = re.exec(t)) != null ) {
- r = [];
-
- var merge = {};
- nodeName = m[2].toUpperCase();
- m = m[1];
-
- for ( var j = 0, rl = ret.length; j < rl; j++ ) {
- var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
- for ( ; n; n = n.nextSibling )
- if ( n.nodeType == 1 ) {
- var id = jQuery.data(n);
-
- if ( m == "~" && merge[id] ) break;
-
- if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
- if ( m == "~" ) merge[id] = true;
- r.push( n );
- }
-
- if ( m == "+" ) break;
- }
- }
-
- ret = r;
-
- // And remove the token
- t = jQuery.trim( t.replace( re, "" ) );
- foundToken = true;
- }
- }
-
- // See if there's still an expression, and that we haven't already
- // matched a token
- if ( t && !foundToken ) {
- // Handle multiple expressions
- if ( !t.indexOf(",") ) {
- // Clean the result set
- if ( context == ret[0] ) ret.shift();
-
- // Merge the result sets
- done = jQuery.merge( done, ret );
-
- // Reset the context
- r = ret = [context];
-
- // Touch up the selector string
- t = " " + t.substr(1,t.length);
-
- } else {
- // Optimize for the case nodeName#idName
- var re2 = quickID;
- var m = re2.exec(t);
-
- // Re-organize the results, so that they're consistent
- if ( m ) {
- m = [ 0, m[2], m[3], m[1] ];
-
- } else {
- // Otherwise, do a traditional filter check for
- // ID, class, and element selectors
- re2 = quickClass;
- m = re2.exec(t);
- }
-
- m[2] = m[2].replace(/\\/g, "");
-
- var elem = ret[ret.length-1];
-
- // Try to do a global search by ID, where we can
- if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
- // Optimization for HTML document case
- var oid = elem.getElementById(m[2]);
-
- // Do a quick check for the existence of the actual ID attribute
- // to avoid selecting by the name attribute in IE
- // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
- if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
- oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
-
- // Do a quick check for node name (where applicable) so
- // that div#foo searches will be really fast
- ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
- } else {
- // We need to find all descendant elements
- for ( var i = 0; ret[i]; i++ ) {
- // Grab the tag name being searched for
- var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
-
- // Handle IE7 being really dumb about <object>s
- if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
- tag = "param";
-
- r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
- }
-
- // It's faster to filter by class and be done with it
- if ( m[1] == "." )
- r = jQuery.classFilter( r, m[2] );
-
- // Same with ID filtering
- if ( m[1] == "#" ) {
- var tmp = [];
-
- // Try to find the element with the ID
- for ( var i = 0; r[i]; i++ )
- if ( r[i].getAttribute("id") == m[2] ) {
- tmp = [ r[i] ];
- break;
- }
-
- r = tmp;
- }
-
- ret = r;
- }
-
- t = t.replace( re2, "" );
- }
-
- }
-
- // If a selector string still exists
- if ( t ) {
- // Attempt to filter it
- var val = jQuery.filter(t,r);
- ret = r = val.r;
- t = jQuery.trim(val.t);
- }
- }
-
- // An error occurred with the selector;
- // just return an empty set instead
- if ( t )
- ret = [];
-
- // Remove the root context
- if ( ret && context == ret[0] )
- ret.shift();
-
- // And combine the results
- done = jQuery.merge( done, ret );
-
- return done;
- },
-
- classFilter: function(r,m,not){
- m = " " + m + " ";
- var tmp = [];
- for ( var i = 0; r[i]; i++ ) {
- var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
- if ( !not && pass || not && !pass )
- tmp.push( r[i] );
- }
- return tmp;
- },
-
- filter: function(t,r,not) {
- var last;
-
- // Look for common filter expressions
- while ( t && t != last ) {
- last = t;
-
- var p = jQuery.parse, m;
-
- for ( var i = 0; p[i]; i++ ) {
- m = p[i].exec( t );
-
- if ( m ) {
- // Remove what we just matched
- t = t.substring( m[0].length );
-
- m[2] = m[2].replace(/\\/g, "");
- break;
- }
- }
-
- if ( !m )
- break;
-
- // :not() is a special case that can be optimized by
- // keeping it out of the expression list
- if ( m[1] == ":" && m[2] == "not" )
- // optimize if only one selector found (most common case)
- r = isSimple.test( m[3] ) ?
- jQuery.filter(m[3], r, true).r :
- jQuery( r ).not( m[3] );
-
- // We can get a big speed boost by filtering by class here
- else if ( m[1] == "." )
- r = jQuery.classFilter(r, m[2], not);
-
- else if ( m[1] == "[" ) {
- var tmp = [], type = m[3];
-
- for ( var i = 0, rl = r.length; i < rl; i++ ) {
- var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
-
- if ( z == null || /href|src|selected/.test(m[2]) )
- z = jQuery.attr(a,m[2]) || '';
-
- if ( (type == "" && !!z ||
- type == "=" && z == m[5] ||
- type == "!=" && z != m[5] ||
- type == "^=" && z && !z.indexOf(m[5]) ||
- type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
- (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
- tmp.push( a );
- }
-
- r = tmp;
-
- // We can get a speed boost by handling nth-child here
- } else if ( m[1] == ":" && m[2] == "nth-child" ) {
- var merge = {}, tmp = [],
- // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
- test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
- m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
- !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
- // calculate the numbers (first)n+(last) including if they are negative
- first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
-
- // loop through all the elements left in the jQuery object
- for ( var i = 0, rl = r.length; i < rl; i++ ) {
- var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
-
- if ( !merge[id] ) {
- var c = 1;
-
- for ( var n = parentNode.firstChild; n; n = n.nextSibling )
- if ( n.nodeType == 1 )
- n.nodeIndex = c++;
-
- merge[id] = true;
- }
-
- var add = false;
-
- if ( first == 0 ) {
- if ( node.nodeIndex == last )
- add = true;
- } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
- add = true;
-
- if ( add ^ not )
- tmp.push( node );
- }
-
- r = tmp;
-
- // Otherwise, find the expression to execute
- } else {
- var fn = jQuery.expr[ m[1] ];
- if ( typeof fn == "object" )
- fn = fn[ m[2] ];
-
- if ( typeof fn == "string" )
- fn = eval("false||function(a,i){return " + fn + ";}");
-
- // Execute it against the current filter
- r = jQuery.grep( r, function(elem, i){
- return fn(elem, i, m, r);
- }, not );
- }
- }
-
- // Return an array of filtered elements (r)
- // and the modified expression string (t)
- return { r: r, t: t };
- },
-
- dir: function( elem, dir ){
- var matched = [],
- cur = elem[dir];
- while ( cur && cur != document ) {
- if ( cur.nodeType == 1 )
- matched.push( cur );
- cur = cur[dir];
- }
- return matched;
- },
-
- nth: function(cur,result,dir,elem){
- result = result || 1;
- var num = 0;
-
- for ( ; cur; cur = cur[dir] )
- if ( cur.nodeType == 1 && ++num == result )
- break;
-
- return cur;
- },
-
- sibling: function( n, elem ) {
- var r = [];
-
- for ( ; n; n = n.nextSibling ) {
- if ( n.nodeType == 1 && n != elem )
- r.push( n );
- }
-
- return r;
- }
-});
-/*
- * A number of helper functions used for managing events.
- * Many of the ideas behind this code orignated from
- * Dean Edwards' addEvent library.
- */
-jQuery.event = {
-
- // Bind an event to an element
- // Original by Dean Edwards
- add: function(elem, types, handler, data) {
- if ( elem.nodeType == 3 || elem.nodeType == 8 )
- return;
-
- // For whatever reason, IE has trouble passing the window object
- // around, causing it to be cloned in the process
- if ( jQuery.browser.msie && elem.setInterval )
- elem = window;
-
- // Make sure that the function being executed has a unique ID
- if ( !handler.guid )
- handler.guid = this.guid++;
-
- // if data is passed, bind to handler
- if( data != undefined ) {
- // Create temporary function pointer to original handler
- var fn = handler;
-
- // Create unique handler function, wrapped around original handler
- handler = this.proxy( fn, function() {
- // Pass arguments and context to original handler
- return fn.apply(this, arguments);
- });
-
- // Store data in unique handler
- handler.data = data;
- }
-
- // Init the element's event structure
- var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
- handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
- // Handle the second event of a trigger and when
- // an event is called after a page has unloaded
- if ( typeof jQuery != "undefined" && !jQuery.event.triggered )
- return jQuery.event.handle.apply(arguments.callee.elem, arguments);
- });
- // Add elem as a property of the handle function
- // This is to prevent a memory leak with non-native
- // event in IE.
- handle.elem = elem;
-
- // Handle multiple events separated by a space
- // jQuery(...).bind("mouseover mouseout", fn);
- jQuery.each(types.split(/\s+/), function(index, type) {
- // Namespaced event handlers
- var parts = type.split(".");
- type = parts[0];
- handler.type = parts[1];
-
- // Get the current list of functions bound to this event
- var handlers = events[type];
-
- // Init the event handler queue
- if (!handlers) {
- handlers = events[type] = {};
-
- // Check for a special event handler
- // Only use addEventListener/attachEvent if the special
- // events handler returns false
- if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
- // Bind the global event handler to the element
- if (elem.addEventListener)
- elem.addEventListener(type, handle, false);
- else if (elem.attachEvent)
- elem.attachEvent("on" + type, handle);
- }
- }
-
- // Add the function to the element's handler list
- handlers[handler.guid] = handler;
-
- // Keep track of which events have been used, for global triggering
- jQuery.event.global[type] = true;
- });
-
- // Nullify elem to prevent memory leaks in IE
- elem = null;
- },
-
- guid: 1,
- global: {},
-
- // Detach an event or set of events from an element
- remove: function(elem, types, handler) {
- // don't do events on text and comment nodes
- if ( elem.nodeType == 3 || elem.nodeType == 8 )
- return;
-
- var events = jQuery.data(elem, "events"), ret, index;
-
- if ( events ) {
- // Unbind all events for the element
- if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )
- for ( var type in events )
- this.remove( elem, type + (types || "") );
- else {
- // types is actually an event object here
- if ( types.type ) {
- handler = types.handler;
- types = types.type;
- }
-
- // Handle multiple events seperated by a space
- // jQuery(...).unbind("mouseover mouseout", fn);
- jQuery.each(types.split(/\s+/), function(index, type){
- // Namespaced event handlers
- var parts = type.split(".");
- type = parts[0];
-
- if ( events[type] ) {
- // remove the given handler for the given type
- if ( handler )
- delete events[type][handler.guid];
-
- // remove all handlers for the given type
- else
- for ( handler in events[type] )
- // Handle the removal of namespaced events
- if ( !parts[1] || events[type][handler].type == parts[1] )
- delete events[type][handler];
-
- // remove generic event handler if no more handlers exist
- for ( ret in events[type] ) break;
- if ( !ret ) {
- if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
- if (elem.removeEventListener)
- elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
- else if (elem.detachEvent)
- elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
- }
- ret = null;
- delete events[type];
- }
- }
- });
- }
-
- // Remove the expando if it's no longer used
- for ( ret in events ) break;
- if ( !ret ) {
- var handle = jQuery.data( elem, "handle" );
- if ( handle ) handle.elem = null;
- jQuery.removeData( elem, "events" );
- jQuery.removeData( elem, "handle" );
- }
- }
- },
-
- trigger: function(type, data, elem, donative, extra) {
- // Clone the incoming data, if any
- data = jQuery.makeArray(data);
-
- if ( type.indexOf("!") >= 0 ) {
- type = type.slice(0, -1);
- var exclusive = true;
- }
-
- // Handle a global trigger
- if ( !elem ) {
- // Only trigger if we've ever bound an event for it
- if ( this.global[type] )
- jQuery("*").add([window, document]).trigger(type, data);
-
- // Handle triggering a single element
- } else {
- // don't do events on text and comment nodes
- if ( elem.nodeType == 3 || elem.nodeType == 8 )
- return undefined;
-
- var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
- // Check to see if we need to provide a fake event, or not
- event = !data[0] || !data[0].preventDefault;
-
- // Pass along a fake event
- if ( event ) {
- data.unshift({
- type: type,
- target: elem,
- preventDefault: function(){},
- stopPropagation: function(){},
- timeStamp: now()
- });
- data[0][expando] = true; // no need to fix fake event
- }
-
- // Enforce the right trigger type
- data[0].type = type;
- if ( exclusive )
- data[0].exclusive = true;
-
- // Trigger the event, it is assumed that "handle" is a function
- var handle = jQuery.data(elem, "handle");
- if ( handle )
- val = handle.apply( elem, data );
-
- // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
- if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
- val = false;
-
- // Extra functions don't get the custom event object
- if ( event )
- data.shift();
-
- // Handle triggering of extra function
- if ( extra && jQuery.isFunction( extra ) ) {
- // call the extra function and tack the current return value on the end for possible inspection
- ret = extra.apply( elem, val == null ? data : data.concat( val ) );
- // if anything is returned, give it precedence and have it overwrite the previous value
- if (ret !== undefined)
- val = ret;
- }
-
- // Trigger the native events (except for clicks on links)
- if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
- this.triggered = true;
- try {
- elem[ type ]();
- // prevent IE from throwing an error for some hidden elements
- } catch (e) {}
- }
-
- this.triggered = false;
- }
-
- return val;
- },
-
- handle: function(event) {
- // returned undefined or false
- var val, ret, namespace, all, handlers;
-
- event = arguments[0] = jQuery.event.fix( event || window.event );
-
- // Namespaced event handlers
- namespace = event.type.split(".");
- event.type = namespace[0];
- namespace = namespace[1];
- // Cache this now, all = true means, any handler
- all = !namespace && !event.exclusive;
-
- handlers = ( jQuery.data(this, "events") || {} )[event.type];
-
- for ( var j in handlers ) {
- var handler = handlers[j];
-
- // Filter the functions by class
- if ( all || handler.type == namespace ) {
- // Pass in a reference to the handler function itself
- // So that we can later remove it
- event.handler = handler;
- event.data = handler.data;
-
- ret = handler.apply( this, arguments );
-
- if ( val !== false )
- val = ret;
-
- if ( ret === false ) {
- event.preventDefault();
- event.stopPropagation();
- }
- }
- }
-
- return val;
- },
-
- fix: function(event) {
- if ( event[expando] == true )
- return event;
-
- // store a copy of the original event object
- // and "clone" to set read-only properties
- var originalEvent = event;
- event = { originalEvent: originalEvent };
- var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
- for ( var i=props.length; i; i-- )
- event[ props[i] ] = originalEvent[ props[i] ];
-
- // Mark it as fixed
- event[expando] = true;
-
- // add preventDefault and stopPropagation since
- // they will not work on the clone
- event.preventDefault = function() {
- // if preventDefault exists run it on the original event
- if (originalEvent.preventDefault)
- originalEvent.preventDefault();
- // otherwise set the returnValue property of the original event to false (IE)
- originalEvent.returnValue = false;
- };
- event.stopPropagation = function() {
- // if stopPropagation exists run it on the original event
- if (originalEvent.stopPropagation)
- originalEvent.stopPropagation();
- // otherwise set the cancelBubble property of the original event to true (IE)
- originalEvent.cancelBubble = true;
- };
-
- // Fix timeStamp
- event.timeStamp = event.timeStamp || now();
-
- // Fix target property, if necessary
- if ( !event.target )
- event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
-
- // check if target is a textnode (safari)
- if ( event.target.nodeType == 3 )
- event.target = event.target.parentNode;
-
- // Add relatedTarget, if necessary
- if ( !event.relatedTarget && event.fromElement )
- event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
-
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && event.clientX != null ) {
- var doc = document.documentElement, body = document.body;
- event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
- event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
- }
-
- // Add which for key events
- if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
- event.which = event.charCode || event.keyCode;
-
- // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
- if ( !event.metaKey && event.ctrlKey )
- event.metaKey = event.ctrlKey;
-
- // Add which for click: 1 == left; 2 == middle; 3 == right
- // Note: button is not normalized, so don't use it
- if ( !event.which && event.button )
- event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
-
- return event;
- },
-
- proxy: function( fn, proxy ){
- // Set the guid of unique handler to the same of original handler, so it can be removed
- proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
- // So proxy can be declared as an argument
- return proxy;
- },
-
- special: {
- ready: {
- setup: function() {
- // Make sure the ready event is setup
- bindReady();
- return;
- },
-
- teardown: function() { return; }
- },
-
- mouseenter: {
- setup: function() {
- if ( jQuery.browser.msie ) return false;
- jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
- return true;
- },
-
- teardown: function() {
- if ( jQuery.browser.msie ) return false;
- jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
- return true;
- },
-
- handler: function(event) {
- // If we actually just moused on to a sub-element, ignore it
- if ( withinElement(event, this) ) return true;
- // Execute the right handlers by setting the event type to mouseenter
- event.type = "mouseenter";
- return jQuery.event.handle.apply(this, arguments);
- }
- },
-
- mouseleave: {
- setup: function() {
- if ( jQuery.browser.msie ) return false;
- jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
- return true;
- },
-
- teardown: function() {
- if ( jQuery.browser.msie ) return false;
- jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
- return true;
- },
-
- handler: function(event) {
- // If we actually just moused on to a sub-element, ignore it
- if ( withinElement(event, this) ) return true;
- // Execute the right handlers by setting the event type to mouseleave
- event.type = "mouseleave";
- return jQuery.event.handle.apply(this, arguments);
- }
- }
- }
-};
-
-jQuery.fn.extend({
- bind: function( type, data, fn ) {
- return type == "unload" ? this.one(type, data, fn) : this.each(function(){
- jQuery.event.add( this, type, fn || data, fn && data );
- });
- },
-
- one: function( type, data, fn ) {
- var one = jQuery.event.proxy( fn || data, function(event) {
- jQuery(this).unbind(event, one);
- return (fn || data).apply( this, arguments );
- });
- return this.each(function(){
- jQuery.event.add( this, type, one, fn && data);
- });
- },
-
- unbind: function( type, fn ) {
- return this.each(function(){
- jQuery.event.remove( this, type, fn );
- });
- },
-
- trigger: function( type, data, fn ) {
- return this.each(function(){
- jQuery.event.trigger( type, data, this, true, fn );
- });
- },
-
- triggerHandler: function( type, data, fn ) {
- return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
- },
-
- toggle: function( fn ) {
- // Save reference to arguments for access in closure
- var args = arguments, i = 1;
-
- // link all the functions, so any of them can unbind this click handler
- while( i < args.length )
- jQuery.event.proxy( fn, args[i++] );
-
- return this.click( jQuery.event.proxy( fn, function(event) {
- // Figure out which function to execute
- this.lastToggle = ( this.lastToggle || 0 ) % i;
-
- // Make sure that clicks stop
- event.preventDefault();
-
- // and execute the function
- return args[ this.lastToggle++ ].apply( this, arguments ) || false;
- }));
- },
-
- hover: function(fnOver, fnOut) {
- return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
- },
-
- ready: function(fn) {
- // Attach the listeners
- bindReady();
-
- // If the DOM is already ready
- if ( jQuery.isReady )
- // Execute the function immediately
- fn.call( document, jQuery );
-
- // Otherwise, remember the function for later
- else
- // Add the function to the wait list
- jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
-
- return this;
- }
-});
-
-jQuery.extend({
- isReady: false,
- readyList: [],
- // Handle when the DOM is ready
- ready: function() {
- // Make sure that the DOM is not already loaded
- if ( !jQuery.isReady ) {
- // Remember that the DOM is ready
- jQuery.isReady = true;
-
- // If there are functions bound, to execute
- if ( jQuery.readyList ) {
- // Execute all of them
- jQuery.each( jQuery.readyList, function(){
- this.call( document );
- });
-
- // Reset the list of functions
- jQuery.readyList = null;
- }
-
- // Trigger any bound ready events
- jQuery(document).triggerHandler("ready");
- }
- }
-});
-
-var readyBound = false;
-
-function bindReady(){
- if ( readyBound ) return;
- readyBound = true;
-
- // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
- if ( document.addEventListener && !jQuery.browser.opera)
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
-
- // If IE is used and is not in a frame
- // Continually check to see if the document is ready
- if ( jQuery.browser.msie && window == top ) (function(){
- if (jQuery.isReady) return;
- try {
- // If IE is used, use the trick by Diego Perini
- // http://javascript.nwbox.com/IEContentLoaded/
- document.documentElement.doScroll("left");
- } catch( error ) {
- setTimeout( arguments.callee, 0 );
- return;
- }
- // and execute any waiting functions
- jQuery.ready();
- })();
-
- if ( jQuery.browser.opera )
- document.addEventListener( "DOMContentLoaded", function () {
- if (jQuery.isReady) return;
- for (var i = 0; i < document.styleSheets.length; i++)
- if (document.styleSheets[i].disabled) {
- setTimeout( arguments.callee, 0 );
- return;
- }
- // and execute any waiting functions
- jQuery.ready();
- }, false);
-
- if ( jQuery.browser.safari ) {
- var numStyles;
- (function(){
- if (jQuery.isReady) return;
- if ( document.readyState != "loaded" && document.readyState != "complete" ) {
- setTimeout( arguments.callee, 0 );
- return;
- }
- if ( numStyles === undefined )
- numStyles = jQuery("style, link[rel=stylesheet]").length;
- if ( document.styleSheets.length != numStyles ) {
- setTimeout( arguments.callee, 0 );
- return;
- }
- // and execute any waiting functions
- jQuery.ready();
- })();
- }
-
- // A fallback to window.onload, that will always work
- jQuery.event.add( window, "load", jQuery.ready );
-}
-
-jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
- "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
- "submit,keydown,keypress,keyup,error").split(","), function(i, name){
-
- // Handle event binding
- jQuery.fn[name] = function(fn){
- return fn ? this.bind(name, fn) : this.trigger(name);
- };
-});
-
-// Checks if an event happened on an element within another element
-// Used in jQuery.event.special.mouseenter and mouseleave handlers
-var withinElement = function(event, elem) {
- // Check if mouse(over|out) are still within the same parent element
- var parent = event.relatedTarget;
- // Traverse up the tree
- while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
- // Return true if we actually just moused on to a sub-element
- return parent == elem;
-};
-
-// Prevent memory leaks in IE
-// And prevent errors on refresh with events like mouseover in other browsers
-// Window isn't included so as not to unbind existing unload events
-jQuery(window).bind("unload", function() {
- jQuery("*").add(document).unbind();
-});
-jQuery.fn.extend({
- // Keep a copy of the old load
- _load: jQuery.fn.load,
-
- load: function( url, params, callback ) {
- if ( typeof url != 'string' )
- return this._load( url );
-
- var off = url.indexOf(" ");
- if ( off >= 0 ) {
- var selector = url.slice(off, url.length);
- url = url.slice(0, off);
- }
-
- callback = callback || function(){};
-
- // Default to a GET request
- var type = "GET";
-
- // If the second parameter was provided
- if ( params )
- // If it's a function
- if ( jQuery.isFunction( params ) ) {
- // We assume that it's the callback
- callback = params;
- params = null;
-
- // Otherwise, build a param string
- } else {
- params = jQuery.param( params );
- type = "POST";
- }
-
- var self = this;
-
- // Request the remote document
- jQuery.ajax({
- url: url,
- type: type,
- dataType: "html",
- data: params,
- complete: function(res, status){
- // If successful, inject the HTML into all the matched elements
- if ( status == "success" || status == "notmodified" )
- // See if a selector was specified
- self.html( selector ?
- // Create a dummy div to hold the results
- jQuery("<div/>")
- // inject the contents of the document in, removing the scripts
- // to avoid any 'Permission Denied' errors in IE
- .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
-
- // Locate the specified elements
- .find(selector) :
-
- // If not, just inject the full result
- res.responseText );
-
- self.each( callback, [res.responseText, status, res] );
- }
- });
- return this;
- },
-
- serialize: function() {
- return jQuery.param(this.serializeArray());
- },
- serializeArray: function() {
- return this.map(function(){
- return jQuery.nodeName(this, "form") ?
- jQuery.makeArray(this.elements) : this;
- })
- .filter(function(){
- return this.name && !this.disabled &&
- (this.checked || /select|textarea/i.test(this.nodeName) ||
- /text|hidden|password/i.test(this.type));
- })
- .map(function(i, elem){
- var val = jQuery(this).val();
- return val == null ? null :
- val.constructor == Array ?
- jQuery.map( val, function(val, i){
- return {name: elem.name, value: val};
- }) :
- {name: elem.name, value: val};
- }).get();
- }
-});
-
-// Attach a bunch of functions for handling common AJAX events
-jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
- jQuery.fn[o] = function(f){
- return this.bind(o, f);
- };
-});
-
-var jsc = now();
-
-jQuery.extend({
- get: function( url, data, callback, type ) {
- // shift arguments if data argument was ommited
- if ( jQuery.isFunction( data ) ) {
- callback = data;
- data = null;
- }
-
- return jQuery.ajax({
- type: "GET",
- url: url,
- data: data,
- success: callback,
- dataType: type
- });
- },
-
- getScript: function( url, callback ) {
- return jQuery.get(url, null, callback, "script");
- },
-
- getJSON: function( url, data, callback ) {
- return jQuery.get(url, data, callback, "json");
- },
-
- post: function( url, data, callback, type ) {
- if ( jQuery.isFunction( data ) ) {
- callback = data;
- data = {};
- }
-
- return jQuery.ajax({
- type: "POST",
- url: url,
- data: data,
- success: callback,
- dataType: type
- });
- },
-
- ajaxSetup: function( settings ) {
- jQuery.extend( jQuery.ajaxSettings, settings );
- },
-
- ajaxSettings: {
- url: location.href,
- global: true,
- type: "GET",
- timeout: 0,
- contentType: "application/x-www-form-urlencoded",
- processData: true,
- async: true,
- data: null,
- username: null,
- password: null,
- accepts: {
- xml: "application/xml, text/xml",
- html: "text/html",
- script: "text/javascript, application/javascript",
- json: "application/json, text/javascript",
- text: "text/plain",
- _default: "*/*"
- }
- },
-
- // Last-Modified header cache for next request
- lastModified: {},
-
- ajax: function( s ) {
- // Extend the settings, but re-extend 's' so that it can be
- // checked again later (in the test suite, specifically)
- s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
-
- var jsonp, jsre = /=\?(&|$)/g, status, data,
- type = s.type.toUpperCase();
-
- // convert data if not already a string
- if ( s.data && s.processData && typeof s.data != "string" )
- s.data = jQuery.param(s.data);
-
- // Handle JSONP Parameter Callbacks
- if ( s.dataType == "jsonp" ) {
- if ( type == "GET" ) {
- if ( !s.url.match(jsre) )
- s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
- } else if ( !s.data || !s.data.match(jsre) )
- s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
- s.dataType = "json";
- }
-
- // Build temporary JSONP function
- if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
- jsonp = "jsonp" + jsc++;
-
- // Replace the =? sequence both in the query string and the data
- if ( s.data )
- s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
- s.url = s.url.replace(jsre, "=" + jsonp + "$1");
-
- // We need to make sure
- // that a JSONP style response is executed properly
- s.dataType = "script";
-
- // Handle JSONP-style loading
- window[ jsonp ] = function(tmp){
- data = tmp;
- success();
- complete();
- // Garbage collect
- window[ jsonp ] = undefined;
- try{ delete window[ jsonp ]; } catch(e){}
- if ( head )
- head.removeChild( script );
- };
- }
-
- if ( s.dataType == "script" && s.cache == null )
- s.cache = false;
-
- if ( s.cache === false && type == "GET" ) {
- var ts = now();
- // try replacing _= if it is there
- var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
- // if nothing was replaced, add timestamp to the end
- s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
- }
-
- // If data is available, append data to url for get requests
- if ( s.data && type == "GET" ) {
- s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
-
- // IE likes to send both get and post data, prevent this
- s.data = null;
- }
-
- // Watch for a new set of requests
- if ( s.global && ! jQuery.active++ )
- jQuery.event.trigger( "ajaxStart" );
-
- // Matches an absolute URL, and saves the domain
- var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
-
- // If we're requesting a remote document
- // and trying to load JSON or Script with a GET
- if ( s.dataType == "script" && type == "GET"
- && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
- var head = document.getElementsByTagName("head")[0];
- var script = document.createElement("script");
- script.src = s.url;
- if (s.scriptCharset)
- script.charset = s.scriptCharset;
-
- // Handle Script loading
- if ( !jsonp ) {
- var done = false;
-
- // Attach handlers for all browsers
- script.onload = script.onreadystatechange = function(){
- if ( !done && (!this.readyState ||
- this.readyState == "loaded" || this.readyState == "complete") ) {
- done = true;
- success();
- complete();
- head.removeChild( script );
- }
- };
- }
-
- head.appendChild(script);
-
- // We handle everything using the script element injection
- return undefined;
- }
-
- var requestDone = false;
-
- // Create the request object; Microsoft failed to properly
- // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
- var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
-
- // Open the socket
- // Passing null username, generates a login popup on Opera (#2865)
- if( s.username )
- xhr.open(type, s.url, s.async, s.username, s.password);
- else
- xhr.open(type, s.url, s.async);
-
- // Need an extra try/catch for cross domain requests in Firefox 3
- try {
- // Set the correct header, if data is being sent
- if ( s.data )
- xhr.setRequestHeader("Content-Type", s.contentType);
-
- // Set the If-Modified-Since header, if ifModified mode.
- if ( s.ifModified )
- xhr.setRequestHeader("If-Modified-Since",
- jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
-
- // Set header so the called script knows that it's an XMLHttpRequest
- xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
-
- // Set the Accepts header for the server, depending on the dataType
- xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
- s.accepts[ s.dataType ] + ", */*" :
- s.accepts._default );
- } catch(e){}
-
- // Allow custom headers/mimetypes
- if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
- // cleanup active request counter
- s.global && jQuery.active--;
- // close opended socket
- xhr.abort();
- return false;
- }
-
- if ( s.global )
- jQuery.event.trigger("ajaxSend", [xhr, s]);
-
- // Wait for a response to come back
- var onreadystatechange = function(isTimeout){
- // The transfer is complete and the data is available, or the request timed out
- if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
- requestDone = true;
-
- // clear poll interval
- if (ival) {
- clearInterval(ival);
- ival = null;
- }
-
- status = isTimeout == "timeout" && "timeout" ||
- !jQuery.httpSuccess( xhr ) && "error" ||
- s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" ||
- "success";
-
- if ( status == "success" ) {
- // Watch for, and catch, XML document parse errors
- try {
- // process the data (runs the xml through httpData regardless of callback)
- data = jQuery.httpData( xhr, s.dataType, s.dataFilter );
- } catch(e) {
- status = "parsererror";
- }
- }
-
- // Make sure that the request was successful or notmodified
- if ( status == "success" ) {
- // Cache Last-Modified header, if ifModified mode.
- var modRes;
- try {
- modRes = xhr.getResponseHeader("Last-Modified");
- } catch(e) {} // swallow exception thrown by FF if header is not available
-
- if ( s.ifModified && modRes )
- jQuery.lastModified[s.url] = modRes;
-
- // JSONP handles its own success callback
- if ( !jsonp )
- success();
- } else
- jQuery.handleError(s, xhr, status);
-
- // Fire the complete handlers
- complete();
-
- // Stop memory leaks
- if ( s.async )
- xhr = null;
- }
- };
-
- if ( s.async ) {
- // don't attach the handler to the request, just poll it instead
- var ival = setInterval(onreadystatechange, 13);
-
- // Timeout checker
- if ( s.timeout > 0 )
- setTimeout(function(){
- // Check to see if the request is still happening
- if ( xhr ) {
- // Cancel the request
- xhr.abort();
-
- if( !requestDone )
- onreadystatechange( "timeout" );
- }
- }, s.timeout);
- }
-
- // Send the data
- try {
- xhr.send(s.data);
- } catch(e) {
- jQuery.handleError(s, xhr, null, e);
- }
-
- // firefox 1.5 doesn't fire statechange for sync requests
- if ( !s.async )
- onreadystatechange();
-
- function success(){
- // If a local callback was specified, fire it and pass it the data
- if ( s.success )
- s.success( data, status );
-
- // Fire the global callback
- if ( s.global )
- jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
- }
-
- function complete(){
- // Process result
- if ( s.complete )
- s.complete(xhr, status);
-
- // The request was completed
- if ( s.global )
- jQuery.event.trigger( "ajaxComplete", [xhr, s] );
-
- // Handle the global AJAX counter
- if ( s.global && ! --jQuery.active )
- jQuery.event.trigger( "ajaxStop" );
- }
-
- // return XMLHttpRequest to allow aborting the request etc.
- return xhr;
- },
-
- handleError: function( s, xhr, status, e ) {
- // If a local callback was specified, fire it
- if ( s.error ) s.error( xhr, status, e );
-
- // Fire the global callback
- if ( s.global )
- jQuery.event.trigger( "ajaxError", [xhr, s, e] );
- },
-
- // Counter for holding the number of active queries
- active: 0,
-
- // Determines if an XMLHttpRequest was successful or not
- httpSuccess: function( xhr ) {
- try {
- // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
- return !xhr.status && location.protocol == "file:" ||
- ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 ||
- jQuery.browser.safari && xhr.status == undefined;
- } catch(e){}
- return false;
- },
-
- // Determines if an XMLHttpRequest returns NotModified
- httpNotModified: function( xhr, url ) {
- try {
- var xhrRes = xhr.getResponseHeader("Last-Modified");
-
- // Firefox always returns 200. check Last-Modified date
- return xhr.status == 304 || xhrRes == jQuery.lastModified[url] ||
- jQuery.browser.safari && xhr.status == undefined;
- } catch(e){}
- return false;
- },
-
- httpData: function( xhr, type, filter ) {
- var ct = xhr.getResponseHeader("content-type"),
- xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
- data = xml ? xhr.responseXML : xhr.responseText;
-
- if ( xml && data.documentElement.tagName == "parsererror" )
- throw "parsererror";
-
- // Allow a pre-filtering function to sanitize the response
- if( filter )
- data = filter( data, type );
-
- // If the type is "script", eval it in global context
- if ( type == "script" )
- jQuery.globalEval( data );
-
- // Get the JavaScript object, if JSON is used.
- if ( type == "json" )
- data = eval("(" + data + ")");
-
- return data;
- },
-
- // Serialize an array of form elements or a set of
- // key/values into a query string
- param: function( a ) {
- var s = [];
-
- // If an array was passed in, assume that it is an array
- // of form elements
- if ( a.constructor == Array || a.jquery )
- // Serialize the form elements
- jQuery.each( a, function(){
- s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
- });
-
- // Otherwise, assume that it's an object of key/value pairs
- else
- // Serialize the key/values
- for ( var j in a )
- // If the value is an array then the key names need to be repeated
- if ( a[j] && a[j].constructor == Array )
- jQuery.each( a[j], function(){
- s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
- });
- else
- s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );
-
- // Return the resulting serialization
- return s.join("&").replace(/%20/g, "+");
- }
-
-});
-jQuery.fn.extend({
- show: function(speed,callback){
- return speed ?
- this.animate({
- height: "show", width: "show", opacity: "show"
- }, speed, callback) :
-
- this.filter(":hidden").each(function(){
- this.style.display = this.oldblock || "";
- if ( jQuery.css(this,"display") == "none" ) {
- var elem = jQuery("<" + this.tagName + " />").appendTo("body");
- this.style.display = elem.css("display");
- // handle an edge condition where css is - div { display:none; } or similar
- if (this.style.display == "none")
- this.style.display = "block";
- elem.remove();
- }
- }).end();
- },
-
- hide: function(speed,callback){
- return speed ?
- this.animate({
- height: "hide", width: "hide", opacity: "hide"
- }, speed, callback) :
-
- this.filter(":visible").each(function(){
- this.oldblock = this.oldblock || jQuery.css(this,"display");
- this.style.display = "none";
- }).end();
- },
-
- // Save the old toggle function
- _toggle: jQuery.fn.toggle,
-
- toggle: function( fn, fn2 ){
- return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
- this._toggle.apply( this, arguments ) :
- fn ?
- this.animate({
- height: "toggle", width: "toggle", opacity: "toggle"
- }, fn, fn2) :
- this.each(function(){
- jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
- });
- },
-
- slideDown: function(speed,callback){
- return this.animate({height: "show"}, speed, callback);
- },
-
- slideUp: function(speed,callback){
- return this.animate({height: "hide"}, speed, callback);
- },
-
- slideToggle: function(speed, callback){
- return this.animate({height: "toggle"}, speed, callback);
- },
-
- fadeIn: function(speed, callback){
- return this.animate({opacity: "show"}, speed, callback);
- },
-
- fadeOut: function(speed, callback){
- return this.animate({opacity: "hide"}, speed, callback);
- },
-
- fadeTo: function(speed,to,callback){
- return this.animate({opacity: to}, speed, callback);
- },
-
- animate: function( prop, speed, easing, callback ) {
- var optall = jQuery.speed(speed, easing, callback);
-
- return this[ optall.queue === false ? "each" : "queue" ](function(){
- if ( this.nodeType != 1)
- return false;
-
- var opt = jQuery.extend({}, optall), p,
- hidden = jQuery(this).is(":hidden"), self = this;
-
- for ( p in prop ) {
- if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
- return opt.complete.call(this);
-
- if ( p == "height" || p == "width" ) {
- // Store display property
- opt.display = jQuery.css(this, "display");
-
- // Make sure that nothing sneaks out
- opt.overflow = this.style.overflow;
- }
- }
-
- if ( opt.overflow != null )
- this.style.overflow = "hidden";
-
- opt.curAnim = jQuery.extend({}, prop);
-
- jQuery.each( prop, function(name, val){
- var e = new jQuery.fx( self, opt, name );
-
- if ( /toggle|show|hide/.test(val) )
- e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
- else {
- var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
- start = e.cur(true) || 0;
-
- if ( parts ) {
- var end = parseFloat(parts[2]),
- unit = parts[3] || "px";
-
- // We need to compute starting value
- if ( unit != "px" ) {
- self.style[ name ] = (end || 1) + unit;
- start = ((end || 1) / e.cur(true)) * start;
- self.style[ name ] = start + unit;
- }
-
- // If a +=/-= token was provided, we're doing a relative animation
- if ( parts[1] )
- end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
-
- e.custom( start, end, unit );
- } else
- e.custom( start, val, "" );
- }
- });
-
- // For JS strict compliance
- return true;
- });
- },
-
- queue: function(type, fn){
- if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
- fn = type;
- type = "fx";
- }
-
- if ( !type || (typeof type == "string" && !fn) )
- return queue( this[0], type );
-
- return this.each(function(){
- if ( fn.constructor == Array )
- queue(this, type, fn);
- else {
- queue(this, type).push( fn );
-
- if ( queue(this, type).length == 1 )
- fn.call(this);
- }
- });
- },
-
- stop: function(clearQueue, gotoEnd){
- var timers = jQuery.timers;
-
- if (clearQueue)
- this.queue([]);
-
- this.each(function(){
- // go in reverse order so anything added to the queue during the loop is ignored
- for ( var i = timers.length - 1; i >= 0; i-- )
- if ( timers[i].elem == this ) {
- if (gotoEnd)
- // force the next step to be the last
- timers[i](true);
- timers.splice(i, 1);
- }
- });
-
- // start the next in the queue if the last step wasn't forced
- if (!gotoEnd)
- this.dequeue();
-
- return this;
- }
-
-});
-
-var queue = function( elem, type, array ) {
- if ( elem ){
-
- type = type || "fx";
-
- var q = jQuery.data( elem, type + "queue" );
-
- if ( !q || array )
- q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
-
- }
- return q;
-};
-
-jQuery.fn.dequeue = function(type){
- type = type || "fx";
-
- return this.each(function(){
- var q = queue(this, type);
-
- q.shift();
-
- if ( q.length )
- q[0].call( this );
- });
-};
-
-jQuery.extend({
-
- speed: function(speed, easing, fn) {
- var opt = speed && speed.constructor == Object ? speed : {
- complete: fn || !fn && easing ||
- jQuery.isFunction( speed ) && speed,
- duration: speed,
- easing: fn && easing || easing && easing.constructor != Function && easing
- };
-
- opt.duration = (opt.duration && opt.duration.constructor == Number ?
- opt.duration :
- jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
-
- // Queueing
- opt.old = opt.complete;
- opt.complete = function(){
- if ( opt.queue !== false )
- jQuery(this).dequeue();
- if ( jQuery.isFunction( opt.old ) )
- opt.old.call( this );
- };
-
- return opt;
- },
-
- easing: {
- linear: function( p, n, firstNum, diff ) {
- return firstNum + diff * p;
- },
- swing: function( p, n, firstNum, diff ) {
- return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
- }
- },
-
- timers: [],
- timerId: null,
-
- fx: function( elem, options, prop ){
- this.options = options;
- this.elem = elem;
- this.prop = prop;
-
- if ( !options.orig )
- options.orig = {};
- }
-
-});
-
-jQuery.fx.prototype = {
-
- // Simple function for setting a style value
- update: function(){
- if ( this.options.step )
- this.options.step.call( this.elem, this.now, this );
-
- (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
-
- // Set display property to block for height/width animations
- if ( this.prop == "height" || this.prop == "width" )
- this.elem.style.display = "block";
- },
-
- // Get the current size
- cur: function(force){
- if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
- return this.elem[ this.prop ];
-
- var r = parseFloat(jQuery.css(this.elem, this.prop, force));
- return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
- },
-
- // Start an animation from one number to another
- custom: function(from, to, unit){
- this.startTime = now();
- this.start = from;
- this.end = to;
- this.unit = unit || this.unit || "px";
- this.now = this.start;
- this.pos = this.state = 0;
- this.update();
-
- var self = this;
- function t(gotoEnd){
- return self.step(gotoEnd);
- }
-
- t.elem = this.elem;
-
- jQuery.timers.push(t);
-
- if ( jQuery.timerId == null ) {
- jQuery.timerId = setInterval(function(){
- var timers = jQuery.timers;
-
- for ( var i = 0; i < timers.length; i++ )
- if ( !timers[i]() )
- timers.splice(i--, 1);
-
- if ( !timers.length ) {
- clearInterval( jQuery.timerId );
- jQuery.timerId = null;
- }
- }, 13);
- }
- },
-
- // Simple 'show' function
- show: function(){
- // Remember where we started, so that we can go back to it later
- this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
- this.options.show = true;
-
- // Begin the animation
- this.custom(0, this.cur());
-
- // Make sure that we start at a small width/height to avoid any
- // flash of content
- if ( this.prop == "width" || this.prop == "height" )
- this.elem.style[this.prop] = "1px";
-
- // Start by showing the element
- jQuery(this.elem).show();
- },
-
- // Simple 'hide' function
- hide: function(){
- // Remember where we started, so that we can go back to it later
- this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
- this.options.hide = true;
-
- // Begin the animation
- this.custom(this.cur(), 0);
- },
-
- // Each step of an animation
- step: function(gotoEnd){
- var t = now();
-
- if ( gotoEnd || t > this.options.duration + this.startTime ) {
- this.now = this.end;
- this.pos = this.state = 1;
- this.update();
-
- this.options.curAnim[ this.prop ] = true;
-
- var done = true;
- for ( var i in this.options.curAnim )
- if ( this.options.curAnim[i] !== true )
- done = false;
-
- if ( done ) {
- if ( this.options.display != null ) {
- // Reset the overflow
- this.elem.style.overflow = this.options.overflow;
-
- // Reset the display
- this.elem.style.display = this.options.display;
- if ( jQuery.css(this.elem, "display") == "none" )
- this.elem.style.display = "block";
- }
-
- // Hide the element if the "hide" operation was done
- if ( this.options.hide )
- this.elem.style.display = "none";
-
- // Reset the properties, if the item has been hidden or shown
- if ( this.options.hide || this.options.show )
- for ( var p in this.options.curAnim )
- jQuery.attr(this.elem.style, p, this.options.orig[p]);
- }
-
- if ( done )
- // Execute the complete function
- this.options.complete.call( this.elem );
-
- return false;
- } else {
- var n = t - this.startTime;
- this.state = n / this.options.duration;
-
- // Perform the easing function, defaults to swing
- this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
- this.now = this.start + ((this.end - this.start) * this.pos);
-
- // Perform the next step of the animation
- this.update();
- }
-
- return true;
- }
-
-};
-
-jQuery.extend( jQuery.fx, {
- speeds:{
- slow: 600,
- fast: 200,
- // Default speed
- def: 400
- },
- step: {
- scrollLeft: function(fx){
- fx.elem.scrollLeft = fx.now;
- },
-
- scrollTop: function(fx){
- fx.elem.scrollTop = fx.now;
- },
-
- opacity: function(fx){
- jQuery.attr(fx.elem.style, "opacity", fx.now);
- },
-
- _default: function(fx){
- fx.elem.style[ fx.prop ] = fx.now + fx.unit;
- }
- }
-});
-// The Offset Method
-// Originally By Brandon Aaron, part of the Dimension Plugin
-// http://jquery.com/plugins/project/dimensions
-jQuery.fn.offset = function() {
- var left = 0, top = 0, elem = this[0], results;
-
- if ( elem ) with ( jQuery.browser ) {
- var parent = elem.parentNode,
- offsetChild = elem,
- offsetParent = elem.offsetParent,
- doc = elem.ownerDocument,
- safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
- css = jQuery.curCSS,
- fixed = css(elem, "position") == "fixed";
-
- // Use getBoundingClientRect if available
- if ( elem.getBoundingClientRect ) {
- var box = elem.getBoundingClientRect();
-
- // Add the document scroll offsets
- add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
- box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
-
- // IE adds the HTML element's border, by default it is medium which is 2px
- // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
- // IE 7 standards mode, the border is always 2px
- // This border/offset is typically represented by the clientLeft and clientTop properties
- // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
- // Therefore this method will be off by 2px in IE while in quirksmode
- add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
-
- // Otherwise loop through the offsetParents and parentNodes
- } else {
-
- // Initial element offsets
- add( elem.offsetLeft, elem.offsetTop );
-
- // Get parent offsets
- while ( offsetParent ) {
- // Add offsetParent offsets
- add( offsetParent.offsetLeft, offsetParent.offsetTop );
-
- // Mozilla and Safari > 2 does not include the border on offset parents
- // However Mozilla adds the border for table or table cells
- if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
- border( offsetParent );
-
- // Add the document scroll offsets if position is fixed on any offsetParent
- if ( !fixed && css(offsetParent, "position") == "fixed" )
- fixed = true;
-
- // Set offsetChild to previous offsetParent unless it is the body element
- offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
- // Get next offsetParent
- offsetParent = offsetParent.offsetParent;
- }
-
- // Get parent scroll offsets
- while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
- // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
- if ( !/^inline|table.*$/i.test(css(parent, "display")) )
- // Subtract parent scroll offsets
- add( -parent.scrollLeft, -parent.scrollTop );
-
- // Mozilla does not add the border for a parent that has overflow != visible
- if ( mozilla && css(parent, "overflow") != "visible" )
- border( parent );
-
- // Get next parent
- parent = parent.parentNode;
- }
-
- // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
- // Mozilla doubles body offsets with a non-absolutely positioned offsetChild
- if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||
- (mozilla && css(offsetChild, "position") != "absolute") )
- add( -doc.body.offsetLeft, -doc.body.offsetTop );
-
- // Add the document scroll offsets if position is fixed
- if ( fixed )
- add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
- Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
- }
-
- // Return an object with top and left properties
- results = { top: top, left: left };
- }
-
- function border(elem) {
- add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
- }
-
- function add(l, t) {
- left += parseInt(l, 10) || 0;
- top += parseInt(t, 10) || 0;
- }
-
- return results;
-};
-
-
-jQuery.fn.extend({
- position: function() {
- var left = 0, top = 0, results;
-
- if ( this[0] ) {
- // Get *real* offsetParent
- var offsetParent = this.offsetParent(),
-
- // Get correct offsets
- offset = this.offset(),
- parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
-
- // Subtract element margins
- // note: when an element has margin: auto the offsetLeft and marginLeft
- // are the same in Safari causing offset.left to incorrectly be 0
- offset.top -= num( this, 'marginTop' );
- offset.left -= num( this, 'marginLeft' );
-
- // Add offsetParent borders
- parentOffset.top += num( offsetParent, 'borderTopWidth' );
- parentOffset.left += num( offsetParent, 'borderLeftWidth' );
-
- // Subtract the two offsets
- results = {
- top: offset.top - parentOffset.top,
- left: offset.left - parentOffset.left
- };
- }
-
- return results;
- },
-
- offsetParent: function() {
- var offsetParent = this[0].offsetParent;
- while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
- offsetParent = offsetParent.offsetParent;
- return jQuery(offsetParent);
- }
-});
-
-
-// Create scrollLeft and scrollTop methods
-jQuery.each( ['Left', 'Top'], function(i, name) {
- var method = 'scroll' + name;
-
- jQuery.fn[ method ] = function(val) {
- if (!this[0]) return;
-
- return val != undefined ?
-
- // Set the scroll offset
- this.each(function() {
- this == window || this == document ?
- window.scrollTo(
- !i ? val : jQuery(window).scrollLeft(),
- i ? val : jQuery(window).scrollTop()
- ) :
- this[ method ] = val;
- }) :
-
- // Return the scroll offset
- this[0] == window || this[0] == document ?
- self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
- jQuery.boxModel && document.documentElement[ method ] ||
- document.body[ method ] :
- this[0][ method ];
- };
-});
-// Create innerHeight, innerWidth, outerHeight and outerWidth methods
-jQuery.each([ "Height", "Width" ], function(i, name){
-
- var tl = i ? "Left" : "Top", // top or left
- br = i ? "Right" : "Bottom"; // bottom or right
-
- // innerHeight and innerWidth
- jQuery.fn["inner" + name] = function(){
- return this[ name.toLowerCase() ]() +
- num(this, "padding" + tl) +
- num(this, "padding" + br);
- };
-
- // outerHeight and outerWidth
- jQuery.fn["outer" + name] = function(margin) {
- return this["inner" + name]() +
- num(this, "border" + tl + "Width") +
- num(this, "border" + br + "Width") +
- (margin ?
- num(this, "margin" + tl) + num(this, "margin" + br) : 0);
- };
-
-});})();
+++ /dev/null
-/*!\r
- SoundManager 2: Javascript Sound for the Web\r
- --------------------------------------------\r
- http://schillmania.com/projects/soundmanager2/\r
-\r
- Copyright (c) 2008, Scott Schiller. All rights reserved.\r
- Code licensed under the BSD License:\r
- http://schillmania.com/projects/soundmanager2/license.txt\r
-\r
- V2.90a.20081028\r
-*/\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.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 = 'null.mp3'; // 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 "while playing", peak, sound spectrum functions to work.)\r
- this.useMovieStar = false; // enable support for Flash 9.0r115+ (codename "MovieStar") MPEG4 audio + video formats (AAC, M4V, FLV, MOV etc.)\r
- this.useHighPerformance = true; // flash positioning trick, improves JS/flash callback speed, minimizes delay\r
- this.bgColor = '#ffffff'; // movie (.swf) background color, useful if showing on-screen for video etc.\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
- '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
- '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
- 'position': null, // offset (milliseconds) to seek to within loaded sound data.\r
- 'pan': 0, // "pan" settings, left-to-right, -100 to 100\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/video 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
- };\r
-\r
- this.movieStarOptions = { // flash 9.0r115+ MPEG4 audio/video options, merged into defaultOptions if flash 9 + movieStar mode is enabled\r
- 'onmetadata': null, // callback for when video width/height etc. are received\r
- 'useVideo': false // if loading movieStar content, whether to show video\r
- }\r
-\r
- this.flashBlockHelper = {\r
- 'enabled': false, // experimental, removed with >v2.80\r
- 'message': [] // "nag bar" to show when messaging the user, if SM2 fails on firefox etc.\r
- };\r
-\r
- var _s = this; \r
- this.version = null;\r
- this.versionNumber = 'V2.90a.20081028';\r
- this.movieURL = null;\r
- this.url = null;\r
- this.altURL = null;\r
- this.swfLoaded = false;\r
- this.enabled = false;\r
- this.o = null;\r
- this.id = (smID||'sm2movie');\r
- this.oMC = null;\r
- this.sounds = [];\r
- this.soundIDs = [];\r
- this.muted = false;\r
- this.isIE = (navigator.userAgent.match(/MSIE/i));\r
- this.isSafari = (navigator.userAgent.match(/safari/i));\r
- this.isGecko = (navigator.userAgent.match(/gecko/i));\r
- this.debugID = 'soundmanager-debug';\r
- this._debugOpen = true;\r
- this._didAppend = false;\r
- this._appendSuccess = false;\r
- this._didInit = false;\r
- this._disabled = false;\r
- this._windowLoaded = false;\r
- this._hasConsole = (typeof console != 'undefined' && typeof console.log != 'undefined');\r
- this._debugLevels = ['log','info','warn','error'];\r
- this._defaultFlashVersion = 8;\r
- this.filePatterns = {\r
- flash8: /\.(mp3)/i,\r
- flash9: /\.(mp3)/i\r
- };\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.filePattern = null;\r
- this.features = {\r
- peakData: false,\r
- waveformData: false,\r
- eqData: false\r
- };\r
-\r
- this.sandbox = {\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
- };\r
-\r
- this._setVersionInfo = function() {\r
- if (_s.flashVersion != 8 && _s.flashVersion != 9) {\r
- alert('soundManager.flashVersion must be 8 or 9. "'+_s.flashVersion+'" is invalid. Reverting to '+_s._defaultFlashVersion+'.');\r
- _s.flashVersion = _s._defaultFlashVersion;\r
- }\r
- _s.version = _s.versionNumber+(_s.flashVersion==9?' (AS3/Flash 9)':' (AS2/Flash 8)');\r
- // set up default options\r
- if (_s.flashVersion > 8) {\r
- _s.defaultOptions = _s._mergeObjects(_s.defaultOptions,_s.flash9Options);\r
- }\r
- if (_s.flashVersion > 8 && _s.useMovieStar) {\r
- _s.defaultOptions = _s._mergeObjects(_s.defaultOptions,_s.movieStarOptions);\r
- _s.filePatterns.flash9 = new RegExp('.(mp3|'+_s.netStreamTypes.join('|')+')','i');\r
- } else {\r
- _s.useMovieStar = false;\r
- }\r
- _s.filePattern = _s.filePatterns[(_s.flashVersion!=8?'flash9':'flash8')];\r
- _s.movieURL = (_s.flashVersion==8?'soundmanager2.swf':'soundmanager2_flash9.swf');\r
- _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_s.flashVersion==9);\r
- }\r
-\r
- this._overHTTP = (document.location?document.location.protocol.match(/http/i):null);\r
- this._waitingforEI = false;\r
- this._initPending = false;\r
- this._tryInitOnFocus = (this.isSafari && typeof document.hasFocus == 'undefined');\r
- this._isFocused = (typeof document.hasFocus != 'undefined'?document.hasFocus():null);\r
- this._okToDisable = !this._tryInitOnFocus;\r
-\r
- this.useAltURL = !this._overHTTP; // use altURL if not "online"\r
-\r
- var flashCPLink = 'http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html';\r
-\r
- // --- public methods ---\r
- \r
- this.supported = function() {\r
- return (_s._didInit && !_s._disabled);\r
- };\r
-\r
- this.getMovie = function(smID) {\r
- return _s.isIE?window[smID]:(_s.isSafari?document.getElementById(smID)||document[smID]:document.getElementById(smID));\r
- };\r
-\r
- this.loadFromXML = function(sXmlUrl) {\r
- try {\r
- _s.o._loadFromXML(sXmlUrl);\r
- } catch(e) {\r
- _s._failSafely();\r
- return true;\r
- };\r
- };\r
-\r
- this.createSound = function(oOptions) {\r
- if (!_s._didInit) throw new Error('soundManager.createSound(): Not loaded yet - wait for soundManager.onload() before calling sound-related methods');\r
- if (arguments.length==2) {\r
- // function overloading in JS! :) ..assume simple createSound(id,url) use case\r
- var oOptions = {'id':arguments[0],'url':arguments[1]};\r
- };\r
- var thisOptions = _s._mergeObjects(oOptions); // inherit SM2 defaults\r
- var _tO = thisOptions; // alias\r
- _s._wD('soundManager.createSound(): '+_tO.id+' ('+_tO.url+')',1);\r
- if (_s._idCheck(_tO.id,true)) {\r
- _s._wD('soundManager.createSound(): '+_tO.id+' exists',1);\r
- return _s.sounds[_tO.id];\r
- };\r
- if (_s.flashVersion > 8 && _s.useMovieStar) {\r
- if (_tO.isMovieStar == null) {\r
- _tO.isMovieStar = (_tO.url.match(_s.netStreamPattern)?true:false);\r
- }\r
- if (_tO.isMovieStar) {\r
- _s._wD('soundManager.createSound(): using MovieStar handling');\r
- }\r
- if (_tO.isMovieStar && (_tO.usePeakData || _tO.useWaveformData || _tO.useEQData)) {\r
- _s._wD('Warning: peak/waveform/eqData features unsupported for non-MP3 formats');\r
- _tO.usePeakData = false;\r
- _tO.useWaveformData = false;\r
- _tO.useEQData = false;\r
- }\r
- };\r
- _s.sounds[_tO.id] = new SMSound(_tO);\r
- _s.soundIDs[_s.soundIDs.length] = _tO.id;\r
- // AS2:\r
- if (_s.flashVersion == 8) {\r
- _s.o._createSound(_tO.id,_tO.onjustbeforefinishtime);\r
- } else {\r
- _s.o._createSound(_tO.id,_tO.url,_tO.onjustbeforefinishtime,_tO.usePeakData,_tO.useWaveformData,_tO.useEQData,_tO.isMovieStar,(_tO.isMovieStar?_tO.useVideo:false));\r
- };\r
- if (_tO.autoLoad || _tO.autoPlay) {\r
- window.setTimeout(function() {\r
- if (_s.sounds[_tO.id]) {\r
- _s.sounds[_tO.id].load(_tO);\r
- }\r
- },20);\r
- }\r
- if (_tO.autoPlay) {\r
- if (_s.flashVersion == 8) {\r
- _s.sounds[_tO.id].playState = 1; // we can only assume this sound will be playing soon.\r
- } else {\r
- _s.sounds[_tO.id].play(); \r
- }\r
- }\r
- return _s.sounds[_tO.id];\r
- };\r
-\r
- this.createVideo = function(oOptions) {\r
- if (arguments.length==2) {\r
- var oOptions = {'id':arguments[0],'url':arguments[1]};\r
- };\r
- if (_s.flashVersion >= 9) {\r
- oOptions.isMovieStar = true;\r
- oOptions.useVideo = true;\r
- } else {\r
- _s._wD('soundManager.createVideo(): flash 9 required for video. Exiting.',2);\r
- return false;\r
- }\r
- if (!_s.useMovieStar) {\r
- _s._wD('soundManager.createVideo(): MovieStar mode not enabled. Exiting.',2);\r
- }\r
- return _s.createSound(oOptions);\r
- }\r
-\r
- this.destroySound = function(sID,bFromSound) {\r
- // explicitly destroy a sound before normal page unload, etc.\r
- if (!_s._idCheck(sID)) return false;\r
- for (var i=0; i<_s.soundIDs.length; i++) {\r
- if (_s.soundIDs[i] == sID) {\r
- _s.soundIDs.splice(i,1);\r
- continue;\r
- };\r
- };\r
- // conservative option: avoid crash with ze flash 8\r
- // calling destroySound() within a sound onload() might crash firefox, certain flavours of winXP + flash 8??\r
- // if (_s.flashVersion != 8) {\r
- _s.sounds[sID].unload();\r
- // }\r
- if (!bFromSound) {\r
- // ignore if being called from SMSound instance\r
- _s.sounds[sID].destruct();\r
- };\r
- delete _s.sounds[sID];\r
- };\r
-\r
- this.destroyVideo = this.destroySound;\r
-\r
- this.load = function(sID,oOptions) {\r
- if (!_s._idCheck(sID)) return false;\r
- _s.sounds[sID].load(oOptions);\r
- };\r
-\r
- this.unload = function(sID) {\r
- if (!_s._idCheck(sID)) return false;\r
- _s.sounds[sID].unload();\r
- };\r
-\r
- this.play = function(sID,oOptions) {\r
- if (!_s._idCheck(sID)) {\r
- if (typeof oOptions != 'Object') oOptions = {url:oOptions}; // overloading use case: play('mySound','/path/to/some.mp3');\r
- if (oOptions && oOptions.url) {\r
- // overloading use case, creation + playing of sound: .play('someID',{url:'/path/to.mp3'});\r
- _s._wD('soundController.play(): attempting to create "'+sID+'"',1);\r
- oOptions.id = sID;\r
- _s.createSound(oOptions);\r
- } else {\r
- return false;\r
- };\r
- };\r
- _s.sounds[sID].play(oOptions);\r
- };\r
-\r
- this.start = this.play; // just for convenience\r
-\r
- this.setPosition = function(sID,nMsecOffset) {\r
- if (!_s._idCheck(sID)) return false;\r
- nMsecOffset = Math.min((nMsecOffset||0),_s.duration); // don't allow seek past loaded duration\r
- _s.sounds[sID].setPosition(nMsecOffset);\r
- };\r
-\r
- this.stop = function(sID) {\r
- if (!_s._idCheck(sID)) return false;\r
- _s._wD('soundManager.stop('+sID+')',1);\r
- _s.sounds[sID].stop(); \r
- };\r
-\r
- this.stopAll = function() {\r
- _s._wD('soundManager.stopAll()',1);\r
- for (var oSound in _s.sounds) {\r
- if (_s.sounds[oSound] instanceof SMSound) _s.sounds[oSound].stop(); // apply only to sound objects\r
- };\r
- };\r
-\r
- this.pause = function(sID) {\r
- if (!_s._idCheck(sID)) return false;\r
- _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 (!_s._idCheck(sID)) return false;\r
- _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 (!_s._idCheck(sID)) return false;\r
- _s.sounds[sID].togglePause();\r
- };\r
-\r
- this.setPan = function(sID,nPan) {\r
- if (!_s._idCheck(sID)) return false;\r
- _s.sounds[sID].setPan(nPan);\r
- };\r
-\r
- this.setVolume = function(sID,nVol) {\r
- if (!_s._idCheck(sID)) return false;\r
- _s.sounds[sID].setVolume(nVol);\r
- };\r
-\r
- this.mute = function(sID) {\r
- if (typeof sID != 'string') sID = null;\r
- if (!sID) {\r
- var o = null;\r
- _s._wD('soundManager.mute(): Muting all sounds');\r
- for (var i=_s.soundIDs.length; i--;) {\r
- _s.sounds[_s.soundIDs[i]].mute();\r
- }\r
- _s.muted = true;\r
- } else {\r
- if (!_s._idCheck(sID)) return false;\r
- _s._wD('soundManager.mute(): Muting "'+sID+'"');\r
- _s.sounds[sID].mute();\r
- }\r
- };\r
-\r
- this.muteAll = function() {\r
- _s.mute();\r
- };\r
-\r
- this.unmute = function(sID) {\r
- if (typeof sID != 'string') sID = null;\r
- if (!sID) {\r
- var o = null;\r
- _s._wD('soundManager.unmute(): Unmuting all sounds');\r
- for (var i=_s.soundIDs.length; i--;) {\r
- _s.sounds[_s.soundIDs[i]].unmute();\r
- }\r
- _s.muted = false;\r
- } else {\r
- if (!_s._idCheck(sID)) return false;\r
- _s._wD('soundManager.unmute(): Unmuting "'+sID+'"');\r
- _s.sounds[sID].unmute();\r
- }\r
- };\r
-\r
- this.unmuteAll = function() {\r
- _s.unmute();\r
- };\r
-\r
- this.setPolling = function(bPolling) {\r
- if (!_s.o || !_s.allowPolling) return false;\r
- // _s._wD('soundManager.setPolling('+bPolling+')');\r
- _s.o._setPolling(bPolling);\r
- };\r
-\r
- this.disable = function(bUnload) {\r
- // destroy all functions\r
- if (_s._disabled) return false;\r
- _s._disabled = true;\r
- _s._wD('soundManager.disable(): Disabling all functions - future calls will return false.',1);\r
- for (var i=_s.soundIDs.length; i--;) {\r
- _s._disableObject(_s.sounds[_s.soundIDs[i]]);\r
- };\r
- _s.initComplete(); // fire "complete", despite fail\r
- _s._disableObject(_s);\r
- };\r
-\r
- this.handleFlashBlock = function(bForce) {\r
- // experimental, removed with >v2.80.\r
- return false;\r
- };\r
-\r
- this.canPlayURL = function(sURL) {\r
- return (sURL?(sURL.match(_s.filePattern)?true:false):null); \r
- };\r
-\r
- this.getSoundById = function(sID,suppressDebug) {\r
- if (!sID) throw new Error('SoundManager.getSoundById(): sID is null/undefined');\r
- var result = _s.sounds[sID];\r
- if (!result && !suppressDebug) {\r
- _s._wD('"'+sID+'" is an invalid sound ID.',2);\r
- // soundManager._wD('trace: '+arguments.callee.caller);\r
- };\r
- return result;\r
- };\r
-\r
- this.onload = function() {\r
- // window.onload() equivalent for SM2, ready to create sounds etc.\r
- // this is a stub - you can override this in your own external script, eg. soundManager.onload = function() {}\r
- soundManager._wD('<em>Warning</em>: soundManager.onload() is undefined.',2);\r
- };\r
-\r
- this.onerror = function() {\r
- // stub for user handler, called when SM2 fails to load/init\r
- };\r
-\r
- // --- "private" methods ---\r
-\r
- this._idCheck = this.getSoundById;\r
-\r
- this._disableObject = function(o) {\r
- for (var oProp in o) {\r
- if (typeof o[oProp] == 'function' && typeof o[oProp]._protected == 'undefined') o[oProp] = function(){return false;};\r
- };\r
- oProp = null;\r
- };\r
-\r
- this._failSafely = function() {\r
- // exception handler for "object doesn't support this property or method" or general failure\r
- var fpgssTitle = 'You may need to whitelist this location/domain eg. file:///C:/ or C:/ or mysite.com, or set ALWAYS ALLOW under the Flash Player Global Security Settings page. The latter is probably less-secure.';\r
- var flashCPL = '<a href="'+flashCPLink+'" title="'+fpgssTitle+'">view/edit</a>';\r
- var FPGSS = '<a href="'+flashCPLink+'" title="Flash Player Global Security Settings">FPGSS</a>';\r
- if (!_s._disabled) {\r
- _s._wD('soundManager: Failed to initialise.',2);\r
- _s.disable();\r
- };\r
- };\r
- \r
- this._normalizeMovieURL = function(smURL) {\r
- if (smURL) {\r
- if (smURL.match(/\.swf/)) {\r
- smURL = smURL.substr(0,smURL.lastIndexOf('.swf'));\r
- }\r
- 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
- this._getDocument = function() {\r
- return (document.body?document.body:(document.documentElement?document.documentElement:document.getElementsByTagName('div')[0]));\r
- };\r
-\r
- this._getDocument._protected = true;\r
-\r
- this._createMovie = function(smID,smURL) {\r
- if (_s._didAppend && _s._appendSuccess) return false; // ignore if already succeeded\r
- if (window.location.href.indexOf('debug=1')+1) _s.debugMode = true; // allow force of debug mode via URL\r
- _s._didAppend = true;\r
- \r
- // safety check for legacy (change to Flash 9 URL)\r
- _s._setVersionInfo();\r
- var remoteURL = (smURL?smURL:_s.url);\r
- var localURL = (_s.altURL?_s.altURL:remoteURL);\r
- _s.url = _s._normalizeMovieURL(_s._overHTTP?remoteURL:localURL);\r
- smURL = _s.url;\r
-\r
- var htmlEmbed = '<embed name="'+smID+'" id="'+smID+'" src="'+smURL+'" width="100%" height="100%" quality="high" allowScriptAccess="always" quality="high" '+(_s.useHighPerformance && !_s.useMovieStar?'wmode="transparent" ':'')+'bgcolor="'+_s.bgColor+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>';\r
- var htmlObject = '<object id="'+smID+'" data="'+smURL+'" type="application/x-shockwave-flash" width="100%" height="100%"><param name="movie" value="'+smURL+'" /><param name="AllowScriptAccess" value="always" /><param name="quality" value="high" />'+(_s.useHighPerformance && !_s.useMovieStar?'<param name="wmode" value="transparent" /> ':'')+'<param name="bgcolor" value="'+_s.bgColor+'" /><!-- --></object>';\r
- var html = (!_s.isIE?htmlEmbed:htmlObject);\r
-\r
- var toggleElement = '<div id="'+_s.debugID+'-toggle" style="position:fixed;_position:absolute;right:0px;bottom:0px;_top:0px;width:1.2em;height:1.2em;line-height:1.2em;margin:2px;padding:0px;text-align:center;border:1px solid #999;cursor:pointer;background:#fff;color:#333;z-index:10001" title="Toggle SM2 debug console" onclick="soundManager._toggleDebug()">-</div>';\r
- var debugHTML = '<div id="'+_s.debugID+'" style="display:'+(_s.debugMode && ((!_s._hasConsole||!_s.useConsole)||(_s.useConsole && _s._hasConsole && !_s.consoleOnly))?'block':'none')+';opacity:0.85"></div>';\r
- var appXHTML = 'soundManager._createMovie(): appendChild/innerHTML set failed. May be app/xhtml+xml DOM-related.';\r
-\r
- var oTarget = _s._getDocument();\r
- if (oTarget) {\r
- \r
- _s.oMC = document.getElementById('sm2-container')?document.getElementById('sm2-container'):document.createElement('div');\r
- if (!_s.oMC.id) {\r
- _s.oMC.id = 'sm2-container';\r
- _s.oMC.className = 'movieContainer';\r
- // "hide" flash movie\r
- var s = null;\r
- if (_s.useHighPerformance) {\r
- s = {\r
- position: 'fixed',\r
- width: '8px',\r
- height: '8px', // must be at least 6px for flash to run fast. odd? yes.\r
- bottom: '0px',\r
- left: '0px',\r
- zIndex:-1 // sit behind everything else\r
- }\r
- } else {\r
- s = {\r
- position: 'absolute',\r
- width: '1px',\r
- height: '1px',\r
- bottom: '0px',\r
- left: '0px'\r
- }\r
- }\r
- var x = null;\r
- for (x in s) {\r
- _s.oMC.style[x] = s[x];\r
- }\r
- try {\r
- oTarget.appendChild(_s.oMC);\r
- _s.oMC.innerHTML = html;\r
- _s._appendSuccess = true;\r
- } catch(e) {\r
- throw new Error(appXHTML);\r
- }\r
- } else {\r
- // it's already in the document.\r
- _s.oMC.innerHTML = html;\r
- _s._appendSuccess = true;\r
- }\r
- if (!document.getElementById(_s.debugID) && ((!_s._hasConsole||!_s.useConsole)||(_s.useConsole && _s._hasConsole && !_s.consoleOnly))) {\r
- var oDebug = document.createElement('div');\r
- oDebug.id = _s.debugID;\r
- oDebug.style.display = (_s.debugMode?'block':'none');\r
- if (_s.debugMode) {\r
- try {\r
- var oD = document.createElement('div');\r
- oTarget.appendChild(oD);\r
- oD.innerHTML = toggleElement;\r
- } catch(e) {\r
- throw new Error(appXHTML);\r
- };\r
- };\r
- oTarget.appendChild(oDebug);\r
- };\r
- oTarget = null;\r
- };\r
- _s._wD('-- SoundManager 2 '+_s.version+(_s.useMovieStar?', MovieStar mode':'')+(_s._wD?', high performance mode':'')+' --',1);\r
- _s._wD('soundManager._createMovie(): Trying to load '+smURL+(!_s._overHTTP && _s.altURL?'(alternate URL)':''),1);\r
- };\r
-\r
- // aliased to this._wD()\r
- this._writeDebug = function(sText,sType,bTimestamp) {\r
- if (!_s.debugMode) return false;\r
- if (typeof bTimestamp != 'undefined' && bTimestamp) {\r
- sText = sText + ' | '+new Date().getTime();\r
- };\r
- if (_s._hasConsole && _s.useConsole) {\r
- var sMethod = _s._debugLevels[sType];\r
- if (typeof console[sMethod] != 'undefined') {\r
- console[sMethod](sText);\r
- } else {\r
- console.log(sText);\r
- };\r
- if (_s.useConsoleOnly) return true;\r
- };\r
- var sDID = 'soundmanager-debug';\r
- try {\r
- var o = document.getElementById(sDID);\r
- if (!o) return false;\r
- var oItem = document.createElement('div');\r
- sText = sText.replace(/\n/g,'<br />');\r
- if (typeof sType == 'undefined') {\r
- var sType = 0;\r
- } else {\r
- sType = parseInt(sType);\r
- };\r
- oItem.innerHTML = sText;\r
- if (sType) {\r
- if (sType >= 2) oItem.style.fontWeight = 'bold';\r
- if (sType == 3) oItem.style.color = '#ff3333';\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
- };\r
- this._writeDebug._protected = true;\r
- this._wD = this._writeDebug;\r
-\r
- this._wDAlert = function(sText) { alert(sText); };\r
-\r
- if (window.location.href.indexOf('debug=alert')+1 && _s.debugMode) {\r
- _s._wD = _s._wDAlert;\r
- };\r
-\r
- this._toggleDebug = function() {\r
- var o = document.getElementById(_s.debugID);\r
- var oT = document.getElementById(_s.debugID+'-toggle');\r
- if (!o) return false;\r
- if (_s._debugOpen) {\r
- // minimize\r
- oT.innerHTML = '+';\r
- o.style.display = 'none';\r
- } else {\r
- oT.innerHTML = '-';\r
- o.style.display = 'block';\r
- };\r
- _s._debugOpen = !_s._debugOpen;\r
- };\r
-\r
- this._toggleDebug._protected = true;\r
-\r
- this._debug = function() {\r
- _s._wD('--- soundManager._debug(): Current sound objects ---',1);\r
- for (var i=0,j=_s.soundIDs.length; i<j; i++) {\r
- _s.sounds[_s.soundIDs[i]]._debug();\r
- };\r
- };\r
-\r
- this._mergeObjects = function(oMain,oAdd) {\r
- // non-destructive merge\r
- var o1 = {}; // clone o1\r
- for (var i in oMain) {\r
- o1[i] = oMain[i];\r
- }\r
- var o2 = (typeof oAdd == 'undefined'?_s.defaultOptions:oAdd);\r
- for (var o in o2) {\r
- if (typeof o1[o] == 'undefined') o1[o] = o2[o];\r
- };\r
- return o1;\r
- };\r
-\r
- this.createMovie = function(sURL) {\r
- if (sURL) _s.url = sURL;\r
- _s._initMovie();\r
- };\r
-\r
- this.go = this.createMovie; // nice alias\r
-\r
- this._initMovie = function() {\r
- // attempt to get, or create, movie\r
- if (_s.o) return false; // pre-init may have fired this function before window.onload(), may already exist\r
- _s.o = _s.getMovie(_s.id); // try to get flash movie (inline markup)\r
- if (!_s.o) {\r
- // try to create\r
- _s._createMovie(_s.id,_s.url);\r
- _s.o = _s.getMovie(_s.id);\r
- };\r
- if (_s.o) {\r
- _s._wD('soundManager._initMovie(): Got '+_s.o.nodeName+' element ('+(_s._didAppend?'created via JS':'static HTML')+')',1);\r
- _s._wD('soundManager._initMovie(): Waiting for ExternalInterface call from Flash..');\r
- };\r
- };\r
-\r
- this.waitForExternalInterface = function() {\r
- if (_s._waitingForEI) return false;\r
- _s._waitingForEI = true;\r
- if (_s._tryInitOnFocus && !_s._isFocused) {\r
- _s._wD('soundManager: Special case: Flash may not have started due to non-focused tab (Safari is lame), and/or focus cannot be detected. Waiting for focus-related event..');\r
- return false;\r
- };\r
- if (!_s._didInit) {\r
- _s._wD('soundManager: Getting impatient, still waiting for Flash.. ;)');\r
- };\r
- setTimeout(function() {\r
- if (!_s._didInit) {\r
- _s._wD('soundManager: No Flash response within reasonable time after document load.\nPossible causes: Flash version under 8, no support, or Flash security denying JS-Flash communication.',2);\r
- if (!_s._overHTTP) {\r
- _s._wD('soundManager: Loading this page from local/network file system (not over HTTP?) Flash security likely restricting JS-Flash access. Consider adding current URL to "trusted locations" in the Flash player security settings manager at '+flashCPLink+', or simply serve this content over HTTP.',2);\r
- };\r
- };\r
- // if still not initialized and no other options, give up\r
- if (!_s._didInit && _s._okToDisable) _s._failSafely();\r
- },750);\r
- };\r
-\r
- this.handleFocus = function() {\r
- if (_s._isFocused || !_s._tryInitOnFocus) return true;\r
- _s._okToDisable = true;\r
- _s._isFocused = true;\r
- _s._wD('soundManager.handleFocus()');\r
- if (_s._tryInitOnFocus) {\r
- // giant Safari 3.1 hack - assume window in focus if mouse is moving, since document.hasFocus() not currently implemented.\r
- window.removeEventListener('mousemove',_s.handleFocus,false);\r
- };\r
- // allow init to restart\r
- _s._waitingForEI = false;\r
- setTimeout(_s.waitForExternalInterface,500);\r
- // detach event\r
- if (window.removeEventListener) {\r
- window.removeEventListener('focus',_s.handleFocus,false);\r
- } else if (window.detachEvent) {\r
- window.detachEvent('onfocus',_s.handleFocus);\r
- };\r
- };\r
-\r
- this.initComplete = function() {\r
- if (_s._didInit) return false;\r
- _s._didInit = true;\r
- _s._wD('-- SoundManager 2 '+(_s._disabled?'failed to load':'loaded')+' ('+(_s._disabled?'security/load error':'OK')+') --',1);\r
- if (_s._disabled) {\r
- _s._wD('soundManager.initComplete(): calling soundManager.onerror()',1);\r
- _s.onerror.apply(window);\r
- return false;\r
- };\r
- if (_s.waitForWindowLoad && !_s._windowLoaded) {\r
- _s._wD('soundManager: Waiting for window.onload()');\r
- if (window.addEventListener) {\r
- window.addEventListener('load',_s.initUserOnload,false);\r
- } else if (window.attachEvent) {\r
- window.attachEvent('onload',_s.initUserOnload);\r
- };\r
- return false;\r
- } else {\r
- if (_s.waitForWindowLoad && _s._windowLoaded) {\r
- _s._wD('soundManager: Document already loaded');\r
- };\r
- _s.initUserOnload();\r
- };\r
- };\r
-\r
- this.initUserOnload = function() {\r
- _s._wD('soundManager.initComplete(): calling soundManager.onload()',1);\r
- // call user-defined "onload", scoped to window\r
- //try {\r
- _s.onload.apply(window);\r
- /*\r
- } catch(e) {\r
- // something broke (likely JS error in user function)\r
- _s._wD('soundManager.onload() threw an exception: '+e.message,2);\r
- setTimeout(function(){throw new Error(e)},20);\r
- return false;\r
- };\r
- */\r
- _s._wD('soundManager.onload() complete',1);\r
- };\r
-\r
- this.init = function() {\r
- _s._wD('-- soundManager.init() --');\r
- // called after onload()\r
- _s._initMovie();\r
- if (_s._didInit) {\r
- _s._wD('soundManager.init(): Already called?');\r
- return false;\r
- };\r
- // event cleanup\r
- if (window.removeEventListener) {\r
- window.removeEventListener('load',_s.beginDelayedInit,false);\r
- } else if (window.detachEvent) {\r
- window.detachEvent('onload',_s.beginDelayedInit);\r
- };\r
- try {\r
- _s._wD('Attempting to call JS -> Flash..');\r
- _s.o._externalInterfaceTest(false); // attempt to talk to Flash\r
- // _s._wD('Flash ExternalInterface call (JS-Flash) OK',1);\r
- if (!_s.allowPolling) {\r
- _s._wD('Polling (whileloading/whileplaying support) is disabled.',1);\r
- }\r
- _s.setPolling(true);\r
- if (!_s.debugMode) _s.o._disableDebug();\r
- _s.enabled = true;\r
- } catch(e) {\r
- _s._failSafely();\r
- _s.initComplete();\r
- return false;\r
- };\r
- _s.initComplete();\r
- };\r
-\r
- this.beginDelayedInit = function() {\r
- _s._wD('soundManager.beginDelayedInit(): Document loaded');\r
- _s._windowLoaded = true;\r
- setTimeout(_s.waitForExternalInterface,500);\r
- setTimeout(_s.beginInit,20);\r
- };\r
-\r
- this.beginInit = function() {\r
- if (_s._initPending) return false;\r
- _s.createMovie(); // ensure creation if not already done\r
- _s._initMovie();\r
- _s._initPending = true;\r
- return true;\r
- };\r
-\r
- this.domContentLoaded = function() {\r
- _s._wD('soundManager.domContentLoaded()');\r
- if (document.removeEventListener) document.removeEventListener('DOMContentLoaded',_s.domContentLoaded,false);\r
- _s.go();\r
- };\r
-\r
- this._externalInterfaceOK = function() {\r
- // callback from flash for confirming that movie loaded, EI is working etc.\r
- if (_s.swfLoaded) return false;\r
- _s._wD('soundManager._externalInterfaceOK()');\r
- _s.swfLoaded = true;\r
- _s._tryInitOnFocus = false;\r
- if (_s.isIE) {\r
- // IE needs a timeout OR delay until window.onload - may need TODO: investigating\r
- setTimeout(_s.init,100);\r
- } else {\r
- _s.init();\r
- };\r
- };\r
-\r
- this._setSandboxType = function(sandboxType) {\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
- _s._wD('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',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
- };\r
-\r
- this.destruct = function() {\r
- _s._wD('soundManager.destruct()');\r
- _s.disable(true);\r
- };\r
- \r
- // SMSound (sound object)\r
- \r
- function SMSound(oOptions) {\r
- var _t = this;\r
- this.sID = oOptions.id;\r
- this.url = oOptions.url;\r
- this.options = _s._mergeObjects(oOptions);\r
- this.instanceOptions = this.options; // per-play-instance-specific options\r
- this._iO = this.instanceOptions; // short alias\r
-\r
- this._debug = function() {\r
- if (_s.debugMode) {\r
- var stuff = null;\r
- var msg = [];\r
- var sF = null;\r
- var sfBracket = null;\r
- var maxLength = 64; // # of characters of function code to show before truncating\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[msg.length] = ' '+stuff+': {'+sF.substr(sfBracket+1,(Math.min(Math.max(sF.indexOf('\n')-1,maxLength),maxLength))).replace(/\n/g,'')+'... }';\r
- } else {\r
- msg[msg.length] = ' '+stuff+': '+_t.options[stuff];\r
- };\r
- };\r
- };\r
- _s._wD('SMSound() merged options: {\n'+msg.join(', \n')+'\n}');\r
- };\r
- };\r
-\r
- this._debug();\r
-\r
- this.id3 = {\r
- /* \r
- Name/value pairs set via Flash when available - see reference for names:\r
- http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001567.html\r
- (eg., this.id3.songname or this.id3['songname'])\r
- */\r
- };\r
-\r
- this.resetProperties = function(bLoaded) {\r
- _t.bytesLoaded = null;\r
- _t.bytesTotal = null;\r
- _t.position = null;\r
- _t.duration = null;\r
- _t.durationEstimate = null;\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.instanceOptions = {};\r
- _t.instanceCount = 0;\r
- _t.peakData = {\r
- left: 0,\r
- right: 0\r
- };\r
- _t.waveformData = [];\r
- _t.eqData = [];\r
- };\r
-\r
- _t.resetProperties();\r
-\r
- // --- public methods ---\r
-\r
- this.load = function(oOptions) {\r
- if (typeof oOptions != 'undefined') {\r
- _t._iO = _s._mergeObjects(oOptions);\r
- _t.instanceOptions = _t._iO;\r
- } else {\r
- var oOptions = _t.options;\r
- _t._iO = oOptions;\r
- _t.instanceOptions = _t._iO;\r
- } \r
- if (typeof _t._iO.url == 'undefined') _t._iO.url = _t.url;\r
- _s._wD('soundManager.load(): '+_t._iO.url,1);\r
- if (_t._iO.url == _t.url && _t.readyState != 0 && _t.readyState != 2) {\r
- _s._wD('soundManager.load(): current URL already assigned.',1);\r
- return false;\r
- }\r
- _t.loaded = false;\r
- _t.readyState = 1;\r
- _t.playState = (oOptions.autoPlay?1:0); // if autoPlay, assume "playing" is true (no way to detect when it actually starts in Flash unless onPlay is watched?)\r
- try {\r
- if (_s.flashVersion==8) {\r
- _s.o._load(_t.sID,_t._iO.url,_t._iO.stream,_t._iO.autoPlay,(_t._iO.whileloading?1:0));\r
- } else {\r
- _s.o._load(_t.sID,_t._iO.url,_t._iO.stream?true:false,_t._iO.autoPlay?true:false); // ,(_tO.whileloading?true:false)\r
- if (_t._iO.isMovieStar && _t._iO.autoLoad && !_t._iO.autoPlay) {\r
- // special case: MPEG4 content must start playing to load, then pause to prevent playing.\r
- _t.pause();\r
- }\r
- };\r
- } catch(e) {\r
- _s._wD('SMSound.load(): Exception: JS-Flash communication failed, or JS error.',2);\r
- _s.onerror();\r
- _s.disable();\r
- };\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.readyState != 2) { // reset if not error\r
- _t.setPosition(0); // reset current sound positioning\r
- }\r
- _s.o._unload(_t.sID,_s.nullURL);\r
- // reset load/status flags\r
- _t.resetProperties();\r
- }\r
- };\r
-\r
- this.destruct = function() {\r
- // kill sound within Flash\r
- _s._wD('SMSound.destruct(): "'+_t.sID+'"');\r
- _s.o._destroySound(_t.sID);\r
- _s.destroySound(_t.sID,true); // ensure deletion from controller\r
- }\r
-\r
- this.play = function(oOptions) {\r
- if (!oOptions) oOptions = {};\r
- _t._iO = _s._mergeObjects(oOptions,_t._iO);\r
- _t._iO = _s._mergeObjects(_t._iO,_t.options);\r
- _t.instanceOptions = _t._iO;\r
- if (_t.playState == 1) {\r
- var allowMulti = _t._iO.multiShot;\r
- if (!allowMulti) {\r
- _s._wD('SMSound.play(): "'+_t.sID+'" already playing (one-shot)',1);\r
- return false;\r
- } else {\r
- _s._wD('SMSound.play(): "'+_t.sID+'" already playing (multi-shot)',1);\r
- };\r
- };\r
- if (!_t.loaded) {\r
- if (_t.readyState == 0) {\r
- _s._wD('SMSound.play(): Attempting to load "'+_t.sID+'"',1);\r
- // try to get this sound playing ASAP\r
- _t._iO.stream = true;\r
- _t._iO.autoPlay = true;\r
- // TODO: need to investigate when false, double-playing\r
- // if (typeof oOptions.autoPlay=='undefined') _tO.autoPlay = true; // only set autoPlay if unspecified here\r
- _t.load(_t._iO); // try to get this sound playing ASAP\r
- } else if (_t.readyState == 2) {\r
- _s._wD('SMSound.play(): Could not load "'+_t.sID+'" - exiting',2);\r
- return false;\r
- } else {\r
- _s._wD('SMSound.play(): "'+_t.sID+'" is loading - attempting to play..',1);\r
- };\r
- } else {\r
- _s._wD('SMSound.play(): "'+_t.sID+'"');\r
- };\r
- if (_t.paused) {\r
- _t.resume();\r
- } else {\r
- _t.playState = 1;\r
- if (!_t.instanceCount || _s.flashVersion == 9) _t.instanceCount++;\r
- _t.position = (typeof _t._iO.position != 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0);\r
- if (_t._iO.onplay) _t._iO.onplay.apply(_t);\r
- _t.setVolume(_t._iO.volume);\r
- _t.setPan(_t._iO.pan);\r
- _s.o._start(_t.sID,_t._iO.loop||1,(_s.flashVersion==9?_t.position:_t.position/1000));\r
- };\r
- };\r
-\r
- this.start = this.play; // just for convenience\r
-\r
- this.stop = function(bAll) {\r
- if (_t.playState == 1) {\r
- _t.playState = 0;\r
- _t.paused = false;\r
- // if (_s.defaultOptions.onstop) _s.defaultOptions.onstop.apply(_s);\r
- if (_t._iO.onstop) _t._iO.onstop.apply(_t);\r
- _s.o._stop(_t.sID,bAll);\r
- _t.instanceCount = 0;\r
- _t._iO = {};\r
- // _t.instanceOptions = _t._iO;\r
- };\r
- };\r
-\r
- this.setPosition = function(nMsecOffset) {\r
- _t._iO.position = nMsecOffset;\r
- _s._wD('SMSound.setPosition('+nMsecOffset+')');\r
- _s.o._setPosition(_t.sID,(_s.flashVersion==9?_t._iO.position:_t._iO.position/1000),(_t.paused||!_t.playState)); // if paused or not playing, will not resume (by playing)\r
- };\r
-\r
- this.pause = function() {\r
- if (_t.paused || _t.playState == 0) return false;\r
- _s._wD('SMSound.pause()');\r
- _t.paused = true;\r
- _s.o._pause(_t.sID);\r
- if (_t._iO.onpause) _t._iO.onpause.apply(_t);\r
- };\r
-\r
- this.resume = function() {\r
- if (!_t.paused || _t.playState == 0) return false;\r
- _s._wD('SMSound.resume()');\r
- _t.paused = false;\r
- _s.o._pause(_t.sID); // flash method is toggle-based (pause/resume)\r
- if (_t._iO.onresume) _t._iO.onresume.apply(_t);\r
- };\r
-\r
- this.togglePause = function() {\r
- _s._wD('SMSound.togglePause()');\r
- if (!_t.playState) {\r
- _t.play({position:(_s.flashVersion==9?_t.position:_t.position/1000)});\r
- return false;\r
- };\r
- if (_t.paused) {\r
- _t.resume();\r
- } else {\r
- _t.pause();\r
- };\r
- };\r
-\r
- this.setPan = function(nPan) {\r
- if (typeof nPan == 'undefined') nPan = 0;\r
- _s.o._setPan(_t.sID,nPan);\r
- _t._iO.pan = nPan;\r
- };\r
-\r
- this.setVolume = function(nVol) {\r
- if (typeof nVol == 'undefined') nVol = 100;\r
- _s.o._setVolume(_t.sID,(_s.muted&&!_t.muted)||_t.muted?0:nVol);\r
- _t._iO.volume = nVol;\r
- };\r
-\r
- this.mute = function() {\r
- _t.muted = true;\r
- _s.o._setVolume(_t.sID,0);\r
- };\r
-\r
- this.unmute = function() {\r
- _t.muted = false;\r
- _s.o._setVolume(_t.sID,typeof _t._iO.volume != 'undefined'?_t._iO.volume:_t.options.volume);\r
- };\r
-\r
- // --- "private" methods called by Flash ---\r
-\r
- this._whileloading = function(nBytesLoaded,nBytesTotal,nDuration) {\r
- if (!_t._iO.isMovieStar) {\r
- _t.bytesLoaded = nBytesLoaded;\r
- _t.bytesTotal = nBytesTotal;\r
- _t.duration = Math.floor(nDuration);\r
- _t.durationEstimate = parseInt((_t.bytesTotal/_t.bytesLoaded)*_t.duration); // estimate total time (will only be accurate with CBR MP3s.)\r
- if (_t.readyState != 3 && _t._iO.whileloading) _t._iO.whileloading.apply(_t);\r
- } else {\r
- _t.bytesLoaded = nBytesLoaded;\r
- _t.bytesTotal = nBytesTotal;\r
- _t.duration = Math.floor(nDuration);\r
- _t.durationEstimate = _t.duration;\r
- if (_t.readyState != 3 && _t._iO.whileloading) _t._iO.whileloading.apply(_t);\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 = [];\r
- for (var i=0,j=oID3PropNames.length; i<j; i++) {\r
- oData[oID3PropNames[i]] = oID3Data[i];\r
- // _s._wD(oID3PropNames[i]+': '+oID3Data[i]);\r
- };\r
- _t.id3 = _s._mergeObjects(_t.id3,oData);\r
- if (_t._iO.onid3) _t._iO.onid3.apply(_t);\r
- };\r
-\r
- this._whileplaying = function(nPosition,oPeakData,oWaveformData,oEQData) {\r
- if (isNaN(nPosition) || nPosition == null) return false; // Flash may return NaN at times\r
- _t.position = nPosition;\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 oWaveformData != 'undefined' && oWaveformData) {\r
- _t.waveformData = oWaveformData;\r
- /*\r
- _t.spectrumData = {\r
- left: oSpectrumData.left.split(','),\r
- right: oSpectrumData.right.split(',')\r
- }\r
- */\r
- };\r
- if (_t._iO.useEQData && typeof oEQData != 'undefined' && oEQData) {\r
- _t.eqData = oEQData;\r
- };\r
- if (_t.playState == 1) {\r
- if (_t._iO.whileplaying) {\r
- _t._iO.whileplaying.apply(_t); // flash may call after actual finish\r
- };\r
- if (_t.loaded && _t._iO.onbeforefinish && _t._iO.onbeforefinishtime && !_t.didBeforeFinish && _t.duration-_t.position <= _t._iO.onbeforefinishtime) {\r
- _s._wD('duration-position <= onbeforefinishtime: '+_t.duration+' - '+_t.position+' <= '+_t._iO.onbeforefinishtime+' ('+(_t.duration-_t.position)+')');\r
- _t._onbeforefinish();\r
- };\r
- };\r
- };\r
-\r
- this._onload = function(bSuccess) {\r
- bSuccess = (bSuccess==1?true:false);\r
- _s._wD('SMSound._onload(): "'+_t.sID+'"'+(bSuccess?' loaded.':' failed to load? - '+_t.url));\r
- if (!bSuccess) {\r
- if (_s.sandbox.noRemote == true) {\r
- _s._wD('SMSound._onload(): Reminder: Flash security is denying network/internet access',1);\r
- };\r
- if (_s.sandbox.noLocal == true) {\r
- _s._wD('SMSound._onload(): Reminder: Flash security is denying local access',1);\r
- };\r
- };\r
- _t.loaded = bSuccess;\r
- _t.readyState = bSuccess?3:2;\r
- if (_t._iO.onload) {\r
- _t._iO.onload.apply(_t);\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
- // msOffset: "end of sound" delay actual value (eg. 200 msec, value at event fire time was 187)\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
- // sound has finished playing\r
- _t.playState = 0;\r
- _t.paused = false;\r
- if (_t._iO.onfinish) {\r
- _s._wD('SMSound._onfinish(): "'+_t.sID+'"');\r
- _t._iO.onfinish.apply(_t);\r
- }\r
- if (_t._iO.onbeforefinishcomplete) _t._iO.onbeforefinishcomplete.apply(_t);\r
- // reset some state items\r
- _t.setPosition(0);\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.instanceCount = 0;\r
- _t.instanceOptions = {};\r
- }\r
- }\r
- };\r
-\r
- this._onmetadata = function(oMetaData) {\r
- // movieStar mode only\r
- _s._wD('SMSound.onmetadata()');\r
- // Contains a subset of metadata. Note that files may have their own unique metadata.\r
- // http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000267.html\r
- if (!oMetaData.width && !oMetaData.height) {\r
- _s._wD('No width/height given, assuming defaults');\r
- oMetaData.width = 320;\r
- oMetaData.height = 240;\r
- };\r
- _t.metadata = oMetaData; // potentially-large object from flash\r
- _t.width = oMetaData.width;\r
- _t.height = oMetaData.height;\r
- if (_t._iO.onmetadata) {\r
- _s._wD('SMSound._onmetadata(): "'+_t.sID+'"');\r
- _t._iO.onmetadata.apply(_t);\r
- }\r
- _s.wD('SMSound.onmetadata() complete');\r
- };\r
-\r
- }; // SMSound()\r
-\r
- // register a few event handlers\r
- if (window.addEventListener) {\r
- window.addEventListener('focus',_s.handleFocus,false);\r
- window.addEventListener('load',_s.beginDelayedInit,false);\r
- window.addEventListener('unload',_s.destruct,false);\r
- if (_s._tryInitOnFocus) window.addEventListener('mousemove',_s.handleFocus,false); // massive Safari focus hack\r
- } else if (window.attachEvent) {\r
- window.attachEvent('onfocus',_s.handleFocus);\r
- window.attachEvent('onload',_s.beginDelayedInit);\r
- window.attachEvent('unload',_s.destruct);\r
- } else {\r
- // no add/attachevent support - safe to assume no JS -> Flash either.\r
- soundManager.onerror();\r
- soundManager.disable();\r
- };\r
-\r
- if (document.addEventListener) document.addEventListener('DOMContentLoaded',_s.domContentLoaded,false);\r
-\r
-}; // SoundManager()\r
-\r
-var soundManager = new SoundManager();\r
+++ /dev/null
-/* This notice must be untouched at all times.\r
-\r
-wz_jsgraphics.js v. 3.03\r
-The latest version is available at\r
-http://www.walterzorn.com\r
-or http://www.devira.com\r
-or http://www.walterzorn.de\r
-\r
-Copyright (c) 2002-2004 Walter Zorn. All rights reserved.\r
-Created 3. 11. 2002 by Walter Zorn (Web: http://www.walterzorn.com )\r
-Last modified: 28. 1. 2008\r
-\r
-Performance optimizations for Internet Explorer\r
-by Thomas Frank and John Holdsworth.\r
-fillPolygon method implemented by Matthieu Haller.\r
-\r
-High Performance JavaScript Graphics Library.\r
-Provides methods\r
-- to draw lines, rectangles, ellipses, polygons\r
- with specifiable line thickness,\r
-- to fill rectangles, polygons, ellipses and arcs\r
-- to draw text.\r
-NOTE: Operations, functions and branching have rather been optimized\r
-to efficiency and speed than to shortness of source code.\r
-\r
-LICENSE: LGPL\r
-\r
-This library is free software; you can redistribute it and/or\r
-modify it under the terms of the GNU Lesser General Public\r
-License (LGPL) as published by the Free Software Foundation; either\r
-version 2.1 of the License, or (at your option) any later version.\r
-\r
-This library is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
-Lesser General Public License for more details.\r
-\r
-You should have received a copy of the GNU Lesser General Public\r
-License along with this library; if not, write to the Free Software\r
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,\r
-or see http://www.gnu.org/copyleft/lesser.html\r
-*/\r
-\r
-\r
-var jg_ok, jg_ie, jg_fast, jg_dom, jg_moz;\r
-\r
-\r
-function _chkDHTM(x, i)\r
-{\r
- x = document.body || null;\r
- jg_ie = x && typeof x.insertAdjacentHTML != "undefined" && document.createElement;\r
- jg_dom = (x && !jg_ie &&\r
- typeof x.appendChild != "undefined" &&\r
- typeof document.createRange != "undefined" &&\r
- typeof (i = document.createRange()).setStartBefore != "undefined" &&\r
- typeof i.createContextualFragment != "undefined");\r
- jg_fast = jg_ie && document.all && !window.opera;\r
- jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined";\r
- jg_ok = !!(jg_ie || jg_dom);\r
-}\r
-\r
-function _pntCnvDom()\r
-{\r
- var x = this.wnd.document.createRange();\r
- x.setStartBefore(this.cnv);\r
- x = x.createContextualFragment(jg_fast? this._htmRpc() : this.htm);\r
- if(this.cnv) this.cnv.appendChild(x);\r
- this.htm = "";\r
-}\r
-\r
-function _pntCnvIe()\r
-{\r
- if(this.cnv) this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this._htmRpc() : this.htm);\r
- this.htm = "";\r
-}\r
-\r
-function _pntDoc()\r
-{\r
- this.wnd.document.write(jg_fast? this._htmRpc() : this.htm);\r
- this.htm = '';\r
-}\r
-\r
-function _pntN()\r
-{\r
- ;\r
-}\r
-\r
-function _mkDiv(x, y, w, h)\r
-{\r
- this.htm += '<div style="position:absolute;'+\r
- 'left:' + x + 'px;'+\r
- 'top:' + y + 'px;'+\r
- 'width:' + w + 'px;'+\r
- 'height:' + h + 'px;'+\r
- 'clip:rect(0,'+w+'px,'+h+'px,0);'+\r
- 'background-color:' + this.color +\r
- (!jg_moz? ';overflow:hidden' : '')+\r
- ';"><\/div>';\r
-}\r
-\r
-function _mkDivIe(x, y, w, h)\r
-{\r
- this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';\r
-}\r
-\r
-function _mkDivPrt(x, y, w, h)\r
-{\r
- this.htm += '<div style="position:absolute;'+\r
- 'border-left:' + w + 'px solid ' + this.color + ';'+\r
- 'left:' + x + 'px;'+\r
- 'top:' + y + 'px;'+\r
- 'width:0px;'+\r
- 'height:' + h + 'px;'+\r
- 'clip:rect(0,'+w+'px,'+h+'px,0);'+\r
- 'background-color:' + this.color +\r
- (!jg_moz? ';overflow:hidden' : '')+\r
- ';"><\/div>';\r
-}\r
-\r
-var _regex = /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;\r
-function _htmRpc()\r
-{\r
- return this.htm.replace(\r
- _regex,\r
- '<div style="overflow:hidden;position:absolute;background-color:'+\r
- '$1;left:$2;top:$3;width:$4;height:$5"></div>\n');\r
-}\r
-\r
-function _htmPrtRpc()\r
-{\r
- return this.htm.replace(\r
- _regex,\r
- '<div style="overflow:hidden;position:absolute;background-color:'+\r
- '$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n');\r
-}\r
-\r
-function _mkLin(x1, y1, x2, y2)\r
-{\r
- if(x1 > x2)\r
- {\r
- var _x2 = x2;\r
- var _y2 = y2;\r
- x2 = x1;\r
- y2 = y1;\r
- x1 = _x2;\r
- y1 = _y2;\r
- }\r
- var dx = x2-x1, dy = Math.abs(y2-y1),\r
- x = x1, y = y1,\r
- yIncr = (y1 > y2)? -1 : 1;\r
-\r
- if(dx >= dy)\r
- {\r
- var pr = dy<<1,\r
- pru = pr - (dx<<1),\r
- p = pr-dx,\r
- ox = x;\r
- while(dx > 0)\r
- {--dx;\r
- ++x;\r
- if(p > 0)\r
- {\r
- this._mkDiv(ox, y, x-ox, 1);\r
- y += yIncr;\r
- p += pru;\r
- ox = x;\r
- }\r
- else p += pr;\r
- }\r
- this._mkDiv(ox, y, x2-ox+1, 1);\r
- }\r
-\r
- else\r
- {\r
- var pr = dx<<1,\r
- pru = pr - (dy<<1),\r
- p = pr-dy,\r
- oy = y;\r
- if(y2 <= y1)\r
- {\r
- while(dy > 0)\r
- {--dy;\r
- if(p > 0)\r
- {\r
- this._mkDiv(x++, y, 1, oy-y+1);\r
- y += yIncr;\r
- p += pru;\r
- oy = y;\r
- }\r
- else\r
- {\r
- y += yIncr;\r
- p += pr;\r
- }\r
- }\r
- this._mkDiv(x2, y2, 1, oy-y2+1);\r
- }\r
- else\r
- {\r
- while(dy > 0)\r
- {--dy;\r
- y += yIncr;\r
- if(p > 0)\r
- {\r
- this._mkDiv(x++, oy, 1, y-oy);\r
- p += pru;\r
- oy = y;\r
- }\r
- else p += pr;\r
- }\r
- this._mkDiv(x2, oy, 1, y2-oy+1);\r
- }\r
- }\r
-}\r
-\r
-function _mkLin2D(x1, y1, x2, y2)\r
-{\r
- if(x1 > x2)\r
- {\r
- var _x2 = x2;\r
- var _y2 = y2;\r
- x2 = x1;\r
- y2 = y1;\r
- x1 = _x2;\r
- y1 = _y2;\r
- }\r
- var dx = x2-x1, dy = Math.abs(y2-y1),\r
- x = x1, y = y1,\r
- yIncr = (y1 > y2)? -1 : 1;\r
-\r
- var s = this.stroke;\r
- if(dx >= dy)\r
- {\r
- if(dx > 0 && s-3 > 0)\r
- {\r
- var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx;\r
- _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;\r
- }\r
- else var _s = s;\r
- var ad = Math.ceil(s/2);\r
-\r
- var pr = dy<<1,\r
- pru = pr - (dx<<1),\r
- p = pr-dx,\r
- ox = x;\r
- while(dx > 0)\r
- {--dx;\r
- ++x;\r
- if(p > 0)\r
- {\r
- this._mkDiv(ox, y, x-ox+ad, _s);\r
- y += yIncr;\r
- p += pru;\r
- ox = x;\r
- }\r
- else p += pr;\r
- }\r
- this._mkDiv(ox, y, x2-ox+ad+1, _s);\r
- }\r
-\r
- else\r
- {\r
- if(s-3 > 0)\r
- {\r
- var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy;\r
- _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;\r
- }\r
- else var _s = s;\r
- var ad = Math.round(s/2);\r
-\r
- var pr = dx<<1,\r
- pru = pr - (dy<<1),\r
- p = pr-dy,\r
- oy = y;\r
- if(y2 <= y1)\r
- {\r
- ++ad;\r
- while(dy > 0)\r
- {--dy;\r
- if(p > 0)\r
- {\r
- this._mkDiv(x++, y, _s, oy-y+ad);\r
- y += yIncr;\r
- p += pru;\r
- oy = y;\r
- }\r
- else\r
- {\r
- y += yIncr;\r
- p += pr;\r
- }\r
- }\r
- this._mkDiv(x2, y2, _s, oy-y2+ad);\r
- }\r
- else\r
- {\r
- while(dy > 0)\r
- {--dy;\r
- y += yIncr;\r
- if(p > 0)\r
- {\r
- this._mkDiv(x++, oy, _s, y-oy+ad);\r
- p += pru;\r
- oy = y;\r
- }\r
- else p += pr;\r
- }\r
- this._mkDiv(x2, oy, _s, y2-oy+ad+1);\r
- }\r
- }\r
-}\r
-\r
-function _mkLinDott(x1, y1, x2, y2)\r
-{\r
- if(x1 > x2)\r
- {\r
- var _x2 = x2;\r
- var _y2 = y2;\r
- x2 = x1;\r
- y2 = y1;\r
- x1 = _x2;\r
- y1 = _y2;\r
- }\r
- var dx = x2-x1, dy = Math.abs(y2-y1),\r
- x = x1, y = y1,\r
- yIncr = (y1 > y2)? -1 : 1,\r
- drw = true;\r
- if(dx >= dy)\r
- {\r
- var pr = dy<<1,\r
- pru = pr - (dx<<1),\r
- p = pr-dx;\r
- while(dx > 0)\r
- {--dx;\r
- if(drw) this._mkDiv(x, y, 1, 1);\r
- drw = !drw;\r
- if(p > 0)\r
- {\r
- y += yIncr;\r
- p += pru;\r
- }\r
- else p += pr;\r
- ++x;\r
- }\r
- }\r
- else\r
- {\r
- var pr = dx<<1,\r
- pru = pr - (dy<<1),\r
- p = pr-dy;\r
- while(dy > 0)\r
- {--dy;\r
- if(drw) this._mkDiv(x, y, 1, 1);\r
- drw = !drw;\r
- y += yIncr;\r
- if(p > 0)\r
- {\r
- ++x;\r
- p += pru;\r
- }\r
- else p += pr;\r
- }\r
- }\r
- if(drw) this._mkDiv(x, y, 1, 1);\r
-}\r
-\r
-function _mkOv(left, top, width, height)\r
-{\r
- var a = (++width)>>1, b = (++height)>>1,\r
- wod = width&1, hod = height&1,\r
- cx = left+a, cy = top+b,\r
- x = 0, y = b,\r
- ox = 0, oy = b,\r
- aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,\r
- st = (aa2>>1)*(1-(b<<1)) + bb2,\r
- tt = (bb2>>1) - aa2*((b<<1)-1),\r
- w, h;\r
- while(y > 0)\r
- {\r
- if(st < 0)\r
- {\r
- st += bb2*((x<<1)+3);\r
- tt += bb4*(++x);\r
- }\r
- else if(tt < 0)\r
- {\r
- st += bb2*((x<<1)+3) - aa4*(y-1);\r
- tt += bb4*(++x) - aa2*(((y--)<<1)-3);\r
- w = x-ox;\r
- h = oy-y;\r
- if((w&2) && (h&2))\r
- {\r
- this._mkOvQds(cx, cy, x-2, y+2, 1, 1, wod, hod);\r
- this._mkOvQds(cx, cy, x-1, y+1, 1, 1, wod, hod);\r
- }\r
- else this._mkOvQds(cx, cy, x-1, oy, w, h, wod, hod);\r
- ox = x;\r
- oy = y;\r
- }\r
- else\r
- {\r
- tt -= aa2*((y<<1)-3);\r
- st -= aa4*(--y);\r
- }\r
- }\r
- w = a-ox+1;\r
- h = (oy<<1)+hod;\r
- y = cy-oy;\r
- this._mkDiv(cx-a, y, w, h);\r
- this._mkDiv(cx+ox+wod-1, y, w, h);\r
-}\r
-\r
-function _mkOv2D(left, top, width, height)\r
-{\r
- var s = this.stroke;\r
- width += s+1;\r
- height += s+1;\r
- var a = width>>1, b = height>>1,\r
- wod = width&1, hod = height&1,\r
- cx = left+a, cy = top+b,\r
- x = 0, y = b,\r
- aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,\r
- st = (aa2>>1)*(1-(b<<1)) + bb2,\r
- tt = (bb2>>1) - aa2*((b<<1)-1);\r
-\r
- if(s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0))\r
- {\r
- var ox = 0, oy = b,\r
- w, h,\r
- pxw;\r
- while(y > 0)\r
- {\r
- if(st < 0)\r
- {\r
- st += bb2*((x<<1)+3);\r
- tt += bb4*(++x);\r
- }\r
- else if(tt < 0)\r
- {\r
- st += bb2*((x<<1)+3) - aa4*(y-1);\r
- tt += bb4*(++x) - aa2*(((y--)<<1)-3);\r
- w = x-ox;\r
- h = oy-y;\r
-\r
- if(w-1)\r
- {\r
- pxw = w+1+(s&1);\r
- h = s;\r
- }\r
- else if(h-1)\r
- {\r
- pxw = s;\r
- h += 1+(s&1);\r
- }\r
- else pxw = h = s;\r
- this._mkOvQds(cx, cy, x-1, oy, pxw, h, wod, hod);\r
- ox = x;\r
- oy = y;\r
- }\r
- else\r
- {\r
- tt -= aa2*((y<<1)-3);\r
- st -= aa4*(--y);\r
- }\r
- }\r
- this._mkDiv(cx-a, cy-oy, s, (oy<<1)+hod);\r
- this._mkDiv(cx+a+wod-s, cy-oy, s, (oy<<1)+hod);\r
- }\r
-\r
- else\r
- {\r
- var _a = (width-(s<<1))>>1,\r
- _b = (height-(s<<1))>>1,\r
- _x = 0, _y = _b,\r
- _aa2 = (_a*_a)<<1, _aa4 = _aa2<<1, _bb2 = (_b*_b)<<1, _bb4 = _bb2<<1,\r
- _st = (_aa2>>1)*(1-(_b<<1)) + _bb2,\r
- _tt = (_bb2>>1) - _aa2*((_b<<1)-1),\r
-\r
- pxl = new Array(),\r
- pxt = new Array(),\r
- _pxb = new Array();\r
- pxl[0] = 0;\r
- pxt[0] = b;\r
- _pxb[0] = _b-1;\r
- while(y > 0)\r
- {\r
- if(st < 0)\r
- {\r
- pxl[pxl.length] = x;\r
- pxt[pxt.length] = y;\r
- st += bb2*((x<<1)+3);\r
- tt += bb4*(++x);\r
- }\r
- else if(tt < 0)\r
- {\r
- pxl[pxl.length] = x;\r
- st += bb2*((x<<1)+3) - aa4*(y-1);\r
- tt += bb4*(++x) - aa2*(((y--)<<1)-3);\r
- pxt[pxt.length] = y;\r
- }\r
- else\r
- {\r
- tt -= aa2*((y<<1)-3);\r
- st -= aa4*(--y);\r
- }\r
-\r
- if(_y > 0)\r
- {\r
- if(_st < 0)\r
- {\r
- _st += _bb2*((_x<<1)+3);\r
- _tt += _bb4*(++_x);\r
- _pxb[_pxb.length] = _y-1;\r
- }\r
- else if(_tt < 0)\r
- {\r
- _st += _bb2*((_x<<1)+3) - _aa4*(_y-1);\r
- _tt += _bb4*(++_x) - _aa2*(((_y--)<<1)-3);\r
- _pxb[_pxb.length] = _y-1;\r
- }\r
- else\r
- {\r
- _tt -= _aa2*((_y<<1)-3);\r
- _st -= _aa4*(--_y);\r
- _pxb[_pxb.length-1]--;\r
- }\r
- }\r
- }\r
-\r
- var ox = -wod, oy = b,\r
- _oy = _pxb[0],\r
- l = pxl.length,\r
- w, h;\r
- for(var i = 0; i < l; i++)\r
- {\r
- if(typeof _pxb[i] != "undefined")\r
- {\r
- if(_pxb[i] < _oy || pxt[i] < oy)\r
- {\r
- x = pxl[i];\r
- this._mkOvQds(cx, cy, x, oy, x-ox, oy-_oy, wod, hod);\r
- ox = x;\r
- oy = pxt[i];\r
- _oy = _pxb[i];\r
- }\r
- }\r
- else\r
- {\r
- x = pxl[i];\r
- this._mkDiv(cx-x, cy-oy, 1, (oy<<1)+hod);\r
- this._mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);\r
- ox = x;\r
- oy = pxt[i];\r
- }\r
- }\r
- this._mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod);\r
- this._mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);\r
- }\r
-}\r
-\r
-function _mkOvDott(left, top, width, height)\r
-{\r
- var a = (++width)>>1, b = (++height)>>1,\r
- wod = width&1, hod = height&1, hodu = hod^1,\r
- cx = left+a, cy = top+b,\r
- x = 0, y = b,\r
- aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,\r
- st = (aa2>>1)*(1-(b<<1)) + bb2,\r
- tt = (bb2>>1) - aa2*((b<<1)-1),\r
- drw = true;\r
- while(y > 0)\r
- {\r
- if(st < 0)\r
- {\r
- st += bb2*((x<<1)+3);\r
- tt += bb4*(++x);\r
- }\r
- else if(tt < 0)\r
- {\r
- st += bb2*((x<<1)+3) - aa4*(y-1);\r
- tt += bb4*(++x) - aa2*(((y--)<<1)-3);\r
- }\r
- else\r
- {\r
- tt -= aa2*((y<<1)-3);\r
- st -= aa4*(--y);\r
- }\r
- if(drw && y >= hodu) this._mkOvQds(cx, cy, x, y, 1, 1, wod, hod);\r
- drw = !drw;\r
- }\r
-}\r
-\r
-function _mkRect(x, y, w, h)\r
-{\r
- var s = this.stroke;\r
- this._mkDiv(x, y, w, s);\r
- this._mkDiv(x+w, y, s, h);\r
- this._mkDiv(x, y+h, w+s, s);\r
- this._mkDiv(x, y+s, s, h-s);\r
-}\r
-\r
-function _mkRectDott(x, y, w, h)\r
-{\r
- this.drawLine(x, y, x+w, y);\r
- this.drawLine(x+w, y, x+w, y+h);\r
- this.drawLine(x, y+h, x+w, y+h);\r
- this.drawLine(x, y, x, y+h);\r
-}\r
-\r
-function jsgFont()\r
-{\r
- this.PLAIN = 'font-weight:normal;';\r
- this.BOLD = 'font-weight:bold;';\r
- this.ITALIC = 'font-style:italic;';\r
- this.ITALIC_BOLD = this.ITALIC + this.BOLD;\r
- this.BOLD_ITALIC = this.ITALIC_BOLD;\r
-}\r
-var Font = new jsgFont();\r
-\r
-function jsgStroke()\r
-{\r
- this.DOTTED = -1;\r
-}\r
-var Stroke = new jsgStroke();\r
-\r
-function jsGraphics(cnv, wnd)\r
-{\r
- this.setColor = function(x)\r
- {\r
- this.color = x.toLowerCase();\r
- };\r
-\r
- this.setStroke = function(x)\r
- {\r
- this.stroke = x;\r
- if(!(x+1))\r
- {\r
- this.drawLine = _mkLinDott;\r
- this._mkOv = _mkOvDott;\r
- this.drawRect = _mkRectDott;\r
- }\r
- else if(x-1 > 0)\r
- {\r
- this.drawLine = _mkLin2D;\r
- this._mkOv = _mkOv2D;\r
- this.drawRect = _mkRect;\r
- }\r
- else\r
- {\r
- this.drawLine = _mkLin;\r
- this._mkOv = _mkOv;\r
- this.drawRect = _mkRect;\r
- }\r
- };\r
-\r
- this.setPrintable = function(arg)\r
- {\r
- this.printable = arg;\r
- if(jg_fast)\r
- {\r
- this._mkDiv = _mkDivIe;\r
- this._htmRpc = arg? _htmPrtRpc : _htmRpc;\r
- }\r
- else this._mkDiv = arg? _mkDivPrt : _mkDiv;\r
- };\r
-\r
- this.setFont = function(fam, sz, sty)\r
- {\r
- this.ftFam = fam;\r
- this.ftSz = sz;\r
- this.ftSty = sty || Font.PLAIN;\r
- };\r
-\r
- this.drawPolyline = this.drawPolyLine = function(x, y)\r
- {\r
- for (var i=x.length - 1; i;)\r
- {--i;\r
- this.drawLine(x[i], y[i], x[i+1], y[i+1]);\r
- }\r
- };\r
-\r
- this.fillRect = function(x, y, w, h)\r
- {\r
- this._mkDiv(x, y, w, h);\r
- };\r
-\r
- this.drawPolygon = function(x, y)\r
- {\r
- this.drawPolyline(x, y);\r
- this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]);\r
- };\r
-\r
- this.drawEllipse = this.drawOval = function(x, y, w, h)\r
- {\r
- this._mkOv(x, y, w, h);\r
- };\r
-\r
- this.fillEllipse = this.fillOval = function(left, top, w, h)\r
- {\r
- var a = w>>1, b = h>>1,\r
- wod = w&1, hod = h&1,\r
- cx = left+a, cy = top+b,\r
- x = 0, y = b, oy = b,\r
- aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,\r
- st = (aa2>>1)*(1-(b<<1)) + bb2,\r
- tt = (bb2>>1) - aa2*((b<<1)-1),\r
- xl, dw, dh;\r
- if(w) while(y > 0)\r
- {\r
- if(st < 0)\r
- {\r
- st += bb2*((x<<1)+3);\r
- tt += bb4*(++x);\r
- }\r
- else if(tt < 0)\r
- {\r
- st += bb2*((x<<1)+3) - aa4*(y-1);\r
- xl = cx-x;\r
- dw = (x<<1)+wod;\r
- tt += bb4*(++x) - aa2*(((y--)<<1)-3);\r
- dh = oy-y;\r
- this._mkDiv(xl, cy-oy, dw, dh);\r
- this._mkDiv(xl, cy+y+hod, dw, dh);\r
- oy = y;\r
- }\r
- else\r
- {\r
- tt -= aa2*((y<<1)-3);\r
- st -= aa4*(--y);\r
- }\r
- }\r
- this._mkDiv(cx-a, cy-oy, w, (oy<<1)+hod);\r
- };\r
-\r
- this.fillArc = function(iL, iT, iW, iH, fAngA, fAngZ)\r
- {\r
- var a = iW>>1, b = iH>>1,\r
- iOdds = (iW&1) | ((iH&1) << 16),\r
- cx = iL+a, cy = iT+b,\r
- x = 0, y = b, ox = x, oy = y,\r
- aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,\r
- st = (aa2>>1)*(1-(b<<1)) + bb2,\r
- tt = (bb2>>1) - aa2*((b<<1)-1),\r
- // Vars for radial boundary lines\r
- xEndA, yEndA, xEndZ, yEndZ,\r
- iSects = (1 << (Math.floor((fAngA %= 360.0)/180.0) << 3))\r
- | (2 << (Math.floor((fAngZ %= 360.0)/180.0) << 3))\r
- | ((fAngA >= fAngZ) << 16),\r
- aBndA = new Array(b+1), aBndZ = new Array(b+1);\r
- \r
- // Set up radial boundary lines\r
- fAngA *= Math.PI/180.0;\r
- fAngZ *= Math.PI/180.0;\r
- xEndA = cx+Math.round(a*Math.cos(fAngA));\r
- yEndA = cy+Math.round(-b*Math.sin(fAngA));\r
- _mkLinVirt(aBndA, cx, cy, xEndA, yEndA);\r
- xEndZ = cx+Math.round(a*Math.cos(fAngZ));\r
- yEndZ = cy+Math.round(-b*Math.sin(fAngZ));\r
- _mkLinVirt(aBndZ, cx, cy, xEndZ, yEndZ);\r
-\r
- while(y > 0)\r
- {\r
- if(st < 0) // Advance x\r
- {\r
- st += bb2*((x<<1)+3);\r
- tt += bb4*(++x);\r
- }\r
- else if(tt < 0) // Advance x and y\r
- {\r
- st += bb2*((x<<1)+3) - aa4*(y-1);\r
- ox = x;\r
- tt += bb4*(++x) - aa2*(((y--)<<1)-3);\r
- this._mkArcDiv(ox, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);\r
- oy = y;\r
- }\r
- else // Advance y\r
- {\r
- tt -= aa2*((y<<1)-3);\r
- st -= aa4*(--y);\r
- if(y && (aBndA[y] != aBndA[y-1] || aBndZ[y] != aBndZ[y-1]))\r
- {\r
- this._mkArcDiv(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);\r
- ox = x;\r
- oy = y;\r
- }\r
- }\r
- }\r
- this._mkArcDiv(x, 0, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);\r
- if(iOdds >> 16) // Odd height\r
- {\r
- if(iSects >> 16) // Start-angle > end-angle\r
- {\r
- var xl = (yEndA <= cy || yEndZ > cy)? (cx - x) : cx;\r
- this._mkDiv(xl, cy, x + cx - xl + (iOdds & 0xffff), 1);\r
- }\r
- else if((iSects & 0x01) && yEndZ > cy)\r
- this._mkDiv(cx - x, cy, x, 1);\r
- }\r
- };\r
-\r
-/* fillPolygon method, implemented by Matthieu Haller.\r
-This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib.\r
-C source of GD 1.8.4 found at http://www.boutell.com/gd/\r
-\r
-THANKS to Kirsten Schulz for the polygon fixes!\r
-\r
-The intersection finding technique of this code could be improved\r
-by remembering the previous intertersection, and by using the slope.\r
-That could help to adjust intersections to produce a nice\r
-interior_extrema. */\r
- this.fillPolygon = function(array_x, array_y)\r
- {\r
- var i;\r
- var y;\r
- var miny, maxy;\r
- var x1, y1;\r
- var x2, y2;\r
- var ind1, ind2;\r
- var ints;\r
-\r
- var n = array_x.length;\r
- if(!n) return;\r
-\r
- miny = array_y[0];\r
- maxy = array_y[0];\r
- for(i = 1; i < n; i++)\r
- {\r
- if(array_y[i] < miny)\r
- miny = array_y[i];\r
-\r
- if(array_y[i] > maxy)\r
- maxy = array_y[i];\r
- }\r
- for(y = miny; y <= maxy; y++)\r
- {\r
- var polyInts = new Array();\r
- ints = 0;\r
- for(i = 0; i < n; i++)\r
- {\r
- if(!i)\r
- {\r
- ind1 = n-1;\r
- ind2 = 0;\r
- }\r
- else\r
- {\r
- ind1 = i-1;\r
- ind2 = i;\r
- }\r
- y1 = array_y[ind1];\r
- y2 = array_y[ind2];\r
- if(y1 < y2)\r
- {\r
- x1 = array_x[ind1];\r
- x2 = array_x[ind2];\r
- }\r
- else if(y1 > y2)\r
- {\r
- y2 = array_y[ind1];\r
- y1 = array_y[ind2];\r
- x2 = array_x[ind1];\r
- x1 = array_x[ind2];\r
- }\r
- else continue;\r
-\r
- // Modified 11. 2. 2004 Walter Zorn\r
- if((y >= y1) && (y < y2))\r
- polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);\r
-\r
- else if((y == maxy) && (y > y1) && (y <= y2))\r
- polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);\r
- }\r
- polyInts.sort(_CompInt);\r
- for(i = 0; i < ints; i+=2)\r
- this._mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1);\r
- }\r
- };\r
-\r
- this.drawString = function(txt, x, y)\r
- {\r
- this.htm += '<div style="position:absolute;white-space:nowrap;'+\r
- 'left:' + x + 'px;'+\r
- 'top:' + y + 'px;'+\r
- 'font-family:' + this.ftFam + ';'+\r
- 'font-size:' + this.ftSz + ';'+\r
- 'color:' + this.color + ';' + this.ftSty + '">'+\r
- txt +\r
- '<\/div>';\r
- };\r
-\r
-/* drawStringRect() added by Rick Blommers.\r
-Allows to specify the size of the text rectangle and to align the\r
-text both horizontally (e.g. right) and vertically within that rectangle */\r
- this.drawStringRect = function(txt, x, y, width, halign)\r
- {\r
- this.htm += '<div style="position:absolute;overflow:hidden;'+\r
- 'left:' + x + 'px;'+\r
- 'top:' + y + 'px;'+\r
- 'width:'+width +'px;'+\r
- 'text-align:'+halign+';'+\r
- 'font-family:' + this.ftFam + ';'+\r
- 'font-size:' + this.ftSz + ';'+\r
- 'color:' + this.color + ';' + this.ftSty + '">'+\r
- txt +\r
- '<\/div>';\r
- };\r
-\r
- this.drawImage = function(imgSrc, x, y, w, h, a)\r
- {\r
- this.htm += '<div style="position:absolute;'+\r
- 'left:' + x + 'px;'+\r
- 'top:' + y + 'px;'+\r
- // w (width) and h (height) arguments are now optional.\r
- // Added by Mahmut Keygubatli, 14.1.2008\r
- (w? ('width:' + w + 'px;') : '') +\r
- (h? ('height:' + h + 'px;'):'')+'">'+\r
- '<img src="' + imgSrc +'"'+ (w ? (' width="' + w + '"'):'')+ (h ? (' height="' + h + '"'):'') + (a? (' '+a) : '') + '>'+\r
- '<\/div>';\r
- };\r
-\r
- this.clear = function()\r
- {\r
- this.htm = "";\r
- if(this.cnv) this.cnv.innerHTML = "";\r
- };\r
-\r
- this._mkOvQds = function(cx, cy, x, y, w, h, wod, hod)\r
- {\r
- var xl = cx - x, xr = cx + x + wod - w, yt = cy - y, yb = cy + y + hod - h;\r
- if(xr > xl+w)\r
- {\r
- this._mkDiv(xr, yt, w, h);\r
- this._mkDiv(xr, yb, w, h);\r
- }\r
- else\r
- w = xr - xl + w;\r
- this._mkDiv(xl, yt, w, h);\r
- this._mkDiv(xl, yb, w, h);\r
- };\r
- \r
- this._mkArcDiv = function(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects)\r
- {\r
- var xrDef = cx + x + (iOdds & 0xffff), y2, h = oy - y, xl, xr, w;\r
-\r
- if(!h) h = 1;\r
- x = cx - x;\r
-\r
- if(iSects & 0xff0000) // Start-angle > end-angle\r
- {\r
- y2 = cy - y - h;\r
- if(iSects & 0x00ff)\r
- {\r
- if(iSects & 0x02)\r
- {\r
- xl = Math.max(x, aBndZ[y]);\r
- w = xrDef - xl;\r
- if(w > 0) this._mkDiv(xl, y2, w, h);\r
- }\r
- if(iSects & 0x01)\r
- {\r
- xr = Math.min(xrDef, aBndA[y]);\r
- w = xr - x;\r
- if(w > 0) this._mkDiv(x, y2, w, h);\r
- }\r
- }\r
- else\r
- this._mkDiv(x, y2, xrDef - x, h);\r
- y2 = cy + y + (iOdds >> 16);\r
- if(iSects & 0xff00)\r
- {\r
- if(iSects & 0x0100)\r
- {\r
- xl = Math.max(x, aBndA[y]);\r
- w = xrDef - xl;\r
- if(w > 0) this._mkDiv(xl, y2, w, h);\r
- }\r
- if(iSects & 0x0200)\r
- {\r
- xr = Math.min(xrDef, aBndZ[y]);\r
- w = xr - x;\r
- if(w > 0) this._mkDiv(x, y2, w, h);\r
- }\r
- }\r
- else\r
- this._mkDiv(x, y2, xrDef - x, h);\r
- }\r
- else\r
- {\r
- if(iSects & 0x00ff)\r
- {\r
- if(iSects & 0x02)\r
- xl = Math.max(x, aBndZ[y]);\r
- else\r
- xl = x;\r
- if(iSects & 0x01)\r
- xr = Math.min(xrDef, aBndA[y]);\r
- else\r
- xr = xrDef;\r
- y2 = cy - y - h;\r
- w = xr - xl;\r
- if(w > 0) this._mkDiv(xl, y2, w, h);\r
- }\r
- if(iSects & 0xff00)\r
- {\r
- if(iSects & 0x0100)\r
- xl = Math.max(x, aBndA[y]);\r
- else\r
- xl = x;\r
- if(iSects & 0x0200)\r
- xr = Math.min(xrDef, aBndZ[y]);\r
- else\r
- xr = xrDef;\r
- y2 = cy + y + (iOdds >> 16);\r
- w = xr - xl;\r
- if(w > 0) this._mkDiv(xl, y2, w, h);\r
- }\r
- }\r
- };\r
-\r
- this.setStroke(1);\r
- this.setFont("verdana,geneva,helvetica,sans-serif", "12px", Font.PLAIN);\r
- this.color = "#000000";\r
- this.htm = "";\r
- this.wnd = wnd || window;\r
-\r
- if(!jg_ok) _chkDHTM();\r
- if(jg_ok)\r
- {\r
- if(cnv)\r
- {\r
- if(typeof(cnv) == "string")\r
- this.cont = document.all? (this.wnd.document.all[cnv] || null)\r
- : document.getElementById? (this.wnd.document.getElementById(cnv) || null)\r
- : null;\r
- else if(cnv == window.document)\r
- this.cont = document.getElementsByTagName("body")[0];\r
- // If cnv is a direct reference to a canvas DOM node\r
- // (option suggested by Andreas Luleich)\r
- else this.cont = cnv;\r
- // Create new canvas inside container DIV. Thus the drawing and clearing\r
- // methods won't interfere with the container's inner html.\r
- // Solution suggested by Vladimir.\r
- this.cnv = this.wnd.document.createElement("div");\r
- this.cnv.style.fontSize=0;\r
- this.cont.appendChild(this.cnv);\r
- this.paint = jg_dom? _pntCnvDom : _pntCnvIe;\r
- }\r
- else\r
- this.paint = _pntDoc;\r
- }\r
- else\r
- this.paint = _pntN;\r
-\r
- this.setPrintable(false);\r
-}\r
-\r
-function _mkLinVirt(aLin, x1, y1, x2, y2)\r
-{\r
- var dx = Math.abs(x2-x1), dy = Math.abs(y2-y1),\r
- x = x1, y = y1,\r
- xIncr = (x1 > x2)? -1 : 1,\r
- yIncr = (y1 > y2)? -1 : 1,\r
- p,\r
- i = 0;\r
- if(dx >= dy)\r
- {\r
- var pr = dy<<1,\r
- pru = pr - (dx<<1);\r
- p = pr-dx;\r
- while(dx > 0)\r
- {--dx;\r
- if(p > 0) // Increment y\r
- {\r
- aLin[i++] = x;\r
- y += yIncr;\r
- p += pru;\r
- }\r
- else p += pr;\r
- x += xIncr;\r
- }\r
- }\r
- else\r
- {\r
- var pr = dx<<1,\r
- pru = pr - (dy<<1);\r
- p = pr-dy;\r
- while(dy > 0)\r
- {--dy;\r
- y += yIncr;\r
- aLin[i++] = x;\r
- if(p > 0) // Increment x\r
- {\r
- x += xIncr;\r
- p += pru;\r
- }\r
- else p += pr;\r
- }\r
- }\r
- for(var len = aLin.length, i = len-i; i;)\r
- aLin[len-(i--)] = x;\r
-};\r
-\r
-function _CompInt(x, y)\r
-{\r
- return(x - y);\r
-}\r
-\r
--- /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;
+}
-.ts-skin-lab .ts-player {
- background: #3c4251;
- padding-top: 10px;
- padding-bottom: 10px;
- border: solid #b2b2b2 1px;
-}
+/*
+* 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-skin-lab .ts-player .ts-viewer {
- margin: 0 12px 10px 12px;
- border: solid 1px white;
+.ts-player {
+ padding: 0;
+ border: solid 1px #ADADAD;
+ margin-top: 2px;
}
-.ts-skin-lab .ts-player .ts-viewer .ts-marker {
- color: white;
- background: #7290bc;
-}
-.ts-skin-lab .ts-player .ts-viewer a.ts-marker, .ts-skin-lab .ts-player .ts-viewer a.ts-pointer {
- text-decoration: none;
+.ts-player .ts-ruler{
+ color: white;
+ background-color: #2E2E2E;
+ font-size: 10px;
line-height: 13px;
}
-
-.ts-skin-lab .ts-player .ts-viewer .ts-pointer {
- color: #3c4251;
- background: #e7e7e7;
+/*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...*/
}
-
-.ts-skin-lab .ts-player .ts-ruler .ts-section .ts-label {
- color: #c3c2cc;
- background: #2a3242;
- padding-bottom: 1px;
- padding-left: 2px;
- 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-lines"*/
+.ts-svg-ruler-lines{
+ stroke-width:1;
+ stroke: #ADADAD;
}
-.ts-skin-lab .ts-player .ts-ruler .ts-section .ts-lines {
- background: #384051;
- color: #9498a1;
- border-bottom: solid 1px white;
- line-height: 13px;
+/*wave:*/
+.ts-player .ts-wave {
+ height: 130px;
}
-.ts-skin-lab .ts-player .ts-wave .ts-image {
- background: #090e0d ;
+/*.ts-player .ts-viewer .ts-marker {*/
+.ts-player .ts-ruler .ts-marker {
+ padding: 0 0.5em;
+ background: #e65911;
+ color: #FFF;
+ text-decoration: none;
}
-
-.ts-skin-lab .ts-player .ts-control {
- background: url('img/controlbg.png');
- height: 28px;
-/* border-top: dotted #b2b2b2 1px; */
+/*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-skin-lab .ts-player .ts-control .ts-layout {
- margin-left: 12px;
- margin-right: 12px;
- padding-top: 0px;
+/*.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-skin-lab .ts-player .ts-control .ts-playback a {
- display: block;
- float: left;
- width: 30px;
- padding: 28px 0 0 0;
- overflow: hidden;
- height: 0px !important;
- height /**/:28px; /* for IE5/Win only */
- margin-right: 0px;
+.ts-player .ts-wave .ts-image {
+ background: #090e0d ;
}
-.ts-skin-lab .ts-player .ts-control .ts-playback a:hover {
- background-position: 0 -28px;
+.ts-player .ts-control {
+ background: url('img/controlbg.png');
}
-.ts-skin-lab .ts-player .ts-control .ts-playback .ts-play {
+ /** 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-skin-lab .ts-player .ts-control .ts-playback .ts-pause {
+.ts-player .ts-control .ts-pause {
background-image: url('img/pause.png');
}
-.ts-skin-lab .ts-player .ts-control .ts-playback .ts-rewind {
+.ts-player .ts-control .ts-rewind {
background-image: url('img/rewind.png');
}
-.ts-skin-lab .ts-player .ts-control .ts-playback .ts-forward {
+.ts-player .ts-control .ts-forward {
background-image: url('img/forward.png');
}
-.ts-skin-lab .ts-player .ts-control .ts-playback .ts-set-marker {
+.ts-player .ts-control .ts-set-marker {
background-image: url('img/setmarker.png');
}
-/* unused */
-.ts-skin-lab .ts-player .ts-marker-control .ts-set-marker {
- display: block;
- width: 89px;
- padding: 28px 0 0 0;
- overflow: hidden;
- height: 0px !important;
- height /**/:28px; /* for IE5/Win only */
- background-image: url('img/setmarker.gif');
- margin: 5px auto 0 auto;
-}
-
-/* unused */
-.ts-skin-lab .ts-player .ts-marker-control .ts-set-marker:hover {
- background-position: 0 -21px;
-}
-
-.ts-skin-lab .ts-player .ts-marker-control {
- border-top: dotted #b2b2b2 1px;
- border-bottom: dotted #b2b2b2 1px;
- height: 30px;
-}
-
-
-
+.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
+++ /dev/null
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2008-2009 Samalyse
- * Author: Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
- */
-
-TimeSide(function($N) {
-
- $N.Class.create("Controller", $N.Core, {
-
- initialize: function($super, cfg) {
- $super();
- this.configure(cfg, {
- player: null,
- soundProvider: null,
- map: null,
- divmarkers:[]
- });
- if (this.cfg.player && !$N.isInstanceOf(this.cfg.player, 'Player')) {
- this.cfg.player = new $N.Player(this.cfg.player);
- }
- this._setupPlayer();
- //setting the divmarkers
- //this.cfg.map.observe('add')
-
- },
-
- _setupPlayer: function() {
-
- this.cfg.player
- .setSoundProvider(this.cfg.soundProvider)
- .setMarkerMap(this.cfg.map)
- .observe('play', $N.attachFunction(this.cfg.soundProvider, this.cfg.soundProvider.play))
- .observe('pause', $N.attachFunction(this.cfg.soundProvider, this.cfg.soundProvider.pause))
- .observe('move', this.attach(this._onMove))
- .observe('markeradd', this.attach(this._onMarkerAdd))
- //player markermove listens for changes of ruler markermove which listens
- //foir changes in each marker move
- .observe('markermove', this.attach(this._onMarkerMove))
-
- .draw();
- this.loadHTTP();
-
- this.cfg.map.observe('add',this.attach(this._onMarkerMapAdd));
- this.cfg.map.observe('remove',this.attach(this._onMarkerMapRemove));
- this.cfg.map.observe('moved',this.attach(this._onMarkerMapMoved));
-
- },
-
-
- _onMove: function(e, data) {
- this.cfg.soundProvider.seek(data.offset);
- },
-
- //called whenever a marker is moved in the ruler BUT NOT in the map
- _onMarkerMove: function(e, data) {
- if (this.cfg.map) {
- $N.Util.selectMarkerTab(); //defined in utils.js
- this.cfg.map.move(data.index, data.offset);
- //this will fire the method below
- }
- },
-
- _onMarkerMapMoved:function(e, data){
- var from = data.fromIndex;
- var to = data.toIndex;
- if(from===to){
- //just update the div in order to show the new time offset
- //and start edit
- this.cfg.divmarkers[from].setIndex(to);
- return;
- }
- this.cfg.player.ruler.move(from,to);
- var m = this.cfg.divmarkers.splice(from,1)[0]; //remove
- this.cfg.divmarkers.splice(to,0,m); //add
- this.updateIndices(from,to);
- },
-
- //called whenever a marker is added to the ruler BUT NOT in the map
- _onMarkerAdd: function(e, data) {
- if (this.cfg.map) {
- $N.Util.selectMarkerTab(); //defined in mediaitem|_detail.html
- var idx = this.cfg.map.add(data.offset); //this will call the method below _onMarkerMapAdd,
- //which btw adds a new div to divmarkers
- //now update the indices for the div (which also sets the event bindings as clicks etc...
- this.updateIndices(idx);
- }
- },
- //fired from markermap, attached as listener above in
- //this.cfg.map.observe('add',this.attach(this._onMarkerMapAdd));
- //this method basically adds the html elements, but updateIndices must be called elsewhere after this function
- //(see _onMarkerAdd and loadHTTP)
- _onMarkerMapAdd: function(e, data) {
- if (this.cfg.map) {
- //$N.Util.selectMarkerTab(); //defined in mediaitem|_detail.html
- //this.refreshMarkersText(this.cfg.map);
- //var idx = this.cfg.map.add(data.offset);
- //alert('df');
- var idx = data.index;
- var divMarker = new $N.DivMarker(this.cfg.map);
- this.cfg.divmarkers.splice(idx,0, divMarker);
- this.cfg.player.ruler.add(data.marker, idx);
- }
- },
-
- //fired from markermap, attached as listener above in
- //this.cfg.map.observe('add',this.attach(this._onMarkerMapAdd));
- _onMarkerMapRemove: function(e, data) {
- if (this.cfg.map) {
- //$N.Util.selectMarkerTab(); //defined in mediaitem|_detail.html
- //this.refreshMarkersText(this.cfg.map);
- //var idx = this.cfg.map.add(data.offset);
- //alert('df');
- var idx = data.index;
- var divRemoved = this.cfg.divmarkers.splice(idx,1)[0]; //there is only one element removed
- divRemoved.remove();
- this.cfg.player.ruler.remove(idx);
- this.updateIndices(idx);
- }
- },
-
- updateIndices: function(from, to){
- if(from===undefined || from==null){
- from = 0;
- }
- var len = this.cfg.divmarkers.length-1;
- if(from>len){
- //it might happen when we remove the last element
- //suppose [0,1,2], we remove [2] then we call
- //updateIndices[2] but array till 1 (there is nothing to update)
- return;
- }
- if(to==undefined || to ==null){
- to = len;
- }
- if(to<from){
- var tmp = to;
- to=from;
- from=tmp;
- }
- for(var i = from; i <= to; i++){
- this.cfg.divmarkers[i].setIndex(i);
- }
- this.cfg.player.ruler.updateMarkerIndices(from,to);
- },
-
-
- loadHTTP: function(){
-
- //itemid is the item (spund file) name
- var sPath = window.location.pathname;
- //remove last "/" or last "/#", if any...
- sPath = sPath.replace(/\/#*$/,"");
- var itemid = sPath.substring(sPath.lastIndexOf('/') + 1);
-
- //WARNING: use single quotes for the whole string!!
- //see http://stackoverflow.com/questions/4809157/i-need-to-pass-a-json-object-to-a-javascript-ajax-method-for-a-wcf-call-how-can
- var data2send = '{"id":"jsonrpc","params":["'+itemid+'"], "method":"telemeta.get_markers","jsonrpc":"1.0"}';
- var map = this.cfg.map;
- var update = this.updateIndices;
- var me = this;
- $.ajax({
- type: "POST",
- url: '/json/',
- contentType: "application/json",
- data: data2send,
- dataType: "json",
- success: function(data) {
- if(data){
- if(data.result && data.result.length>0){
- var result = data.result;
-
- for(var i =0; i< result.length; i++){
- map.add(result[i]);
- }
- //we call now updateindices
- update.apply(me);
-
- }
-
- }
- //We call mediaitem_detail.setUpTabs from controller once all markers have been loaded
- //this because setLabelDescription, which sets the label text according to the div width,
- //needs to have all elements visible.
- $N.Util.setUpTabs();
- //setUpTabs(); //which hides the marker div. Call with argument 1 to set up marker div
- //as visible as startup
- }
- });
- //var g = 9;
- }
-
-
-
- });
-
- $N.notifyScriptLoad();
-
-});
+++ /dev/null
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2008-2009 Samalyse
- * Author: Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
- */
-
-TimeSide(function($N, $J) {
-
- $N.extend = function(destination, source) {
- for (var property in source){
- destination[property] = source[property];
- }
- return destination;
- };
-
- $N.objectKeys = function(object) {
- var keys = [];
- for (var property in object){
- keys.push(property);
- }
- return keys;
- };
-
- $N.argumentNames = function(method) {
- var names = method.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1]
- .replace(/\s+/g, '').split(',');
- return names.length == 1 && !names[0] ? [] : names;
- };
-
- $N.argsToArray = function(args) {
- var length = args.length || 0, result = new Array(length);
- while (length--){
- result[length] = args[length];
- }
- return result;
- };
-
- $N.wrapFunction = function(wrapper, method) {
- return function() {
- var args = $N.argsToArray(arguments);
- return wrapper.apply(this, [$N.attachFunction(this, method)].concat(args));
- }
- };
-
- $N.attachFunction = function() {
- if (arguments.length < 3 && (typeof arguments[1] == 'undefined')){
- return arguments[0];
- }
- var args = $N.argsToArray(arguments);
- var object = args.shift();
- var method = args.shift();
- return function() {
- var _args = $N.argsToArray(arguments);
- return method.apply(object, args.concat(_args));
- }
- };
-
- $N.attachAsEventListener = function() {
- var args = $N.argsToArray(arguments), object = args.shift();
- var method = args.shift();
- return function(event) {
- return method.apply(object, [event || window.event].concat(args));
- }
- };
-
- $N.isInstanceOf = function(obj, className) {
- if (typeof obj == 'object' && obj.__class__) {
- var c = obj.__class__;
- if (c.__name__ == className) {
- return true;
- }
- while (c = c.__super__) {
- if (c.__name__ == className) {
- return true;
- }
- }
- }
- return false;
- }
-
- $N.Class = {
- create: function() {
- var parent = null, className = null;
- var properties = $N.argsToArray(arguments)
- if (typeof properties[0] == "string"){
- className = properties.shift();
- }
- if (typeof properties[0] == "function"){
- parent = properties.shift();
- }
-
- function klass() {
- this.initialize.apply(this, arguments);
- }
- //Merge the contents of $N.Class.Methods into klass:
- $N.extend(klass, $N.Class.Methods);
- klass.__name__ = className;
- klass.__super__ = parent;
- klass.__subclasses__ = [];
-
- if (parent) {
- var subclass = function() { };
- subclass.prototype = parent.prototype;
- klass.prototype = new subclass;
- parent.__subclasses__.push(klass);
- }
-
- klass.prototype.__class__ = klass;
- for (var i = 0; i < properties.length; i++){
- klass.addMethods(properties[i]);
- }
-
- if (!klass.prototype.initialize){
- klass.prototype.initialize = function () {};
-
- }
-
- klass.prototype.constructor = klass;
-
- if (className) {
- $N[className] = klass;
- }
- return klass;
- }
- };
-
- $N.Class.Methods = {
- addMethods: function(source) {
- var ancestor = this.__super__ && this.__super__.prototype;
- var properties = $N.objectKeys(source);
-
- if (!$N.objectKeys({
- toString: true
- }).length){
- properties.push("toString", "valueOf");
- }
- for (var i = 0, length = properties.length; i < length; i++) {
- var property = properties[i], value = source[property];
- if (ancestor && (typeof value == 'function') &&
- $N.argumentNames(value)[0] == "$super") {
- var method = value;
- value = $N.wrapFunction(method, (function(m) {
- return function() {
- return ancestor[m].apply(this, arguments)
- };
- })(property));
-
- value.valueOf = $N.attachFunction(method, method.valueOf);
- value.toString = $N.attachFunction(method, method.toString);
- }
- this.prototype[property] = value;
- }
-
- return this;
- }
- };
-
- $N.Core = $N.Class.create("Core", {
- eventContainer: null,
- eventPrefix: '',
- cfg: {},
-
- initialize: function() {
- this.debug("new instance");
- $N.registerInstance(this);
- this.eventContainer = $J('<div/>');
- this.forwardEvent = this.attach(this._forwardEvent);
- },
-
- free: function() {
- this.eventContainer = null;
- },
-
- configure: function(config, defaults) {
- if (!config){
- config = {};
-
- }
- for (k in defaults) {
- var value = null, flags = [];
-
- if (defaults[k] && typeof defaults[k][0] !== 'undefined') {
- value = defaults[k][0];
- if (defaults[k][1]) {
- flags = defaults[k][1].split(",");
- }
- } else {
- value = defaults[k];
- }
-
- if (typeof config[k] !== 'undefined'){
- value = config[k];
- }
-
- var source = this;
- $J(flags).each(function(i, flag) {
- switch (flag) {
- case 'required':
- if (value === null)
- throw new $N.RequiredOptionError(source, k);
- break;
- /*
- case 'element':
- value = $J(value);
- break;
- */
-
- }
- });
-
- this.cfg[k] = value;
- }
- return this;
- },
-
- observe: function(eventName, handler) {
- this.eventContainer.bind(this.eventPrefix + eventName, handler);
- return this;
- },
-
- fire: function(eventName, data) {
- if (!data){
- data = {};
-
- }
- this.eventContainer.trigger(this.eventPrefix + eventName, data);
- return this;
- },
-
- _forwardEvent: function(e, data) {
- if (!data){
- data = {};
-
- }
- this.eventContainer.trigger(e.type, data);
- return this;
- },
-
- _textWidth: function(text, fontSize) {
- var ratio = 3/5;
- return text.length * ratio * fontSize;
- },
-
- debug: function(message) {
- if ($N.debugging && typeof console != 'undefined' && console.log) {
- console.log('TimeSide.' + this.__class__.__name__ + ': ' + message);
- }
- },
-
- attach: function(method) {
- return $N.attachFunction(this, method);
- },
-
- attachWithEvent: function(method) {
- return $N.attachAsEventListener(this, method);
- },
-
- uniqid: function() {
- d = new Date();
- return new String(d.getTime() + '' + Math.floor(Math.random() * 1000000)).substr(0, 18);
- }
- });
-
- $N.Class.create("Exception", {
- _source: null,
- _message: null,
-
- initialize: function(source, message) {
- this._source = source;
- this._message = message;
- },
- toString: function() {
- return this.__class__.__name__ + " from TimeSide." + this._source.__class__.__name__
- + ": " + this._message;
- }
- });
-
- $N.Class.create("RequiredOptionError", $N.Exception, {
- initialize: function($super, source, optionName) {
- $super(source, "missing '" + optionName + "' required option");
- }
- });
-
- $N.Class.create("RequiredArgumentError", $N.Exception, {
- initialize: function($super, source, optionName) {
- $super(source, "missing '" + optionName + "' required argument");
- }
- });
-
- $N.notifyScriptLoad();
-
-});
+++ /dev/null
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2008-2009 Samalyse
- * Author: Riccardo Zaccarelli
- * License: GNU General Public License version 2.0
- */
-
-TimeSide(function($N, $J) {
-
- $N.Class.create("DivMarker", $N.Core, {
- //static constant variables to retireve the Marker Html Elements (MHE)
- //to be used with the function below getHtmElm, eg:
- //getHtmElm(marker, this.MHE_OFFSET_LABEL)
- e_indexLabel:null,
- e_descriptionText:null,
- e_offsetLabel:null,
- e_deleteButton:null,
- e_okButton:null,
- e_header:null,
- e_editButton:null,
- e_titleText:null,
- me:null,
- markerMap:null,
- markerIndex:-1,
- //static constant variables for edit mode:
- EDIT_MODE_SAVED:0,
- EDIT_MODE_EDIT_TEXT:1,
- EDIT_MODE_MARKER_MOVED:2,
-
- initialize: function($super, markermap) {
- $super();
- //sets the fields required???? see ruler.js createPointer
- this.configure({
- //why instantiating a variable to null?
- parent: [null, 'required']
- });
- this.cfg.parent = $J("#markers_div_id");
- this.markerMap = markermap;
- this.me = this.createDiv();
- //set the index insert the div and set events on elements
- //this.setIndex(insertionIndex);
- },
-
-
- //creates a new div. By default, text is hidden and edit button is visible
- createDiv: function(){
-
- var div = this.cfg.parent;
- var markerDiv;
- if(div){
-
-
- //var indexLabel, descriptionText, offsetLabel, deleteButton, okButton, header, editButton, descriptionLabel;
- var margin = '1ex';
-
- //index label
- this.e_indexLabel = $J('<span/>')
- .addClass('markersdivIndexLabel')
- .addClass('markersdivTopElement');
-
- //offset label
- this.e_offsetLabel = $J('<span/>')
- .addClass('markersdivTopElement')
- .addClass('markersdivOffset')
-
-
- //title text
- this.e_titleText = $J('<input/>')
- .attr('type','text')
- .addClass('markersdivTitle')
- .addClass('markersdivTopElement')
-
-
- //close button
- this.e_deleteButton = $J('<a/>')
- .addClass('markersdivDelete')
- .addClass('markersdivTopElement')
- .attr('title','delete marker')
- .attr("href","#")
-
- //edit button
- this.e_editButton = $J('<a/>')
- .addClass('roundBorder4')
- .addClass('markersdivEdit')
- .addClass('markersdivTopElement')
- .attr('title','edit marker description')
- .attr("href","#")
- .html('<span>EDIT</span>')
-
-
- //add all elements to header:
- this.e_header = $J('<div/>')
- .append(this.e_indexLabel)
- .append(this.e_offsetLabel)
- .append(this.e_titleText)
- .append(this.e_deleteButton)
- .append(this.e_editButton);
-
- //description text
- this.e_descriptionText = $J('<textarea/>')
- .addClass('markersdivDescription')
-
- //ok button
- this.e_okButton = $J('<a/>')
- .attr('title','save marker description and offset')
- .addClass('roundBorder6')
- .addClass('markersdivSave')
- .attr("href","#")
- .html("OK");
- // .append($J('<img/>').attr("src","/images/marker_ok_green.png").css({
- // width:'3em'
- // }))
-
- //create marker div and append all elements
- markerDiv = $J('<div/>')
- .append(this.e_header)
- .append(this.e_descriptionText)
- .append(this.e_okButton)
- .addClass('roundBorder8')
- .addClass('markerdiv');
-
- }
- return markerDiv;
- },
-
- setIndex: function(index){
- var map = this.markerMap;
- var marker = map.get(index);
- this.e_indexLabel.attr('title',marker.toString());
- this.e_indexLabel.html(index+1);
- this.e_offsetLabel.html(this.formatMarkerOffset(marker.offset));
- if(index!=this.markerIndex){
- //add it to the parent div or move the div
- if(this.markerIndex!=-1){
- //here is the case when the div is already added, so we have to remove it from the parent
- //The .detach() method is the same as .remove(), except that .detach() keeps
- //all jQuery data associated with the removed elements.
- //This method is useful when removed elements are to be reinserted into the DOM at a later time.
- this.me.detach();
- //note that we might have index!=this.markerIndex without the need to detach the div
- //we leave this code to be sure, especially on loading
- }else{
- //div is not added: set description and title
- this.e_descriptionText.val(marker.desc ? marker.desc : "");
- this.e_titleText.val(marker.title ? marker.title : "");
- }
- //the div is still to be added
- var divLen = this.cfg.parent.children().length;
- //this.cfg.parent.append(this.me);
- if(index==divLen){
- this.cfg.parent.append(this.me);
- }else{
- $( this.cfg.parent.children()[index] ).before(this.me);
- }
- }
-
- if(!marker.isEditable || marker.isSaved){
- this.e_okButton.hide();
- this.e_descriptionText.attr('readonly','readonly').addClass('markersdivUneditable');
- this.e_titleText.attr('readonly','readonly').addClass('markersdivUneditable');
- if(!marker.isEditable){
- this.e_deleteButton.hide();
- this.e_editButton.hide();
- return;
- }
- }
- if(index!=this.markerIndex){
- //update events associated to anchors
- this.markerIndex = index;
- var remove = map.remove;
- this.e_deleteButton.unbind('click').click( function(){
- remove.apply(map,[index]);
- return false; //avoid scrolling of the page on anchor click
- }).show();
-
- var dText = this.e_descriptionText;
- var tText = this.e_titleText;
- var okB = this.e_okButton;
- this.e_editButton.unbind('click').click( function(){
- dText.removeAttr('readonly').removeClass('markersdivUneditable').show();
- tText.removeAttr('readonly').removeClass('markersdivUneditable').show();
- okB.show();
- $(this).hide();
- tText.select();
- return false; //avoid scrolling of the page on anchor click
- });
- var eB = this.e_editButton;
- //action for ok button
- this.e_okButton.unbind('click').click( function(){
- //if(marker.desc !== descriptionText.val()){ //strict equality needed. See note below
- marker.desc = dText.val();
- marker.title = tText.val();
- map.sendHTTP(marker,
-
- function(){
- dText.attr('readonly','readonly').addClass('markersdivUneditable');
- tText.attr('readonly','readonly').addClass('markersdivUneditable');
- eB.show();
- okB.hide();
- },
- true
- );
- //}
- // func_fem.apply(klass,[marker,editModeSaved,editButton, descriptionText,
- // descriptionLabel, okButton]);
- return false; //avoid scrolling of the page on anchor click
- });
- //set the title text width. This method
- var w = tText.parent().width();
- w-=tText.outerWidth(true)-tText.width(); //so we consider also tText margin border and padding
- var space = w-this.e_indexLabel.outerWidth(true) - this.e_offsetLabel.outerWidth(true) -
- this.e_editButton.outerWidth(true) - this.e_deleteButton.outerWidth(true);
- tText.css('width',space+'px');
- }
- if(!marker.isSaved){
- this.e_editButton.trigger('click');
- }
-
- },
-
- remove: function(){
- this.me.remove();
- this.e_indexLabel = null;
- this.e_descriptionText=null;
- this.e_offsetLabel=null;
- this.e_deleteButton=null;
- this.e_okButton=null;
- this.e_header=null;
- this.e_editButton=null;
- this.e_titleText=null;
- this.me=null;
- },
-
- formatMarkerOffset: function(markerOffset){
- //marker offset is in float format second.decimalPart
- var hours = parseInt(markerOffset/(60*24));
- markerOffset-=hours*(60*24);
- var minutes = parseInt(markerOffset/(60));
- markerOffset-=minutes*(60);
- var seconds = parseInt(markerOffset);
- markerOffset-=seconds;
- var msec = Math.round(markerOffset*100); //show only centiseconds
- //(use 1000* to show milliseconds)
- var format = (hours<10 ? "0"+hours : hours )+":"+
- (minutes<10 ? "0"+minutes : minutes )+":"+
- (seconds<10 ? "0"+seconds : seconds )+"."+
- (msec<10 ? "0"+msec : msec );
- return format;
- }
-
-
-
- });
-
- $N.notifyScriptLoad();
-
-});
-
-
-Object.prototype.toString = function(){
- var s="";
- for(var k in this){
- s+=k+": "+this[k]+"\n";
- }
- return s;
-}
\ No newline at end of file
+++ /dev/null
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2008-2009 Samalyse
- * Author: Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
- */
-
-TimeSide(function($N, $J) {
-
- $N.Class.create("Marker", $N.Core, {
- id: null,
- painter: null,
- visible: false,
- position: 0,
- label: null,
- blinking: false,
- nodes: null,
- mouseDown: false,
- blinkAnimation: null,
-
- initialize: function($super, cfg) {
- $super();
- //sets the fields required???? see ruler.js createPointer
- this.configure(cfg, {
- rulerLayout: [null, 'required'],
- viewer: [null, 'required'],
- fontSize: 10,
- zIndex: null,
- className: [null, 'required'],
- index: null,
- tooltip: null,
- canMove: false
- });
- this.cfg.rulerLayout = $J(this.cfg.rulerLayout);
- this.cfg.viewer = $J(this.cfg.viewer);
-
- this.width = this.cfg.viewer.width();
- this.painter = new jsGraphics(this.cfg.viewer.get(0));
- this._create();
- if(this.cfg.canMove){
- this._observeMouseEvents();
- }
- //if it is the pointer, cfg.index is undefined
- if(cfg.index !== undefined && cfg.className!='pointer'){
- this.setIndex(cfg.index);
- }
- },
-
- setIndex: function(index){
- this.index = index;
- this.setText(index+1);
- },
-
- free: function($super) {
- this.cfg.rulerLayout = null;
- this.cfg.viewer = null;
- $super();
- },
-
- clear: function() {
- this.painter.clear();
- $J(this.painter.cnv).remove();
- this.label.remove();
- return this;
- },
-
- _create: function() {
- this.debug('create marker');
- var y = this.cfg.rulerLayout.find('.' + $N.cssPrefix + 'label').outerHeight();
- this.label = $J('<a/>')
- .css({
- display: 'block',
- width: '10px',
- textAlign: 'center',
- position: 'absolute',
- fontSize: this.cfg.fontSize + 'px',
- fontFamily: 'monospace',
- top: y + 'px'
- })
- .attr('href', '#')
- .addClass($N.cssPrefix + this.cfg.className)
- .append('<span />')
- .hide();
-
- if (this.cfg.tooltip){
- this.label.attr('title', this.cfg.tooltip);
- }
- this.cfg.rulerLayout.append(this.label);
-
- var height = this.cfg.viewer.height();
- var x = 0;
- this.painter.drawLine(x, 0, x, height);
- x = [-4, 4, 0];
- var y = [0, 0, 4];
- this.painter.fillPolygon(x, y);
- this.painter.paint();
- this.nodes = $J(this.painter.cnv).children();
-
- var style = {};
- if (this.cfg.zIndex) {
- style.zIndex = this.cfg.zIndex;
- this.label.css(style);
- }
- style.backgroundColor = '';
-
- this.nodes.hide().css(style).addClass($N.cssPrefix + this.cfg.className)
- .each(function(i, node) {
- node.originalPosition = parseInt($J(node).css('left'));
- });
- },
-
- setText: function(text) {
- if (this.label) {
- text += '';
- var labelWidth = this._textWidth(text, this.cfg.fontSize) + 10;
- labelWidth += 'px';
- if (this.label.css('width') != labelWidth) {
- this.label.css({
- width: labelWidth
- });
- }
- this.label.find('span').html(text);
- }
- return this;
- },
-
- move: function(pixelOffset) {
- if (this.position != pixelOffset) {
- if (pixelOffset < 0) {
- pixelOffset = 0;
- } else if (pixelOffset >= this.width) {
- pixelOffset = this.width - 1;
- }
- this.nodes.each(function(i, node) {
- $J(node).css('left', Math.round(node.originalPosition + pixelOffset) + 'px');
- });
- var labelWidth = this.label.width();
- var labelPixelOffset = pixelOffset - labelWidth / 2;
- if (labelPixelOffset < 0)
- labelPixelOffset = 0;
- else if (labelPixelOffset + labelWidth > this.width)
- labelPixelOffset = this.width - labelWidth;
- this.label.css({
- left: Math.round(labelPixelOffset) + 'px'
- });
- this.position = pixelOffset;
- }
- return this;
- },
-
- show: function(offset) {
- if (!this.visible) {
- this.nodes.show();
- this.label.show();
- this.visible = true;
- }
- return this;
- },
-
- hide: function() {
- this.nodes.hide();
- this.label.hide();
- this.visible = false;
- return this;
- },
-
- isVisible: function() {
- return this.visible;
- },
-
- blink: function(state) {
- var speed = 200;
- if (this.label && this.blinking != state) {
- var span = this.label.find('span');
-
- span.stop();
-
- function fade(on) {
- if (on) {
- span.animate({
- opacity: 1
- }, speed, null,
- function() {
- fade(false)
- });
- } else {
- span.animate({
- opacity: 0.4
- }, speed, null,
- function() {
- fade(true)
- })
- }
- }
-
- if (state) {
- fade();
- } else {
- span.animate({
- opacity: 1
- }, speed);
- }
-
- this.blinking = state;
- }
- return this;
- },
-
- _onMouseDown: function(evt) {
- this.mouseDown = true;
- this._onMouseMove(evt);
- return false;
- },
-
- _onMouseMove: function(evt) {
- if (this.mouseDown) {
- var offset = (evt.pageX - this.cfg.rulerLayout.offset().left);
- this.move(offset);
- this.fire('move', { //calls move (see above)
- offset: this.position,
- finish: false
- });
- return false;
- }
- },
-
- _onMouseUp: function(evt) {
- if (this.mouseDown) {
- this.mouseDown = false;
- this.fire('move', {
- index: this.index,
- offset: this.position,
- finish: true
- });
- return false;
- }
- },
-
- _observeMouseEvents: function() {
- this.label.mousedown(this.attachWithEvent(this._onMouseDown))
- .bind('click dragstart', function() {
- return false;
- });
- this.cfg.rulerLayout.mousemove(this.attachWithEvent(this._onMouseMove));
- this.cfg.rulerLayout.mouseup(this.attachWithEvent(this._onMouseUp));
- $J(document).mouseup(this.attachWithEvent(this._onMouseUp));
- }
-
- // _toString: function() {
- // return "<marker id="+id+" position="+position+" description=\""+
- // +description+"\"/>";
- // }
-
-
- });
-
- $N.notifyScriptLoad();
-
-});
+++ /dev/null
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2008-2009 Samalyse
- * Author: Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
- */
-
-TimeSide(function($N) {
-
-$N.Class.create("MarkerList", $N.Core, {
- initialize: function($super, cfg) {
- $super();
- this.cfg = this.configure(cfg, {
- container: null,
- map: null
- });
- },
-
- _buildItem: function(marker) {
- var dt = new Element('dt');
- var time = $N.Util.makeTimeLabel(marker.offset);
-
-
- },
-
- _setupInterface: function() {
- }
-});
-
-$N.notifyScriptLoad();
-
-});
+++ /dev/null
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2008-2009 Samalyse
- * Author: Olivier Guilyardi <olivier samalyse com> and Riccardo Zaccarelli
- * License: GNU General Public License version 2.0
- */
-
-TimeSide(function($N, $J) {
-
- $N.Class.create("MarkerMap", $N.Core, {
- markers: null,
- //the main div container:
- divContainer: $J("#markers_div_id"),
- initialize: function($super, markers) {
- $super();
- if (!markers){
- markers = [];
- }
- this.markers = markers;
- },
-
- get: function(index){
- return this.markers[index];
-
- },
-
-
- add: function(obj) {
- var marker = this.createMarker(obj);
- var idx = this.indexOf(marker);
-
- //adding the div
- //marker.div = this.createDiv(marker,idx);
- //setting focus and label description
- //set label description
- //this.setLabelDescription(marker);
- //finally, set the focus to the text
- //this.getHtmElm(marker,this.MHE_DESCRIPTION_TEXT).focus();
-
-
- this.markers.splice(idx,0,marker);
- //notifies controller.onMarkerMapAdd
- this.fire('add', {
- marker: marker,
- index: idx
- });
- //this.fireRefreshLabels(idx+1,this.markers.length);
- //this._reorder(marker.offset);
- //this.fireEditMode(marker);
- return idx;
- },
- //argument is either an object loaded from server or a number specifying the marker offset
- createMarker: function(argument){
- var marker = null;
- if(typeof argument == 'object'){
- var editable = CURRENT_USER_NAME === argument.author;
- marker = {
- id: argument.public_id,
- offset: argument.time,
- desc: argument.description,
- title: argument.title,
- author: argument.author,
- isEditable: editable,
- isSaved: true
-
- };
- }else if(typeof argument == 'number'){
- marker = {
- id: undefined, //before was: this.uniqid(),
- //now an undefined id means: not saved on server (see sendHTTP below)
- offset: parseFloat(argument),
- desc: "",
- title: "",
- author: CURRENT_USER_NAME,
- isEditable: true,
- isSaved: false
- };
- }
- return marker;
-
- },
-
- remove: function(index) {
- var marker = this.get(index);
- if (marker) {
- if(marker.isSaved){
- this.removeHTTP(marker);
- }
- this.markers.splice(index, 1);
- //notifies controller.js
- this.fire('remove', {
- index: index
- });
- }
- return marker;
- },
-
- move: function(markerIndex, newOffset){
- var newIndex = this.indexOf(newOffset);
-
- //if we moved left to right, the insertion index is actually
- //newIndex-1, as we must also consider to remove the current index markerIndex, so:
- if(newIndex>markerIndex){
- newIndex--;
- }
- //this way, we are sure that if markerIndex==newIndex we do not have to move,
- //and we can safely first remove the marker then add it at the newIndex without
- //checking if we moved left to right or right to left
- var marker = this.markers[markerIndex];
- marker.offset = newOffset;
- marker.isSaved = marker.isEditable ? false : true;
- if(newIndex != markerIndex){
- this.markers.splice(markerIndex,1);
- this.markers.splice(newIndex,0,marker);
- }
- this.fire('moved', {
- fromIndex: markerIndex,
- toIndex: newIndex
- });
- },
- //
- //The core search index function: returns insertionIndex if object is found according to comparatorFunction,
- //(-insertionIndex-1) if object is not found. This assures that if the returned
- //number is >=0, the array contains the element, otherwise not and the element can be inserted at
- //-insertionIndex-1
- insertionIndex: function(object){
- var offset;
- if(typeof object == 'object'){
- offset = object.offset;
- }else if(typeof object == 'number'){
- offset = object;
- }else{ //to be sure...
- offset = parseFloat(object);
- }
- var pInt = parseInt; //reference to parseInt (to increase algorithm performances)
- var comparatorFunction = function(a,b){
- return (a<b ? -1 : (a>b ? 1 : 0));
- };
- var data = this.markers;
- var low = 0;
- var high = data.length-1;
-
- while (low <= high) {
- //int mid = (low + high) >>> 1;
- var mid = pInt((low + high)/2);
- var midVal = data[mid];
- var cmp = comparatorFunction(midVal.offset,offset);
- if (cmp < 0){
- low = mid + 1;
- }else if (cmp > 0){
- high = mid - 1;
- }else{
- return mid; // key found
- }
- }
- return -(low + 1); // key not found
- },
- //indexOf is the same as insertionIndex, but returns a positive number.
- //in other words, it is useful when we do not want to know if obj is already present
- //in the map, but only WHERE WOULD be inserted obj in the map. obj can be a marker
- //or an offset (time). In the latter case a dummy marker with that offset will be considered
- indexOf: function(obj){
- var idx = this.insertionIndex(obj);
- return idx<0 ? -idx-1 : idx;
- },
- each: function(callback) {
- $J(this.markers).each(callback);
- },
- // length: function(){
- // return this.markers ? this.markers.length : 0;
- // },
-
-
- sendHTTP: function(marker, functionOnSuccess, showAlertOnError){
-
- //itemid is the item (spund file) name
- var sPath = window.location.pathname;
- //remove last "/" or last "/#", if any...
- sPath = sPath.replace(/\/#*$/,"");
- var itemid = sPath.substring(sPath.lastIndexOf('/') + 1);
-
- //WARNING: use single quotes for the whole string!!
- //see http://stackoverflow.com/questions/4809157/i-need-to-pass-a-json-object-to-a-javascript-ajax-method-for-a-wcf-call-how-can
- // var data2send = '{"id":"jsonrpc", "params":[{"item_id":"'+ itemid+'", "public_id": "'+marker.id+'", "time": "'+
- // marker.offset+'","description": "'+marker.desc+'"}], "method":"telemeta.add_marker","jsonrpc":"1.0"}';
-
- var isSaved = marker.id !== undefined;
- if(!isSaved){
- marker.id=this.uniqid(); //defined in core;
- }
- var method = isSaved ? "telemeta.update_marker" : "telemeta.add_marker";
-
- var s = this.jsonify;
- var data2send = '{"id":"jsonrpc", "params":[{"item_id":"'+ s(itemid)+
- '", "public_id": "'+s(marker.id)+'", "time": "'+s(marker.offset)+
- '", "author": "'+s(marker.author)+
- '", "title": "'+s(marker.title)+
- '","description": "'+s(marker.desc)+'"}], "method":"'+method+'","jsonrpc":"1.0"}';
-
- $.ajax({
- type: "POST",
- url: '/json/',
- contentType: "application/json",
- data: data2send,
- success: function(){
- if(!isSaved){
- marker.isSaved = true;
- }
- if(functionOnSuccess){
- functionOnSuccess();
- }
- },
- error: function(jqXHR, textStatus, errorThrown){
- if(showAlertOnError){
- var details = "\n(no further info available)";
- if(jqXHR) {
- details="\nThe server responded witha status of "+jqXHR.status+" ("+
- jqXHR.statusText+")\n\nDetails (request responseText):\n"+jqXHR.responseText;
- }
- alert("ERROR: Failed to save marker"+details);
- }
- }
- });
-
-
- },
-
- jsonify: function(string){
- var s = string;
- if(typeof string == "string"){
- s = string.replace(/\\/g,"\\\\")
- .replace(/\n/g,"\\n")
- .replace(/"/g,"\\\"");
- }
- return s;
- },
- removeHTTP: function(marker){
-
- // //itemid is the item (spund file) name
- // var sPath = window.location.pathname;
- // //remove last "/" or last "/#", if any...
- // sPath = sPath.replace(/\/#*$/,"");
- // var itemid = sPath.substring(sPath.lastIndexOf('/') + 1);
- var public_id = marker.id;
- //WARNING: use single quotes for the whole string!!
- //see http://stackoverflow.com/questions/4809157/i-need-to-pass-a-json-object-to-a-javascript-ajax-method-for-a-wcf-call-how-can
- var data2send = '{"id":"jsonrpc","params":["'+public_id+'"], "method":"telemeta.del_marker","jsonrpc":"1.0"}';
- // var map = this.cfg.map;
- // var me = this;
- $.ajax({
- type: "POST",
- url: '/json/',
- contentType: "application/json",
- data: data2send,
- dataType: "json"
-
- });
- var g = 9;
- }
-
- });
-
- $N.notifyScriptLoad();
-
-});
+++ /dev/null
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2008-2009 Samalyse
- * Author: Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
- */
-
-TimeSide(function($N, $J) {
-
- $N.Class.create("Player", $N.Core, {
- skeleton: {
- 'div.viewer': {
- 'div.ruler': {},
- 'div.wave': {
- 'div.image-canvas': {},
- 'div.image-container': ['img.image']
- }
- },
- 'div.control': {
- 'div.layout': {
- 'div.playback': ['a.play', 'a.pause', 'a.rewind', 'a.forward', 'a.set-marker']
- //,'input.textMarker']
- }
- }/*,
- 'div.marker-control': ['a.set-marker']*/
- },
- defaultContents: {
- play: 'Play',
- pause: 'Pause',
- rewind: 'Rewind',
- forward: 'Forward',
- 'set-marker': 'Set marker'
- //,'text-marker' : 'textmarker'
- },
- elements: {},
- ruler: null,
- soundProvider: null,
- map: null,
- container: null,
- imageWidth: null,
- imageHeight: null,
-
- initialize: function($super, container, cfg) {
- $super();
- if (!container)
- throw new $N.RequiredArgumentError(this, 'container');
- this.container = $J(container);
- this.configure(cfg, {
- image: null
- });
- },
-
- free: function($super) {
- this.elements = null;
- this.container = null;
- $super();
- },
-
- setSoundProvider: function(soundProvider) {
- this.soundProvider = soundProvider;
- return this;
- },
-
- setMarkerMap: function(map) {
- this.map = map;
- return this;
- },
-
- setImage: function(expr) {
- this.cfg.image = expr;
- this.refreshImage();
- },
-
- refreshImage: function() {
- var src = null;
- if (typeof this.cfg.image == 'function') {
- src = this.cfg.image(this.imageWidth, this.imageHeight);
- } else if (typeof this.cfg.image == 'string') {
- src = this.cfg.image;
- }
-
- if (src) {
- this.elements.image.attr('src', src);
- }
- },
-
- draw: function() {
- this.debug('drawing');
- $N.domReady(this.attach(this._setupInterface));
- return this;
- },
-
- _setupInterface: function() {
- this.elements = $N.Util.loadUI(this.container, this.skeleton, this.defaultContents);
-
- // IE apparently doesn't send the second mousedown on double click:
- var jump = $J.browser.msie ? 'mousedown dblclick' : 'mousedown';
- this.elements.rewind.attr('href', '#').bind(jump, this.attach(this._onRewind))
- .click(function() {
- return false;
- });
- this.elements.forward.attr('href', '#').bind(jump, this.attach(this._onForward))
- .click(function() {
- return false;
- });
- this.elements.pause.attr('href', '#').bind('click', this.attach(this._onPause));
- this.elements.play.attr('href', '#').bind('click', this.attach(this._onPlay));
-
- //assigning title string to all anchors???????
- this.elements.control.find('a').add(this.elements.setMarker)
- .attr('href', '#')
- .each(function(i, a){
- a = $J(a);
- if (!a.attr('title'))
- a.attr('title', a.text());
- });
-
- //this.elements.markerControl.find('a').attr('href', '#');
- if (this.map && CURRENT_USER_NAME) {
- //configureMarkersDiv();
- this.elements.setMarker.bind('click', this.attach(this._onSetMarker));
- //this.elements.setMarker2.bind('click', this.attach(this._onSetMarker2));
- //this.elements.textMarker.attr('type', 'text');
- //this.elements.textMarker.bind('click', this.attach(this._onSetMarker2));
-
- } else {
- this.elements.setMarker.remove();
- }
- //creating the ruler
- this.ruler = new $N.Ruler({
- viewer: this.elements.viewer,
- //map: this.map,
- soundProvider: this.soundProvider
- });
- //bind events to the ruler (see function observe in core.js, I guess,
- //which overrides jQuery bind function):
- //the first arg is basically the event name, the second
- //arg is a function to execute each time the event is triggered
- this.ruler
- .observe('markermove', this.forwardEvent)
- .observe('markeradd', this.forwardEvent)
- .observe('move', this.forwardEvent)
- .draw();
- this.refreshImage();
- this.resize();
- var resizeTimer = null;
- $J(window).resize(this.attach(function() {
- if (resizeTimer)
- clearTimeout(resizeTimer);
- resizeTimer = setTimeout(this.attach(this.resize), 100);
- }));
- //this.container.resize(this.attach(this.resize)); // Can loop ?
- },
-
- resize: function(overrideHeight) {
- this.debug("resizing");
- var height;
- if (overrideHeight === true) {
- this.debug("override height");
- height = this.elements.image.css('height', 'auto').height();
- } else {
- height = this.elements.wave.height();
- this.debug("wave height:" + height);
- if (!height) {
- this.elements.image.one('load', this.attach(function() {
- this.resize(true);
- this.debug("image loaded");
- }));
- height = this.elements.image.height();
- }
- }
-
- var elements = this.elements.image
- .add(this.elements.imageContainer)
- .add(this.elements.imageCanvas);
-
- elements.css('width', 'auto'); // for IE6
-
- if (!height){
- height = 200;
- }
- var style = {
- width: this.elements.wave.width(),
- height: height
- }
- elements.css(style);
- this.imageWidth = style.width;
- this.imageHeight = style.height;
- this.refreshImage();
- this.ruler.resize();
- return this;
- },
-
- _onRewind: function() {
- var offset = 0;
- if (this.map) {
- var position = parseFloat(this.soundProvider.getPosition());
- // var marker = this.map.getPrevious(position);
- // if (marker && this.soundProvider.isPlaying()
- // && position - marker.offset < this.ruler.getUnitDuration())
- // marker = this.map.getPrevious(marker.offset)
- // if (marker) {
- // offset = marker.offset;
- // }
- //
- var idx = this.map.indexOf(position)-1;
- if(idx>=0){
- var marker = this.map.get(idx);
- if(marker){
- offset = marker.offset;
- }
- }
- }
- this.fire('move', {
- offset: offset
- });
- return false;
- },
-
- _onForward: function() {
- var offset = this.soundProvider.getDuration();
- if (this.map) {
- var position = parseFloat(this.soundProvider.getPosition());
- var idx = this.map.insertionIndex(position);
- if(idx>=0){ //the pointer is exactly on a marker, increase by one
- //otherwise the index is the marker itself and we wouldn't move ahead
- idx++;
- }else{
- //we are not on a pointer, get the index of the marker
- //(see markermap insertionindex)
- idx = -idx-1;
- }
- if(idx>=0){
- var marker = this.map.get(idx);
- if(marker){
- offset = marker.offset;
- }
- }
- // var marker = this.map.getNext(this.soundProvider.getPosition());
- // if (marker) {
- // offset = marker.offset;
- // }
- }
- this.fire('move', {
- offset: offset
- });
- return false;
- },
-
- _onPlay: function() {
- this.fire('play');
- return false;
- },
-
- _onPause: function() {
- this.fire('pause');
- return false;
- },
-
- _onSetMarker: function() {
- if (this.map) {
- this.fire('markeradd', {
- offset: this.soundProvider.getPosition()
- });
- }
- return false;
- }
- });
-
- $N.notifyScriptLoad();
-
-});
+++ /dev/null
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2008-2009 Samalyse
- * Author: Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
- */
-
-TimeSide(function($N, $J) {
-
- $N.Class.create("Ruler", $N.Core, {
-
- fullSectionDuration: 60,
- sectionSubDivision: 10,
- sectionSteps: [[5, 1], [10, 1], [20, 2], [30, 5], [60, 10], [120, 20], [300, 30],
- [600, 60], [1800, 300], [3600, 600]],
- sectionsNum: 0,
- timeLabelWidth: 0,
- pointerPos: 0,
- layout: null,
- width: null,
- mouseDown: false,
- pointer: null,
- markers: new Array(),
- duration: 0,
- container: null,
- waveContainer: null,
-
- initialize: function($super, cfg) {
- $super();
- this.configure(cfg, {
- viewer: [null, 'required'],
- fontSize: 10,
- //map: null,
- soundProvider: [null, 'required']
- });
- this.cfg.viewer = $J(this.cfg.viewer);
- this.container = this.cfg.viewer.find('.' + $N.cssPrefix + 'ruler');
- this.waveContainer = this.cfg.viewer.find('.' + $N.cssPrefix + 'image-canvas');
- this._setDuration(this.cfg.soundProvider.getDuration());
- var imgContainer = this.cfg.viewer.find('.' + $N.cssPrefix + 'image-container'); // for IE
-
- this._observeMouseEvents(this.waveContainer.add(imgContainer));
- //if (this.cfg.map) {
- // this.cfg.map
- //.observe('add', this.attach(this._onMapAdd))
- //.observe('remove', this.attach(this._onMapRemove))
- //.observe('indexchange', this.attach(this._onMapIndexChange));
- //}
-
- this.cfg.soundProvider.observe('update', this.attach(this._onSoundProviderUpdate));
- },
-
- free: function($super) {
- this.layout = null;
- this.container = null;
- this.waveContainer = null;
- this.cfg.viewer = null;
- $super();
- },
-
- _computeLayout: function() {
- this.width = this.waveContainer.width();
-
- this.debug('container width: ' + this.width);
- var i, ii = this.sectionSteps.length;
- this.timeLabelWidth = this._textWidth('00:00', this.cfg.fontSize);
- for (i = 0; i < ii; i++) {
- var duration = this.sectionSteps[i][0];
- var subDivision = this.sectionSteps[i][1];
- var labelsNum = Math.floor(this.duration / duration);
- if ((i == ii - 1) || (this.width / labelsNum > this.timeLabelWidth * 2)) {
- this.fullSectionDuration = duration;
- this.sectionSubDivision = subDivision;
- this.sectionsNum = Math.floor(this.duration / this.fullSectionDuration);
- break;
- }
- }
- },
-
- getUnitDuration: function() {
- return this.sectionSubDivision;
- },
-
- resize: function() {
- var pointerVisible = this.pointer && this.pointer.isVisible();
- this._computeLayout();
- this.draw();
- if (pointerVisible) {
- this.setPosition(this.cfg.soundProvider.getPosition());
- this.setBuffering(this.cfg.soundProvider.isBuffering() && this.cfg.soundProvider.isPlaying());
- this.pointer.show();
- }
- },
-
- _setDuration: function(duration) {
- this.duration = duration;
- this._computeLayout();
- },
-
- setDuration: function(duration) {
- if (duration == 0)
- duration = 60;
- if (this.duration != duration) {
- this._setDuration(duration);
- this.draw();
- }
- },
-
- _createSection: function(timeOffset, pixelWidth) {
- var section = $J('<div/>')
- .addClass($N.cssPrefix + 'section')
- .css({
- fontSize: this.cfg.fontSize + 'px',
- fontFamily: 'monospace',
- width: pixelWidth,
- overflow: 'hidden'
- })
- .append($J('<div />').addClass($N.cssPrefix + 'canvas'));
-
- var topDiv = $J('<div/>')
- .addClass($N.cssPrefix + 'label')
- .appendTo(section);
- var bottomDiv = $J('<div/>')
- .addClass($N.cssPrefix + 'lines')
- .appendTo(section);
- var empty = $J('<span/>').css({
- visibility: 'hidden'
- }).text(' ');
- if (pixelWidth > this.timeLabelWidth) {
- var text = $J('<span/>')
- .text($N.Util.makeTimeLabel(timeOffset))
- .bind('mousedown selectstart', function() {
- return false;
- });
- } else {
- var text = empty.clone();
- }
- topDiv.append(text);
- bottomDiv.append(empty);
- return section;
- },
-
- _drawSectionRuler: function(section, drawFirstMark) {
- var j;
- var jg = new jsGraphics(section.find('.' + $N.cssPrefix + 'canvas').get(0));
- jg.setColor(this.layout.find('.' + $N.cssPrefix + 'lines').css('color'));
- var height = section.height();
- var ypos;
- for (j = 0; j < section.duration; j += this.sectionSubDivision) {
- if (j == 0) {
- if (drawFirstMark) {
- ypos = 0;
- } else {
- continue;
- }
- } else {
- ypos = (j == section.duration / 2) ? 1/2 + 1/8 : 3/4;
- }
- var x = j / this.duration * this.width;
- jg.drawLine(x, height * ypos, x, height - 1);
- }
- jg.paint();
- },
-
- getHeight: function() {
- return this.container.find('' + $N.cssPrefix + '.section').height();
- },
-
- draw: function() {
- if (!this.duration) {
- this.debug("Can't draw ruler with a duration of 0");
- return;
- }
- this.debug("draw ruler, duration: " + this.duration);
- if (this.layout){
- this.layout.remove();
- }
- this.layout = $J('<div/>')
- .addClass($N.cssPrefix + 'layout')
- .css({
- position: 'relative'
- }) // bugs on IE when resizing
- .bind('dblclick', this.attachWithEvent(this._onDoubleClick))
- //.bind('resize', this.attachWithEvent(this.resize)) // Can loop ?
- .appendTo(this.container);
-
- //this.container.html(this.layout);
-
- var sections = new Array();
- var currentWidth = 0;
- var i;
- for (i = 0; i <= this.sectionsNum; i++) {
- if (i < this.sectionsNum) {
- var duration = this.fullSectionDuration;
- var width = Math.floor(duration / this.duration * this.width);
- } else {
- var duration = this.duration - i * this.fullSectionDuration;
- var width = this.width - currentWidth;
-
- }
- var section = this._createSection(i * this.fullSectionDuration, width);
- if (i > 0) {
- section.css({
- left: currentWidth,
- top: 0,
- position: 'absolute'
- });
- }
- section.duration = duration;
- this.layout.append(section);
- currentWidth += section.width();
- sections[i] = section;
- }
-
- for (i = 0; i <= this.sectionsNum; i++) {
- this._drawSectionRuler(sections[i], (i > 0));
- }
-
- this._createPointer();
- //draw markers
- if (this.cfg.map) {
- $J(this.markers).each(function(i, m) {
- m.clear();
- });
- this.markers = new Array();
- this.cfg.map.each(this.attach(function(i, m) {
- this.markers.push(this._drawMarker(m, i));
- }));
- }
- //this._drawMarkers();
- },
-
- // _drawMarkers: function() {
- // if (this.cfg.map) {
- // $J(this.markers).each(function(i, m) {
- // m.clear();
- // });
- // this.markers = new Array();
- // this.cfg.map.each(this.attach(function(i, m) {
- // this.markers.push(this._drawMarker(m, i));
- // }));
- // }
- // },
-
- _createPointer: function() {
- if (this.pointer) {
- this.pointer.clear();
- }
- this.pointer = new $N.Marker({
- rulerLayout: this.layout.get(0),
- viewer: this.waveContainer,
- fontSize: this.cfg.fontSize,
- zIndex: 1000,
- top:0,
- className: 'pointer',
- tooltip: 'Move head',
- canMove: true
- });
- // //create the label
- // var tsMainLabel = $.find('.' + $N.cssPrefix + 'label');
- // if(tsMainLabel){
- // var label = tsMainLabel.find('#' + $N.cssPrefix + 'pointerOffset');
- // if(!label){
- // label = $("<span/>").id('#' + $N.cssPrefix + 'pointerOffset').css('zIndex','10').appendTo(tsMainLabel);
- // this.pointer.label = label;
- // }
- // }
-
- this.pointer
- //.setText("+")
- .setText($N.Util.makeTimeLabel(0))
- .observe('move', this.attach(this._onPointerMove));
- },
-
- _movePointer: function(offset) {
- if (offset < 0){
- offset = 0;
- }else if (offset > this.duration){
- offset = this.duration;
- }
- pixelOffset = offset / this.duration * this.width;
- if (this.pointer) {
- this.pointer.move(pixelOffset);
- this.pointer.setText($N.Util.makeTimeLabel(offset));
- }
- this.pointerPos = offset;
- },
-
- _setPosition: function(offset) {
- this._movePointer(offset);
- if (this.pointer) {
- this.pointer.show();
- }
- },
-
- setPosition: function(offset) {
- if (!this.mouseDown) {
- this._setPosition(offset);
- }
- },
-
- shiftPosition: function(delta) {
- this.setPosition(this.pointerPos + delta);
- },
-
- hidePointer: function() {
- if (this.pointer)
- this.pointer.hide();
- },
-
- setBuffering: function(state) {
- if (this.pointer) {
- this.pointer.blink(state);
- }
- },
- /*
- _onClick: function(evt) {
- var offset = (evt.pageX - this.container.offset().left)
- / this.width * this.duration;
- this._setPosition(offset);
- this.fire('move', {offset: offset});
- },
-*/
- _onMouseDown: function(evt) {
- this.mouseDown = true;
- this._onMouseMove(evt);
- evt.preventDefault();
- },
-
- _onPointerMove: function(evt, data) {
- this.mouseDown = true;
- this._setPosition(data.offset / this.width * this.duration);
- if(data.finish) {
- this.fire('move', {
- offset: this.pointerPos
- });
- this.mouseDown = false;
- }
- return false;
- },
-
- _onMouseMove: function(evt) {
- if (this.mouseDown) {
- var pixelOffset = evt.pageX - this.container.offset().left;
- this._setPosition(pixelOffset / this.width * this.duration);
- return false;
- }
- },
-
- _onMouseUp: function(evt) {
-
- if (this.mouseDown) {
- this.mouseDown = false;
- this.fire('move', {
- offset: this.pointerPos
- });
- return false;
- }
- },
-
- _observeMouseEvents: function(element) {
- if(!(CURRENT_USER_NAME)){
- return;
- }
- element
- .bind('click dragstart', function() {
- return false;
- })
- .bind('mousedown', this.attachWithEvent(this._onMouseDown))
- .bind('mousemove', this.attachWithEvent(this._onMouseMove))
- .bind('mouseup', this.attachWithEvent(this._onMouseUp));
- $J(document)
- .bind('mousemove', this.attachWithEvent(this._onMouseMove));
- },
-
- _drawMarker: function(marker, index) {
- if (marker.offset < 0){
- marker.offset = 0;
- }else if (marker.offset > this.duration){
- marker.offset = this.duration;
- }
-
- pixelOffset = marker.offset / this.duration * this.width;
-
- m = new $N.Marker({
- rulerLayout: this.layout.get(0),
- viewer: this.waveContainer,
- fontSize: this.cfg.fontSize,
- className: 'marker',
- index: index,
- tooltip: 'Move marker',
- canMove: marker.isEditable
- });
- if(marker.isEditable){
- m.observe('move', this.attach(this._onMarkerMove))
- }
- //m.observe('move', this.attach(this._onMarkerMove))
- m
- //.setText(index + 1)
- .move(pixelOffset)
- .show();
- return m;
- },
-
- _onMarkerMove: function(e, data) {
- if (data.finish) {
- var offset = data.offset / this.width * this.duration;
- this.fire('markermove', {
- index: data.index,
- offset: offset
- });
- }
- },
-
- add: function(marker, index){
- this.markers.splice(index, 0, this._drawMarker(marker, index));
- //this.markers.push(this._drawMarker(marker, index));
- },
-
- // _onMapAdd2: function(e, data) {
- // this.markers.push(this._drawMarker(data.marker, data.index));
- // },
-
- remove: function(index){
- var rulermarker = this.markers[index];
- rulermarker.clear();
- this.markers.splice(index, 1);
- },
-
- //it is assured that fromIndex!=toIndex and fromIndex!=toIndex+1 (see markermap.move)
- move: function(fromIndex, toIndex){
- var m = this.markers.splice(fromIndex,1)[0]; //remove
- this.markers.splice(toIndex,0,m); //add
- },
-
- updateMarkerIndices:function(fromIndex, toIndex){
- for(var i=fromIndex; i<=toIndex; i++){
- this.markers[i].setIndex(i);
- }
- },
-
- _onDoubleClick: function(evt) {
- if (CURRENT_USER_NAME) {
- var offset = (evt.pageX - this.container.offset().left)
- / this.width * this.duration;
- this.fire('markeradd', {
- offset: offset
- });
- }
- },
-
- _onSoundProviderUpdate: function(e) {
- this.setDuration(this.cfg.soundProvider.getDuration());
- this.setPosition(this.cfg.soundProvider.getPosition());
- this.setBuffering(this.cfg.soundProvider.isBuffering() && this.cfg.soundProvider.isPlaying());
- }
- });
-
- $N.notifyScriptLoad();
-
-});
-
-// _onMapRemove: function(e, data) {
- // $J(this.markers).each(this.attach(function(i, m) {
- // if (m.id == data.marker.id) {
- // m.clear();
- // this.markers.splice(i, 1);
- // }
- // }));
- // },
-
- // onMapMove: function(fromIndex, toIndex) {
- // var min = Math.min(fromIndex, toIndex);
- // var max = Math.max(fromIndex, toIndex);
- // this.updateMarkerIndices(min,max);
- //// $J(this.markers).each(this.attach(function(i, m) {
- //// if (m.id == data.marker.id) {
- //// m.setText(data.index + 1);
- //// return false;
- //// }
- //// }));
- // },
+++ /dev/null
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2008-2009 Samalyse
- * Author: Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
- */
-
-TimeSide(function($N) {
-
-$N.Class.create("SoundProvider", $N.Core, {
- sound: null,
- timer: null,
- buggyPosition: null,
- isDurationForced: false,
- state: {
- position: null,
- duration: null,
- playing: false,
- buffering: false
- },
- lastState: null,
-
- initialize: function($super, cfg) {
- $super();
- this.configure(cfg, {
- source: null,
- duration: null
- });
- this.sound = this.cfg.source;
- if (this.cfg.duration) {
- this.forceDuration(this.cfg.duration);
- }
- this.state.position = 0;
- this.update = this.attach(this._update);
- this.timer = setInterval(this.update, 43);
- },
-
- free: function($super) {
- this.sound = null;
- $super();
- },
-
- play: function() {
- if (this.sound) {
- if (!this.sound.playState) {
- this.sound.play();
- } else if (this.sound.paused) {
- this.sound.resume();
- }
- }
- return this;
- },
-
- pause: function() {
- if (this.sound)
- this.sound.pause();
- return this;
- },
-
- seek: function(offset) {
- if (this.sound) {
- this.sound.setPosition(offset * 1000);
- if (!this.state.playing) {
- this.buggyPosition = this.sound.position / 1000;
- this.state.position = offset;
- }
- }
- return this;
- },
-
- isPlaying: function() {
- return this.state.playing;
- },
-
- getPosition: function() {
- if (this.state.position == null)
- this._retrieveState();
- return this.state.position;
- },
-
- getDuration: function() {
- if (this.state.duration == null)
- this._retrieveState();
- return this.state.duration;
- },
-
- forceDuration: function(duration) {
- this.state.duration = duration;
- this.isDurationForced = true;
- },
-
- isBuffering: function() {
- return this.state.buffering;
- },
-
- _retrieveState: function() {
- if (this.sound) {
- this.state.playing = (this.sound.playState && !this.sound.paused);
- if (this.state.playing) {
- var position = this.sound.position / 1000;
- if (position != this.buggyPosition) {
- this.state.position = position;
- this.buggyPosition = null;
- }
- }
- if (!this.isDurationForced) {
- if (this.sound.readyState == 1) {
- this.state.duration = this.sound.durationEstimate / 1000;
- } else {
- this.state.duration = this.sound.duration / 1000;
- }
- }
- this.state.buffering = (this.sound.readyState == 1 && this.state.position > this.sound.duration / 1000);
- }
- },
-
- _update: function() {
- this._retrieveState();
- var updated = false;
- if (this.lastState) {
- for (k in this.state) {
- if (this.state[k] != this.lastState[k]) {
- updated = true;
- break;
- }
- }
- } else {
- this.lastState = {};
- updated = true;
- }
- if (updated) {
- for (k in this.state) {
- this.lastState[k] = this.state[k];
- }
- this.fire('update');
- }
- },
-
- setSource: function(source) {
- this.debug("setting source");
- this.sound = source;
- return this;
- }
-
-});
-
-$N.notifyScriptLoad();
-
-});
+++ /dev/null
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2008-2009 Samalyse
- * Author: Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
- */
-
-//this global variable SEEMS to do a check on the variable jQuery, then
-//simply executes the argument (which is a function)
-var TimeSide = function() {
- //arguments is an array-like object corresponding to the arguments passed to a function
- if (arguments[0]) {
- var toolkit = null;
- if (typeof jQuery != 'undefined'){
- toolkit = jQuery;
- }
- //call arguments[0] (a function) with arguments this and jQuery
- (arguments[0])(TimeSide, toolkit)
- }
-};
-//this is the first function instantiated. It SEEMS to check the document status and
-//load synchronously all the scripts
-TimeSide(function($N, $J) {
-
- $N.isDomLoaded = false;
- $N.isLoaded = false;
- $N.isLoading = false;
- $N.onLoadCallbacks = [];
- $N.cssPrefix = 'ts-';
- $N.debugging = false;
-
- $J(document).ready(function () {
- $N.isDomLoaded = true;
- });
-
- $N.domReady = function(callback) {
- // simply calling jQuery.ready() *after* the DOM is loaded doesn't work reliably,
- // at least with jQuery 1.2.6
- if ($N.isDomLoaded) {
- callback();
- } else{
- $J(document).ready(callback);
- }
- }
-
- $N.instances = [];
- $N.registerInstance = function(obj) {
- $N.instances.push(obj);
- }
-
- $N.free = function() {
- $J($N.instances).each(function(i, obj) {
- obj.free();
- });
- }
-
- $J(window).unload($N.free);
-
- $N.loadScriptsNum = 0;
- $N.loadScriptsCallback = null;
- $N.loadScripts = function(root, scripts, callback) {
- if ($N.loadScriptsCallback) {
- throw "Timeside loader error: concurrent script loading";
- }
-
- $N.loadScriptsNum = scripts.length;
- $N.loadScriptsCallback = callback;
-
- var head= document.getElementsByTagName('head')[0];
- for (i = 0; i < scripts.length; i++) {
-
- var script = document.createElement('script');
- script.type = 'text/javascript';
- var debug = $N.debugging ? '?rand=' + Math.random() : '';
- script.src = root + scripts[i] + debug;
- head.appendChild(script);
- }
- }
-
- $N.notifyScriptLoad = function() {
- if (--$N.loadScriptsNum == 0 && $N.loadScriptsCallback) {
- var callback = $N.loadScriptsCallback;
- $N.loadScriptsCallback = null;
- callback();
- }
- }
-
- $N.debug = function(state) {
- $N.debugging = state;
- }
-
- $N.load = function(callback) {
- $N.domReady(function() {
- if ($N.isLoaded) {
- if (callback)
- callback();
- } else {
- if (callback)
- $N.onLoadCallbacks.push(callback);
-
- if (!$N.isLoading) {
- $N.isLoading = true;
- var re = /(.*)timeside.js/;
- var root = '';
- $J('head script').each(function(i, e) {
- if ((match = re.exec(e.src))) {
- root = match[1];
- }
- });
-
- $N.loadScripts(root, ['core.js'], function() {
- $N.loadScripts(root, ['util.js'], function() {
- var scripts = ['controller.js', 'marker.js', 'markerlist.js',
- 'markermap.js', 'player.js', 'ruler.js','divmarker.js',
- 'soundprovider.js'];
-
- $N.loadScripts(root, scripts, function() {
- $N.isLoaded = true;
- $N.isLoading = false;
- $J($N.onLoadCallbacks).each(function(i, callback) {
- callback();
- });
- });
- });
- });
- }
- }
- });
- }
-
-});
+++ /dev/null
-/**
- * TimeSide - Web Audio Components
- * Copyright (c) 2008-2009 Samalyse
- * Author: Olivier Guilyardi <olivier samalyse com>
- * License: GNU General Public License version 2.0
- */
-
-TimeSide(function($N, $J) {
-
- $N.Util = {
- _loadChild: function(container, tag, className, index, contents) {
- var p = $N.cssPrefix;
- var element = container.find('.' + p + className);
- if (!element.length) {
- element = $J(document.createElement(tag)).addClass(p + className);
- if (contents[className]) {
- element.text(contents[className]);
- }
- var children = container.children();
- if (index < children.length) {
- children.eq(index).before(element);
- } else {
- container.append(element);
- }
- }
- return element;
- },
-
- _loadUI: function(container, skeleton, contents) {
- var i = 0;
- var elements = {};
- with ($N.Util) {
- if (skeleton[0]) {
- $J(skeleton).each((function(i, selector) {
- var s = selector.split('.');
- elements[$N.Util.camelize(s[1])] = _loadChild(container, s[0], s[1], i++, contents);
- }));
- } else {
- for (key in skeleton) {
- var s = key.split('.');
- var e = _loadChild(container, s[0], s[1], i++, contents);
- elements[$N.Util.camelize(s[1])] = e;
- $N.extend(elements, _loadUI(e, skeleton[key], contents));
-
- }
- }
- }
- return elements;
- },
-
- loadUI: function(container, skeleton, contents) {
- return $N.Util._loadUI($J(container), skeleton, contents);
- },
-
- makeTimeLabel: function(offset) {
- var minutes = Math.floor(offset / 60);
- if (minutes < 10)
- minutes = '0' + minutes;
- var seconds = Math.floor(offset % 60);
- if (seconds < 10)
- seconds = '0' + seconds;
- return minutes + ':' + seconds;
- },
-
- camelize: function(str) {
- var parts = str.split('-'), len = parts.length;
- if (len == 1) return parts[0];
-
- var camelized = str.charAt(0) == '-'
- ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
- : parts[0];
-
- for (var i = 1; i < len; i++)
- camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
-
- return camelized;
- },
-
- setUpTabs:function(selIndex) {//called from within controller.js once all markers have been loaded.
- //this is because we need all divs to be visible to calculate size. selIndex is optional, it defaults to 0
- //
- //declare variables:
- var tabContainerHeight = '5ex'; //height for the tab container
- var tabHeight = '3.5ex'; //height for the tab. Must be lower than tabContainerHeight
- var tabPaddingTop ='.8ex'; //padding top of each tab. Increasing it will increase also the tab height, so
- //compensate by decreasing tabHeight, in case. In any case, must be lower or equal to tabContainerHeight-tabHeight
- var tabWidth = '10ex'; //width of each tab. Each tab from index 1 to n will be at left=n*tabWidth
- var tabBottom ='-1px'; //bottom of each tab. Must be equal and opposite to the border of the div below the tab
-
- //retrieve tab container:
- var tabContainer = $("#tabs_container"); //change if tabContainer has to be retrieved diferently
- //retrieve the tabs by checking the elements whose class name starts with "tab_"
- //var tabs = $('a[class^="tab_"]'); //change if the tabs have to be determined differently.
- var tabs = tabContainer.find('a[id^="tab_"]');
- //function that retrieves the div relative to a tab (the div will be set visible.invisible according to tab click):
- var tab2div = function(tab){
- return $("#"+tab.attr("name"));
- //ie, returns the element whose id is equal to the tab name.
- //change here if div has to be determined differently
- };
- var selectedTabClassName = "tab_selected"; //change if needed
- var unselectedTabClassName = "tab_unselected"; //change if needed
- var tabClicked = function(index) {
- for(var i=0; i<tabs.length; i++){
- var t = $(tabs[i]);
- if(i===index){
- t.removeClass(unselectedTabClassName).addClass(selectedTabClassName);
- tab2div(t).fadeIn('slow');
- }else{
- t.removeClass(selectedTabClassName).addClass(unselectedTabClassName);
- tab2div(t).hide();
- }
- }
- return false; //returning false avoids scroll of the anchor to the top of the page
- //if the tab is an anchor, of course
- };
- //end of variables declaration
-
- //tabContainer default css:
- tabContainer.css({
- 'position':'relative',
- 'height':tabContainerHeight
- });
- //tabs default css:
- tabs.css({
- 'position':'absolute',
- 'height':tabHeight,
- 'bottom':tabBottom,
- 'paddingTop':tabPaddingTop,
- 'width':tabWidth,
- 'color': '#000000',
- 'left':0, //this will be overridden for tabs from 1 to n (see below)
- 'textAlign':'center'
- });
- //setting the left property for all tabs from 1 to n
- var left = parseFloat(tabWidth); //note that 40%, 33.3ex will be converted
- //succesfully to 40 and 33.3 respectively
- if(!isNaN(left)){
- //retrieve the unit
- var s = new String(left);
- var unit = '';
- if(s.length<tabWidth.length){
- unit = tabWidth.substring(s.length,tabWidth.length);
- }
- for(var i=1; i<tabs.length; i++){
- $(tabs[i]).css('left',(left*i)+unit);
- }
- }
-
- for (var i=0;i<tabs.length;i++){
- // introduce a new scope (round brackets)
- //otherwise i is retrieved from the current scope and will be always equal to tabs.length
- //due to this loop
- (function(tabIndex){
- $(tabs[i]).click(function(){
- return tabClicked(tabIndex);
- });
- })(i);
- }
-
- this.setRoundBorder(tabs,'5px','5px',[0,1]);
-
- if(!(selIndex)){
- selIndex = 0;
- }
- $(tabs[selIndex]).trigger("click");
- },
-
- selectMarkerTab: function(){
- $('#tab_markers').trigger("click");
- },
- //set cross browser round borders.
- //elements: the html element or elements (jQuery syntax)
- //hRadius the horizontal radius, or the horizontal vertical radius if the latter is omitted (see below)
- //vRadius OPTIONAL the vertical radius. If missing, it defaults to hRadius
- //angles: OTPIONAL. An array object of the corner indices where to apply radius. Indices are
- // considered clockwise starting from the top left corner,ie:
- // 0=topleft, 1 topright, 2 bottomright, 3 bottomleft
- // If missing, it defaults to [0,1,2,3] (all indices)
- setRoundBorder: function(elements, hRadius, vRadius, whichAngles){
- if(!(vRadius)){
- vRadius = hRadius;
- }
- var cssVal = hRadius+' '+vRadius;
- if(!(whichAngles)){
- whichAngles = [0,1,2,3];
- }
- $(elements).each(function(){
- var element = $(this);
- for(var i=0; i<whichAngles.length; i++){
- var keys=[];
- if(whichAngles[i]===0){
- keys=['-webkit-border-top-left-radius','moz-border-radius-topleft','border-top-left-radius'];
- }else if(whichAngles[i]===1){
- keys=['-webkit-border-top-right-radius','moz-border-radius-topright','border-top-right-radius'];
- }else if(whichAngles[i]===2){
- keys=['-webkit-border-bottom-right-radius','moz-border-radius-bottomright','border-bottom-right-radius'];
- }else if(whichAngles[i]===3){
- keys=['-webkit-border-bottom-left-radius','moz-border-radius-bottomleft','border-bottom-left-radius'];
- }
- if(keys){
- for(var j=0; j<keys.length; j++){
- element.css(keys[j],cssVal);
- }
- }
- // element.css('-webkit-border-top-left-radius',hRadius+' '+vRadius);
- // element.css('moz-border-radius-topleft',hRadius+' '+vRadius);
- // element.css('border-top-left-radius',hRadius+' '+vRadius);
- }
- });
-
- },
-
-
- }
-
- $N.notifyScriptLoad();
-
-});