//piraja.com.br GoogleApiKey
var GOOGLE_API_KEY = "ABQIAAAA6AYfYvs1jsnfnuF7VKv1jxQVhELZxn0Vhmm7fPaVJmbHyeiwIRTADdo0NLfC5OF70AenVsWJExfG6A";

//log function (console.log)
window.log = function(){
  log.history = log.history || [];
  log.history.push(arguments);
  arguments.callee = arguments.callee.caller;  
  if(this.console || console) console.log( Array.prototype.slice.call(arguments) );
};
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});

/*
 * Plugin videoplayer PlayerLite (requires swfobject)
 */
jQuery.fn.videoplayer = function(options){
	
	if(!arguments.callee.$id)
		arguments.callee.$id = 0;
		
	arguments.callee.$id++;
	
	var container = $(this);
	
	var settings = {
		autoPlay:false,
		width:'auto',
		height:'auto',
		image:null,
		video:null,
		watermark:"hide"
	};
	
	if(options) {
		$.extend(settings, options);
	}
	
	container.css("display", "block");
	
	if(settings.width == "auto")
		settings.width = container.width();
	
	if(settings.height == "auto")
		settings.height = container.height();
		
	if(!settings.image)
		settings.image = container.find("img").attr("src") || "";
	
	if(!settings.video)
		settings.video = container.attr("href") || "";
	
	var id = "videoplayer_"+arguments.callee.$id;
	
	container.replaceWith($("<div class='videoplayerholder'><div id='"+id+"' class='videoplayer'></div></div>"));
	
	swfobject.embedSWF("/util/swf/playerLite.swf", id, settings.width, settings.height, "9.0.0", "/util/swf/expressInstall.swf", 
	{
		vidWidth:settings.width,
		vidHeight:settings.height,
		thumbPath:settings.image,
		vidPath:settings.video,
		watermark:settings.watermark,
		autoPlay:true
	}, 
	{
		wmode:'transparent',
		allowfullscreen:'true',
		allowscriptdomain:'true',
		scale:'noscale'
	});
	
	return this;
}

/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();

/*
 * Function.bind;
 */
(function(){
	Function.prototype.bind = function(scope) {
		var args = Array.prototype.slice.call(arguments, 1);
		var fn = this;
		return function(){
	        fn.apply(scope, Array.prototype.slice.call( arguments ).concat(args));
	    };
	}
	Function.prototype.bindWithArgs = function(scope) {
		var args = Array.prototype.slice.call(arguments, 1);
		var fn = this;
		return function(){
	        fn.apply(scope, args);
	    };
	}
})();

/**
 * Classy - classy classes for JavaScript
 *
 * :copyright: (c) 2010 by Armin Ronacher.
 * :license: BSD.
 */
(function(undefined){var
CLASSY_VERSION='1.3',root=this,old_class=Class,disable_constructor=false;var probe_super=(function(){$super();}).toString().indexOf('$super')>0;function usesSuper(obj){return!probe_super||/\B\$super\b/.test(obj.toString());}
function setOrUnset(obj,key,value){if(value===undefined)
delete obj[key];else
obj[key]=value;}
function getOwnProperty(obj,name){return Object.prototype.hasOwnProperty.call(obj,name)?obj[name]:undefined;}
function cheapNew(cls){disable_constructor=true;var rv=new cls;disable_constructor=false;return rv;}
var Class=function(){};Class.$noConflict=function(){try{setOrUnset(root,'Class',old_class);}
catch(e){root.Class=old_class;}
return Class;};Class.$classyVersion=CLASSY_VERSION;Class.$extend=function(properties){var super_prototype=this.prototype;properties=typeof(properties)==="function"?properties():properties;var prototype=cheapNew(this);if(properties.__include__)
for(var i=0,n=properties.__include__.length;i!=n;++i){var mixin=properties.__include__[i];for(var name in mixin){var value=getOwnProperty(mixin,name);if(value!==undefined)
prototype[name]=mixin[name];}}
for(var name in properties){var value=getOwnProperty(properties,name);if(name==='__include__'||name==='__classvars__'||value===undefined)
continue;prototype[name]=typeof value==='function'&&usesSuper(value)?(function(meth,name){return function(){var old_super=getOwnProperty(this,'$super');this.$super=super_prototype[name];try{return meth.apply(this,arguments);}
finally{setOrUnset(this,'$super',old_super);}};})(value,name):value}
var rv=function(){if(disable_constructor)
return;var proper_this=root===this?cheapNew(arguments.callee):this;if(proper_this.__init__)
proper_this.__init__.apply(proper_this,arguments);proper_this.$class=rv;return proper_this;}
if(properties.__classvars__)
for(var key in properties.__classvars__){var value=getOwnProperty(properties.__classvars__,key);if(value!==undefined)
rv[key]=value;}
rv.prototype=prototype;rv.constructor=rv;rv.$extend=Class.$extend;rv.$withData=Class.$withData;return rv;};Class.$withData=function(data){var rv=cheapNew(this);for(var key in data){var value=getOwnProperty(data,key);if(value!==undefined)
rv[key]=value;}
return rv;};root.Class=Class;})();

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
/*
 * jQuery history plugin
 * 
 * The MIT License
 * 
 * Copyright (c) 2006-2009 Taku Sano (Mikage Sawatari)
 * Copyright (c) 2010 Takayuki Miwa
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

(function($) {
    var locationWrapper = {
        put: function(hash, win) {
            (win || window).location.hash = this.encoder(hash);
        },
        get: function(win) {
            var hash = ((win || window).location.hash).replace(/^#/, '');
            try {
                return $.browser.mozilla ? hash : decodeURIComponent(hash);
            }
            catch (error) {
                return hash;
            }
        },
        encoder: encodeURIComponent
    };

    var iframeWrapper = {
        id: "__jQuery_history",
        init: function() {
            var html = '<iframe id="'+ this.id +'" style="display:none" src="javascript:false;" />';
            $("body").prepend(html);
            return this;
        },
        _document: function() {
            return $("#"+ this.id)[0].contentWindow.document;
        },
        put: function(hash) {
            var doc = this._document();
            doc.open();
            doc.close();
            locationWrapper.put(hash, doc);
        },
        get: function() {
            return locationWrapper.get(this._document());
        }
    };

    function initObjects(options) {
        options = $.extend({
                unescape: false
            }, options || {});

        locationWrapper.encoder = encoder(options.unescape);

        function encoder(unescape_) {
            if(unescape_ === true) {
                return function(hash){ return hash; };
            }
            if(typeof unescape_ == "string" &&
               (unescape_ = partialDecoder(unescape_.split("")))
               || typeof unescape_ == "function") {
                return function(hash) { return unescape_(encodeURIComponent(hash)); };
            }
            return encodeURIComponent;
        }

        function partialDecoder(chars) {
            var re = new RegExp($.map(chars, encodeURIComponent).join("|"), "ig");
            return function(enc) { return enc.replace(re, decodeURIComponent); };
        }
    }

    var implementations = {};

    implementations.base = {
        callback: undefined,
        type: undefined,

        check: function() {},
        load:  function(hash) {},
        init:  function(callback, options) {
            initObjects(options);
            self.callback = callback;
            self._options = options;
            self._init();
        },

        _init: function() {},
        _options: {}
    };

    implementations.timer = {
        _appState: undefined,
        _init: function() {
            var current_hash = locationWrapper.get();
            self._appState = current_hash;
            self.callback(current_hash);
            setInterval(self.check, 100);
        },
        check: function() {
            var current_hash = locationWrapper.get();
            if(current_hash != self._appState) {
                self._appState = current_hash;
                self.callback(current_hash);
            }
        },
        load: function(hash) {
            if(hash != self._appState) {
                locationWrapper.put(hash);
                self._appState = hash;
                self.callback(hash);
            }
        }
    };

    implementations.iframeTimer = {
        _appState: undefined,
        _init: function() {
            var current_hash = locationWrapper.get();
            self._appState = current_hash;
            iframeWrapper.init().put(current_hash);
            self.callback(current_hash);
            setInterval(self.check, 100);
        },
        check: function() {
            var iframe_hash = iframeWrapper.get(),
                location_hash = locationWrapper.get();

            if (location_hash != iframe_hash) {
                if (location_hash == self._appState) {    // user used Back or Forward button
                    self._appState = iframe_hash;
                    locationWrapper.put(iframe_hash);
                    self.callback(iframe_hash); 
                } else {                              // user loaded new bookmark
                    self._appState = location_hash;  
                    iframeWrapper.put(location_hash);
                    self.callback(location_hash);
                }
            }
        },
        load: function(hash) {
            if(hash != self._appState) {
                locationWrapper.put(hash);
                iframeWrapper.put(hash);
                self._appState = hash;
                self.callback(hash);
            }
        }
    };

    implementations.hashchangeEvent = {
        _init: function() {
            self.callback(locationWrapper.get());
            $(window).bind('hashchange', self.check);
        },
        check: function() {
            self.callback(locationWrapper.get());
        },
        load: function(hash) {
            locationWrapper.put(hash);
        }
    };

    var self = $.extend({}, implementations.base);

    if($.browser.msie && ($.browser.version < 8 || document.documentMode < 8)) {
        self.type = 'iframeTimer';
    } else if("onhashchange" in window) {
        self.type = 'hashchangeEvent';
    } else {
        self.type = 'timer';
    }

    $.extend(self, implementations[self.type]);
    $.history = self;
})(jQuery);

/*!
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */

(function(i){var q={vertical:false,rtl:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click",buttonNextCallback:null,buttonPrevCallback:null, itemFallbackDimension:null},r=false;i(window).bind("load.jcarousel",function(){r=true});i.jcarousel=function(a,c){this.options=i.extend({},q,c||{});this.autoStopped=this.locked=false;this.buttonPrevState=this.buttonNextState=this.buttonPrev=this.buttonNext=this.list=this.clip=this.container=null;if(!c||c.rtl===undefined)this.options.rtl=(i(a).attr("dir")||i("html").attr("dir")||"").toLowerCase()=="rtl";this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical?this.options.rtl? "right":"left":"top";for(var b="",d=a.className.split(" "),f=0;f<d.length;f++)if(d[f].indexOf("jcarousel-skin")!=-1){i(a).removeClass(d[f]);b=d[f];break}if(a.nodeName.toUpperCase()=="UL"||a.nodeName.toUpperCase()=="OL"){this.list=i(a);this.container=this.list.parent();if(this.container.hasClass("jcarousel-clip")){if(!this.container.parent().hasClass("jcarousel-container"))this.container=this.container.wrap("<div></div>");this.container=this.container.parent()}else if(!this.container.hasClass("jcarousel-container"))this.container= this.list.wrap("<div></div>").parent()}else{this.container=i(a);this.list=this.container.find("ul,ol").eq(0)}b!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+b+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass("jcarousel-clip"))this.clip=this.list.wrap("<div></div>").parent();this.buttonNext=i(".jcarousel-next",this.container);if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null)this.buttonNext= this.clip.after(this.options.buttonNextHTML).next();this.buttonNext.addClass(this.className("jcarousel-next"));this.buttonPrev=i(".jcarousel-prev",this.container);if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null)this.buttonPrev=this.clip.after(this.options.buttonPrevHTML).next();this.buttonPrev.addClass(this.className("jcarousel-prev"));this.clip.addClass(this.className("jcarousel-clip")).css({overflow:"hidden",position:"relative"});this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden", position:"relative",top:0,margin:0,padding:0}).css(this.options.rtl?"right":"left",0);this.container.addClass(this.className("jcarousel-container")).css({position:"relative"});!this.options.vertical&&this.options.rtl&&this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl");var j=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;b=this.list.children("li");var e=this;if(b.size()>0){var g=0,k=this.options.offset;b.each(function(){e.format(this,k++);g+=e.dimension(this, j)});this.list.css(this.wh,g+100+"px");if(!c||c.size===undefined)this.options.size=b.size()}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display","block");this.funcNext=function(){e.next()};this.funcPrev=function(){e.prev()};this.funcResize=function(){e.reload()};this.options.initCallback!==null&&this.options.initCallback(this,"init");if(!r&&i.browser.safari){this.buttons(false,false);i(window).bind("load.jcarousel",function(){e.setup()})}else this.setup()}; var h=i.jcarousel;h.fn=h.prototype={jcarousel:"0.2.7"};h.fn.extend=h.extend=i.extend;h.fn.extend({setup:function(){this.prevLast=this.prevFirst=this.last=this.first=null;this.animating=false;this.tail=this.timer=null;this.inTail=false;if(!this.locked){this.list.css(this.lt,this.pos(this.options.offset)+"px");var a=this.pos(this.options.start,true);this.prevFirst=this.prevLast=null;this.animate(a,false);i(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize)}}, reset:function(){this.list.empty();this.list.css(this.lt,"0px");this.list.css(this.wh,"10px");this.options.initCallback!==null&&this.options.initCallback(this,"reset");this.setup()},reload:function(){this.tail!==null&&this.inTail&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=false;this.options.reloadCallback!==null&&this.options.reloadCallback(this);if(this.options.visible!==null){var a=this,c=Math.ceil(this.clipping()/this.options.visible),b=0,d=0; this.list.children("li").each(function(f){b+=a.dimension(this,c);if(f+1<a.first)d=b});this.list.css(this.wh,b+"px");this.list.css(this.lt,-d+"px")}this.scroll(this.first,false)},lock:function(){this.locked=true;this.buttons()},unlock:function(){this.locked=false;this.buttons()},size:function(a){if(a!==undefined){this.options.size=a;this.locked||this.buttons()}return this.options.size},has:function(a,c){if(c===undefined||!c)c=a;if(this.options.size!==null&&c>this.options.size)c=this.options.size;for(var b= a;b<=c;b++){var d=this.get(b);if(!d.length||d.hasClass("jcarousel-item-placeholder"))return false}return true},get:function(a){return i(".jcarousel-item-"+a,this.list)},add:function(a,c){var b=this.get(a),d=0,f=i(c);if(b.length===0){var j,e=h.intval(a);for(b=this.create(a);;){j=this.get(--e);if(e<=0||j.length){e<=0?this.list.prepend(b):j.after(b);break}}}else d=this.dimension(b);if(f.get(0).nodeName.toUpperCase()=="LI"){b.replaceWith(f);b=f}else b.empty().append(c);this.format(b.removeClass(this.className("jcarousel-item-placeholder")), a);f=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;d=this.dimension(b,f)-d;a>0&&a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))-d+"px");this.list.css(this.wh,h.intval(this.list.css(this.wh))+d+"px");return b},
removeAndAnimate:function(i) {
    var counter = 1;    
    var itemsHTML = new Array();
    var e = this.get(i);
    children = e.parent().find("li");
    $(e).remove()
    $.each(children,function(){
        if(counter != i) {
            itemsHTML[counter] = $(this).removeAttr("class").removeAttr("jcarouselindex"); 
        }
        counter++;
    });
    this.size(this.options.size -1);
    this.reset();
    counter = 1;
    carousel = this;
    $.each(itemsHTML, function(k, v){
        if(v != null) {
            carousel.add(counter, v[0].innerHTML);
            counter++;
        }
    });
    this.reload();
},
addAndRedraw:function(i, html) {
	i = i <= 0 ? 1 : i;
    var counter = 1;
    var itemsHTML = new Array();
	var children = this.list.find("li");
	itemsHTML[i] = $(html);
    $.each(children,function(){
	
		if(counter == i)
			counter++;
			
		itemsHTML[counter] = $(this).removeAttr("class").removeAttr("jcarouselindex"); 
        counter++;
    });
    this.size(this.options.size +1);
    this.reset();
    counter = 1;
    carousel = this;
    $.each(itemsHTML, function(k, v){
        if(v != null) {
            carousel.add(counter, v[0].innerHTML);
            counter++;
        }
    });
    this.reload();
},
remove:function(a){var c=this.get(a);log(c);if((!c.length||a>=this.first&&a<=this.last)){var b=this.dimension(c);a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+b+"px");log(1);c.remove();this.list.css(this.wh,h.intval(this.list.css(this.wh))- b+"px")}},next:function(){this.tail!==null&&!this.inTail?this.scrollTail(false):this.scroll((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!==null&&this.last==this.options.size?1:this.first+this.options.scroll)},prev:function(){this.tail!==null&&this.inTail?this.scrollTail(true):this.scroll((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!==null&&this.first==1?this.options.size:this.first-this.options.scroll)},scrollTail:function(a){if(!(this.locked|| this.animating||!this.tail)){this.pauseAuto();var c=h.intval(this.list.css(this.lt));c=!a?c-this.tail:c+this.tail;this.inTail=!a;this.prevFirst=this.first;this.prevLast=this.last;this.animate(c)}},scroll:function(a,c){if(!(this.locked||this.animating)){this.pauseAuto();this.animate(this.pos(a),c)}},pos:function(a,c){var b=h.intval(this.list.css(this.lt));if(this.locked||this.animating)return b;if(this.options.wrap!="circular")a=a<1?1:this.options.size&&a>this.options.size?this.options.size:a;for(var d= this.first>a,f=this.options.wrap!="circular"&&this.first<=1?1:this.first,j=d?this.get(f):this.get(this.last),e=d?f:f-1,g=null,k=0,l=false,m=0;d?--e>=a:++e<a;){g=this.get(e);l=!g.length;if(g.length===0){g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));j[d?"before":"after"](g);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){j=this.get(this.index(e));if(j.length)g=this.add(e,j.clone(true))}}j=g;m=this.dimension(g);if(l)k+= m;if(this.first!==null&&(this.options.wrap=="circular"||e>=1&&(this.options.size===null||e<=this.options.size)))b=d?b+m:b-m}f=this.clipping();var p=[],o=0,n=0;j=this.get(a-1);for(e=a;++o;){g=this.get(e);l=!g.length;if(g.length===0){g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));j.length===0?this.list.prepend(g):j[d?"before":"after"](g);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){j=this.get(this.index(e));if(j.length)g= this.add(e,j.clone(true))}}j=g;m=this.dimension(g);if(m===0)throw Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...");if(this.options.wrap!="circular"&&this.options.size!==null&&e>this.options.size)p.push(g);else if(l)k+=m;n+=m;if(n>=f)break;e++}for(g=0;g<p.length;g++)p[g].remove();if(k>0){this.list.css(this.wh,this.dimension(this.list)+k+"px");if(d){b-=k;this.list.css(this.lt,h.intval(this.list.css(this.lt))-k+"px")}}k=a+o-1;if(this.options.wrap!="circular"&& this.options.size&&k>this.options.size)k=this.options.size;if(e>k){o=0;e=k;for(n=0;++o;){g=this.get(e--);if(!g.length)break;n+=this.dimension(g);if(n>=f)break}}e=k-o+1;if(this.options.wrap!="circular"&&e<1)e=1;if(this.inTail&&d){b+=this.tail;this.inTail=false}this.tail=null;if(this.options.wrap!="circular"&&k==this.options.size&&k-o+1>=1){d=h.margin(this.get(k),!this.options.vertical?"marginRight":"marginBottom");if(n-d>f)this.tail=n-f-d}if(c&&a===this.options.size&&this.tail){b-=this.tail;this.inTail= true}for(;a-- >e;)b+=this.dimension(this.get(a));this.prevFirst=this.first;this.prevLast=this.last;this.first=e;this.last=k;return b},animate:function(a,c){if(!(this.locked||this.animating)){this.animating=true;var b=this,d=function(){b.animating=false;a===0&&b.list.css(b.lt,0);if(!b.autoStopped&&(b.options.wrap=="circular"||b.options.wrap=="both"||b.options.wrap=="last"||b.options.size===null||b.last<b.options.size||b.last==b.options.size&&b.tail!==null&&!b.inTail))b.startAuto();b.buttons();b.notify("onAfterAnimation"); if(b.options.wrap=="circular"&&b.options.size!==null)for(var f=b.prevFirst;f<=b.prevLast;f++)if(f!==null&&!(f>=b.first&&f<=b.last)&&(f<1||f>b.options.size))b.remove(f)};this.notify("onBeforeAnimation");if(!this.options.animation||c===false){this.list.css(this.lt,a+"px");d()}else this.list.animate(!this.options.vertical?this.options.rtl?{right:a}:{left:a}:{top:a},this.options.animation,this.options.easing,d)}},startAuto:function(a){if(a!==undefined)this.options.auto=a;if(this.options.auto===0)return this.stopAuto(); if(this.timer===null){this.autoStopped=false;var c=this;this.timer=window.setTimeout(function(){c.next()},this.options.auto*1E3)}},stopAuto:function(){this.pauseAuto();this.autoStopped=true},pauseAuto:function(){if(this.timer!==null){window.clearTimeout(this.timer);this.timer=null}},buttons:function(a,c){if(a==null){a=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="first"||this.options.size===null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap== "first")&&this.options.size!==null&&this.last>=this.options.size)a=this.tail!==null&&!this.inTail}if(c==null){c=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="last"||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!==null&&this.first==1)c=this.tail!==null&&this.inTail}var b=this;if(this.buttonNext.size()>0){this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext);a&&this.buttonNext.bind(this.options.buttonNextEvent+ ".jcarousel",this.funcNext);this.buttonNext[a?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",a?false:true);this.options.buttonNextCallback!==null&&this.buttonNext.data("jcarouselstate")!=a&&this.buttonNext.each(function(){b.options.buttonNextCallback(b,this,a)}).data("jcarouselstate",a)}else this.options.buttonNextCallback!==null&&this.buttonNextState!=a&&this.options.buttonNextCallback(b,null,a);if(this.buttonPrev.size()>0){this.buttonPrev.unbind(this.options.buttonPrevEvent+ ".jcarousel",this.funcPrev);c&&this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev);this.buttonPrev[c?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",c?false:true);this.options.buttonPrevCallback!==null&&this.buttonPrev.data("jcarouselstate")!=c&&this.buttonPrev.each(function(){b.options.buttonPrevCallback(b,this,c)}).data("jcarouselstate",c)}else this.options.buttonPrevCallback!==null&&this.buttonPrevState!=c&&this.options.buttonPrevCallback(b, null,c);this.buttonNextState=a;this.buttonPrevState=c},notify:function(a){var c=this.prevFirst===null?"init":this.prevFirst<this.first?"next":"prev";this.callback("itemLoadCallback",a,c);if(this.prevFirst!==this.first){this.callback("itemFirstInCallback",a,c,this.first);this.callback("itemFirstOutCallback",a,c,this.prevFirst)}if(this.prevLast!==this.last){this.callback("itemLastInCallback",a,c,this.last);this.callback("itemLastOutCallback",a,c,this.prevLast)}this.callback("itemVisibleInCallback", a,c,this.first,this.last,this.prevFirst,this.prevLast);this.callback("itemVisibleOutCallback",a,c,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(a,c,b,d,f,j,e){if(!(this.options[a]==null||typeof this.options[a]!="object"&&c!="onAfterAnimation")){var g=typeof this.options[a]=="object"?this.options[a][c]:this.options[a];if(i.isFunction(g)){var k=this;if(d===undefined)g(k,b,c);else if(f===undefined)this.get(d).each(function(){g(k,this,d,b,c)});else{a=function(m){k.get(m).each(function(){g(k, this,m,b,c)})};for(var l=d;l<=f;l++)l!==null&&!(l>=j&&l<=e)&&a(l)}}}},create:function(a){return this.format("<li></li>",a)},format:function(a,c){a=i(a);for(var b=a.get(0).className.split(" "),d=0;d<b.length;d++)b[d].indexOf("jcarousel-")!=-1&&a.removeClass(b[d]);a.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+c)).css({"float":this.options.rtl?"right":"left","list-style":"none"}).attr("jcarouselindex",c);return a},className:function(a){return a+" "+a+(!this.options.vertical? "-horizontal":"-vertical")},dimension:function(a,c){var b=a.jquery!==undefined?a[0]:a,d=!this.options.vertical?(b.offsetWidth||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginLeft")+h.margin(b,"marginRight"):(b.offsetHeight||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginTop")+h.margin(b,"marginBottom");if(c==null||d==c)return d;d=!this.options.vertical?c-h.margin(b,"marginLeft")-h.margin(b,"marginRight"):c-h.margin(b,"marginTop")-h.margin(b,"marginBottom");i(b).css(this.wh, d+"px");return this.dimension(b)},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-h.intval(this.clip.css("borderLeftWidth"))-h.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-h.intval(this.clip.css("borderTopWidth"))-h.intval(this.clip.css("borderBottomWidth"))},index:function(a,c){if(c==null)c=this.options.size;return Math.round(((a-1)/c-Math.floor((a-1)/c))*c)+1}});h.extend({defaults:function(a){return i.extend(q,a||{})},margin:function(a,c){if(!a)return 0; var b=a.jquery!==undefined?a[0]:a;if(c=="marginRight"&&i.browser.safari){var d={display:"block","float":"none",width:"auto"},f,j;i.swap(b,d,function(){f=b.offsetWidth});d.marginRight=0;i.swap(b,d,function(){j=b.offsetWidth});return j-f}return h.intval(i.css(b,c))},intval:function(a){a=parseInt(a,10);return isNaN(a)?0:a}});i.fn.jcarousel=function(a){if(typeof a=="string"){var c=i(this).data("jcarousel"),b=Array.prototype.slice.call(arguments,1);return c[a].apply(c,b)}else return this.each(function(){i(this).data("jcarousel", new h(this,a))})}})(jQuery);

/*
 * jQuery 9-Grid Scaling Plugin 0.9.3
 *
 * Copyright (c) 2008 Gordon L. Hempton ( http://hempton.com )
 * Licensed under the MIT license
 */
 
(function($){var supportsBorderImage=false;var borderImageStyle;if($.browser.safari){supportsBorderImage=true;borderImageStyle='-webkit-border-image';}else if($.browser.mozilla&&$.browser.version.substr(0,3)=="1.9"&&parseFloat($.browser.version.substr(3))>1.0){supportsBorderImage=true;borderImageStyle='-moz-border-image';}
$.fn.extend({scale9Grid:function(settings){var gridTop=settings.top||0;var gridBottom=settings.bottom||0;var gridLeft=settings.left||0;var gridRight=settings.right||0;return $(this).each(function(){var $target=$(this);if($target.data('layoutGrid')){$target.remove9Grid();}
var backgroundImage=$target.css('background-image');var match=/url\("?([^\(\)"]+)"?\)/i.exec(backgroundImage);if(!match||match.length<2){return;}
var backgroundUrl=match[1];if($.browser.msie&&$.browser.version<7&&$target.css('float')!='none'&&$target.css('position')=='static'){$target.css('position','relative');}
$target.wrapInner('<div class="s9gwrapper"></div>');var $wrapper=$target.find('.s9gwrapper');$wrapper.css({'padding-left':$target.css('padding-left'),'padding-right':$target.css('padding-right'),'padding-top':$target.css('padding-top'),'padding-bottom':$target.css('padding-bottom'),'text-align':$target.css('text-align'),'position':'relative','z-index':'2','display':'block','background-color':'transparent','background-image':'none'});$target.css({'background-color':'transparent','background-image':'none','border-color':'transparent','padding':'0','text-align':'left'});var backgroundElement=document.createElement('div');$target.prepend(backgroundElement);var $background=$(backgroundElement);$background.css({'position':'relative','width':'0px','height':'0px','z-index':'0','display':'block'});$background.addClass('s9gbackground');if(supportsBorderImage){var cssProperties={'border-width':gridTop+'px '+gridRight+'px '+gridBottom+'px '+gridLeft+'px ','position':'absolute'}
cssProperties[borderImageStyle]=backgroundImage+' '+gridTop+' '+gridRight+' '+gridBottom+' '+gridLeft+' stretch stretch';$background.css(cssProperties);}
var imageWidth;var imageHeight;var lastWidth=0;var lastHeight=0;var cells=new Array();var layoutGrid=function(){var width=$target.innerWidth();var height=$target.innerHeight();if(width<gridLeft+gridRight||height<gridTop+gridBottom||(width==lastWidth&&height==lastHeight)){return;}
if(supportsBorderImage){$background.css({'width':width-gridLeft-gridRight+'px','height':height-gridTop-gridBottom+'px'})
return;}
lastWidth=width;lastHeight=height;var cellIndex=0;var existingCells=cells.length;for(var y=0;y<height;)
{var cellHeight;var verticalPosition;if(y==0){verticalPosition="top";cellHeight=Math.min(imageHeight-gridBottom,height-gridBottom);}
else if(y+imageHeight-gridTop>=height){verticalPosition="bottom";cellHeight=height-y;}
else{verticalPosition="center";cellHeight=Math.min(imageHeight-gridTop-gridBottom,height-y-gridBottom);}
for(var x=0;x<width;cellIndex++)
{var $cell;if(cellIndex<existingCells){$cell=cells[cellIndex];}
else{cellElement=document.createElement('div');$background.append(cellElement);$cell=$(cellElement);$cell.css({'position':'absolute','background-image':backgroundImage});cells.push($cell);}
var cellWidth;var horizontalPosition;if(x==0){horizontalPosition="left";cellWidth=Math.min(imageWidth-gridRight,width-gridRight);}
else if(x+imageWidth-gridBottom>=width){horizontalPosition="right";cellWidth=width-x;}
else{horizontalPosition="center";cellWidth=Math.min(imageWidth-gridLeft-gridRight,width-x-gridRight);}
$cell.css({'left':x+'px','top':y+'px','width':cellWidth+'px','height':cellHeight+'px','background-position':verticalPosition+' '+horizontalPosition});x+=cellWidth;}
y+=cellHeight;}
for(var i=cellIndex;i<existingCells;i++){cells[i].remove();}
cells.splice(cellIndex,cells.length-cellIndex);};var image=new Image();$(image).load(function(){if(image.width<gridLeft+gridRight||image.height<gridTop+gridBottom){return;}
imageWidth=image.width;imageHeight=image.height;layoutGrid();$(window).resize(layoutGrid);}).attr('src',backgroundUrl);$target.data('layoutGrid',layoutGrid);});},remove9Grid:function(){return $(this).each(function(){var $target=$(this);if(!$target.data('layoutGrid'))
return;$(window).unbind('resize',$target.data('layoutGrid'));$target.removeAttr('style');var content=$target.find('.s9gwrapper').contents();$target.prepend(content);$target.find('.s9gwrapper').remove();$target.find('.s9gbackground').remove();$target.removeData('layoutGrid');});}});})(jQuery);

//JQUERY JSON
(function($){$.toJSON=function(o)
{if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
return"null";if(type=="undefined")
return undefined;if(type=="number"||type=="boolean")
return o+"";if(type=="string")
return $.quoteString(o);if(type=='object')
{if(typeof o.toJSON=="function")
return $.toJSON(o.toJSON());if(o.constructor===Date)
{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array)
{var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string)
{if(string.match(_escapeable))
{return'"'+string.replace(_escapeable,function(a)
{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);

/*
 * jGFeed 1.0 - Google Feed API abstraction plugin for jQuery
 *
 * Copyright (c) 2009 jQuery HowTo
 *
 * Licensed under the GPL license:
 *   http://www.gnu.org/licenses/gpl.html
 *
 * URL:
 *   http://jquery-howto.blogspot.com
 *
 * Author URL:
 *   http://me.boo.uz
 *
 */
(function($){$.extend({jGFeed:function(url,fnk,num,key){if(url==null){return false;}var gurl="http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="+url;if(num!=null){gurl+="&num="+num;}if(key!=null){gurl+="&key="+key;}$.getJSON(gurl,function(data){if(typeof fnk=="function"){fnk.call(this,data.responseData.feed);}else{return false;}});}});})(jQuery);


/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 * Thanks to: Seamus Leahy for adding deltaX and deltaY
 *
 * Version: 3.0.4
 * 
 * Requires: 1.2.2+
 */

(function($) {

var types = ['DOMMouseScroll', 'mousewheel'];

$.event.special.mousewheel = {
    setup: function() {
        if ( this.addEventListener ) {
            for ( var i=types.length; i; ) {
                this.addEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = handler;
        }
    },
    
    teardown: function() {
        if ( this.removeEventListener ) {
            for ( var i=types.length; i; ) {
                this.removeEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = null;
        }
    }
};

$.fn.extend({
    mousewheel: function(fn) {
        return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
    },
    
    unmousewheel: function(fn) {
        return this.unbind("mousewheel", fn);
    }
});


function handler(event) {
    var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
    event = $.event.fix(orgEvent);
    event.type = "mousewheel";
    
    // Old school scrollwheel delta
    if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
    if ( event.detail     ) { delta = -event.detail/3; }
    
    // New school multidimensional scroll (touchpads) deltas
    deltaY = delta;
    
    // Gecko
    if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
        deltaY = 0;
        deltaX = -1*delta;
    }
    
    // Webkit
    if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
    if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
    
    // Add event and delta to the front of the arguments
    args.unshift(event, delta, deltaX, deltaY);
    
    return $.event.handle.apply(this, args);
}

})(jQuery);

/*
 * jScrollPane - v2.0.0beta10 - 2011-04-17
 * http://jscrollpane.kelvinluck.com/
 *
 * Copyright (c) 2010 Kelvin Luck
 * Dual licensed under the MIT and GPL licenses.
 */
(function(b,a,c){b.fn.jScrollPane=function(f){function d(E,P){var aA,R=this,Z,al,w,an,U,aa,z,r,aB,aG,aw,j,J,i,k,ab,V,ar,Y,u,B,at,ag,ao,H,m,av,az,y,ax,aJ,g,M,ak=true,Q=true,aI=false,l=false,aq=E.clone(false,false).empty(),ad=b.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";aJ=E.css("paddingTop")+" "+E.css("paddingRight")+" "+E.css("paddingBottom")+" "+E.css("paddingLeft");g=(parseInt(E.css("paddingLeft"),10)||0)+(parseInt(E.css("paddingRight"),10)||0);function au(aS){var aN,aP,aO,aL,aK,aR,aQ=false,aM=false;aA=aS;if(Z===c){aK=E.scrollTop();aR=E.scrollLeft();E.css({overflow:"hidden",padding:0});al=E.innerWidth()+g;w=E.innerHeight();E.width(al);Z=b('<div class="jspPane" />').css("padding",aJ).append(E.children());an=b('<div class="jspContainer" />').css({width:al+"px",height:w+"px"}).append(Z).appendTo(E)}else{E.css("width","");aQ=aA.stickToBottom&&L();aM=aA.stickToRight&&C();aL=E.innerWidth()+g!=al||E.outerHeight()!=w;if(aL){al=E.innerWidth()+g;w=E.innerHeight();an.css({width:al+"px",height:w+"px"})}if(!aL&&M==U&&Z.outerHeight()==aa){E.width(al);return}M=U;Z.css("width","");E.width(al);an.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}Z.css("overflow","auto");if(aS.contentWidth){U=aS.contentWidth}else{U=Z[0].scrollWidth}aa=Z[0].scrollHeight;Z.css("overflow","");z=U/al;r=aa/w;aB=r>1;aG=z>1;if(!(aG||aB)){E.removeClass("jspScrollable");Z.css({top:0,width:an.width()-g});o();F();S();x();aj()}else{E.addClass("jspScrollable");aN=aA.maintainPosition&&(J||ab);if(aN){aP=aE();aO=aC()}aH();A();G();if(aN){O(aM?(U-al):aP,false);N(aQ?(aa-w):aO,false)}K();ah();ap();if(aA.enableKeyboardNavigation){T()}if(aA.clickOnTrack){q()}D();if(aA.hijackInternalLinks){n()}}if(aA.autoReinitialise&&!ax){ax=setInterval(function(){au(aA)},aA.autoReinitialiseDelay)}else{if(!aA.autoReinitialise&&ax){clearInterval(ax)}}aK&&E.scrollTop(0)&&N(aK,false);aR&&E.scrollLeft(0)&&O(aR,false);E.trigger("jsp-initialised",[aG||aB])}function aH(){if(aB){an.append(b('<div class="jspVerticalBar" />').append(b('<div class="jspCap jspCapTop" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragTop" />'),b('<div class="jspDragBottom" />'))),b('<div class="jspCap jspCapBottom" />')));V=an.find(">.jspVerticalBar");ar=V.find(">.jspTrack");aw=ar.find(">.jspDrag");if(aA.showArrows){at=b('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",aF(0,-1)).bind("click.jsp",aD);ag=b('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",aF(0,1)).bind("click.jsp",aD);if(aA.arrowScrollOnHover){at.bind("mouseover.jsp",aF(0,-1,at));ag.bind("mouseover.jsp",aF(0,1,ag))}am(ar,aA.verticalArrowPositions,at,ag)}u=w;an.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){u-=b(this).outerHeight()});aw.hover(function(){aw.addClass("jspHover")},function(){aw.removeClass("jspHover")}).bind("mousedown.jsp",function(aK){b("html").bind("dragstart.jsp selectstart.jsp",aD);aw.addClass("jspActive");var s=aK.pageY-aw.position().top;b("html").bind("mousemove.jsp",function(aL){W(aL.pageY-s,false)}).bind("mouseup.jsp mouseleave.jsp",ay);return false});p()}}function p(){ar.height(u+"px");J=0;Y=aA.verticalGutter+ar.outerWidth();Z.width(al-Y-g);try{if(V.position().left===0){Z.css("margin-left",Y+"px")}}catch(s){}}function A(){if(aG){an.append(b('<div class="jspHorizontalBar" />').append(b('<div class="jspCap jspCapLeft" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragLeft" />'),b('<div class="jspDragRight" />'))),b('<div class="jspCap jspCapRight" />')));ao=an.find(">.jspHorizontalBar");H=ao.find(">.jspTrack");i=H.find(">.jspDrag");if(aA.showArrows){az=b('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",aF(-1,0)).bind("click.jsp",aD);y=b('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",aF(1,0)).bind("click.jsp",aD);
if(aA.arrowScrollOnHover){az.bind("mouseover.jsp",aF(-1,0,az));y.bind("mouseover.jsp",aF(1,0,y))}am(H,aA.horizontalArrowPositions,az,y)}i.hover(function(){i.addClass("jspHover")},function(){i.removeClass("jspHover")}).bind("mousedown.jsp",function(aK){b("html").bind("dragstart.jsp selectstart.jsp",aD);i.addClass("jspActive");var s=aK.pageX-i.position().left;b("html").bind("mousemove.jsp",function(aL){X(aL.pageX-s,false)}).bind("mouseup.jsp mouseleave.jsp",ay);return false});m=an.innerWidth();ai()}}function ai(){an.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){m-=b(this).outerWidth()});H.width(m+"px");ab=0}function G(){if(aG&&aB){var aK=H.outerHeight(),s=ar.outerWidth();u-=aK;b(ao).find(">.jspCap:visible,>.jspArrow").each(function(){m+=b(this).outerWidth()});m-=s;w-=s;al-=aK;H.parent().append(b('<div class="jspCorner" />').css("width",aK+"px"));p();ai()}if(aG){Z.width((an.outerWidth()-g)+"px")}aa=Z.outerHeight();r=aa/w;if(aG){av=Math.ceil(1/z*m);if(av>aA.horizontalDragMaxWidth){av=aA.horizontalDragMaxWidth}else{if(av<aA.horizontalDragMinWidth){av=aA.horizontalDragMinWidth}}i.width(av+"px");k=m-av;af(ab)}if(aB){B=Math.ceil(1/r*u);if(B>aA.verticalDragMaxHeight){B=aA.verticalDragMaxHeight}else{if(B<aA.verticalDragMinHeight){B=aA.verticalDragMinHeight}}aw.height(B+"px");j=u-B;ae(J)}}function am(aL,aN,aK,s){var aP="before",aM="after",aO;if(aN=="os"){aN=/Mac/.test(navigator.platform)?"after":"split"}if(aN==aP){aM=aN}else{if(aN==aM){aP=aN;aO=aK;aK=s;s=aO}}aL[aP](aK)[aM](s)}function aF(aK,s,aL){return function(){I(aK,s,this,aL);this.blur();return false}}function I(aN,aM,aQ,aP){aQ=b(aQ).addClass("jspActive");var aO,aL,aK=true,s=function(){if(aN!==0){R.scrollByX(aN*aA.arrowButtonSpeed)}if(aM!==0){R.scrollByY(aM*aA.arrowButtonSpeed)}aL=setTimeout(s,aK?aA.initialDelay:aA.arrowRepeatFreq);aK=false};s();aO=aP?"mouseout.jsp":"mouseup.jsp";aP=aP||b("html");aP.bind(aO,function(){aQ.removeClass("jspActive");aL&&clearTimeout(aL);aL=null;aP.unbind(aO)})}function q(){x();if(aB){ar.bind("mousedown.jsp",function(aP){if(aP.originalTarget===c||aP.originalTarget==aP.currentTarget){var aN=b(this),aQ=aN.offset(),aO=aP.pageY-aQ.top-J,aL,aK=true,s=function(){var aT=aN.offset(),aU=aP.pageY-aT.top-B/2,aR=w*aA.scrollPagePercent,aS=j*aR/(aa-w);if(aO<0){if(J-aS>aU){R.scrollByY(-aR)}else{W(aU)}}else{if(aO>0){if(J+aS<aU){R.scrollByY(aR)}else{W(aU)}}else{aM();return}}aL=setTimeout(s,aK?aA.initialDelay:aA.trackClickRepeatFreq);aK=false},aM=function(){aL&&clearTimeout(aL);aL=null;b(document).unbind("mouseup.jsp",aM)};s();b(document).bind("mouseup.jsp",aM);return false}})}if(aG){H.bind("mousedown.jsp",function(aP){if(aP.originalTarget===c||aP.originalTarget==aP.currentTarget){var aN=b(this),aQ=aN.offset(),aO=aP.pageX-aQ.left-ab,aL,aK=true,s=function(){var aT=aN.offset(),aU=aP.pageX-aT.left-av/2,aR=al*aA.scrollPagePercent,aS=k*aR/(U-al);if(aO<0){if(ab-aS>aU){R.scrollByX(-aR)}else{X(aU)}}else{if(aO>0){if(ab+aS<aU){R.scrollByX(aR)}else{X(aU)}}else{aM();return}}aL=setTimeout(s,aK?aA.initialDelay:aA.trackClickRepeatFreq);aK=false},aM=function(){aL&&clearTimeout(aL);aL=null;b(document).unbind("mouseup.jsp",aM)};s();b(document).bind("mouseup.jsp",aM);return false}})}}function x(){if(H){H.unbind("mousedown.jsp")}if(ar){ar.unbind("mousedown.jsp")}}function ay(){b("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");if(aw){aw.removeClass("jspActive")}if(i){i.removeClass("jspActive")}}function W(s,aK){if(!aB){return}if(s<0){s=0}else{if(s>j){s=j}}if(aK===c){aK=aA.animateScroll}if(aK){R.animate(aw,"top",s,ae)}else{aw.css("top",s);ae(s)}}function ae(aK){if(aK===c){aK=aw.position().top}an.scrollTop(0);J=aK;var aN=J===0,aL=J==j,aM=aK/j,s=-aM*(aa-w);if(ak!=aN||aI!=aL){ak=aN;aI=aL;E.trigger("jsp-arrow-change",[ak,aI,Q,l])}v(aN,aL);Z.css("top",s);E.trigger("jsp-scroll-y",[-s,aN,aL]).trigger("scroll")}function X(aK,s){if(!aG){return}if(aK<0){aK=0}else{if(aK>k){aK=k}}if(s===c){s=aA.animateScroll}if(s){R.animate(i,"left",aK,af)
}else{i.css("left",aK);af(aK)}}function af(aK){if(aK===c){aK=i.position().left}an.scrollTop(0);ab=aK;var aN=ab===0,aM=ab==k,aL=aK/k,s=-aL*(U-al);if(Q!=aN||l!=aM){Q=aN;l=aM;E.trigger("jsp-arrow-change",[ak,aI,Q,l])}t(aN,aM);Z.css("left",s);E.trigger("jsp-scroll-x",[-s,aN,aM]).trigger("scroll")}function v(aK,s){if(aA.showArrows){at[aK?"addClass":"removeClass"]("jspDisabled");ag[s?"addClass":"removeClass"]("jspDisabled")}}function t(aK,s){if(aA.showArrows){az[aK?"addClass":"removeClass"]("jspDisabled");y[s?"addClass":"removeClass"]("jspDisabled")}}function N(s,aK){var aL=s/(aa-w);W(aL*j,aK)}function O(aK,s){var aL=aK/(U-al);X(aL*k,s)}function ac(aX,aS,aL){var aP,aM,aN,s=0,aW=0,aK,aR,aQ,aU,aT,aV;try{aP=b(aX)}catch(aO){return}aM=aP.outerHeight();aN=aP.outerWidth();an.scrollTop(0);an.scrollLeft(0);while(!aP.is(".jspPane")){s+=aP.position().top;aW+=aP.position().left;aP=aP.offsetParent();if(/^body|html$/i.test(aP[0].nodeName)){return}}aK=aC();aQ=aK+w;if(s<aK||aS){aT=s-aA.verticalGutter}else{if(s+aM>aQ){aT=s-w+aM+aA.verticalGutter}}if(aT){N(aT,aL)}aR=aE();aU=aR+al;if(aW<aR||aS){aV=aW-aA.horizontalGutter}else{if(aW+aN>aU){aV=aW-al+aN+aA.horizontalGutter}}if(aV){O(aV,aL)}}function aE(){return -Z.position().left}function aC(){return -Z.position().top}function L(){var s=aa-w;return(s>20)&&(s-aC()<10)}function C(){var s=U-al;return(s>20)&&(s-aE()<10)}function ah(){an.unbind(ad).bind(ad,function(aN,aO,aM,aK){var aL=ab,s=J;R.scrollBy(aM*aA.mouseWheelSpeed,-aK*aA.mouseWheelSpeed,false);return aL==ab&&s==J})}function o(){an.unbind(ad)}function aD(){return false}function K(){Z.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(s){ac(s.target,false)})}function F(){Z.find(":input,a").unbind("focus.jsp")}function T(){var s,aK,aM=[];aG&&aM.push(ao[0]);aB&&aM.push(V[0]);Z.focus(function(){E.focus()});E.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(aP){if(aP.target!==this&&!(aM.length&&b(aP.target).closest(aM).length)){return}var aO=ab,aN=J;switch(aP.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:s=aP.keyCode;aL();break;case 35:N(aa-w);s=null;break;case 36:N(0);s=null;break}aK=aP.keyCode==s&&aO!=ab||aN!=J;return !aK}).bind("keypress.jsp",function(aN){if(aN.keyCode==s){aL()}return !aK});if(aA.hideFocus){E.css("outline","none");if("hideFocus" in an[0]){E.attr("hideFocus",true)}}else{E.css("outline","");if("hideFocus" in an[0]){E.attr("hideFocus",false)}}function aL(){var aO=ab,aN=J;switch(s){case 40:R.scrollByY(aA.keyboardSpeed,false);break;case 38:R.scrollByY(-aA.keyboardSpeed,false);break;case 34:case 32:R.scrollByY(w*aA.scrollPagePercent,false);break;case 33:R.scrollByY(-w*aA.scrollPagePercent,false);break;case 39:R.scrollByX(aA.keyboardSpeed,false);break;case 37:R.scrollByX(-aA.keyboardSpeed,false);break}aK=aO!=ab||aN!=J;return aK}}function S(){E.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")}function D(){if(location.hash&&location.hash.length>1){var aL,aK;try{aL=b(location.hash)}catch(s){return}if(aL.length&&Z.find(location.hash)){if(an.scrollTop()===0){aK=setInterval(function(){if(an.scrollTop()>0){ac(location.hash,true);b(document).scrollTop(an.position().top);clearInterval(aK)}},50)}else{ac(location.hash,true);b(document).scrollTop(an.position().top)}}}}function aj(){b("a.jspHijack").unbind("click.jsp-hijack").removeClass("jspHijack")}function n(){aj();b("a[href^=#]").addClass("jspHijack").bind("click.jsp-hijack",function(){var s=this.href.split("#"),aK;if(s.length>1){aK=s[1];if(aK.length>0&&Z.find("#"+aK).length>0){ac("#"+aK,true);return false}}})}function ap(){var aL,aK,aN,aM,aO,s=false;an.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(aP){var aQ=aP.originalEvent.touches[0];aL=aE();aK=aC();aN=aQ.pageX;aM=aQ.pageY;aO=false;s=true}).bind("touchmove.jsp",function(aS){if(!s){return}var aR=aS.originalEvent.touches[0],aQ=ab,aP=J;R.scrollTo(aL+aN-aR.pageX,aK+aM-aR.pageY);aO=aO||Math.abs(aN-aR.pageX)>5||Math.abs(aM-aR.pageY)>5;
return aQ==ab&&aP==J}).bind("touchend.jsp",function(aP){s=false}).bind("click.jsp-touchclick",function(aP){if(aO){aO=false;return false}})}function h(){var s=aC(),aK=aE();E.removeClass("jspScrollable").unbind(".jsp");E.replaceWith(aq.append(Z.children()));aq.scrollTop(s);aq.scrollLeft(aK)}b.extend(R,{reinitialise:function(aK){aK=b.extend({},aA,aK);au(aK)},scrollToElement:function(aL,aK,s){ac(aL,aK,s)},scrollTo:function(aL,s,aK){O(aL,aK);N(s,aK)},scrollToX:function(aK,s){O(aK,s)},scrollToY:function(s,aK){N(s,aK)},scrollToPercentX:function(aK,s){O(aK*(U-al),s)},scrollToPercentY:function(aK,s){N(aK*(aa-w),s)},scrollBy:function(aK,s,aL){R.scrollByX(aK,aL);R.scrollByY(s,aL)},scrollByX:function(s,aL){var aK=aE()+s,aM=aK/(U-al);X(aM*k,aL)},scrollByY:function(s,aL){var aK=aC()+s,aM=aK/(aa-w);W(aM*j,aL)},positionDragX:function(s,aK){X(s,aK)},positionDragY:function(aK,s){W(aK,s)},animate:function(aK,aN,s,aM){var aL={};aL[aN]=s;aK.animate(aL,{duration:aA.animateDuration,ease:aA.animateEase,queue:false,step:aM})},getContentPositionX:function(){return aE()},getContentPositionY:function(){return aC()},getContentWidth:function(){return U},getContentHeight:function(){return aa},getPercentScrolledX:function(){return aE()/(U-al)},getPercentScrolledY:function(){return aC()/(aa-w)},getIsScrollableH:function(){return aG},getIsScrollableV:function(){return aB},getContentPane:function(){return Z},scrollToBottom:function(s){W(j,s)},hijackInternalLinks:function(){n()},destroy:function(){h()}});au(P)}f=b.extend({},b.fn.jScrollPane.defaults,f);b.each(["mouseWheelSpeed","arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){f[this]=f[this]||f.speed});var e;this.each(function(){var g=b(this),h=g.data("jsp");if(h){h.reinitialise(f)}else{h=new d(g,f);g.data("jsp",h)}e=e?e.add(g):g});return e};b.fn.jScrollPane.defaults={showArrows:false,maintainPosition:true,stickToBottom:false,stickToRight:false,clickOnTrack:true,autoReinitialise:false,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:c,animateScroll:false,animateDuration:300,animateEase:"linear",hijackInternalLinks:false,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:0,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:false,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:true,hideFocus:false,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:0.8}})(jQuery,this);

/*
 * timeago: a jQuery plugin, version: 0.9.3 (2011-01-21)
 * @requires jQuery v1.2.3 or later
 *
 * Timeago is a jQuery plugin that makes it easy to support automatically
 * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
 *
 * For usage and examples, visit:
 * http://timeago.yarp.com/
 *
 * Licensed under the MIT:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Copyright (c) 2008-2011, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org)
 */
(function ($) {
	$.timeago = function (timestamp) {
		if (timestamp instanceof Date) {
			return inWords(timestamp);
		} else if (typeof timestamp === "string") {
			return inWords($.timeago.parse(timestamp));
		} else {
			return inWords($.timeago.datetime(timestamp));
		}
	};
	var $t = $.timeago;

	$.extend($.timeago, {
		settings: {
			refreshMillis: 60000,
			allowFuture: false,
			strings: {
				prefixAgo: null,
				prefixFromNow: null,
				suffixAgo: "atrás",
				suffixFromNow: "daqui",
				seconds: "menos de um minuto",
				minute: "cerca de um minuto",
				minutes: "%d minutos",
				hour: "cerca de uma hora",
				hours: "cerca de %d horas",
				day: "um dia",
				days: "%d dias",
				month: "cerca de um mês",
				months: "%d meses",
				year: "cerca de um ano",
				years: "%d anos",
				numbers: []
			}
		},
		inWords: function (distanceMillis) {
			var $l = this.settings.strings;
			var prefix = $l.prefixAgo;
			var suffix = $l.suffixAgo;
			if (this.settings.allowFuture) {
				if (distanceMillis < 0) {
					prefix = $l.prefixFromNow;
					suffix = $l.suffixFromNow;
				}
				distanceMillis = Math.abs(distanceMillis);
			}

			var seconds = distanceMillis / 1000;
			var minutes = seconds / 60;
			var hours = minutes / 60;
			var days = hours / 24;
			var years = days / 365;

			function substitute(stringOrFunction, number) {
				var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
				var value = ($l.numbers && $l.numbers[number]) || number;
				return string.replace(/%d/i, value);
			}

			var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
        seconds < 90 && substitute($l.minute, 1) ||
        minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
        minutes < 90 && substitute($l.hour, 1) ||
        hours < 24 && substitute($l.hours, Math.round(hours)) ||
        hours < 48 && substitute($l.day, 1) ||
        days < 30 && substitute($l.days, Math.floor(days)) ||
        days < 60 && substitute($l.month, 1) ||
        days < 365 && substitute($l.months, Math.floor(days / 30)) ||
        years < 2 && substitute($l.year, 1) ||
        substitute($l.years, Math.floor(years));

			return $.trim([prefix, words, suffix].join(" "));
		},
		parse: function (iso8601) {
			var s = $.trim(iso8601);
			s = s.replace(/\.\d\d\d+/, ""); // remove milliseconds
			s = s.replace(/-/, "/").replace(/-/, "/");
			s = s.replace(/T/, " ").replace(/Z/, " UTC");
			s = s.replace(/([\+\-]\d\d)\:?(\d\d)/, " $1$2"); // -04:00 -> -0400
			return new Date(s);
		},
		datetime: function (elem) {
			// jQuery's `is()` doesn't play well with HTML5 in IE
			var isTime = $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time");
			var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title");
			return $t.parse(iso8601);
		}
	});

	$.fn.timeago = function () {
		var self = this;
		self.each(refresh);

		var $s = $t.settings;
		if ($s.refreshMillis > 0) {
			setInterval(function () { self.each(refresh); }, $s.refreshMillis);
		}
		return self;
	};

	function refresh() {
		var data = prepareData(this);
		if (!isNaN(data.datetime)) {
			$(this).text(inWords(data.datetime));
		}
		return this;
	}

	function prepareData(element) {
		element = $(element);
		if (!element.data("timeago")) {
			element.data("timeago", { datetime: $t.datetime(element) });
			var text = $.trim(element.text());
			if (text.length > 0) {
				element.attr("title", text);
			}
		}
		return element.data("timeago");
	}

	function inWords(date) {
		return $t.inWords(distance(date));
	}

	function distance(date) {
		return (new Date().getTime() - date.getTime());
	}

	// fix for IE6 suckage
	document.createElement("abbr");
	document.createElement("time");
} (jQuery));

/**
* author Remy Sharp
* url http://remysharp.com/tag/marquee
*/

(function ($) {
    $.fn.marquee = function (klass) {
        var newMarquee = [],
            last = this.length;

        // works out the left or right hand reset position, based on scroll
        // behavior, current direction and new direction
        function getReset(newDir, marqueeRedux, marqueeState) {
            var behavior = marqueeState.behavior, width = marqueeState.width, dir = marqueeState.dir;
            var r = 0;
            if (behavior == 'alternate') {
                r = newDir == 1 ? marqueeRedux[marqueeState.widthAxis] - (width * 2) : width;
            } else if (behavior == 'slide') {
                if (newDir == -1) {
                    r = dir == -1 ? marqueeRedux[marqueeState.widthAxis] : width;
                } else {
                    r = dir == -1 ? marqueeRedux[marqueeState.widthAxis] - (width * 2) : 0;
                }
            } else {
                r = newDir == -1 ? marqueeRedux[marqueeState.widthAxis] : 0;
            }
            return r;
        }

        // single "thread" animation
        function animateMarquee() {
            var i = newMarquee.length,
                marqueeRedux = null,
                $marqueeRedux = null,
                marqueeState = {},
                newMarqueeList = [],
                hitedge = false;

            while (i--) {
                marqueeRedux = newMarquee[i];
                $marqueeRedux = $(marqueeRedux);
                marqueeState = $marqueeRedux.data('marqueeState');

                if ($marqueeRedux.data('paused') !== true) {
                    // TODO read scrollamount, dir, behavior, loops and last from data
                    marqueeRedux[marqueeState.axis] += (marqueeState.scrollamount * marqueeState.dir);

                    // only true if it's hit the end
                    hitedge = marqueeState.dir == -1 ? marqueeRedux[marqueeState.axis] <= getReset(marqueeState.dir * -1, marqueeRedux, marqueeState) : marqueeRedux[marqueeState.axis] >= getReset(marqueeState.dir * -1, marqueeRedux, marqueeState);

                    if ((marqueeState.behavior == 'scroll' && marqueeState.last == marqueeRedux[marqueeState.axis]) || (marqueeState.behavior == 'alternate' && hitedge && marqueeState.last != -1) || (marqueeState.behavior == 'slide' && hitedge && marqueeState.last != -1)) {
                        if (marqueeState.behavior == 'alternate') {
                            marqueeState.dir *= -1; // flip
                        }
                        marqueeState.last = -1;

                        $marqueeRedux.trigger('stop');

                        marqueeState.loops--;
                        if (marqueeState.loops === 0) {
                            if (marqueeState.behavior != 'slide') {
                                marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
                            } else {
                                // corrects the position
                                marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir * -1, marqueeRedux, marqueeState);
                            }

                            $marqueeRedux.trigger('end');
                        } else {
                            // keep this marquee going
                            newMarqueeList.push(marqueeRedux);
                            $marqueeRedux.trigger('start');
                            marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
                        }
                    } else {
                        newMarqueeList.push(marqueeRedux);
                    }
                    marqueeState.last = marqueeRedux[marqueeState.axis];

                    // store updated state only if we ran an animation
                    $marqueeRedux.data('marqueeState', marqueeState);
                } else {
                    // even though it's paused, keep it in the list
                    newMarqueeList.push(marqueeRedux);
                }
            }

            newMarquee = newMarqueeList;

            if (newMarquee.length) {
                setTimeout(animateMarquee, 25);
            }
        }

        // TODO consider whether using .html() in the wrapping process could lead to loosing predefined events...
        this.each(function (i) {
            var $marquee = $(this),
                width = $marquee.attr('width') || $marquee.width(),
                height = $marquee.attr('height') || $marquee.height(),
                $marqueeRedux = $marquee.after('<div ' + (klass ? 'class="' + klass + '" ' : '') + 'style="display: block-inline; width: ' + width + 'px; height: ' + height + 'px; overflow: hidden;"><div style="float: left; white-space: nowrap;">' + $marquee.html() + '</div></div>').next(),
                marqueeRedux = $marqueeRedux.get(0),
                hitedge = 0,
                direction = ($marquee.attr('direction') || 'left').toLowerCase(),
                marqueeState = {
                    dir: /down|right/.test(direction) ? -1 : 1,
                    axis: /left|right/.test(direction) ? 'scrollLeft' : 'scrollTop',
                    widthAxis: /left|right/.test(direction) ? 'scrollWidth' : 'scrollHeight',
                    last: -1,
                    loops: $marquee.attr('loop') || -1,
                    scrollamount: $marquee.attr('scrollamount') || this.scrollAmount || 2,
                    behavior: ($marquee.attr('behavior') || 'scroll').toLowerCase(),
                    width: /left|right/.test(direction) ? width : height
                };

            // corrects a bug in Firefox - the default loops for slide is -1
            if ($marquee.attr('loop') == -1 && marqueeState.behavior == 'slide') {
                marqueeState.loops = 1;
            }

            $marquee.remove();

            // add padding
            if (/left|right/.test(direction)) {
                $marqueeRedux.find('> div').css('padding', '0 ' + width + 'px');
            } else {
                $marqueeRedux.find('> div').css('padding', height + 'px 0');
            }

            // events
            $marqueeRedux.bind('stop', function () {
                $marqueeRedux.data('paused', true);
            }).bind('pause', function () {
                $marqueeRedux.data('paused', true);
            }).bind('start', function () {
                $marqueeRedux.data('paused', false);
            }).bind('unpause', function () {
                $marqueeRedux.data('paused', false);
            }).data('marqueeState', marqueeState); // finally: store the state

            // todo - rerender event allowing us to do an ajax hit and redraw the marquee

            newMarquee.push(marqueeRedux);

            marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
            $marqueeRedux.trigger('start');

            // on the very last marquee, trigger the animation
            if (i + 1 == last) {
                animateMarquee();
            }
        });

        return $(newMarquee);
    };
} (jQuery));

/*
* jPlayer Plugin for jQuery JavaScript Library
* http://www.happyworm.com/jquery/jplayer
*
* Copyright (c) 2009 - 2010 Happyworm Ltd
* Dual licensed under the MIT and GPL licenses.
*  - http://www.opensource.org/licenses/mit-license.php
*  - http://www.gnu.org/copyleft/gpl.html
*
* Author: Mark J Panaghiston
* Version: 2.0.0
* Date: 20th December 2010
*/

(function ($, undefined) {

    // Adapted from jquery.ui.widget.js (1.8.7): $.widget.bridge
    $.fn.jPlayer = function (options) {
        var name = "jPlayer";
        var isMethodCall = typeof options === "string",
			args = Array.prototype.slice.call(arguments, 1),
			returnValue = this;

        // allow multiple hashes to be passed on init
        options = !isMethodCall && args.length ?
			$.extend.apply(null, [true, options].concat(args)) :
			options;

        // prevent calls to internal methods
        if (isMethodCall && options.charAt(0) === "_") {
            return returnValue;
        }

        if (isMethodCall) {
            this.each(function () {
                var instance = $.data(this, name),
					methodValue = instance && $.isFunction(instance[options]) ?
						instance[options].apply(instance, args) :
						instance;
                if (methodValue !== instance && methodValue !== undefined) {
                    returnValue = methodValue;
                    return false;
                }
            });
        } else {
            this.each(function () {
                var instance = $.data(this, name);
                if (instance) {
                    instance.option(options || {})._init(); // Orig jquery.ui.widget.js code: Not recommend for jPlayer. ie., Applying new options to an existing instance (via the jPlayer constructor) and performing the _init(). The _init() is what concerns me. It would leave a lot of event handlers acting on jPlayer instance and the interface.
                    instance.option(options || {}); // The new constructor only changes the options. Changing options only has basic support atm.
                } else {
                    $.data(this, name, new $.jPlayer(options, this));
                }
            });
        }

        return returnValue;
    };

    $.jPlayer = function (options, element) {
        // allow instantiation without initializing for simple inheritance
        if (arguments.length) {
            this.element = $(element);
            this.options = $.extend(true, {},
				this.options,
				options
			);
            var self = this;
            this.element.bind("remove.jPlayer", function () {
                self.destroy();
            });
            this._init();
        }
    };
    // End of: (Adapted from jquery.ui.widget.js (1.8.7))

    $.jPlayer.event = {
        ready: "jPlayer_ready",
        resize: "jPlayer_resize", // Not implemented.
        error: "jPlayer_error", // Event error code in event.jPlayer.error.type. See $.jPlayer.error
        warning: "jPlayer_warning", // Event warning code in event.jPlayer.warning.type. See $.jPlayer.warning

        // Other events match HTML5 spec.
        loadstart: "jPlayer_loadstart",
        progress: "jPlayer_progress",
        suspend: "jPlayer_suspend",
        abort: "jPlayer_abort",
        emptied: "jPlayer_emptied",
        stalled: "jPlayer_stalled",
        play: "jPlayer_play",
        pause: "jPlayer_pause",
        loadedmetadata: "jPlayer_loadedmetadata",
        loadeddata: "jPlayer_loadeddata",
        waiting: "jPlayer_waiting",
        playing: "jPlayer_playing",
        canplay: "jPlayer_canplay",
        canplaythrough: "jPlayer_canplaythrough",
        seeking: "jPlayer_seeking",
        seeked: "jPlayer_seeked",
        timeupdate: "jPlayer_timeupdate",
        ended: "jPlayer_ended",
        ratechange: "jPlayer_ratechange",
        durationchange: "jPlayer_durationchange",
        volumechange: "jPlayer_volumechange"
    };

    $.jPlayer.htmlEvent = [ // These HTML events are bubbled through to the jPlayer event, without any internal action.
		"loadstart",
    // "progress", // jPlayer uses internally before bubbling.
    // "suspend", // jPlayer uses internally before bubbling.
		"abort",
    // "error", // jPlayer uses internally before bubbling.
		"emptied",
		"stalled",
    // "play", // jPlayer uses internally before bubbling.
    // "pause", // jPlayer uses internally before bubbling.
		"loadedmetadata",
		"loadeddata",
    // "waiting", // jPlayer uses internally before bubbling.
    // "playing", // jPlayer uses internally before bubbling.
    // "canplay", // jPlayer fixes the volume (for Chrome) before bubbling.
		"canplaythrough",
    // "seeking", // jPlayer uses internally before bubbling.
    // "seeked", // jPlayer uses internally before bubbling.
    // "timeupdate", // jPlayer uses internally before bubbling.
    // "ended", // jPlayer uses internally before bubbling.
		"ratechange"
    // "durationchange" // jPlayer uses internally before bubbling.
    // "volumechange" // Handled by jPlayer in volume() method, primarily due to the volume fix (for Chrome) in the canplay event. [*] Need to review whether the latest Chrome still needs the fix sometime.
	];

    $.jPlayer.pause = function () {
        // $.each($.jPlayer.instances, function(i, element) {
        $.each($.jPlayer.prototype.instances, function (i, element) {
            if (element.data("jPlayer").status.srcSet) { // Check that media is set otherwise would cause error event.
                element.jPlayer("pause");
            }
        });
    };

    $.jPlayer.timeFormat = {
        showHour: false,
        showMin: true,
        showSec: true,
        padHour: false,
        padMin: true,
        padSec: true,
        sepHour: ":",
        sepMin: ":",
        sepSec: ""
    };

    $.jPlayer.convertTime = function (sec) {
        var myTime = new Date(sec * 1000);
        var hour = myTime.getUTCHours();
        var min = myTime.getUTCMinutes();
        var sec = myTime.getUTCSeconds();
        var strHour = ($.jPlayer.timeFormat.padHour && hour < 10) ? "0" + hour : hour;
        var strMin = ($.jPlayer.timeFormat.padMin && min < 10) ? "0" + min : min;
        var strSec = ($.jPlayer.timeFormat.padSec && sec < 10) ? "0" + sec : sec;
        return (($.jPlayer.timeFormat.showHour) ? strHour + $.jPlayer.timeFormat.sepHour : "") + (($.jPlayer.timeFormat.showMin) ? strMin + $.jPlayer.timeFormat.sepMin : "") + (($.jPlayer.timeFormat.showSec) ? strSec + $.jPlayer.timeFormat.sepSec : "");
    };

    // Adapting jQuery 1.4.4 code for jQuery.browser. Required since jQuery 1.3.2 does not detect Chrome as webkit.
    $.jPlayer.uaMatch = function (ua) {
        var ua = ua.toLowerCase();

        // Useragent RegExp
        var rwebkit = /(webkit)[ \/]([\w.]+)/;
        var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/;
        var rmsie = /(msie) ([\w.]+)/;
        var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/;

        var match = rwebkit.exec(ua) ||
			ropera.exec(ua) ||
			rmsie.exec(ua) ||
			ua.indexOf("compatible") < 0 && rmozilla.exec(ua) ||
			[];

        return { browser: match[1] || "", version: match[2] || "0" };
    };

    $.jPlayer.browser = {
};

var browserMatch = $.jPlayer.uaMatch(navigator.userAgent);
if (browserMatch.browser) {
    $.jPlayer.browser[browserMatch.browser] = true;
    $.jPlayer.browser.version = browserMatch.version;
}

$.jPlayer.prototype = {
    count: 0, // Static Variable: Change it via prototype.
    version: { // Static Object
        script: "2.0.0",
        needFlash: "2.0.0",
        flash: "unknown"
    },
    options: { // Instanced in $.jPlayer() constructor
        swfPath: "js", // Path to Jplayer.swf. Can be relative, absolute or server root relative.
        solution: "html, flash", // Valid solutions: html, flash. Order defines priority. 1st is highest,
        supplied: "mp3", // Defines which formats jPlayer will try and support and the priority by the order. 1st is highest,
        preload: 'metadata',  // HTML5 Spec values: none, metadata, auto.
        volume: 0.8, // The volume. Number 0 to 1.
        muted: false,
        showHidePlayPause: true,
        backgroundColor: "#000000", // To define the jPlayer div and Flash background color.
        cssSelectorAncestor: "#jp_interface_1",
        cssSelector: {
            videoPlay: ".jp-video-play",
            play: ".jp-play",
            pause: ".jp-pause",
            stop: ".jp-stop",
            seekBar: ".jp-seek-bar",
            playBar: ".jp-play-bar",
            mute: ".jp-mute",
            unmute: ".jp-unmute",
            volumeBar: ".jp-volume-bar",
            volumeBarValue: ".jp-volume-bar-value",
            currentTime: ".jp-current-time",
            duration: ".jp-duration"
        },
        // globalVolume: false, // Not implemented: Set to make volume changes affect all jPlayer instances
        // globalMute: false, // Not implemented: Set to make mute changes affect all jPlayer instances
        idPrefix: "jp", // Prefix for the ids of html elements created by jPlayer. For flash, this must not include characters: . - + * / \
        errorAlerts: false,
        warningAlerts: false
    },
    instances: {}, // Static Object
    status: { // Instanced in _init()
        src: "",
        media: {},
        paused: true,
        format: {},
        formatType: "",
        waitForPlay: true, // Same as waitForLoad except in case where preloading.
        waitForLoad: true,
        srcSet: false,
        video: false, // True if playing a video
        seekPercent: 0,
        currentPercentRelative: 0,
        currentPercentAbsolute: 0,
        currentTime: 0,
        duration: 0
    },
    _status: { // Instanced in _init(): These status values are persistent. ie., Are not affected by a status reset.
        volume: undefined, // Set by constructor option/default.
        muted: false, // Set by constructor option/default.
        width: 0, // Read from CSS
        height: 0 // Read from CSS
    },
    internal: { // Instanced in _init()
        ready: false,
        instance: undefined,
        htmlDlyCmdId: undefined
    },
    solution: { // Static Object: Defines the solutions built in jPlayer.
        html: true,
        flash: true
    },
    // 'MPEG-4 support' : canPlayType('video/mp4; codecs="mp4v.20.8"')
    format: { // Static Object
        mp3: {
            codec: 'audio/mpeg; codecs="mp3"',
            flashCanPlay: true,
            media: 'audio'
        },
        m4a: { // AAC / MP4
            codec: 'audio/mp4; codecs="mp4a.40.2"',
            flashCanPlay: true,
            media: 'audio'
        },
        oga: { // OGG
            codec: 'audio/ogg; codecs="vorbis"',
            flashCanPlay: false,
            media: 'audio'
        },
        wav: { // PCM
            codec: 'audio/wav; codecs="1"',
            flashCanPlay: false,
            media: 'audio'
        },
        webma: { // WEBM
            codec: 'audio/webm; codecs="vorbis"',
            flashCanPlay: false,
            media: 'audio'
        },
        m4v: { // H.264 / MP4
            codec: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',
            flashCanPlay: true,
            media: 'video'
        },
        ogv: { // OGG
            codec: 'video/ogg; codecs="theora, vorbis"',
            flashCanPlay: false,
            media: 'video'
        },
        webmv: { // WEBM
            codec: 'video/webm; codecs="vorbis, vp8"',
            flashCanPlay: false,
            media: 'video'
        }
    },
    _init: function () {
        var self = this;

        this.element.empty();

        this.status = $.extend({}, this.status, this._status); // Copy static to unique instance. Adds the status propeties that persist through a reset. NB: Might want to use $.jPlayer.prototype.status instead once options completely implmented and _init() returned to $.fn.jPlayer plugin. 
        this.internal = $.extend({}, this.internal); // Copy static to unique instance.

        this.formats = []; // Array based on supplied string option. Order defines priority.
        this.solutions = []; // Array based on solution string option. Order defines priority.
        this.require = {}; // Which media types are required: video, audio.

        this.htmlElement = {}; // DOM elements created by jPlayer
        this.html = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array.
        this.html.audio = {};
        this.html.video = {};
        this.flash = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array.

        this.css = {};
        this.css.cs = {}; // Holds the css selector strings
        this.css.jq = {}; // Holds jQuery selectors. ie., $(css.cs.method)

        this.status.volume = this._limitValue(this.options.volume, 0, 1); // Set volume status from constructor option.
        this.status.muted = this.options.muted; // Set muted status from constructor option.
        this.status.width = this.element.css('width'); // Sets from CSS.
        this.status.height = this.element.css('height'); // Sets from CSS.

        this.element.css({ 'background-color': this.options.backgroundColor });

        // Create the formats array, with prority based on the order of the supplied formats string
        $.each(this.options.supplied.toLowerCase().split(","), function (index1, value1) {
            var format = value1.replace(/^\s+|\s+$/g, ""); //trim
            if (self.format[format]) { // Check format is valid.
                var dupFound = false;
                $.each(self.formats, function (index2, value2) { // Check for duplicates
                    if (format === value2) {
                        dupFound = true;
                        return false;
                    }
                });
                if (!dupFound) {
                    self.formats.push(format);
                }
            }
        });

        // Create the solutions array, with prority based on the order of the solution string
        $.each(this.options.solution.toLowerCase().split(","), function (index1, value1) {
            var solution = value1.replace(/^\s+|\s+$/g, ""); //trim
            if (self.solution[solution]) { // Check solution is valid.
                var dupFound = false;
                $.each(self.solutions, function (index2, value2) { // Check for duplicates
                    if (solution === value2) {
                        dupFound = true;
                        return false;
                    }
                });
                if (!dupFound) {
                    self.solutions.push(solution);
                }
            }
        });

        this.internal.instance = "jp_" + this.count;
        this.instances[this.internal.instance] = this.element;

        // Check the jPlayer div has an id and create one if required. Important for Flash to know the unique id for comms.
        if (this.element.attr("id") === "") {
            this.element.attr("id", this.options.idPrefix + "_jplayer_" + this.count);
        }

        this.internal.self = $.extend({}, {
            id: this.element.attr("id"),
            jq: this.element
        });
        this.internal.audio = $.extend({}, {
            id: this.options.idPrefix + "_audio_" + this.count,
            jq: undefined
        });
        this.internal.video = $.extend({}, {
            id: this.options.idPrefix + "_video_" + this.count,
            jq: undefined
        });
        this.internal.flash = $.extend({}, {
            id: this.options.idPrefix + "_flash_" + this.count,
            jq: undefined,
            swf: this.options.swfPath + ((this.options.swfPath !== "" && this.options.swfPath.slice(-1) !== "/") ? "/" : "") + "Jplayer.swf"
        });
        this.internal.poster = $.extend({}, {
            id: this.options.idPrefix + "_poster_" + this.count,
            jq: undefined
        });

        // Register listeners defined in the constructor
        $.each($.jPlayer.event, function (eventName, eventType) {
            if (self.options[eventName] !== undefined) {
                self.element.bind(eventType + ".jPlayer", self.options[eventName]); // With .jPlayer namespace.
                self.options[eventName] = undefined; // Destroy the handler pointer copy on the options. Reason, events can be added/removed in other ways so this could be obsolete and misleading.
            }
        });

        // Create the poster image.
        this.htmlElement.poster = document.createElement('img');
        this.htmlElement.poster.id = this.internal.poster.id;
        this.htmlElement.poster.onload = function () { // Note that this did not work on Firefox 3.6: poster.addEventListener("onload", function() {}, false); Did not investigate x-browser.
            if (!self.status.video || self.status.waitForPlay) {
                self.internal.poster.jq.show();
            }
        };
        this.element.append(this.htmlElement.poster);
        this.internal.poster.jq = $("#" + this.internal.poster.id);
        this.internal.poster.jq.css({ 'width': this.status.width, 'height': this.status.height });
        this.internal.poster.jq.hide();

        // Determine if we require solutions for audio, video or both media types.
        this.require.audio = false;
        this.require.video = false;
        $.each(this.formats, function (priority, format) {
            self.require[self.format[format].media] = true;
        });

        this.html.audio.available = false;
        if (this.require.audio) { // If a supplied format is audio
            this.htmlElement.audio = document.createElement('audio');
            this.htmlElement.audio.id = this.internal.audio.id;
            this.html.audio.available = !!this.htmlElement.audio.canPlayType;
        }
        this.html.video.available = false;
        if (this.require.video) { // If a supplied format is video
            this.htmlElement.video = document.createElement('video');
            this.htmlElement.video.id = this.internal.video.id;
            this.html.video.available = !!this.htmlElement.video.canPlayType;
        }

        this.flash.available = this._checkForFlash(10); // IE9 forced to false due to ExternalInterface problem.

        this.html.canPlay = {};
        this.flash.canPlay = {};
        $.each(this.formats, function (priority, format) {
            self.html.canPlay[format] = self.html[self.format[format].media].available && "" !== self.htmlElement[self.format[format].media].canPlayType(self.format[format].codec);
            self.flash.canPlay[format] = self.format[format].flashCanPlay && self.flash.available;
        });
        this.html.desired = false;
        this.flash.desired = false;
        $.each(this.solutions, function (solutionPriority, solution) {
            if (solutionPriority === 0) {
                self[solution].desired = true;
            } else {
                var audioCanPlay = false;
                var videoCanPlay = false;
                $.each(self.formats, function (formatPriority, format) {
                    if (self[self.solutions[0]].canPlay[format]) { // The other solution can play
                        if (self.format[format].media === 'video') {
                            videoCanPlay = true;
                        } else {
                            audioCanPlay = true;
                        }
                    }
                });
                self[solution].desired = (self.require.audio && !audioCanPlay) || (self.require.video && !videoCanPlay);
            }
        });
        // This is what jPlayer will support, based on solution and supplied.
        this.html.support = {};
        this.flash.support = {};
        $.each(this.formats, function (priority, format) {
            self.html.support[format] = self.html.canPlay[format] && self.html.desired;
            self.flash.support[format] = self.flash.canPlay[format] && self.flash.desired;
        });
        // If jPlayer is supporting any format in a solution, then the solution is used.
        this.html.used = false;
        this.flash.used = false;
        $.each(this.solutions, function (solutionPriority, solution) {
            $.each(self.formats, function (formatPriority, format) {
                if (self[solution].support[format]) {
                    self[solution].used = true;
                    return false;
                }
            });
        });

        // If neither html nor flash are being used by this browser, then media playback is not possible. Trigger an error event.
        if (!(this.html.used || this.flash.used)) {
            this._error({
                type: $.jPlayer.error.NO_SOLUTION,
                context: "{solution:'" + this.options.solution + "', supplied:'" + this.options.supplied + "'}",
                message: $.jPlayer.errorMsg.NO_SOLUTION,
                hint: $.jPlayer.errorHint.NO_SOLUTION
            });
        }

        // Init solution active state and the event gates to false.
        this.html.active = false;
        this.html.audio.gate = false;
        this.html.video.gate = false;
        this.flash.active = false;
        this.flash.gate = false;

        // Add the flash solution if it is being used.
        if (this.flash.used) {
            var flashVars = 'id=' + escape(this.internal.self.id) + '&vol=' + this.status.volume + '&muted=' + this.status.muted;

            if ($.browser.msie && Number($.browser.version) <= 8) {
                var html_obj = '<object id="' + this.internal.flash.id + '"';
                html_obj += ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
                html_obj += ' codebase="' + document.URL.substring(0, document.URL.indexOf(':')) + '://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"'; // Fixed IE non secured element warning.
                html_obj += ' type="application/x-shockwave-flash"';
                html_obj += ' width="0" height="0">';
                html_obj += '</object>';

                var obj_param = [];
                obj_param[0] = '<param name="movie" value="' + this.internal.flash.swf + '" />';
                obj_param[1] = '<param name="quality" value="high" />';
                obj_param[2] = '<param name="FlashVars" value="' + flashVars + '" />';
                obj_param[3] = '<param name="allowScriptAccess" value="always" />';
                obj_param[4] = '<param name="bgcolor" value="' + this.options.backgroundColor + '" />';

                var ie_dom = document.createElement(html_obj);
                for (var i = 0; i < obj_param.length; i++) {
                    ie_dom.appendChild(document.createElement(obj_param[i]));
                }
                this.element.append(ie_dom);
            } else {
                var html_embed = '<embed name="' + this.internal.flash.id + '" id="' + this.internal.flash.id + '" src="' + this.internal.flash.swf + '"';
                html_embed += ' width="0" height="0" bgcolor="' + this.options.backgroundColor + '"';
                html_embed += ' quality="high" FlashVars="' + flashVars + '"';
                html_embed += ' allowScriptAccess="always"';
                html_embed += ' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
                this.element.append(html_embed);
            }
            this.internal.flash.jq = $("#" + this.internal.flash.id);
            this.internal.flash.jq.css({ 'width': '0px', 'height': '0px' }); // Must do via CSS as setting attr() to zero causes a jQuery error in IE.
        }

        // Add the HTML solution if being used.
        if (this.html.used) {

            // The HTML Audio handlers
            if (this.html.audio.available) {
                this._addHtmlEventListeners(this.htmlElement.audio, this.html.audio);
                this.element.append(this.htmlElement.audio);
                this.internal.audio.jq = $("#" + this.internal.audio.id);
            }

            // The HTML Video handlers
            if (this.html.video.available) {
                this._addHtmlEventListeners(this.htmlElement.video, this.html.video);
                this.element.append(this.htmlElement.video);
                this.internal.video.jq = $("#" + this.internal.video.id);
                this.internal.video.jq.css({ 'width': '0px', 'height': '0px' }); // Using size 0x0 since a .hide() causes issues in iOS
            }
        }

        if (this.html.used && !this.flash.used) { // If only HTML, then emulate flash ready() call after 100ms.
            window.setTimeout(function () {
                self.internal.ready = true;
                self.version.flash = "n/a";
                self._trigger($.jPlayer.event.ready);
            }, 100);
        }

        // Set up the css selectors for the control and feedback entities.
        $.each(this.options.cssSelector, function (fn, cssSel) {
            self._cssSelector(fn, cssSel);
        });

        this._updateInterface();
        this._updateButtons(false);
        this._updateVolume(this.status.volume);
        this._updateMute(this.status.muted);
        if (this.css.jq.videoPlay.length) {
            this.css.jq.videoPlay.hide();
        }
        $.jPlayer.prototype.count++; // Change static variable via prototype.
    },
    destroy: function () {
        // MJP: The background change remains. Review later.

        // Reset the interface, remove seeking effect and times.
        this._resetStatus();
        this._updateInterface();
        this._seeked();
        if (this.css.jq.currentTime.length) {
            this.css.jq.currentTime.text("");
        }
        if (this.css.jq.duration.length) {
            this.css.jq.duration.text("");
        }

        if (this.status.srcSet) { // Or you get a bogus error event
            this.pause(); // Pauses the media and clears any delayed commands used in the HTML solution.
        }
        $.each(this.css.jq, function (fn, jq) { // Remove any bindings from the interface controls.
            jq.unbind(".jPlayer");
        });
        this.element.removeData("jPlayer"); // Remove jPlayer data
        this.element.unbind(".jPlayer"); // Remove all event handlers created by the jPlayer constructor
        this.element.empty(); // Remove the inserted child elements

        this.instances[this.internal.instance] = undefined; // Clear the instance on the static instance object
    },
    enable: function () { // Plan to implement
        // options.disabled = false
    },
    disable: function () { // Plan to implement
        // options.disabled = true
    },
    _addHtmlEventListeners: function (mediaElement, entity) {
        var self = this;
        mediaElement.preload = this.options.preload;
        mediaElement.muted = this.options.muted;

        // Create the event listeners
        // Only want the active entity to affect jPlayer and bubble events.
        // Using entity.gate so that object is referenced and gate property always current

        mediaElement.addEventListener("progress", function () {
            if (entity.gate && !self.status.waitForLoad) {
                self._getHtmlStatus(mediaElement);
                self._updateInterface();
                self._trigger($.jPlayer.event.progress);
            }
        }, false);
        mediaElement.addEventListener("timeupdate", function () {
            if (entity.gate && !self.status.waitForLoad) {
                self._getHtmlStatus(mediaElement);
                self._updateInterface();
                self._trigger($.jPlayer.event.timeupdate);
            }
        }, false);
        mediaElement.addEventListener("durationchange", function () {
            if (entity.gate && !self.status.waitForLoad) {
                self.status.duration = this.duration;
                self._getHtmlStatus(mediaElement);
                self._updateInterface();
                self._trigger($.jPlayer.event.durationchange);
            }
        }, false);
        mediaElement.addEventListener("play", function () {
            if (entity.gate && !self.status.waitForLoad) {
                self._updateButtons(true);
                self._trigger($.jPlayer.event.play);
            }
        }, false);
        mediaElement.addEventListener("playing", function () {
            if (entity.gate && !self.status.waitForLoad) {
                self._updateButtons(true);
                self._seeked();
                self._trigger($.jPlayer.event.playing);
            }
        }, false);
        mediaElement.addEventListener("pause", function () {
            if (entity.gate && !self.status.waitForLoad) {
                self._updateButtons(false);
                self._trigger($.jPlayer.event.pause);
            }
        }, false);
        mediaElement.addEventListener("waiting", function () {
            if (entity.gate && !self.status.waitForLoad) {
                self._seeking();
                self._trigger($.jPlayer.event.waiting);
            }
        }, false);
        mediaElement.addEventListener("canplay", function () {
            if (entity.gate && !self.status.waitForLoad) {
                mediaElement.volume = self._volumeFix(self.status.volume);
                self._trigger($.jPlayer.event.canplay);
            }
        }, false);
        mediaElement.addEventListener("seeking", function () {
            if (entity.gate && !self.status.waitForLoad) {
                self._seeking();
                self._trigger($.jPlayer.event.seeking);
            }
        }, false);
        mediaElement.addEventListener("seeked", function () {
            if (entity.gate && !self.status.waitForLoad) {
                self._seeked();
                self._trigger($.jPlayer.event.seeked);
            }
        }, false);
        mediaElement.addEventListener("suspend", function () { // Seems to be the only way of capturing that the iOS4 browser did not actually play the media from the page code. ie., It needs a user gesture.
            if (entity.gate && !self.status.waitForLoad) {
                self._seeked();
                self._trigger($.jPlayer.event.suspend);
            }
        }, false);
        mediaElement.addEventListener("ended", function () {
            if (entity.gate && !self.status.waitForLoad) {
                // Order of the next few commands are important. Change the time and then pause.
                // Solves a bug in Firefox, where issuing pause 1st causes the media to play from the start. ie., The pause is ignored.
                if (!$.jPlayer.browser.webkit) { // Chrome crashes if you do this in conjunction with a setMedia command in an ended event handler. ie., The playlist demo.
                    self.htmlElement.media.currentTime = 0; // Safari does not care about this command. ie., It works with or without this line. (Both Safari and Chrome are Webkit.)
                }
                self.htmlElement.media.pause(); // Pause otherwise a click on the progress bar will play from that point, when it shouldn't, since it stopped playback.
                self._updateButtons(false);
                self._getHtmlStatus(mediaElement, true); // With override true. Otherwise Chrome leaves progress at full.
                self._updateInterface();
                self._trigger($.jPlayer.event.ended);
            }
        }, false);
        mediaElement.addEventListener("error", function () {
            if (entity.gate && !self.status.waitForLoad) {
                self._updateButtons(false);
                self._seeked();
                if (self.status.srcSet) { // Deals with case of clearMedia() causing an error event.
                    self.status.waitForLoad = true; // Allows the load operation to try again.
                    self.status.waitForPlay = true; // Reset since a play was captured.
                    if (self.status.video) {
                        self.internal.video.jq.css({ 'width': '0px', 'height': '0px' });
                    }
                    if (self._validString(self.status.media.poster)) {
                        self.internal.poster.jq.show();
                    }
                    if (self.css.jq.videoPlay.length) {
                        self.css.jq.videoPlay.show();
                    }
                    self._error({
                        type: $.jPlayer.error.URL,
                        context: self.status.src, // this.src shows absolute urls. Want context to show the url given.
                        message: $.jPlayer.errorMsg.URL,
                        hint: $.jPlayer.errorHint.URL
                    });
                }
            }
        }, false);
        // Create all the other event listeners that bubble up to a jPlayer event from html, without being used by jPlayer.
        $.each($.jPlayer.htmlEvent, function (i, eventType) {
            mediaElement.addEventListener(this, function () {
                if (entity.gate && !self.status.waitForLoad) {
                    self._trigger($.jPlayer.event[eventType]);
                }
            }, false);
        });
    },
    _getHtmlStatus: function (media, override) {
        var ct = 0, d = 0, cpa = 0, sp = 0, cpr = 0;

        ct = media.currentTime;
        cpa = (this.status.duration > 0) ? 100 * ct / this.status.duration : 0;
        if ((typeof media.seekable === "object") && (media.seekable.length > 0)) {
            sp = (this.status.duration > 0) ? 100 * media.seekable.end(media.seekable.length - 1) / this.status.duration : 100;
            cpr = 100 * media.currentTime / media.seekable.end(media.seekable.length - 1);
        } else {
            sp = 100;
            cpr = cpa;
        }

        if (override) {
            ct = 0;
            cpr = 0;
            cpa = 0;
        }

        this.status.seekPercent = sp;
        this.status.currentPercentRelative = cpr;
        this.status.currentPercentAbsolute = cpa;
        this.status.currentTime = ct;
    },
    _resetStatus: function () {
        var self = this;
        this.status = $.extend({}, this.status, $.jPlayer.prototype.status); // Maintains the status properties that persist through a reset. ie., The properties of this._status, contained in the current this.status.

    },
    _trigger: function (eventType, error, warning) { // eventType always valid as called using $.jPlayer.event.eventType
        var event = $.Event(eventType);
        event.jPlayer = {};
        event.jPlayer.version = $.extend({}, this.version);
        event.jPlayer.status = $.extend(true, {}, this.status); // Deep copy
        event.jPlayer.html = $.extend(true, {}, this.html); // Deep copy
        event.jPlayer.flash = $.extend(true, {}, this.flash); // Deep copy
        if (error) event.jPlayer.error = $.extend({}, error);
        if (warning) event.jPlayer.warning = $.extend({}, warning);
        this.element.trigger(event);
    },
    jPlayerFlashEvent: function (eventType, status) { // Called from Flash
        if (eventType === $.jPlayer.event.ready && !this.internal.ready) {
            this.internal.ready = true;
            this.version.flash = status.version;
            if (this.version.needFlash !== this.version.flash) {
                this._error({
                    type: $.jPlayer.error.VERSION,
                    context: this.version.flash,
                    message: $.jPlayer.errorMsg.VERSION + this.version.flash,
                    hint: $.jPlayer.errorHint.VERSION
                });
            }
            this._trigger(eventType);
        }
        if (this.flash.gate) {
            switch (eventType) {
                case $.jPlayer.event.progress:
                    this._getFlashStatus(status);
                    this._updateInterface();
                    this._trigger(eventType);
                    break;
                case $.jPlayer.event.timeupdate:
                    this._getFlashStatus(status);
                    this._updateInterface();
                    this._trigger(eventType);
                    break;
                case $.jPlayer.event.play:
                    this._seeked();
                    this._updateButtons(true);
                    this._trigger(eventType);
                    break;
                case $.jPlayer.event.pause:
                    this._updateButtons(false);
                    this._trigger(eventType);
                    break;
                case $.jPlayer.event.ended:
                    this._updateButtons(false);
                    this._trigger(eventType);
                    break;
                case $.jPlayer.event.error:
                    this.status.waitForLoad = true; // Allows the load operation to try again.
                    this.status.waitForPlay = true; // Reset since a play was captured.
                    if (this.status.video) {
                        this.internal.flash.jq.css({ 'width': '0px', 'height': '0px' });
                    }
                    if (this._validString(this.status.media.poster)) {
                        this.internal.poster.jq.show();
                    }
                    if (this.css.jq.videoPlay.length) {
                        this.css.jq.videoPlay.show();
                    }
                    if (this.status.video) { // Set up for another try. Execute before error event.
                        this._flash_setVideo(this.status.media);
                    } else {
                        this._flash_setAudio(this.status.media);
                    }
                    this._error({
                        type: $.jPlayer.error.URL,
                        context: status.src,
                        message: $.jPlayer.errorMsg.URL,
                        hint: $.jPlayer.errorHint.URL
                    });
                    break;
                case $.jPlayer.event.seeking:
                    this._seeking();
                    this._trigger(eventType);
                    break;
                case $.jPlayer.event.seeked:
                    this._seeked();
                    this._trigger(eventType);
                    break;
                default:
                    this._trigger(eventType);
            }
        }
        return false;
    },
    _getFlashStatus: function (status) {
        this.status.seekPercent = status.seekPercent;
        this.status.currentPercentRelative = status.currentPercentRelative;
        this.status.currentPercentAbsolute = status.currentPercentAbsolute;
        this.status.currentTime = status.currentTime;
        this.status.duration = status.duration;
    },
    _updateButtons: function (playing) {
        this.status.paused = !playing;

        if (!this.options.showHidePlayPause)
            return;

        if (this.css.jq.play.length && this.css.jq.pause.length) {
            if (playing) {
                this.css.jq.play.hide();
                this.css.jq.pause.show();
            } else {
                this.css.jq.play.show();
                this.css.jq.pause.hide();
            }
        }
    },
    _updateInterface: function () {
        if (this.css.jq.seekBar.length) {
            this.css.jq.seekBar.width(this.status.seekPercent + "%");
        }
        if (this.css.jq.playBar.length) {
            this.css.jq.playBar.width(this.status.currentPercentRelative + "%");
        }
        if (this.css.jq.currentTime.length) {
            this.css.jq.currentTime.text($.jPlayer.convertTime(this.status.currentTime));
        }
        if (this.css.jq.duration.length) {
            this.css.jq.duration.text($.jPlayer.convertTime(this.status.duration));
        }
    },
    _seeking: function () {
        if (this.css.jq.seekBar.length) {
            this.css.jq.seekBar.addClass("jp-seeking-bg");
        }
    },
    _seeked: function () {
        if (this.css.jq.seekBar.length) {
            this.css.jq.seekBar.removeClass("jp-seeking-bg");
        }
    },
    setMedia: function (media) {

        /*	media[format] = String: URL of format. Must contain all of the supplied option's video or audio formats.
        *	media.poster = String: Video poster URL.
        *	media.subtitles = String: * NOT IMPLEMENTED * URL of subtitles SRT file
        *	media.chapters = String: * NOT IMPLEMENTED * URL of chapters SRT file
        *	media.stream = Boolean: * NOT IMPLEMENTED * Designating actual media streams. ie., "false/undefined" for files. Plan to refresh the flash every so often.
        */

        var self = this;

        this._seeked();
        clearTimeout(this.internal.htmlDlyCmdId); // Clears any delayed commands used in the HTML solution.

        // Store the current html gates, since we need for clearMedia() conditions.
        var audioGate = this.html.audio.gate;
        var videoGate = this.html.video.gate;

        var supported = false;
        $.each(this.formats, function (formatPriority, format) {
            var isVideo = self.format[format].media === 'video';
            $.each(self.solutions, function (solutionPriority, solution) {
                if (self[solution].support[format] && self._validString(media[format])) { // Format supported in solution and url given for format.
                    var isHtml = solution === 'html';

                    if (isVideo) {
                        if (isHtml) {
                            self.html.audio.gate = false;
                            self.html.video.gate = true;
                            self.flash.gate = false;
                        } else {
                            self.html.audio.gate = false;
                            self.html.video.gate = false;
                            self.flash.gate = true;
                        }
                    } else {
                        if (isHtml) {
                            self.html.audio.gate = true;
                            self.html.video.gate = false;
                            self.flash.gate = false;
                        } else {
                            self.html.audio.gate = false;
                            self.html.video.gate = false;
                            self.flash.gate = true;
                        }
                    }

                    // Clear media of the previous solution if:
                    //  - it was Flash
                    //  - changing from HTML to Flash
                    //  - the HTML solution media type (audio or video) remained the same.
                    // Note that, we must be careful with clearMedia() on iPhone, otherwise clearing the video when changing to audio corrupts the built in video player.
                    if (self.flash.active || (self.html.active && self.flash.gate) || (audioGate === self.html.audio.gate && videoGate === self.html.video.gate)) {
                        self.clearMedia();
                    } else if (audioGate !== self.html.audio.gate && videoGate !== self.html.video.gate) { // If switching between html elements
                        self._html_pause();
                        // Hide the video if it was being used.
                        if (self.status.video) {
                            self.internal.video.jq.css({ 'width': '0px', 'height': '0px' });
                        }
                        self._resetStatus(); // Since clearMedia usually does this. Execute after status.video useage.
                    }

                    if (isVideo) {
                        if (isHtml) {
                            self._html_setVideo(media);
                            self.html.active = true;
                            self.flash.active = false;
                        } else {
                            self._flash_setVideo(media);
                            self.html.active = false;
                            self.flash.active = true;
                        }
                        if (self.css.jq.videoPlay.length) {
                            self.css.jq.videoPlay.show();
                        }
                        self.status.video = true;
                    } else {
                        if (isHtml) {
                            self._html_setAudio(media);
                            self.html.active = true;
                            self.flash.active = false;
                        } else {
                            self._flash_setAudio(media);
                            self.html.active = false;
                            self.flash.active = true;
                        }
                        if (self.css.jq.videoPlay.length) {
                            self.css.jq.videoPlay.hide();
                        }
                        self.status.video = false;
                    }

                    supported = true;
                    return false; // Exit $.each
                }
            });
            if (supported) {
                return false; // Exit $.each
            }
        });

        if (supported) {
            // Set poster after the possible clearMedia() command above. IE had issues since the IMG onload event occurred immediately when cached. ie., The clearMedia() hide the poster.
            if (this._validString(media.poster)) {
                if (this.htmlElement.poster.src !== media.poster) { // Since some browsers do not generate img onload event.
                    this.htmlElement.poster.src = media.poster;
                } else {
                    this.internal.poster.jq.show();
                }
            } else {
                this.internal.poster.jq.hide(); // Hide if not used, since clearMedia() does not always occur above. ie., HTML audio <-> video switching.
            }
            this.status.srcSet = true;
            this.status.media = $.extend({}, media);
            this._updateButtons(false);
            this._updateInterface();
        } else { // jPlayer cannot support any formats provided in this browser
            // Pause here if old media could be playing. Otherwise, playing media being changed to bad media would leave the old media playing.
            if (this.status.srcSet && !this.status.waitForPlay) {
                this.pause();
            }
            // Reset all the control flags
            this.html.audio.gate = false;
            this.html.video.gate = false;
            this.flash.gate = false;
            this.html.active = false;
            this.flash.active = false;
            // Reset status and interface.
            this._resetStatus();
            this._updateInterface();
            this._updateButtons(false);
            // Hide the any old media
            this.internal.poster.jq.hide();
            if (this.html.used && this.require.video) {
                this.internal.video.jq.css({ 'width': '0px', 'height': '0px' });
            }
            if (this.flash.used) {
                this.internal.flash.jq.css({ 'width': '0px', 'height': '0px' });
            }
            // Send an error event
            this._error({
                type: $.jPlayer.error.NO_SUPPORT,
                context: "{supplied:'" + this.options.supplied + "'}",
                message: $.jPlayer.errorMsg.NO_SUPPORT,
                hint: $.jPlayer.errorHint.NO_SUPPORT
            });
        }
    },
    clearMedia: function () {
        this._resetStatus();
        this._updateButtons(false);

        this.internal.poster.jq.hide();

        clearTimeout(this.internal.htmlDlyCmdId);

        if (this.html.active) {
            this._html_clearMedia();
        } else if (this.flash.active) {
            this._flash_clearMedia();
        }
    },
    load: function () {
        if (this.status.srcSet) {
            if (this.html.active) {
                this._html_load();
            } else if (this.flash.active) {
                this._flash_load();
            }
        } else {
            this._urlNotSetError("load");
        }
    },
    play: function (time) {
        time = (typeof time === "number") ? time : NaN; // Remove jQuery event from click handler
        if (this.status.srcSet) {
            if (this.html.active) {
                this._html_play(time);
            } else if (this.flash.active) {
                this._flash_play(time);
            }
        } else {
            this._urlNotSetError("play");
        }
    },
    videoPlay: function (e) { // Handles clicks on the play button over the video poster
        this.play();
    },
    pause: function (time) {
        time = (typeof time === "number") ? time : NaN; // Remove jQuery event from click handler
        if (this.status.srcSet) {
            if (this.html.active) {
                this._html_pause(time);
            } else if (this.flash.active) {
                this._flash_pause(time);
            }
        } else {
            this._urlNotSetError("pause");
        }
    },
    pauseOthers: function () {
        var self = this;
        $.each(this.instances, function (i, element) {
            if (self.element !== element) { // Do not this instance.
                if (element.data("jPlayer").status.srcSet) { // Check that media is set otherwise would cause error event.
                    element.jPlayer("pause");
                }
            }
        });
    },
    stop: function () {
        if (this.status.srcSet) {
            if (this.html.active) {
                this._html_pause(0);
            } else if (this.flash.active) {
                this._flash_pause(0);
            }
        } else {
            this._urlNotSetError("stop");
        }
    },
    playHead: function (p) {
        p = this._limitValue(p, 0, 100);
        if (this.status.srcSet) {
            if (this.html.active) {
                this._html_playHead(p);
            } else if (this.flash.active) {
                this._flash_playHead(p);
            }
        } else {
            this._urlNotSetError("playHead");
        }
    },
    mute: function () {
        this.status.muted = true;
        if (this.html.used) {
            this._html_mute(true);
        }
        if (this.flash.used) {
            this._flash_mute(true);
        }
        this._updateMute(true);
        this._updateVolume(0);
        this._trigger($.jPlayer.event.volumechange);
    },
    unmute: function () {
        this.status.muted = false;
        if (this.html.used) {
            this._html_mute(false);
        }
        if (this.flash.used) {
            this._flash_mute(false);
        }
        this._updateMute(false);
        this._updateVolume(this.status.volume);
        this._trigger($.jPlayer.event.volumechange);
    },
    _updateMute: function (mute) {
        if (this.css.jq.mute.length && this.css.jq.unmute.length) {
            if (mute) {
                this.css.jq.mute.hide();
                this.css.jq.unmute.show();
            } else {
                this.css.jq.mute.show();
                this.css.jq.unmute.hide();
            }
        }
    },
    volume: function (v) {
        v = this._limitValue(v, 0, 1);
        this.status.volume = v;

        if (this.html.used) {
            this._html_volume(v);
        }
        if (this.flash.used) {
            this._flash_volume(v);
        }
        if (!this.status.muted) {
            this._updateVolume(v);
        }
        this._trigger($.jPlayer.event.volumechange);
    },
    volumeBar: function (e) { // Handles clicks on the volumeBar
        if (!this.status.muted && this.css.jq.volumeBar) { // Ignore clicks when muted
            var offset = this.css.jq.volumeBar.offset();
            var x = e.pageX - offset.left;
            var w = this.css.jq.volumeBar.width();
            var v = x / w;
            this.volume(v);
        }
    },
    volumeBarValue: function (e) { // Handles clicks on the volumeBarValue
        this.volumeBar(e);
    },
    _updateVolume: function (v) {
        if (this.css.jq.volumeBarValue.length) {
            this.css.jq.volumeBarValue.width((v * 100) + "%");
        }
    },
    _volumeFix: function (v) { // Need to review if this is still necessary on latest Chrome
        var rnd = 0.001 * Math.random(); // Fix for Chrome 4: Fix volume being set multiple times before playing bug.
        var fix = (v < 0.5) ? rnd : -rnd; // Fix for Chrome 4: Solves volume change before play bug. (When new vol == old vol Chrome 4 does nothing!)
        return (v + fix); // Fix for Chrome 4: Event solves initial volume not being set correctly.
    },
    _cssSelectorAncestor: function (ancestor, refresh) {
        this.options.cssSelectorAncestor = ancestor;
        if (refresh) {
            $.each(this.options.cssSelector, function (fn, cssSel) {
                self._cssSelector(fn, cssSel);
            });
        }
    },
    _cssSelector: function (fn, cssSel) {
        var self = this;
        if (typeof cssSel === 'string') {
            if ($.jPlayer.prototype.options.cssSelector[fn]) {
                if (this.css.jq[fn] && this.css.jq[fn].length) {
                    this.css.jq[fn].unbind(".jPlayer");
                }
                this.options.cssSelector[fn] = cssSel;
                this.css.cs[fn] = this.options.cssSelectorAncestor + " " + cssSel;

                if (cssSel) { // Checks for empty string
                    this.css.jq[fn] = $(this.css.cs[fn]);
                } else {
                    this.css.jq[fn] = []; // To comply with the css.jq[fn].length check before its use. As of jQuery 1.4 could have used $() for an empty set. 
                }

                if (this.css.jq[fn].length) {
                    var handler = function (e) {
                        self[fn](e);
                        $(this).blur();
                        return false;
                    }
                    this.css.jq[fn].bind("click.jPlayer", handler); // Using jPlayer namespace
                }

                if (cssSel && this.css.jq[fn].length !== 1) { // So empty strings do not generate the warning. ie., they just remove the old one.
                    this._warning({
                        type: $.jPlayer.warning.CSS_SELECTOR_COUNT,
                        context: this.css.cs[fn],
                        message: $.jPlayer.warningMsg.CSS_SELECTOR_COUNT + this.css.jq[fn].length + " found for " + fn + " method.",
                        hint: $.jPlayer.warningHint.CSS_SELECTOR_COUNT
                    });
                }
            } else {
                this._warning({
                    type: $.jPlayer.warning.CSS_SELECTOR_METHOD,
                    context: fn,
                    message: $.jPlayer.warningMsg.CSS_SELECTOR_METHOD,
                    hint: $.jPlayer.warningHint.CSS_SELECTOR_METHOD
                });
            }
        } else {
            this._warning({
                type: $.jPlayer.warning.CSS_SELECTOR_STRING,
                context: cssSel,
                message: $.jPlayer.warningMsg.CSS_SELECTOR_STRING,
                hint: $.jPlayer.warningHint.CSS_SELECTOR_STRING
            });
        }
    },
    seekBar: function (e) { // Handles clicks on the seekBar
        if (this.css.jq.seekBar) {
            var offset = this.css.jq.seekBar.offset();
            var x = e.pageX - offset.left;
            var w = this.css.jq.seekBar.width();
            var p = 100 * x / w;
            this.playHead(p);
        }
    },
    playBar: function (e) { // Handles clicks on the playBar
        this.seekBar(e);
    },
    currentTime: function (e) { // Handles clicks on the text
        // Added to avoid errors using cssSelector system for the text
    },
    duration: function (e) { // Handles clicks on the text
        // Added to avoid errors using cssSelector system for the text
    },
    // Options code adapted from ui.widget.js (1.8.7).  Made changes so the key can use dot notation. To match previous getData solution in jPlayer 1.
    option: function (key, value) {
        var options = key;

        // Enables use: options().  Returns a copy of options object
        if (arguments.length === 0) {
            return $.extend(true, {}, this.options);
        }

        if (typeof key === "string") {
            var keys = key.split(".");

            // Enables use: options("someOption")  Returns a copy of the option. Supports dot notation.
            if (value === undefined) {

                var opt = $.extend(true, {}, this.options);
                for (var i = 0; i < keys.length; i++) {
                    if (opt[keys[i]] !== undefined) {
                        opt = opt[keys[i]];
                    } else {
                        this._warning({
                            type: $.jPlayer.warning.OPTION_KEY,
                            context: key,
                            message: $.jPlayer.warningMsg.OPTION_KEY,
                            hint: $.jPlayer.warningHint.OPTION_KEY
                        });
                        return undefined;
                    }
                }
                return opt;
            }

            // Enables use: options("someOptionObject", someObject}).  Creates: {someOptionObject:someObject}
            // Enables use: options("someOption", someValue).  Creates: {someOption:someValue}
            // Enables use: options("someOptionObject.someOption", someValue).  Creates: {someOptionObject:{someOption:someValue}}

            options = {};
            var opt = options;

            for (var i = 0; i < keys.length; i++) {
                if (i < keys.length - 1) {
                    opt[keys[i]] = {};
                    opt = opt[keys[i]];
                } else {
                    opt[keys[i]] = value;
                }
            }
        }

        // Otherwise enables use: options(optionObject).  Uses original object (the key)

        this._setOptions(options);

        return this;
    },
    _setOptions: function (options) {
        var self = this;
        $.each(options, function (key, value) { // This supports the 2 level depth that the options of jPlayer has. Would review if we ever need more depth.
            self._setOption(key, value);
        });

        return this;
    },
    _setOption: function (key, value) {
        var self = this;

        // The ability to set options is limited at this time.

        switch (key) {
            case "cssSelectorAncestor":
                this.options[key] = value;
                $.each(self.options.cssSelector, function (fn, cssSel) { // Refresh all associations for new ancestor.
                    self._cssSelector(fn, cssSel);
                });
                break;
            case "cssSelector":
                $.each(value, function (fn, cssSel) {
                    self._cssSelector(fn, cssSel);
                });
                break;
        }

        return this;
    },
    // End of: (Options code adapted from ui.widget.js)

    // The resize() set of functions are not implemented yet.
    // Basically are currently used to allow Flash debugging without too much hassle.
    resize: function (css) {
        // MJP: Want to run some checks on dim {} first.
        if (this.html.active) {
            this._resizeHtml(css);
        }
        if (this.flash.active) {
            this._resizeFlash(css);
        }
        this._trigger($.jPlayer.event.resize);
    },
    _resizePoster: function (css) {
        // Not implemented yet
    },
    _resizeHtml: function (css) {
        // Not implemented yet
    },
    _resizeFlash: function (css) {
        this.internal.flash.jq.css({ 'width': css.width, 'height': css.height });
    },

    _html_initMedia: function () {
        if (this.status.srcSet && !this.status.waitForPlay) {
            this.htmlElement.media.pause();
        }
        if (this.options.preload !== 'none') {
            this._html_load();
        }
        this._trigger($.jPlayer.event.timeupdate); // The flash generates this event for its solution.
    },
    _html_setAudio: function (media) {
        var self = this;
        // Always finds a format due to checks in setMedia()
        $.each(this.formats, function (priority, format) {
            if (self.html.support[format] && media[format]) {
                self.status.src = media[format];
                self.status.format[format] = true;
                self.status.formatType = format;
                return false;
            }
        });
        this.htmlElement.media = this.htmlElement.audio;
        this._html_initMedia();
    },
    _html_setVideo: function (media) {
        var self = this;
        // Always finds a format due to checks in setMedia()
        $.each(this.formats, function (priority, format) {
            if (self.html.support[format] && media[format]) {
                self.status.src = media[format];
                self.status.format[format] = true;
                self.status.formatType = format;
                return false;
            }
        });
        this.htmlElement.media = this.htmlElement.video;
        this._html_initMedia();
    },
    _html_clearMedia: function () {
        if (this.htmlElement.media) {
            if (this.htmlElement.media.id === this.internal.video.id) {
                this.internal.video.jq.css({ 'width': '0px', 'height': '0px' });
            }
            this.htmlElement.media.pause();
            this.htmlElement.media.src = "";

            if (!($.browser.msie && Number($.browser.version) >= 9)) { // IE9 Bug: media.load() on broken src causes an exception. In try/catch IE9 generates the error event too, but it is delayed and corrupts jPlayer's event masking.
                this.htmlElement.media.load(); // Stops an old, "in progress" download from continuing the download. Triggers the loadstart, error and emptied events, due to the empty src. Also an abort event if a download was in progress.
            }
        }
    },
    _html_load: function () {
        if (this.status.waitForLoad) {
            this.status.waitForLoad = false;
            this.htmlElement.media.src = this.status.src;
            try {
                this.htmlElement.media.load(); // IE9 Beta throws an exception here on broken links. Review again later as IE9 Beta matures
            } catch (err) { }
        }
        clearTimeout(this.internal.htmlDlyCmdId);
    },
    _html_play: function (time) {
        var self = this;
        this._html_load(); // Loads if required and clears any delayed commands.

        this.htmlElement.media.play(); // Before currentTime attempt otherwise Firefox 4 Beta never loads.

        if (!isNaN(time)) {
            try {
                this.htmlElement.media.currentTime = time;
            } catch (err) {
                this.internal.htmlDlyCmdId = setTimeout(function () {
                    self.play(time);
                }, 100);
                return; // Cancel execution and wait for the delayed command.
            }
        }
        this._html_checkWaitForPlay();
    },
    _html_pause: function (time) {
        var self = this;

        if (time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation.
            this._html_load(); // Loads if required and clears any delayed commands.
        } else {
            clearTimeout(this.internal.htmlDlyCmdId);
        }

        // Order of these commands is important for Safari (Win) and IE9. Pause then change currentTime.
        this.htmlElement.media.pause();

        if (!isNaN(time)) {
            try {
                this.htmlElement.media.currentTime = time;
            } catch (err) {
                this.internal.htmlDlyCmdId = setTimeout(function () {
                    self.pause(time);
                }, 100);
                return; // Cancel execution and wait for the delayed command.
            }
        }
        if (time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button.
            this._html_checkWaitForPlay();
        }
    },
    _html_playHead: function (percent) {
        var self = this;
        this._html_load(); // Loads if required and clears any delayed commands.
        try {
            if ((typeof this.htmlElement.media.seekable === "object") && (this.htmlElement.media.seekable.length > 0)) {
                this.htmlElement.media.currentTime = percent * this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length - 1) / 100;
            } else if (this.htmlElement.media.duration > 0 && !isNaN(this.htmlElement.media.duration)) {
                this.htmlElement.media.currentTime = percent * this.htmlElement.media.duration / 100;
            } else {
                throw "e";
            }
        } catch (err) {
            this.internal.htmlDlyCmdId = setTimeout(function () {
                self.playHead(percent);
            }, 100);
            return; // Cancel execution and wait for the delayed command.
        }
        if (!this.status.waitForLoad) {
            this._html_checkWaitForPlay();
        }
    },
    _html_checkWaitForPlay: function () {
        if (this.status.waitForPlay) {
            this.status.waitForPlay = false;
            if (this.css.jq.videoPlay.length) {
                this.css.jq.videoPlay.hide();
            }
            if (this.status.video) {
                this.internal.poster.jq.hide();
                this.internal.video.jq.css({ 'width': this.status.width, 'height': this.status.height });
            }
        }
    },
    _html_volume: function (v) {
        if (this.html.audio.available) {
            this.htmlElement.audio.volume = v;
        }
        if (this.html.video.available) {
            this.htmlElement.video.volume = v;
        }
    },
    _html_mute: function (m) {
        if (this.html.audio.available) {
            this.htmlElement.audio.muted = m;
        }
        if (this.html.video.available) {
            this.htmlElement.video.muted = m;
        }
    },
    _flash_setAudio: function (media) {
        var self = this;
        try {
            // Always finds a format due to checks in setMedia()
            $.each(this.formats, function (priority, format) {
                if (self.flash.support[format] && media[format]) {
                    switch (format) {
                        case "m4a":
                            self._getMovie().fl_setAudio_m4a(media[format]);
                            break;
                        case "mp3":
                            self._getMovie().fl_setAudio_mp3(media[format]);
                            break;
                    }
                    self.status.src = media[format];
                    self.status.format[format] = true;
                    self.status.formatType = format;
                    return false;
                }
            });

            if (this.options.preload === 'auto') {
                this._flash_load();
                this.status.waitForLoad = false;
            }
        } catch (err) { this._flashError(err); }
    },
    _flash_setVideo: function (media) {
        var self = this;
        try {
            // Always finds a format due to checks in setMedia()
            $.each(this.formats, function (priority, format) {
                if (self.flash.support[format] && media[format]) {
                    switch (format) {
                        case "m4v":
                            self._getMovie().fl_setVideo_m4v(media[format]);
                            break;
                    }
                    self.status.src = media[format];
                    self.status.format[format] = true;
                    self.status.formatType = format;
                    return false;
                }
            });

            if (this.options.preload === 'auto') {
                this._flash_load();
                this.status.waitForLoad = false;
            }
        } catch (err) { this._flashError(err); }
    },
    _flash_clearMedia: function () {
        this.internal.flash.jq.css({ 'width': '0px', 'height': '0px' }); // Must do via CSS as setting attr() to zero causes a jQuery error in IE.
        try {
            this._getMovie().fl_clearMedia();
        } catch (err) { this._flashError(err); }
    },
    _flash_load: function () {
        try {
            this._getMovie().fl_load();
        } catch (err) { this._flashError(err); }
        this.status.waitForLoad = false;
    },
    _flash_play: function (time) {
        try {
            this._getMovie().fl_play(time);
        } catch (err) { this._flashError(err); }
        this.status.waitForLoad = false;
        this._flash_checkWaitForPlay();
    },
    _flash_pause: function (time) {
        try {
            this._getMovie().fl_pause(time);
        } catch (err) { this._flashError(err); }
        if (time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button.
            this.status.waitForLoad = false;
            this._flash_checkWaitForPlay();
        }
    },
    _flash_playHead: function (p) {
        try {
            this._getMovie().fl_play_head(p)
        } catch (err) { this._flashError(err); }
        if (!this.status.waitForLoad) {
            this._flash_checkWaitForPlay();
        }
    },
    _flash_checkWaitForPlay: function () {
        if (this.status.waitForPlay) {
            this.status.waitForPlay = false;
            if (this.css.jq.videoPlay.length) {
                this.css.jq.videoPlay.hide();
            }
            if (this.status.video) {
                this.internal.poster.jq.hide();
                this.internal.flash.jq.css({ 'width': this.status.width, 'height': this.status.height });
            }
        }
    },
    _flash_volume: function (v) {
        try {
            this._getMovie().fl_volume(v);
        } catch (err) { this._flashError(err); }
    },
    _flash_mute: function (m) {
        try {
            this._getMovie().fl_mute(m);
        } catch (err) { this._flashError(err); }
    },
    _getMovie: function () {
        return document[this.internal.flash.id];
    },
    _checkForFlash: function (version) {
        // Function checkForFlash adapted from FlashReplace by Robert Nyman
        // http://code.google.com/p/flashreplace/
        var flashIsInstalled = false;
        var flash;
        if (window.ActiveXObject) {
            try {
                flash = new ActiveXObject(("ShockwaveFlash.ShockwaveFlash." + version));
                flashIsInstalled = true;
            }
            catch (e) {
                // Throws an error if the version isn't available			
            }
        }
        else if (navigator.plugins && navigator.mimeTypes.length > 0) {
            flash = navigator.plugins["Shockwave Flash"];
            if (flash) {
                var flashVersion = navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/, "$1");
                if (flashVersion >= version) {
                    flashIsInstalled = true;
                }
            }
        }
        if ($.browser.msie && Number($.browser.version) >= 9) { // IE9 does not work with external interface. With dynamic Flash insertion like jPlayer uses.
            return false;
        } else {
            return flashIsInstalled;
        }
    },
    _validString: function (url) {
        return (url && typeof url === "string"); // Empty strings return false
    },
    _limitValue: function (value, min, max) {
        return (value < min) ? min : ((value > max) ? max : value);
    },
    _urlNotSetError: function (context) {
        this._error({
            type: $.jPlayer.error.URL_NOT_SET,
            context: context,
            message: $.jPlayer.errorMsg.URL_NOT_SET,
            hint: $.jPlayer.errorHint.URL_NOT_SET
        });
    },
    _flashError: function (error) {
        this._error({
            type: $.jPlayer.error.FLASH,
            context: this.internal.flash.swf,
            message: $.jPlayer.errorMsg.FLASH + error.message,
            hint: $.jPlayer.errorHint.FLASH
        });
    },
    _error: function (error) {
        this._trigger($.jPlayer.event.error, error);
        if (this.options.errorAlerts) {
            this._alert("Error!" + (error.message ? "\n\n" + error.message : "") + (error.hint ? "\n\n" + error.hint : "") + "\n\nContext: " + error.context);
        }
    },
    _warning: function (warning) {
        this._trigger($.jPlayer.event.warning, undefined, warning);
        if (this.options.errorAlerts) {
            this._alert("Warning!" + (warning.message ? "\n\n" + warning.message : "") + (warning.hint ? "\n\n" + warning.hint : "") + "\n\nContext: " + warning.context);
        }
    },
    _alert: function (message) {
        alert("jPlayer " + this.version.script + " : id='" + this.internal.self.id + "' : " + message);
    }
};

$.jPlayer.error = {
    FLASH: "e_flash",
    NO_SOLUTION: "e_no_solution",
    NO_SUPPORT: "e_no_support",
    URL: "e_url",
    URL_NOT_SET: "e_url_not_set",
    VERSION: "e_version"
};

$.jPlayer.errorMsg = {
    FLASH: "jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ", // Used in: _flashError()
    NO_SOLUTION: "No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.", // Used in: _init()
    NO_SUPPORT: "It is not possible to play any media format provided in setMedia() on this browser using your current options.", // Used in: setMedia()
    URL: "Media URL could not be loaded.", // Used in: jPlayerFlashEvent() and _addHtmlEventListeners()
    URL_NOT_SET: "Attempt to issue media playback commands, while no media url is set.", // Used in: load(), play(), pause(), stop() and playHead()
    VERSION: "jPlayer " + $.jPlayer.prototype.version.script + " needs Jplayer.swf version " + $.jPlayer.prototype.version.needFlash + " but found " // Used in: jPlayerReady()
};

$.jPlayer.errorHint = {
    FLASH: "Check your swfPath option and that Jplayer.swf is there.",
    NO_SOLUTION: "Review the jPlayer options: support and supplied.",
    NO_SUPPORT: "Video or audio formats defined in the supplied option are missing.",
    URL: "Check media URL is valid.",
    URL_NOT_SET: "Use setMedia() to set the media URL.",
    VERSION: "Update jPlayer files."
};

$.jPlayer.warning = {
    CSS_SELECTOR_COUNT: "e_css_selector_count",
    CSS_SELECTOR_METHOD: "e_css_selector_method",
    CSS_SELECTOR_STRING: "e_css_selector_string",
    OPTION_KEY: "e_option_key"
};

$.jPlayer.warningMsg = {
    CSS_SELECTOR_COUNT: "The number of methodCssSelectors found did not equal one: ",
    CSS_SELECTOR_METHOD: "The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",
    CSS_SELECTOR_STRING: "The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",
    OPTION_KEY: "The option requested in jPlayer('option') is undefined."
};

$.jPlayer.warningHint = {
    CSS_SELECTOR_COUNT: "Check your css selector and the ancestor.",
    CSS_SELECTOR_METHOD: "Check your method name.",
    CSS_SELECTOR_STRING: "Check your css selector is a string.",
    OPTION_KEY: "Check your option name."
};
})(jQuery);

/*!
 * linkify - v0.3 - 6/27/2009
 * http://benalman.com/code/test/js-linkify/
 * 
 * Copyright (c) 2009 "Cowboy" Ben Alman
 * Licensed under the MIT license
 * http://benalman.com/about/license/
 * 
 * Some regexps adapted from http://userscripts.org/scripts/review/7122
 */

// Turn text into linkified html.
// 
// var html = linkify( text, options );
// 
// options:
// 
//  callback (Function) - default: undefined - if defined, this will be called
//    for each link- or non-link-chunk with two arguments, text and href. If the
//    chunk is non-link, href will be omitted.
// 
//  punct_regexp (RegExp | Boolean) - a RegExp that can be used to trim trailing
//    punctuation from links, instead of the default.
// 
// This is a work in progress, please let me know if (and how) it fails!

window.linkify = (function(){
  var
    SCHEME = "[a-z\\d.-]+://",
    IPV4 = "(?:(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])",
    HOSTNAME = "(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)+",
    TLD = "(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|com|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xn--0zwm56d|xn--11b5bs3a9aj6g|xn--80akhbyknj4f|xn--9t4b11yi5a|xn--deba0ad|xn--g6w251d|xn--hgbk6aj7f53bba|xn--hlcj6aya9esc7a|xn--jxalpdlp|xn--kgbechtv|xn--zckzah|ye|yt|yu|za|zm|zw)",
    HOST_OR_IP = "(?:" + HOSTNAME + TLD + "|" + IPV4 + ")",
    PATH = "(?:[;/][^#?<>\\s]*)?",
    QUERY_FRAG = "(?:\\?[^#<>\\s]*)?(?:#[^<>\\s]*)?",
    URI1 = "\\b" + SCHEME + "[^<>\\s]+",
    URI2 = "\\b" + HOST_OR_IP + PATH + QUERY_FRAG + "(?!\\w)",
    
    MAILTO = "mailto:",
    EMAIL = "(?:" + MAILTO + ")?[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@" + HOST_OR_IP + QUERY_FRAG + "(?!\\w)",
    
    URI_RE = new RegExp( "(?:" + URI1 + "|" + URI2 + "|" + EMAIL + ")", "ig" ),
    SCHEME_RE = new RegExp( "^" + SCHEME, "i" ),
    
    quotes = {
      "'": "`",
      '>': '<',
      ')': '(',
      ']': '[',
      '}': '{',
      '»': '«',
      '›': '‹'
    },
    
    default_options = {
      callback: function( text, href ) {
        return href ? '<a href="' + href + '" title="' + href + '">' + text + '<\/a>' : text;
      },
      punct_regexp: /(?:[!?.,:;'"]|(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)$/
    };
  
  return function( txt, options ) {
    options = options || {};
    
    // Temp variables.
    var arr,
      i,
      link,
      href,
      
      // Output HTML.
      html = '',
      
      // Store text / link parts, in order, for re-combination.
      parts = [],
      
      // Used for keeping track of indices in the text.
      idx_prev,
      idx_last,
      idx,
      link_last,
      
      // Used for trimming trailing punctuation and quotes from links.
      matches_begin,
      matches_end,
      quote_begin,
      quote_end;
    
    // Initialize options.
    for ( i in default_options ) {
      if ( options[ i ] === undefined ) {
        options[ i ] = default_options[ i ];
      }
    }
    
    // Find links.
    while ( arr = URI_RE.exec( txt ) ) {
      
      link = arr[0];
      idx_last = URI_RE.lastIndex;
      idx = idx_last - link.length;
      
      // Not a link if preceded by certain characters.
      if ( /[\/:]/.test( txt.charAt( idx - 1 ) ) ) {
        continue;
      }
      
      // Trim trailing punctuation.
      do {
        // If no changes are made, we don't want to loop forever!
        link_last = link;
        
        quote_end = link.substr( -1 )
        quote_begin = quotes[ quote_end ];
        
        // Ending quote character?
        if ( quote_begin ) {
          matches_begin = link.match( new RegExp( '\\' + quote_begin + '(?!$)', 'g' ) );
          matches_end = link.match( new RegExp( '\\' + quote_end, 'g' ) );
          
          // If quotes are unbalanced, remove trailing quote character.
          if ( ( matches_begin ? matches_begin.length : 0 ) < ( matches_end ? matches_end.length : 0 ) ) {
            link = link.substr( 0, link.length - 1 );
            idx_last--;
          }
        }
        
        // Ending non-quote punctuation character?
        if ( options.punct_regexp ) {
          link = link.replace( options.punct_regexp, function(a){
            idx_last -= a.length;
            return '';
          });
        }
      } while ( link.length && link !== link_last );
      
      href = link;
      
      // Add appropriate protocol to naked links.
      if ( !SCHEME_RE.test( href ) ) {
        href = ( href.indexOf( '@' ) !== -1 ? ( !href.indexOf( MAILTO ) ? '' : MAILTO )
          : !href.indexOf( 'irc.' ) ? 'irc://'
          : !href.indexOf( 'ftp.' ) ? 'ftp://'
          : 'http://' )
          + href;
      }
      
      // Push preceding non-link text onto the array.
      if ( idx_prev != idx ) {
        parts.push([ txt.slice( idx_prev, idx ) ]);
        idx_prev = idx_last;
      }
      
      // Push massaged link onto the array
      parts.push([ link, href ]);
    };
    
    // Push remaining non-link text onto the array.
    parts.push([ txt.substr( idx_prev ) ]);
    
    // Process the array items.
    for ( i = 0; i < parts.length; i++ ) {
      html += options.callback.apply( window, parts[i] );
    }
    
    // In case of catastrophic failure, return the original text;
    return html || txt;
  };
  
})();
