/**
 * @file ajaxView.js
 *
 * Handles AJAX fetching of views, including filter submission and response.
 */
(function ($) {

/**
 * Attaches the AJAX behavior to Views exposed filter forms and key View links.
 */
Drupal.behaviors.ViewsAjaxView = {};
Drupal.behaviors.ViewsAjaxView.attach = function() {
  if (Drupal.settings && Drupal.settings.views && Drupal.settings.views.ajaxViews) {
    $.each(Drupal.settings.views.ajaxViews, function(i, settings) {
      // @todo: Figure out where to store the object.
      new Drupal.views.ajaxView(settings);
    });
  }
};

Drupal.views = {};

/**
 * Javascript object for a certain view.
 */
Drupal.views.ajaxView = function(settings) {
  var selector = '.view-dom-id-' + settings.view_dom_id;
  this.$view = $(selector);

  // Retrieve the path to use for views' ajax.
  var ajax_path = Drupal.settings.views.ajax_path;

  // If there are multiple views this might've ended up showing up multiple times.
  if (ajax_path.constructor.toString().indexOf("Array") != -1) {
    ajax_path = ajax_path[0];
  }

  this.element_settings = {
    url: ajax_path,
    submit: settings,
    setClick: true,
    event: 'click',
    selector: selector,
    progress: { type: 'throbber' }
  };

  this.settings = settings;

  // Add the ajax to exposed forms.
  this.$exposed_form = $('form#views-exposed-form-'+ settings.view_name.replace(/_/g, '-') + '-' + settings.view_display_id.replace(/_/g, '-'));
  this.$exposed_form.once(jQuery.proxy(this.attachExposedFormAjax, this));

  // Add the ajax to pagers.
  this.$view
    // Don't attach to nested views. Doing so would attach multiple behaviors
    // to a given element.
    .filter(jQuery.proxy(this.filterNestedViews, this))
    .once(jQuery.proxy(this.attachPagerAjax, this));
};

Drupal.views.ajaxView.prototype.attachExposedFormAjax = function() {
  var button = $('input[type=submit], input[type=image]', this.$exposed_form);
  button = button[0];

  this.exposedFormAjax = new Drupal.ajax($(button).attr('id'), button, this.element_settings);
};

Drupal.views.ajaxView.prototype.filterNestedViews= function() {
  // If there is at least one parent with a view class, this view
  // is nested (e.g., an attachment). Bail.
  return !this.$view.parents('.view').size();
};

/**
 * Attach the ajax behavior to each link.
 */
Drupal.views.ajaxView.prototype.attachPagerAjax = function() {
  this.$view.find('ul.pager > li > a, th.views-field a, .attachment .views-summary a')
  .each(jQuery.proxy(this.attachPagerLinkAjax, this));
};

/**
 * Attach the ajax behavior to a singe link.
 */
Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function(id, link) {
  var $link = $(link);
  var viewData = {};
  var href = $link.attr('href');
  // Construct an object using the settings defaults and then overriding
  // with data specific to the link.
  $.extend(
    viewData,
    this.settings,
    Drupal.Views.parseQueryString(href),
    // Extract argument data from the URL.
    Drupal.Views.parseViewArgs(href, this.settings.view_base_path)
  );

  // For anchor tags, these will go to the target of the anchor rather
  // than the usual location.
  $.extend(viewData, Drupal.Views.parseViewArgs(href, this.settings.view_base_path));

  this.element_settings.submit = viewData;
  this.pagerAjax = new Drupal.ajax(false, $link, this.element_settings);
};

})(jQuery);
;
(function($) {
  $(function() {

    // Add the media object.
    jQuery.media = jQuery.media ? jQuery.media : {};

    // Connecting the media blocks to the player.
    var mediaplayer = null;
    var mediaNids = [];
    var mediaIndex = 0;
    var mediaSelected = 'mediafront-selected-media';

    // Get the previous media node.
    jQuery.media.prevMedia = function() {
      mediaIndex = (mediaIndex > 0) ? (mediaIndex - 1) : (mediaNids.length - 1);
      return jQuery.media.nodes[mediaNids[mediaIndex]];
    };

    // Get the next media node.
    jQuery.media.nextMedia = function() {
      mediaIndex = (mediaIndex < (mediaNids.length - 1)) ? (mediaIndex + 1) : 0;
      return jQuery.media.nodes[mediaNids[mediaIndex]];
    };

    // Loads a node by checking to see if it is a full object or not.
    jQuery.media.loadNode = function( node ) {
      if (mediaplayer && node && node.nid) {
        mediaplayer.node.setNode(node);
      }
    };

    // Load the next media.
    jQuery.media.loadNext = function() {
      $("." + mediaSelected).removeClass(mediaSelected);
      var newMedia = jQuery.media.nextMedia();
      $(jQuery.media.fieldSelector).eq(mediaIndex).parent().addClass(mediaSelected);
      jQuery.media.loadNode(newMedia);
    };

    // Load the previous media.
    jQuery.media.loadPrev = function() {
      $("." + mediaSelected).removeClass(mediaSelected);
      var newMedia = jQuery.media.prevMedia();
      $(jQuery.media.fieldSelector).eq(mediaIndex).parent().addClass(mediaSelected);
      jQuery.media.loadNode(newMedia);
    };

    // Only call this if the code is available.
    if (jQuery.media.onLoaded) {

      // Register for media complete events, and load the next media on completion.
      jQuery.media.onLoaded(jQuery.media.playerId, function( player ) {

        // Set the mediaplayer.
        mediaplayer = player;

        // Bind the media update for when one media completes.
        player.node.player.display.bind( "mediaupdate", function( event, data ) {
          if( data.type == 'complete' && jQuery.media.hasMedia ) {
            jQuery.media.loadNext();
          }
        });

        // Load the first media.
        $(jQuery.media.fieldSelector).eq(0).parent().addClass(mediaSelected);
        jQuery.media.loadNode(jQuery.media.nodes[mediaNids[0]]);
      });
    }

    // Iterate through all of the nid fields.
    $(jQuery.media.fieldSelector).each(function(index) {

      // Get the nid for this item.
      var nid = $(this).parent().find('.views-field-mediafront-nid .media-nid-hidden').text();
      mediaNids.push(nid);

      // Alter the parent handler so that this becomes a link to the main player.
      $(this).parent().css("cursor", "pointer").bind('click', {nid:nid, index:index}, function(event) {
        event.preventDefault();
        $("." + mediaSelected).removeClass(mediaSelected);
        $(this).addClass(mediaSelected);
        mediaIndex = event.data.index;
        jQuery.media.loadNode( jQuery.media.nodes[event.data.nid] );
      });
    });

    // Handle when a user clicks on the next button.
    $("#mediaplayer_next").click(function(event) {
      event.preventDefault();
      jQuery.media.loadNext();
    });

    // Handle when a user clicks on the previous button.
    $("#mediaplayer_prev").click(function(event) {
      event.preventDefault();
      jQuery.media.loadPrev();
    });
  });
}(jQuery));;
/**
 *  Copyright (c) 2010 Alethia Inc,
 *  http://www.alethia-inc.com
 *  Developed by Travis Tidwell | travist at alethia-inc.com 
 *
 *  License:  GPL version 3.
 *
 *  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(c){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media=jQuery.extend({},{auto:function(d){return new (function(e){this.json=jQuery.media.json(e);this.rpc=jQuery.media.rpc(e);this.call=function(j,i,f,h,g){if(g=="json"){this.json.call(j,i,f,h,g);}else{this.rpc.call(j,i,f,h,g);}};})(d);}},jQuery.media);jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{volumeVertical:false});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{currentTime:"#mediacurrenttime",totalTime:"#mediatotaltime",playPause:"#mediaplaypause",seekUpdate:"#mediaseekupdate",seekProgress:"#mediaseekprogress",seekBar:"#mediaseekbar",seekHandle:"#mediaseekhandle",volumeUpdate:"#mediavolumeupdate",volumeBar:"#mediavolumebar",volumeHandle:"#mediavolumehandle",mute:"#mediamute"});jQuery.fn.mediacontrol=function(d){if(this.length===0){return null;}return new (function(g,e){e=jQuery.media.utils.getSettings(e);this.display=g;var h=this;this.formatTime=(e.template&&e.template.formatTime)?e.template.formatTime:function(l){l=l?l:0;var m=0;var j=0;var i=0;i=Math.floor(l/3600);l-=(i*3600);j=Math.floor(l/60);l-=(j*60);m=Math.floor(l%60);var k="";if(i){k+=String(i);k+=":";}k+=(j>=10)?String(j):("0"+String(j));k+=":";k+=(m>=10)?String(m):("0"+String(m));return{time:k,units:""};};this.setToggle=function(j,k){var i=k?".on":".off";var l=k?".off":".on";if(j){j.find(i).show();j.find(l).hide();}};var f=this.formatTime(0);this.duration=0;this.volume=-1;this.prevVolume=0;this.percentLoaded=0;this.playState=false;this.muteState=false;this.currentTime=g.find(e.ids.currentTime).text(f.time);this.totalTime=g.find(e.ids.totalTime).text(f.time);this.display.find("a.mediaplayerlink").each(function(){var i=c(this).attr("href");c(this).medialink(e,function(j){j.preventDefault();h.display.trigger(j.data.id);},{id:i.substr(1),obj:c(this)});});this.playPauseButton=g.find(e.ids.playPause).medialink(e,function(i,j){h.playState=!h.playState;h.setToggle(j,h.playState);h.display.trigger("controlupdate",{type:(h.playState?"pause":"play")});});this.seekUpdate=g.find(e.ids.seekUpdate).css("width",0);this.seekProgress=g.find(e.ids.seekProgress).css("width",0);this.seekBar=g.find(e.ids.seekBar).mediaslider(e.ids.seekHandle,false);if(this.seekBar){this.seekBar.display.unbind("setvalue").bind("setvalue",function(i,j){h.seekUpdate.css("width",(j*h.seekBar.trackSize)+"px");h.display.trigger("controlupdate",{type:"seek",value:(j*h.duration)});});this.seekBar.display.unbind("updatevalue").bind("updatevalue",function(i,j){h.seekUpdate.css("width",(j*h.seekBar.trackSize)+"px");});}this.setVolume=function(i){if(this.volumeBar){if(e.volumeVertical){this.volumeUpdate.css({marginTop:(this.volumeBar.handlePos+this.volumeBar.handleMid),height:(this.volumeBar.trackSize-this.volumeBar.handlePos)});}else{this.volumeUpdate.css("width",(i*this.volumeBar.trackSize));}}};this.volumeUpdate=g.find(e.ids.volumeUpdate);this.volumeBar=g.find(e.ids.volumeBar).mediaslider(e.ids.volumeHandle,e.volumeVertical,e.volumeVertical);if(this.volumeBar){this.volumeBar.display.unbind("setvalue").bind("setvalue",function(i,j){h.setVolume(j);h.display.trigger("controlupdate",{type:"volume",value:j});});this.volumeBar.display.unbind("updatevalue").bind("updatevalue",function(i,j){h.setVolume(j);h.volume=j;});}this.mute=g.find(e.ids.mute).medialink(e,function(i,j){h.muteState=!h.muteState;h.setToggle(j,h.muteState);h.setMute(h.muteState);});this.setMute=function(i){this.prevVolume=(this.volumeBar.value>0)?this.volumeBar.value:this.prevVolume;this.volumeBar.updateValue(i?0:this.prevVolume);this.display.trigger("controlupdate",{type:"mute",value:i});};this.setProgress=function(i){if(this.seekProgress&&this.seekBar){this.seekProgress.css("width",(i*(this.seekBar.trackSize+this.seekBar.handleSize)));}};this.onResize=function(){if(this.seekBar){this.seekBar.onResize();}this.setProgress(this.percentLoaded);};this.onMediaUpdate=function(i){switch(i.type){case"reset":this.reset();break;case"paused":this.playState=true;this.setToggle(this.playPauseButton.display,this.playState);break;case"playing":this.playState=false;this.setToggle(this.playPauseButton.display,this.playState);break;case"stopped":this.playState=true;this.setToggle(this.playPauseButton.display,this.playState);break;case"progress":this.percentLoaded=i.percentLoaded;this.setProgress(this.percentLoaded);break;case"meta":case"update":this.timeUpdate(i.currentTime,i.totalTime);if(this.volumeBar){this.volumeBar.updateValue(i.volume);}break;default:break;}};this.reset=function(){this.totalTime.text(this.formatTime(0).time);this.currentTime.text(this.formatTime(0).time);if(this.seekBar){this.seekBar.updateValue(0);}this.seekUpdate.css("width","0px");this.seekProgress.css("width","0px");};this.timeUpdate=function(i,j){this.duration=j;this.totalTime.text(this.formatTime(j).time);this.currentTime.text(this.formatTime(i).time);if(j&&this.seekBar&&!this.seekBar.dragging){this.seekBar.updateValue(i/j);}};this.timeUpdate(0,0);})(this,d);};window.onDailymotionPlayerReady=function(d){d=d.replace("_media","");jQuery.media.players[d].node.player.media.player.onReady();};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{dailymotion:function(d){return(d.search(/^http(s)?\:\/\/(www\.)?dailymotion\.com/i)===0);}});jQuery.fn.mediadailymotion=function(e,d){return new (function(h,g,f){this.display=h;var i=this;this.player=null;this.videoFile=null;this.meta=false;this.loaded=false;this.ready=false;this.createMedia=function(k,m){this.videoFile=k;this.ready=false;var j=(g.id+"_media");var l=Math.floor(Math.random()*1000000);var n="http://www.dailymotion.com/swf/"+k.path+"?rand="+l+"&amp;enablejsapi=1&amp;playerapiid="+j;jQuery.media.utils.insertFlash(this.display,n,j,"100%","100%",{},g.wmode,function(o){i.player=o;i.loadPlayer();});};this.loadMedia=function(j){if(this.player){this.loaded=false;this.meta=false;this.videoFile=j;f({type:"playerready"});this.player.loadVideoById(this.videoFile.path,0);}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){window[g.id+"StateChange"]=function(j){i.onStateChange(j);};window[g.id+"PlayerError"]=function(j){i.onError(j);};this.player.addEventListener("onStateChange",g.id+"StateChange");this.player.addEventListener("onError",g.id+"PlayerError");f({type:"playerready"});this.player.loadVideoById(this.videoFile.path,0);}};this.onStateChange=function(k){var j=this.getPlayerState(k);if(!(!this.meta&&j.state=="stopped")){f({type:j.state,busy:j.busy});}if(!this.loaded&&j.state=="buffering"){this.loaded=true;f({type:"paused",busy:"hide"});if(g.autostart){this.playMedia();}}if(!this.meta&&j.state=="playing"){this.meta=true;f({type:"meta"});}};this.onError=function(k){var j="An unknown error has occured: "+k;if(k==100){j="The requested video was not found.  ";j+="This occurs when a video has been removed (for any reason), ";j+="or it has been marked as private.";}else{if((k==101)||(k==150)){j="The video requested does not allow playback in an embedded player.";}}f({type:"error",data:j});};this.getPlayerState=function(j){switch(j){case 5:return{state:"ready",busy:false};case 3:return{state:"buffering",busy:"show"};case 2:return{state:"paused",busy:"hide"};case 1:return{state:"playing",busy:"hide"};case 0:return{state:"complete",busy:false};case -1:return{state:"stopped",busy:false};default:return{state:"unknown",busy:false};}return"unknown";};this.playMedia=function(){f({type:"buffering",busy:"show"});this.player.playVideo();};this.pauseMedia=function(){this.player.pauseVideo();};this.stopMedia=function(){this.player.stopVideo();};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(g.id+"_media"));this.display.children().remove();};this.seekMedia=function(j){f({type:"buffering",busy:"show"});this.player.seekTo(j,true);};this.setVolume=function(j){this.player.setVolume(j*100);};this.getVolume=function(){return(this.player.getVolume()/100);};this.getDuration=function(){return this.player.getDuration();};this.getCurrentTime=function(){return this.player.getCurrentTime();};this.getBytesLoaded=function(){return this.player.getVideoBytesLoaded();};this.getBytesTotal=function(){return this.player.getVideoBytesTotal();};this.getEmbedCode=function(){return this.player.getVideoEmbedCode();};this.getMediaLink=function(){return this.player.getVideoUrl();};this.hasControls=function(){return true;};this.showControls=function(j){};this.setQuality=function(j){};this.getQuality=function(){return"";};})(this,e,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{volume:80,autostart:false,streamer:"",embedWidth:450,embedHeight:337,wmode:"transparent",forceOverflow:false,quality:"default",repeat:false});jQuery.fn.mediadisplay=function(d){if(this.length===0){return null;}return new (function(f,e){this.settings=jQuery.media.utils.getSettings(e);this.display=f;var g=this;this.volume=-1;this.player=null;this.preview="";this.updateInterval=null;this.progressInterval=null;this.playQueue=[];this.playIndex=0;this.playerReady=false;this.loaded=false;this.mediaFile=null;this.hasPlaylist=false;if(this.settings.forceOverflow){this.display.parents().css("overflow","visible");}this.reset=function(){this.loaded=false;this.stopMedia();clearInterval(this.progressInterval);clearInterval(this.updateInterval);this.playQueue.length=0;this.playQueue=[];this.playIndex=0;this.playerReady=false;this.mediaFile=null;this.display.empty().trigger("mediaupdate",{type:"reset"});};this.getPlayableMedia=function(l){var k=null;var h=l.length;while(h--){var j=new jQuery.media.file(l[h],this.settings);if(!k||(j.weight<k.weight)){k=j;}}return k;};this.getMediaFile=function(h){if(h){var i=typeof h;if(((i==="object")||(i==="array"))&&h[0]){h=this.getPlayableMedia(h);}}return h;};this.addToQueue=function(h){if(h){this.playQueue.push(this.getMediaFile(h));}};this.loadFiles=function(i){if(i){this.playQueue.length=0;this.playQueue=[];this.playIndex=0;this.addToQueue(i.intro);this.addToQueue(i.commercial);this.addToQueue(i.prereel);this.addToQueue(i.media);this.addToQueue(i.postreel);}var h=(this.playQueue.length>0);if(!h){if(this.player){this.player.destroy();this.player=null;}this.display.trigger("mediaupdate",{type:"nomedia"});}return h;};this.playNext=function(){if(this.playQueue.length>this.playIndex){this.loadMedia(this.playQueue[this.playIndex]);this.playIndex++;}else{if(this.settings.repeat){this.playIndex=0;this.playNext();}else{if(this.hasPlaylist){this.reset();}else{this.loaded=false;this.settings.autostart=false;this.playIndex=0;this.playNext();}}}};this.loadMedia=function(i,h){if(i){i=new jQuery.media.file(this.getMediaFile(i),this.settings);i.player=h?h:i.player;this.stopMedia();if(!this.mediaFile||(this.mediaFile.player!=i.player)){this.player=null;this.playerReady=false;if(i.player){this.player=this.display["media"+i.player](this.settings,function(j){g.onMediaUpdate(j);});}if(this.player){this.player.createMedia(i,this.preview);}}else{if(this.player){this.player.loadMedia(i);}}this.mediaFile=i;this.onMediaUpdate({type:"initialize"});}};this.onMediaUpdate=function(i){switch(i.type){case"playerready":this.playerReady=true;this.player.setVolume(0);this.player.setQuality(this.settings.quality);this.startProgress();break;case"buffering":this.startProgress();break;case"stopped":clearInterval(this.progressInterval);clearInterval(this.updateInterval);break;case"error":if(i.code==4){this.loadMedia(this.mediaFile,"flash");}else{clearInterval(this.progressInterval);clearInterval(this.updateInterval);}break;case"paused":clearInterval(this.updateInterval);break;case"playing":this.startUpdate();break;case"progress":var h=this.getPercentLoaded();jQuery.extend(i,{percentLoaded:h});if(h>=1){clearInterval(this.progressInterval);}break;case"meta":jQuery.extend(i,{currentTime:this.player.getCurrentTime(),totalTime:this.getDuration(),volume:this.player.getVolume(),quality:this.getQuality()});break;case"durationupdate":this.mediaFile.duration=i.duration;break;case"complete":this.playNext();break;default:break;}if(i.type=="playing"&&!this.loaded){if(this.settings.autoLoad&&!this.settings.autostart){setTimeout(function(){g.setVolume();g.player.pauseMedia();g.settings.autostart=true;g.loaded=true;},100);}else{this.loaded=true;this.setVolume();this.display.trigger("mediaupdate",i);}}else{this.display.trigger("mediaupdate",i);}};this.startProgress=function(){if(this.playerReady){clearInterval(this.progressInterval);this.progressInterval=setInterval(function(){g.onMediaUpdate({type:"progress"});},500);}};this.startUpdate=function(){if(this.playerReady){clearInterval(this.updateInterval);this.updateInterval=setInterval(function(){if(g.playerReady){g.onMediaUpdate({type:"update",currentTime:g.player.getCurrentTime(),totalTime:g.getDuration(),volume:g.player.getVolume(),quality:g.getQuality()});}},1000);}};this.stopMedia=function(){this.loaded=false;clearInterval(this.progressInterval);clearInterval(this.updateInterval);if(this.playerReady){this.player.stopMedia();}};this.mute=function(h){this.player.setVolume(h?0:this.volume);};this.onResize=function(){if(this.player&&this.player.onResize){this.player.onResize();}};this.getPercentLoaded=function(){if(this.player.getPercentLoaded){return this.player.getPercentLoaded();}else{var i=this.player.getBytesLoaded();var h=this.mediaFile.bytesTotal?this.mediaFile.bytesTotal:this.player.getBytesTotal();return h?(i/h):0;}};this.showControls=function(h){if(this.playerReady){this.player.showControls(h);}};this.hasControls=function(){if(this.player){return this.player.hasControls();}return false;};this.getDuration=function(){if(this.mediaFile){if(!this.mediaFile.duration){this.mediaFile.duration=this.player.getDuration();}return this.mediaFile.duration;}else{return 0;}};this.setVolume=function(h){this.volume=h?h:((this.volume==-1)?(this.settings.volume/100):this.volume);if(this.player){this.player.setVolume(this.volume);}};this.getVolume=function(){if(!this.volume){this.volume=this.player.getVolume();}return this.volume;};this.getQuality=function(){if(!this.mediaFile.quality){this.mediaFile.quality=this.player.getQuality();}return this.mediaFile.quality;};})(this,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{apiKey:"",api:2,sessid:"",drupalVersion:6});jQuery.media=jQuery.extend({},{drupal:function(e,d){return new (function(k,j){j=jQuery.media.utils.getSettings(j);var l=this;var g=(j.apiKey.length>0);var i=(j.api==1);var f=(j.drupalVersion>=6)?"node.get":"node.load";var h=(j.protocol=="auto");jQuery.media=jQuery.extend({},{commands:{connect:{command:{rpc:"system.connect",json:""},useKey:i,protocol:"rpc"},mail:{command:{rpc:"system.mail",json:""},useKey:g,protocol:"rpc"},loadNode:{command:{rpc:f,json:"mediafront_getnode"},useKey:i,protocol:"json"},getPlaylist:{command:{rpc:"mediafront.getPlaylist",json:"mediafront_getplaylist"},useKey:i,protocol:"json"},getVote:{command:{rpc:"vote.getVote",json:""},useKey:i,protocol:"rpc"},setVote:{command:{rpc:"vote.setVote",json:""},useKey:g,protocol:"rpc"},getUserVote:{command:{rpc:"vote.getUserVote",json:""},useKey:i,protocol:"rpc"},deleteVote:{command:{rpc:"vote.deleteVote",json:""},useKey:g,protocol:"rpc"},addTag:{command:{rpc:"tag.addTag",json:""},useKey:g,protocol:"rpc"},incrementCounter:{command:{rpc:"mediafront.incrementNodeCounter",json:""},useKey:g,protocol:"rpc"},setFavorite:{command:{rpc:"favorites.setFavorite",json:""},useKey:g,protocol:"rpc"},deleteFavorite:{command:{rpc:"favorites.deleteFavorite",json:""},useKey:g,protocol:"rpc"},isFavorite:{command:{rpc:"favorites.isFavorite",json:""},useKey:i,protocol:"rpc"},login:{command:{rpc:"user.login",json:""},useKey:g,protocol:"rpc"},logout:{command:{rpc:"user.logout",json:""},useKey:g,protocol:"rpc"},adClick:{command:{rpc:"mediafront.adClick",json:""},useKey:g,protocol:"rpc"},getAd:{command:{rpc:"mediafront.getAd",json:""},useKey:i,protocol:"rpc"},setUserStatus:{command:{rpc:"mediafront.setUserStatus",json:""},useKey:g,protocol:"rpc"}}},jQuery.media);this.user={};this.sessionId="";this.onConnected=null;this.encoder=new jQuery.media.sha256();this.baseURL=j.baseURL.substring(0,(j.baseURL.length-1)).replace(/^(http[s]?\:[\\\/][\\\/])/,"");this.connect=function(m){this.onConnected=m;if(j.sessid){this.onConnect({sessid:j.sessid});}else{this.call(jQuery.media.commands.connect,function(n){l.onConnect(n);},null);}};this.call=function(r,q,o){var m=[];for(var n=3;n<arguments.length;n++){m.push(arguments[n]);}m=this.setupArgs(r,m);var p=h?r.protocol:j.protocol;var s=r.command[p];if(s){k.call(s,q,o,m,p);}else{if(q){q(null);}}};this.setupArgs=function(q,m){m.unshift(this.sessionId);if(q.useKey){if(j.api>1){var o=this.getTimeStamp();var n=this.getNonce();var p=this.computeHMAC(o,this.baseURL,n,q.command.rpc,j.apiKey);m.unshift(n);m.unshift(o);m.unshift(this.baseURL);m.unshift(p);}else{m.unshift(j.apiKey);}}return m;};this.getTimeStamp=function(){return(parseInt(new Date().getTime()/1000,10)).toString();};this.getNonce=function(){var p="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var n="";for(var o=0;o<10;o++){var m=Math.floor(Math.random()*p.length);n+=p.substring(m,m+1);}return n;};this.computeHMAC=function(p,o,n,r,q){var m=p+";"+o+";"+n+";"+r;return this.encoder.encrypt(q,m);};this.onConnect=function(m){if(m){this.sessionId=m.sessid;this.user=m.user;}if(this.onConnected){this.onConnected(m);}};})(e,d);}},jQuery.media);jQuery.media.checkPlayType=function(e,d){if((typeof e.canPlayType)=="function"){return("no"!==e.canPlayType(d))&&(""!==e.canPlayType(d));}else{return false;}};jQuery.media.getPlayTypes=function(){var d={};var e=document.createElement("video");d.ogg=jQuery.media.checkPlayType(e,'video/ogg; codecs="theora, vorbis"');d.h264=jQuery.media.checkPlayType(e,'video/mp4; codecs="avc1.42E01E, mp4a.40.2"');d.webm=jQuery.media.checkPlayType(e,'video/webm; codecs="vp8, vorbis"');e=document.createElement("audio");d.audioOgg=jQuery.media.checkPlayType(e,"audio/ogg");d.mp3=jQuery.media.checkPlayType(e,"audio/mpeg");return d;};jQuery.media.playTypes=null;jQuery.media.file=function(d,e){if(!jQuery.media.playTypes){jQuery.media.playTypes=jQuery.media.getPlayTypes();}d=(typeof d==="string")?{path:d}:d;this.duration=d.duration?d.duration:0;this.bytesTotal=d.bytesTotal?d.bytesTotal:0;this.quality=d.quality?d.quality:0;this.stream=e.streamer?e.streamer:d.stream;this.path=d.path?jQuery.trim(d.path):(e.baseURL+jQuery.trim(d.filepath));this.extension=d.extension?d.extension:this.getFileExtension();this.weight=d.weight?d.weight:this.getWeight();this.player=d.player?d.player:this.getPlayer();this.mimetype=d.mimetype?d.mimetype:this.getMimeType();this.type=d.type?d.type:this.getType();};jQuery.media.file.prototype.getFileExtension=function(){return this.path.substring(this.path.lastIndexOf(".")+1).toLowerCase();};jQuery.media.file.prototype.getPlayer=function(){switch(this.extension){case"ogg":case"ogv":return jQuery.media.playTypes.ogg?"html5":"flash";case"mp4":case"m4v":return jQuery.media.playTypes.h264?"html5":"flash";case"webm":return jQuery.media.playTypes.webm?"html5":"flash";case"oga":return jQuery.media.playTypes.audioOgg?"html5":"flash";case"mp3":return jQuery.media.playTypes.mp3?"html5":"flash";case"swf":case"flv":case"f4v":case"f4a":case"mov":case"3g2":case"3gp":case"3gpp":case"m4a":case"aac":case"wav":case"aif":case"wma":return"flash";default:for(var d in jQuery.media.playerTypes){if(jQuery.media.playerTypes.hasOwnProperty(d)){if(jQuery.media.playerTypes[d](this.path)){return d;}}}break;}return"flash";};jQuery.media.file.prototype.getType=function(){switch(this.extension){case"swf":case"webm":case"ogg":case"ogv":case"mp4":case"m4v":case"flv":case"f4v":case"mov":case"3g2":case"3gp":case"3gpp":return"video";case"oga":case"mp3":case"f4a":case"m4a":case"aac":case"wav":case"aif":case"wma":return"audio";default:break;}return"";};jQuery.media.file.prototype.getWeight=function(){switch(this.extension){case"mp4":case"m4v":case"m4a":return jQuery.media.playTypes.h264?3:7;case"webm":return jQuery.media.playTypes.webm?4:8;case"ogg":case"ogv":return jQuery.media.playTypes.ogg?5:20;case"oga":return jQuery.media.playTypes.audioOgg?5:20;case"mp3":return 6;case"mov":case"swf":case"flv":case"f4v":case"f4a":case"3g2":case"3gp":case"3gpp":return 9;case"wav":case"aif":case"aac":return 10;case"wma":return 11;default:break;}return 0;};jQuery.media.file.prototype.getMimeType=function(){switch(this.extension){case"mp4":case"m4v":case"flv":case"f4v":return"video/mp4";case"webm":return"video/x-webm";case"ogg":case"ogv":return"video/ogg";case"3g2":return"video/3gpp2";case"3gpp":case"3gp":return"video/3gpp";case"mov":return"video/quicktime";case"swf":return"application/x-shockwave-flash";case"oga":return"audio/ogg";case"mp3":return"audio/mpeg";case"m4a":case"f4a":return"audio/mp4";case"aac":return"audio/aac";case"wav":return"audio/vnd.wave";case"wma":return"audio/x-ms-wma";default:break;}return"";};window.onFlashPlayerReady=function(d){jQuery.media.players[d].node.player.media.player.onReady();};window.onFlashPlayerUpdate=function(e,d){jQuery.media.players[e].node.player.media.player.onMediaUpdate(d);};window.onFlashPlayerDebug=function(d){if(window.console&&console.log){console.log(d);}};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{flashPlayer:"./flash/mediafront.swf",skin:"default",config:"nocontrols"});jQuery.fn.mediaflash=function(e,d){return new (function(h,g,f){g=jQuery.media.utils.getSettings(g);this.display=h;var i=this;this.player=null;this.mediaFile=null;this.preview="";this.ready=false;this.translate={mediaConnected:"connected",mediaBuffering:"buffering",mediaPaused:"paused",mediaPlaying:"playing",mediaStopped:"stopped",mediaComplete:"complete",mediaMeta:"meta"};this.busy={mediaConnected:false,mediaBuffering:"show",mediaPaused:"hide",mediaPlaying:"hide",mediaStopped:false,mediaComplete:false,mediaMeta:false};this.createMedia=function(j,n){this.mediaFile=j;this.preview=n;this.ready=false;var l=(g.id+"_media");var m=Math.floor(Math.random()*1000000);var o=g.flashPlayer+"?rand="+m;var k={config:g.config,id:g.id,file:j.path,image:this.preview,skin:g.skin,autostart:(g.autostart||!g.autoLoad)};if(j.stream){k.stream=j.stream;}if(g.debug){k.debug="1";}jQuery.media.utils.insertFlash(this.display,o,l,"100%","100%",k,g.wmode,function(p){i.player=p;i.loadPlayer();});};this.loadMedia=function(j){if(this.player&&this.ready){this.mediaFile=j;this.player.loadMedia(j.path,j.stream);f({type:"playerready"});}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){f({type:"playerready"});}};this.onMediaUpdate=function(j){f({type:this.translate[j],busy:this.busy[j]});};this.playMedia=function(){if(this.player&&this.ready){this.player.playMedia();}};this.pauseMedia=function(){if(this.player&&this.ready){this.player.pauseMedia();}};this.stopMedia=function(){if(this.player&&this.ready){this.player.stopMedia();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(g.id+"_media"));this.display.children().remove();};this.seekMedia=function(j){if(this.player&&this.ready){this.player.seekMedia(j);}};this.setVolume=function(j){if(this.player&&this.ready){this.player.setVolume(j);}};this.getVolume=function(){return(this.player&&this.ready)?this.player.getVolume():0;};this.getDuration=function(){return(this.player&&this.ready)?this.player.getDuration():0;};this.getCurrentTime=function(){return(this.player&&this.ready)?this.player.getCurrentTime():0;};this.getBytesLoaded=function(){return(this.player&&this.ready)?this.player.getMediaBytesLoaded():0;};this.getBytesTotal=function(){return(this.player&&this.ready)?this.player.getMediaBytesTotal():0;};this.hasControls=function(){return true;};this.showControls=function(j){if(this.player&&this.ready){this.player.showPlugin("controlBar",j);this.player.showPlugin("playLoader",j);}};this.getEmbedCode=function(){var j={config:"config",id:"mediafront_player",file:this.mediaFile.path,image:this.preview,skin:g.skin};if(this.mediaFile.stream){j.stream=this.mediaFile.stream;}return jQuery.media.utils.getFlash(g.flashPlayer,"mediafront_player",g.embedWidth,g.embedHeight,j,g.wmode);};this.setQuality=function(j){};this.getQuality=function(){return"";};this.getMediaLink=function(){return"This video currently does not have a link.";};})(this,e,d);};jQuery.fn.mediahtml5=function(e,d){return new (function(h,g,f){this.display=h;var i=this;this.player=null;this.bytesLoaded=0;this.bytesTotal=0;this.mediaType="";this.loaded=false;this.mediaFile=null;this.playerElement=null;this.getPlayer=function(j,n){this.mediaFile=j;var k=g.id+"_"+this.mediaType;var m="<"+this.mediaType+' style="position:absolute" id="'+k+'"';m+=n?' poster="'+n+'"':"";if(typeof j==="array"){m+=">";var l=j.length;while(l){l--;m+='<source src="'+j[l].path+'" type="'+j[l].mimetype+'">';}}else{m+=' src="'+j.path+'">Unable to display media.';}m+="</"+this.mediaType+">";this.display.append(m);this.bytesTotal=j.bytesTotal;this.playerElement=this.display.find("#"+k);this.onResize();return this.playerElement.eq(0)[0];};this.createMedia=function(j,k){jQuery.media.utils.removeFlash(this.display,g.id+"_media");this.display.children().remove();this.mediaType=this.getMediaType(j);this.player=this.getPlayer(j,k);this.loaded=false;var l=false;if(this.player){this.player.addEventListener("abort",function(){f({type:"stopped"});},true);this.player.addEventListener("loadstart",function(){f({type:"ready",busy:"show"});i.onReady();},true);this.player.addEventListener("loadeddata",function(){f({type:"loaded",busy:"hide"});},true);this.player.addEventListener("loadedmetadata",function(){f({type:"meta"});},true);this.player.addEventListener("canplaythrough",function(){f({type:"canplay",busy:"hide"});},true);this.player.addEventListener("ended",function(){f({type:"complete"});},true);this.player.addEventListener("pause",function(){f({type:"paused"});},true);this.player.addEventListener("play",function(){f({type:"playing"});},true);this.player.addEventListener("playing",function(){f({type:"playing",busy:"hide"});},true);this.player.addEventListener("error",function(m){i.onError(m.target.error);f({type:"error",code:m.target.error.code});},true);this.player.addEventListener("waiting",function(){f({type:"waiting",busy:"show"});},true);this.player.addEventListener("timeupdate",function(){if(l){f({type:"timeupdate",busy:"hide"});}else{l=true;}},true);this.player.addEventListener("durationchange",function(){if(this.duration&&(this.duration!==Infinity)){f({type:"durationupdate",duration:this.duration});}},true);this.player.addEventListener("progress",function(m){i.bytesLoaded=m.loaded;i.bytesTotal=m.total;},true);this.player.autoplay=true;if(typeof this.player.hasAttribute=="function"&&this.player.hasAttribute("preload")&&this.player.preload!="none"){this.player.autobuffer=true;}else{this.player.autobuffer=false;this.player.preload="none";}f({type:"playerready"});}};this.onError=function(j){switch(j.code){case 1:console.log("Error: MEDIA_ERR_ABORTED");break;case 2:console.log("Error: MEDIA_ERR_DECODE");break;case 3:console.log("Error: MEDIA_ERR_NETWORK");break;case 4:console.log("Error: MEDIA_ERR_SRC_NOT_SUPPORTED");break;default:break;}};this.onReady=function(){if(!this.loaded){this.loaded=true;this.playMedia();}};this.loadMedia=function(j){this.mediaFile=j;this.createMedia(j);};this.getMediaType=function(j){var k=(typeof j==="array")?j[0].extension:j.extension;switch(k){case"ogg":case"ogv":case"mp4":case"m4v":return"video";case"oga":case"mp3":return"audio";default:break;}return"video";};this.playMedia=function(){if(this.player&&this.player.play){this.player.play();}};this.pauseMedia=function(){if(this.player&&this.player.pause){this.player.pause();}};this.stopMedia=function(){this.pauseMedia();if(this.player){this.player.src="";}};this.destroy=function(){this.stopMedia();this.display.children().remove();};this.seekMedia=function(j){if(this.player){this.player.currentTime=j;}};this.setVolume=function(j){if(this.player){this.player.volume=j;}};this.getVolume=function(){return this.player?this.player.volume:0;};this.getDuration=function(){var j=this.player?this.player.duration:0;return(j===Infinity)?0:j;};this.getCurrentTime=function(){return this.player?this.player.currentTime:0;};this.getPercentLoaded=function(){if(this.player&&this.player.buffered&&this.player.duration){return(this.player.buffered.end(0)/this.player.duration);}else{if(this.bytesTotal){return(this.bytesLoaded/this.bytesTotal);}else{return 0;}}};this.onResize=function(){if(this.mediaType=="video"){this.playerElement.css({width:this.display.width(),height:this.display.height()});}};this.setQuality=function(j){};this.getQuality=function(){return"";};this.hasControls=function(){return false;};this.showControls=function(j){};this.getEmbedCode=function(){if((this.mediaFile.extension=="mp4")||(this.mediaFile.extension=="m4v")||(this.mediaFile.extension=="webm")){var j={config:"config",id:"mediafront_player",file:this.mediaFile.path,image:this.preview,skin:g.skin};if(this.mediaFile.stream){j.stream=this.mediaFile.stream;}return jQuery.media.utils.getFlash(g.flashPlayer,"mediafront_player",g.embedWidth,g.embedHeight,j,g.wmode);}else{return"This media does not support embedding.";}};this.getMediaLink=function(){return"This media currently does not have a link.";};})(this,e,d);};jQuery.fn.mediaimage=function(e,d){if(this.length===0){return null;}return new (function(g,j,f){this.display=g;var k=this;var i=0;var h=false;this.imgLoader=new Image();this.imgLoader.onload=function(){h=true;i=(k.imgLoader.width/k.imgLoader.height);k.resize();k.display.trigger("imageLoaded");};g.css("overflow","hidden");this.loaded=function(){return this.imgLoader.complete;};this.resize=function(p,l){var o=f?this.imgLoader.width:(p?p:this.display.width());var m=f?this.imgLoader.height:(l?l:this.display.height());if(o&&m&&h){var n=jQuery.media.utils.getScaledRect(i,{width:o,height:m});if(this.image){this.image.attr("src",this.imgLoader.src).css({marginLeft:n.x,marginTop:n.y,width:n.width,height:n.height});}this.image.fadeIn();}};this.clear=function(){h=false;if(this.image){this.image.attr("src","");this.imgLoader.src="";this.image.fadeOut(function(){if(j){c(this).parent().remove();}else{c(this).remove();}});}};this.refresh=function(){this.resize();};this.loadImage=function(l){this.clear();this.image=c(document.createElement("img")).attr({src:""}).hide();if(j){this.display.append(c(document.createElement("a")).attr({target:"_blank",href:j}).append(this.image));}else{this.display.append(this.image);}this.imgLoader.src=l;};})(this,e,d);};jQuery.media=jQuery.extend({},{json:function(d){return new (function(g){var h=this;var e={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};var f={"boolean":function(i){return String(i);},"null":function(i){return"null";},number:function(i){return isFinite(i)?String(i):"null";},string:function(i){if(/["\\\x00-\x1f]/.test(i)){i=i.replace(/([\x00-\x1f\\"])/g,function(k,j){var l=e[j];if(l){return l;}l=j.charCodeAt();return"\\u00"+Math.floor(l/16).toString(16)+(l%16).toString(16);});}return'"'+i+'"';},array:function(k){var n=["["],j,q,p,m=k.length,o;for(p=0;p<m;p+=1){o=k[p];q=f[typeof o];if(q){o=q(o);if(typeof o=="string"){if(j){n[n.length]=",";}n[n.length]=o;j=true;}}}n[n.length]="]";return n.join("");},object:function(k){if(k){if(k instanceof Array){return f.array(k);}var l=["{"],j,o,n,m;for(n in k){if(k.hasOwnProperty(n)){m=k[n];o=f[typeof m];if(o){m=o(m);if(typeof m=="string"){if(j){l[l.length]=",";}l.push(f.string(n),":",m);j=true;}}}}l[l.length]="}";return l.join("");}return"null";}};this.serializeToJSON=function(i){return f.object(i);};this.call=function(m,l,i,k,j){if(g.baseURL){jQuery.ajax({url:g.baseURL+m,dataType:"json",type:"POST",data:{methodName:m,params:this.serializeToJSON(k)},error:function(n,p,o){if(i){i(p);}else{if(window.console&&console.log){console.log("Error: "+p);}}},success:function(n){if(l){l(n);}}});}else{if(l){l(null);}}};})(d);}},jQuery.media);jQuery.fn.medialink=function(d,f,e){e=e?e:{noargs:true};return new (function(h,g,j,i){var k=this;this.display=h;this.display.css("cursor","pointer").unbind("click").bind("click",i,function(l){j(l,c(this));}).unbind("mouseenter").bind("mouseenter",function(){if(g.template.onLinkOver){g.template.onLinkOver(c(this));}}).unbind("mouseleave").bind("mouseleave",function(){if(g.template.onLinkOut){g.template.onLinkOut(c(this));}});})(this,d,f,e);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{links:[],linksvertical:false});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{linkScroll:"#medialinkscroll"});jQuery.fn.medialinks=function(d){return new (function(e,f){f=jQuery.media.utils.getSettings(f);this.display=e;var g=this;this.previousLink=null;this.scrollRegion=e.find(f.ids.linkScroll).mediascroll({vertical:f.linksvertical});this.scrollRegion.clear();this.loadLinks=function(){if(e.length>0){this.scrollRegion.clear();var h=function(i,l){g.setLink(l);};var j=f.links.length;while(j){j--;var k=this.scrollRegion.newItem().playlistlink(f,f.links[j]);k.unbind("linkclick").bind("linkclick",h);}this.scrollRegion.activate();}};this.setLink=function(h){if(this.previousLink){this.previousLink.setActive(false);}h.setActive(true);this.previousLink=h;};})(this,d);};jQuery.media.ids=jQuery.extend(jQuery.media.ids,{close:"#mediamenuclose",embed:"#mediaembed",elink:"#mediaelink",email:"#mediaemail"});jQuery.fn.mediamenu=function(e,d){if(this.length===0){return null;}return new (function(h,i,g){g=jQuery.media.utils.getSettings(g);var j=this;this.display=i;this.on=false;this.contents=[];this.prevItem={id:0,link:null,contents:null};this.close=this.display.find(g.ids.close);this.close.unbind("click").bind("click",function(){j.display.trigger("menuclose");});this.setMenuItem=function(l,m){if(this.prevItem.id!=m){if(this.prevItem.id&&g.template.onMenuSelect){g.template.onMenuSelect(this.prevItem.link,this.prevItem.contents,false);}var k=this.contents[m];if(g.template.onMenuSelect){g.template.onMenuSelect(l,k,true);}this.prevItem={id:m,link:l,contents:k};}};this.setEmbedCode=function(k){this.setInputItem(g.ids.embed,k);};this.setMediaLink=function(k){this.setInputItem(g.ids.elink,k);};this.setInputItem=function(m,l){var k=this.contents[m].find("input");k.unbind("click").bind("click",function(){c(this).select().focus();});k.attr("value",l);};var f=0;this.links=this.display.find("a");this.links.each(function(){var l=c(this);if(l.length>0){var m=l.attr("href");var k=j.display.find(m);k.hide();j.contents[m]=k;l.unbind("click").bind("click",{id:m,obj:l.parent()},function(n){n.preventDefault();j.setMenuItem(n.data.obj,n.data.id);});if(f===0){j.setMenuItem(l.parent(),m);}f++;}});})(e,this,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{logo:"logo.png",logoWidth:49,logoHeight:15,logopos:"sw",logox:5,logoy:5,link:"http://www.mediafront.org",file:"",image:"",timeout:8,autoLoad:true});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{busy:"#mediabusy",preview:"#mediapreview",play:"#mediaplay",media:"#mediadisplay"});jQuery.fn.minplayer=function(d){if(this.length===0){return null;}return new (function(e,f){f=jQuery.media.utils.getSettings(f);this.display=e;var g=this;this.autoLoad=f.autoLoad;this.busy=e.find(f.ids.busy);this.busyImg=this.busy.find("img");this.busyWidth=this.busyImg.width();this.busyHeight=this.busyImg.height();this.play=e.find(f.ids.play);this.play.unbind("click").bind("click",function(){g.togglePlayPause();});this.playImg=this.play.find("img");this.playWidth=this.playImg.width();this.playHeight=this.playImg.height();this.preview=e.find(f.ids.preview).mediaimage();if(this.preview){this.preview.display.unbind("click").bind("click",function(){g.onMediaClick();});this.preview.display.unbind("imageLoaded").bind("imageLoaded",function(){g.onPreviewLoaded();});}this.usePlayerControls=false;this.busyFlags=0;this.busyVisible=false;this.playVisible=false;this.previewVisible=false;this.playing=false;this.hasMedia=false;this.timeoutId=0;this.width=this.display.width();this.height=this.display.height();this.showElement=function(j,h,i){if(j&&!this.usePlayerControls){if(h){j.show(i);}else{j.hide(i);}}};this.showPlay=function(h,i){h&=this.hasMedia;this.playVisible=h;this.showElement(this.play,h,i);};this.showBusy=function(j,h,i){if(h){this.busyFlags|=(1<<j);}else{this.busyFlags&=~(1<<j);}this.busyVisible=(this.busyFlags>0);this.showElement(this.busy,this.busyVisible,i);if(j==1&&!h){this.showBusy(3,false);}};this.showPreview=function(h,i){this.previewVisible=h;if(this.preview){this.showElement(this.preview.display,h,i);}};this.onControlUpdate=function(h){if(this.media){if(this.media.playerReady){switch(h.type){case"play":this.media.player.playMedia();break;case"pause":this.media.player.pauseMedia();break;case"seek":this.media.player.seekMedia(h.value);break;case"volume":this.media.setVolume(h.value);break;case"mute":this.media.mute(h.value);break;default:break;}}else{if((this.media.playQueue.length>0)&&!this.media.mediaFile){this.autoLoad=true;this.playNext();}}if(f.template&&f.template.onControlUpdate){f.template.onControlUpdate(h);}}};this.fullScreen=function(h){if(f.template.onFullScreen){f.template.onFullScreen(h);}this.preview.refresh();};this.onPreviewLoaded=function(){this.previewVisible=true;};this.onMediaUpdate=function(h){switch(h.type){case"paused":this.playing=false;this.showPlay(true);if(!this.media.loaded){this.showPreview(true);}break;case"update":case"playing":this.playing=true;this.showPlay(false);this.showPreview((this.media.mediaFile.type=="audio"));break;case"initialize":this.playing=false;this.showPlay(true);this.showBusy(1,this.autoLoad);this.showPreview(true);break;case"buffering":this.showPlay(true);this.showPreview((this.media.mediaFile.type=="audio"));break;default:break;}if(h.busy){this.showBusy(1,(h.busy=="show"));}};this.onMediaClick=function(){if(this.media.player&&!this.media.hasControls()){if(this.playing){this.media.player.pauseMedia();}else{this.media.player.playMedia();}}};this.media=this.display.find(f.ids.media).mediadisplay(f);if(this.media){this.media.display.unbind("click").bind("click",function(){g.onMediaClick();});}this.setLogoPos=function(){if(this.logo){var h={};if(f.logopos=="se"||f.logopos=="sw"){h.bottom=f.logoy;}if(f.logopos=="ne"||f.logopos=="nw"){h.top=f.logoy;}if(f.logopos=="nw"||f.logopos=="sw"){h.left=f.logox;}if(f.logopos=="ne"||f.logopos=="se"){h.right=f.logox;}this.logo.display.css(h);}};if(!f.controllerOnly){this.display.prepend('<div class="'+f.prefix+'medialogo"></div>');this.logo=this.display.find("."+f.prefix+"medialogo").mediaimage(f.link);if(this.logo){this.logo.display.css({width:f.logoWidth,height:f.logoHeight});this.logo.display.bind("imageLoaded",function(){g.setLogoPos();});this.logo.loadImage(f.logo);}}this.reset=function(){this.hasMedia=false;this.playing=false;jQuery.media.players[f.id].showNativeControls(false);this.showPlay(true);this.showPreview(true);clearTimeout(this.timeoutId);if(this.media){this.media.reset();}};this.togglePlayPause=function(){if(this.media){if(this.media.playerReady){if(this.playing){this.showPlay(true);this.media.player.pauseMedia();}else{this.showPlay(false);this.media.player.playMedia();}}else{if((this.media.playQueue.length>0)&&!this.media.mediaFile){this.autoLoad=true;this.playNext();}}}};this.loadImage=function(h){if(this.preview){this.showBusy(3,true);this.preview.loadImage(h);var i=setInterval(function(){if(g.preview.loaded()){clearInterval(i);g.showBusy(3,false);}},500);if(this.media){this.media.preview=h;}}};this.onResize=function(){if(this.preview){this.preview.refresh();}if(this.media){this.media.onResize();}};this.clearImage=function(){if(this.preview){this.preview.clear();}};this.loadFiles=function(h){this.reset();this.hasMedia=this.media&&this.media.loadFiles(h);if(this.hasMedia&&this.autoLoad){this.media.playNext();}else{if(!this.hasMedia){this.showPlay(false);this.showPreview(true);this.timeoutId=setTimeout(function(){g.media.display.trigger("mediaupdate",{type:"complete"});},(f.timeout*1000));}}return this.hasMedia;};this.playNext=function(){if(this.media){this.media.playNext();}};this.hasControls=function(){if(this.media){return this.media.hasControls();}return true;};this.showControls=function(h){if(this.media){this.media.showControls(h);}};this.loadMedia=function(h){this.reset();if(this.media){this.media.loadMedia(h);}};if(f.file){this.loadMedia(f.file);}if(f.image){this.loadImage(f.image);}})(this,d);};
/* 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+
 */
var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){d--;this.addEventListener(a[d],b,false);}}else{this.onmousewheel=b;}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){d--;this.removeEventListener(a[d],b,false);}}else{this.onmousewheel=null;}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel");},unmousewheel:function(d){return this.unbind("mousewheel",d);}});function b(i){var g=i||window.event,f=[].slice.call(arguments,1),j=0,h=true,e=0,d=0;i=c.event.fix(g);i.type="mousewheel";if(i.wheelDelta){j=i.wheelDelta/120;}if(i.detail){j=-i.detail/3;}d=j;if(g.axis!==undefined&&g.axis===g.HORIZONTAL_AXIS){d=0;e=-1*j;}if(g.wheelDeltaY!==undefined){d=g.wheelDeltaY/120;}if(g.wheelDeltaX!==undefined){e=-1*g.wheelDeltaX/120;}f.unshift(i,j,e,d);return c.event.handle.apply(this,f);}jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{node:"",incrementTime:5});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{voter:"#mediavoter",uservoter:"#mediauservoter",mediaRegion:"#mediaregion",field:".mediafield"});jQuery.fn.medianode=function(e,d){if(this.length===0){return null;}return new (function(h,g,f){f=jQuery.media.utils.getSettings(f);this.display=g;this.nodeInfo={};this.incremented=false;var i=this;this.player=this.display.find(f.ids.mediaRegion).minplayer(f);if(this.player&&(f.incrementTime!==0)){this.player.display.unbind("mediaupdate").bind("mediaupdate",function(j,k){i.onMediaUpdate(k);});}this.images=[];this.addVoters=function(j){this.voter=j.find(f.ids.voter).mediavoter(f,h,false);this.uservoter=j.find(f.ids.uservoter).mediavoter(f,h,true);if(this.uservoter&&this.voter){this.uservoter.display.unbind("processing").bind("processing",function(){i.player.showBusy(2,true);});this.uservoter.display.unbind("voteGet").bind("voteGet",function(){i.player.showBusy(2,false);});this.uservoter.display.unbind("voteSet").bind("voteSet",function(l,k){i.player.showBusy(2,false);i.voter.updateVote(k);});}};this.addVoters(this.display);this.onMediaUpdate=function(j){if(!this.incremented){switch(j.type){case"update":if((f.incrementTime>0)&&(j.currentTime>f.incrementTime)){this.incremented=true;h.call(jQuery.media.commands.incrementCounter,null,null,i.nodeInfo.nid);}break;case"complete":if(f.incrementTime<0){this.incremented=true;h.call(jQuery.media.commands.incrementCounter,null,null,i.nodeInfo.nid);}break;default:break;}}};this.loadNode=function(j){return this.getNode(this.translateNode(j));};this.translateNode=function(k){var l=((typeof k)=="number")||((typeof k)=="string");if(!k){var j=f.node;if((typeof j)=="object"){j.load=false;return j;}else{return j?{nid:j,load:true}:null;}}else{if(l){return{nid:k,load:true};}else{k.load=false;return k;}}};this.getNode=function(j){if(j){if(h&&j.load){h.call(jQuery.media.commands.loadNode,function(k){i.setNode(k);},null,j.nid,{});}else{this.setNode(j);}return true;}return false;};this.setNode=function(j){if(j){this.nodeInfo=j;this.incremented=false;if(this.player&&this.nodeInfo.mediafiles){var k=this.getImage("preview");if(k){this.player.loadImage(k.path);}else{this.player.clearImage();}this.player.loadFiles(this.nodeInfo.mediafiles.media);}if(this.voter){this.voter.getVote(j);}if(this.uservoter){this.uservoter.getVote(j);}this.display.find(f.ids.field).each(function(){i.setField(this,j,c(this).attr("type"),c(this).attr("field"));});this.display.trigger("nodeload",this.nodeInfo);}};this.setField=function(l,k,j,m){if(j){switch(j){case"text":this.setTextField(l,k,m);break;case"image":this.setImageField(l,m);break;case"cck_text":this.setCCKTextField(l,k,m);break;default:break;}}};this.setTextField=function(k,j,m){var l=j[m];if(l){c(k).empty().html(l);}return true;};this.setCCKTextField=function(k,j,m){if(args.fieldType=="cck_text"){var l=j[m];if(l){c(k).empty().html(l["0"].value);}}return true;};this.onResize=function(){if(this.player){this.player.onResize();}};this.getImage=function(l){var j=this.nodeInfo.mediafiles?this.nodeInfo.mediafiles.images:null;var m=null;if(j){if(j[l]){m=j[l];}else{for(var k in j){if(j.hasOwnProperty(k)){m=j[k];break;}}}m=(typeof m==="string")?{path:m}:m;m.path=m.path?jQuery.trim(m.path):(f.baseURL+jQuery.trim(m.filepath));if(m&&m.path){m.path=m.path?jQuery.trim(m.path):(f.baseURL+jQuery.trim(m.filepath));}else{m=null;}}return m;};this.setImageField=function(k,m){var j=this.getImage(m);if(j){var l=c(k).empty().mediaimage();this.images.push(l);l.loadImage(j.path);}};})(e,this,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{shuffle:false,loop:false,pageLimit:10});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{prev:"#mediaprev",next:"#medianext",loadPrev:"#medialoadprev",loadNext:"#medialoadnext",prevPage:"#mediaprevpage",nextPage:"#medianextpage"});jQuery.fn.mediapager=function(d){return new (function(e,f){f=jQuery.media.utils.getSettings(f);this.display=e;var g=this;this.activeIndex=-1;this.currentIndex=-1;this.activePage=0;this.currentPage=0;this.numPages=0;this.numItems=10;this.activeNumItems=10;this.loadState="";this.enabled=false;this.prevButton=e.find(f.ids.prev).medialink(f,function(){if(g.enabled){g.loadPrev(false);}});this.nextButton=e.find(f.ids.next).medialink(f,function(){if(g.enabled){g.loadNext(false);}});this.loadPrevButton=e.find(f.ids.loadPrev).medialink(f,function(){if(g.enabled){g.loadPrev(true);}});this.loadNextButton=e.find(f.ids.loadNext).medialink(f,function(){if(g.enabled){g.loadNext(true);}});this.prevPageButton=e.find(f.ids.prevPage).medialink(f,function(){if(g.enabled){g.loadState="click";g.prevPage();}});this.nextPageButton=e.find(f.ids.nextPage).medialink(f,function(){if(g.enabled){g.loadState="click";g.nextPage();}});this.setTotalItems=function(h){if(h&&f.pageLimit){this.numPages=Math.ceil(h/f.pageLimit);if(this.numPages==1){this.numItems=h;}}};this.setNumItems=function(h){this.numItems=h;};this.reset=function(){this.activePage=0;this.currentPage=0;this.activeIndex=-1;this.currentIndex=-1;this.loadState="";};this.loadIndex=function(j){var h=j?"activeIndex":"currentIndex";var i=this[h];switch(this.loadState){case"prev":this.loadState="";this.loadPrev(j);return;case"first":i=0;break;case"last":i=(this.numItems-1);break;case"rand":i=Math.floor(Math.random()*this.numItems);break;default:break;}this.loadState="";if(i!=this[h]){this.loadState="";this[h]=i;this.display.trigger("loadindex",{index:this[h],active:j});}};this.loadNext=function(i){if(this.loadState){this.loadIndex(i);}else{if(f.shuffle){this.loadRand();}else{var h=i?"activeIndex":"currentIndex";if(i&&(this.activePage!=this.currentPage)){if((this.activeIndex==(this.activeNumItems-1))&&(this.activePage==(this.currentPage-1))){this.currentIndex=this.activeIndex=0;this.activePage=this.currentPage;this.display.trigger("loadindex",{index:0,active:true});}else{this.currentPage=this.activePage;this.loadState="";this.display.trigger("loadpage",{index:this.activePage,active:i});}}else{this[h]++;if(this[h]>=this.numItems){if(this.numPages>1){this[h]=(this.numItems-1);this.loadState=this.loadState?this.loadState:"first";this.nextPage(i);}else{if(!i||f.loop){this[h]=0;this.display.trigger("loadindex",{index:this[h],active:i});}}}else{this.display.trigger("loadindex",{index:this[h],active:i});}}}}};this.loadPrev=function(i){var h=i?"activeIndex":"currentIndex";if(i&&(this.activePage!=this.currentPage)){this.currentPage=this.activePage;this.loadState="prev";this.display.trigger("loadpage",{index:this.activePage,active:i});}else{this[h]--;if(this[h]<0){if(this.numPages>1){this[h]=0;this.loadState=this.loadState?this.loadState:"last";this.prevPage(i);}else{if(!i||f.loop){this[h]=(this.numItems-1);this.display.trigger("loadindex",{index:this[h],active:i});}}}else{this.display.trigger("loadindex",{index:this[h],active:i});}}};this.loadRand=function(){var h=Math.floor(Math.random()*this.numPages);if(h!=this.activePage){this.activePage=h;this.loadState=this.loadState?this.loadState:"rand";this.display.trigger("loadpage",{index:this.activePage,active:true});}else{this.activeIndex=Math.floor(Math.random()*this.numItems);this.display.trigger("loadindex",{index:this.activeIndex,active:true});}};this.nextPage=function(j){var h=j?"activePage":"currentPage";var i=false;if(this[h]<(this.numPages-1)){this[h]++;i=true;}else{if(f.loop){this.loadState=this.loadState?this.loadState:"first";this[h]=0;i=true;}else{this.loadState="";}}this.setPageState(j);if(i){this.display.trigger("loadpage",{index:this[h],active:j});}};this.prevPage=function(j){var h=j?"activePage":"currentPage";var i=false;if(this[h]>0){this[h]--;i=true;}else{if(f.loop){this.loadState=this.loadState?this.loadState:"last";this[h]=(this.numPages-1);i=true;}else{this.loadState="";}}this.setPageState(j);if(i){this.display.trigger("loadpage",{index:this[h],active:j});}};this.setPageState=function(h){if(h){this.currentPage=this.activePage;}else{this.activeNumItems=this.numItems;}};})(this,d);};jQuery.media=jQuery.extend({},{parser:function(d){return new (function(e){var f=this;this.onLoaded=null;this.parseFile=function(g,h){this.onLoaded=h;jQuery.ajax({type:"GET",url:g,dataType:"xml",success:function(i){f.parseXML(i);},error:function(i,k,j){if(window.console&&console.log){console.log("Error: "+k);}}});};this.parseXML=function(g){var h=this.parseXSPF(g);if(h.total_rows===0){h=this.parseASX(g);}if(h.total_rows===0){h=this.parseRSS(g);}if(this.onLoaded&&h.total_rows){this.onLoaded(h);}return h;};this.parseXSPF=function(g){var i={total_rows:0,nodes:[]};var h=jQuery("playlist trackList track",g);if(h.length>0){h.each(function(j){i.total_rows++;i.nodes.push({nid:i.total_rows,title:c(this).find("title").text(),description:c(this).find("annotation").text(),mediafiles:{images:{image:{path:c(this).find("image").text()}},media:{media:{path:c(this).find("location").text()}}}});});}return i;};this.parseASX=function(g){var i={total_rows:0,nodes:[]};var h=jQuery("asx entry",g);if(h.length>0){h.each(function(j){i.total_rows++;i.nodes.push({nid:i.total_rows,title:c(this).find("title").text(),mediafiles:{images:{image:{path:c(this).find("image").text()}},media:{media:{path:c(this).find("location").text()}}}});});}return i;};this.parseRSS=function(h){var j={total_rows:0,nodes:[]};var i=jQuery("rss channel",h);if(i.length>0){var g=(i.find("generator").text()=="YouTube data API");i.find("item").each(function(k){j.total_rows++;var l={};l=g?f.parseYouTubeItem(c(this)):f.parseRSSItem(c(this));l.nid=j.total_rows;j.nodes.push(l);});}return j;};this.parseRSSItem=function(g){return{title:g.find("title").text(),mediafiles:{images:{image:{path:g.find("image").text()}},media:{media:{path:g.find("location").text()}}}};};this.parseYouTubeItem=function(h){var g=h.find("description").text();var i=h.find("link").text().replace("&feature=youtube_gdata","");return{title:h.find("title").text(),mediafiles:{images:{image:{path:jQuery("img",g).eq(0).attr("src")}},media:{media:{path:i,player:"youtube"}}}};};})(d);}},jQuery.media);jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{protocol:"auto",server:"drupal",template:"default",baseURL:"",debug:false,draggable:false,resizable:false,showPlaylist:true,autoNext:true,prefix:"",zIndex:400,fluidWidth:false,fluidHeight:false,fullscreen:false});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{loading:"#mediaplayerloading",player:"#mediaplayer",menu:"#mediamenu",titleBar:"#mediatitlebar",node:"#medianode",playlist:"#mediaplaylist",control:"#mediacontrol"});jQuery.media.players={};jQuery.media.loadCallbacks={};jQuery.media.playlists={};jQuery.media.controllers={};jQuery.media.onLoaded=function(d,f){var e=jQuery.media.players[d];if(e&&e.display&&e.loaded){f(e);}else{if(!jQuery.media.loadCallbacks[d]){jQuery.media.loadCallbacks[d]=[];}jQuery.media.loadCallbacks[d].push(f);}};jQuery.media.addElement=function(f,h,e){if(h&&h[e]){var g=jQuery.media.players[f];if(g){switch(e){case"playlist":g.addPlaylist(h.playlist);break;case"controller":g.addController(h.controller);break;default:break;}}else{var d=e+"s";if(!jQuery.media[d][f]){jQuery.media[d][f]=[];}jQuery.media[d][f].push(h[e]);}}};jQuery.media.addController=function(d,e){jQuery.media.addElement(d,e,"controller");};jQuery.media.addPlaylist=function(d,e){jQuery.media.addElement(d,e,"playlist");};jQuery.fn.mediaplayer=function(d){if(this.length===0){return null;}return new (function(g,h){h=jQuery.media.utils.getSettings(h);if(!h.id){h.id=jQuery.media.utils.getId(g);}this.dialog=g;this.display=this.dialog.find(h.ids.player);var j=this;var e=[];jQuery.media.utils.checkVisibility(this.display,e);jQuery.media.players[h.id]=this;this.loaded=false;var f=0;h.template=jQuery.media.templates[h.template](this,h);if(h.template.getSettings){h=jQuery.extend(h,h.template.getSettings());}c(window).keyup(function(i){switch(i.keyCode){case 0:j.onSpaceBar();break;case 113:case 27:j.onEscKey();break;default:break;}});if(h.fluidWidth||h.fluidHeight){c(window).resize(function(){j.onResize();});}if(jQuery.media[h.protocol]){this.protocol=jQuery.media[h.protocol](h);}if(jQuery.media[h.server]){this.server=jQuery.media[h.server](this.protocol,h);}this.menu=this.dialog.find(h.ids.menu).mediamenu(this.server,h);if(this.menu){this.menu.display.unbind("menuclose").bind("menuclose",function(){j.showMenu(false);});}this.menuOn=false;this.maxOn=!h.showPlaylist;this.fullScreen=false;this.playlist=null;this.activePlaylist=null;this.controller=null;this.activeController=null;this.showMenu=function(i){if(h.template.onMenu){this.menuOn=i;h.template.onMenu(this.menuOn);}};this.onEscKey=function(){if(this.fullScreen){this.onFullScreen(false);}};this.onSpaceBar=function(){if(this.fullScreen&&this.node&&this.node.player){this.node.player.togglePlayPause();}};this.addPlayerEvents=function(i){i.display.unbind("menu").bind("menu",function(k){j.showMenu(!j.menuOn);});i.display.unbind("maximize").bind("maximize",function(k){j.maximize(!j.maxOn);});i.display.unbind("fullscreen").bind("fullscreen",function(k){j.onFullScreen(!j.fullScreen);});};this.onFullScreen=function(i){this.fullScreen=i;if(this.node&&this.node.player){this.node.player.fullScreen(this.fullScreen);this.onResize();}};this.titleBar=this.dialog.find(h.ids.titleBar).mediatitlebar(h);if(this.titleBar){this.addPlayerEvents(this.titleBar);if(h.draggable&&this.dialog.draggable){this.dialog.draggable({handle:h.ids.titleBar,containment:"document"});}if(h.resizable&&this.dialog.resizable){this.dialog.resizable({alsoResize:this.display,containment:"document",resize:function(i){j.onResize();}});}}this.node=this.dialog.find(h.ids.node).medianode(this.server,h);if(this.node){this.node.display.unbind("nodeload").bind("nodeload",function(i,k){j.onNodeLoad(k);});if(this.node.player&&this.node.player.media){this.node.player.media.display.unbind("mediaupdate").bind("mediaupdate",function(i,k){j.onMediaUpdate(k);});}if(this.node.uservoter){this.node.uservoter.display.unbind("voteSet").bind("voteSet",function(k,i){if(j.activePlaylist){j.activePlaylist.onVoteSet(i);}});}}this.onMediaUpdate=function(i){this.node.player.onMediaUpdate(i);if(h.autoNext&&this.activePlaylist&&(i.type=="complete")){this.activePlaylist.loadNext();}if(this.controller){this.controller.onMediaUpdate(i);}if(this.activeController){this.activeController.onMediaUpdate(i);}if(this.menu&&this.node&&(i.type=="meta")){this.menu.setEmbedCode(this.node.player.media.player.getEmbedCode());this.menu.setMediaLink(this.node.player.media.player.getMediaLink());}if(h.template&&h.template.onMediaUpdate){h.template.onMediaUpdate(i);}};this.onPlaylistLoad=function(i){if(this.node){if(this.node.player&&this.node.player.media){this.node.player.media.hasPlaylist=true;}this.node.loadNode(i);}if(h.template.onPlaylistLoad){h.template.onPlaylistLoad(i);}};this.onNodeLoad=function(i){if(h.template.onNodeLoad){h.template.onNodeLoad(i);}};this.maximize=function(i){if(!this.fullScreen){if(h.template.onMaximize&&(i!=this.maxOn)){this.maxOn=i;h.template.onMaximize(this.maxOn);}}};this.addPlaylist=function(i){if(i){i.display.unbind("playlistload").bind("playlistload",i,function(k,l){j.activePlaylist=k.data;j.onPlaylistLoad(l);});if(!this.activePlaylist&&i.activeTeaser){this.activePlaylist=i;this.onPlaylistLoad(i.activeTeaser.node.nodeInfo);}}return i;};this.searchForElement=function(i){for(var l in i){var k=new RegExp("^"+l+"(\\_[0-9]+)?$","i");if(h.id.search(k)===0){return i[l];}}return null;};this.playlist=this.addPlaylist(this.dialog.find(h.ids.playlist).mediaplaylist(this.server,h));this.addController=function(k,i){if(k){k.display.unbind("controlupdate").bind("controlupdate",k,function(l,m){j.activeController=l.data;if(j.node&&j.node.player){j.node.player.onControlUpdate(m);}});if(i&&!this.activeController){this.activeController=k;}this.addPlayerEvents(k);}return k;};this.controller=this.addController(this.dialog.find(h.ids.control).mediacontrol(h),false);if(this.controller&&this.node){this.node.addVoters(this.controller.display);}this.onResize=function(){if(h.template.onResize){h.template.onResize();}if(this.node){this.node.onResize();}if(this.controller){this.controller.onResize();}};this.showNativeControls=function(i){var k=this.node?this.node.player:null;if(k&&k.hasControls()){k.usePlayerControls=i;if(i){k.busy.hide();k.play.hide();if(k.preview){k.preview.display.hide();}if(this.controller){this.controller.display.hide();}}else{k.showBusy(1,((this.busyFlags&2)==2));k.showPlay(this.playVisible);k.showPreview(this.previewVisible);if(this.controller){this.controller.display.show();}}k.showControls(i);}};this.loadContent=function(){var l=this.searchForElement(jQuery.media.controllers);if(l){f=l.length;while(f){f--;this.addController(l[f],true);}}var i=this.searchForElement(jQuery.media.playlists);if(i){f=i.length;while(f){f--;this.addPlaylist(i[f]);}}var k=false;if(this.playlist){k=this.playlist.loadPlaylist();}if(!k&&this.node){if(this.node.player&&this.node.player.media){this.node.player.media.settings.repeat=(h.loop||h.repeat);}this.node.loadNode();}};this.initializeTemplate=function(){if(h.template.initialize){h.template.initialize(h);}jQuery.media.utils.resetVisibility(e);};this.load=function(){this.initializeTemplate();this.dialog.css("position","relative");this.dialog.css("marginLeft",0);this.dialog.css("overflow","visible");if(h.fullscreen){this.onFullScreen(true);}this.loaded=true;this.display.trigger("playerLoaded",this);if(jQuery.media.loadCallbacks[h.id]){var l=jQuery.media.loadCallbacks[h.id];var k=l.length;while(k){k--;l[k](this);}}this.server.connect(function(i){j.loadContent();});};this.load();})(this,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{playlist:"",args:[],wildcard:"*"});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{pager:"#mediapager",scroll:"#mediascroll",busy:"#mediabusy",links:"#medialinks"});jQuery.fn.mediaplaylist=function(e,d){if(this.length===0){return null;}return new (function(g,h,f){f=jQuery.media.utils.getSettings(f);this.display=h;var i=this;this.teasers=[];this.selectedTeaser=null;this.activeTeaser=null;this.args=f.args;this.setActive=true;this.activePager=null;this.pager=null;this.parser=jQuery.media.parser(f);this.scrollRegion=h.find(f.ids.scroll).mediascroll(f);this.scrollRegion.clear();this.busy=h.find(f.ids.busy);this.busyVisible=false;this.busyImg=this.busy.find("img");this.busyWidth=this.busyImg.width();this.busyHeight=this.busyImg.height();this.links=h.find(f.ids.links).medialinks(f);this.links.loadLinks();this.loading=function(j){if(this.pager){this.pager.enabled=!j;}if(this.activePager){this.activePager.enabled=!j;}if(j){this.busyVisible=true;this.busy.show();}else{this.busyVisible=false;this.busy.hide();}};this.addPager=function(j,k){if(j){j.display.unbind("loadindex").bind("loadindex",function(l,m){if(m.active){i.activateTeaser(i.teasers[m.index]);}else{i.selectTeaser(i.teasers[m.index]);}});j.display.unbind("loadpage").bind("loadpage",function(l,m){i.setActive=m.active;i.loadPlaylist({pageIndex:m.index});});if(k&&!this.activePager){this.activePager=j;}}return j;};this.pager=this.addPager(h.find(f.ids.pager).mediapager(f),false);this.links.display.unbind("linkclick").bind("linkclick",function(k,j){i.onLinkClick(j);});this.onLinkClick=function(m){var k=m.index;var l=m.playlist;var j=[];j[k]=m.arg;if(this.pager){this.pager.reset();}if(this.activePager){this.activePager.reset();}this.loadPlaylist({playlist:l,args:j});};this.loadNext=function(){if(this.pager){this.pager.loadNext(true);}else{if(this.activePager){this.activePager.loadNext(true);}}};this.loadPlaylist=function(j){var l={playlist:f.playlist,pageLimit:f.pageLimit,pageIndex:(this.pager?this.pager.activePage:0),args:{}};var k=jQuery.extend({},l,j);this.setArgs(k.args);this.loading(true);if(k.playlist){if(((typeof k.playlist)=="object")){f.playlist=k.playlist.name;this.setPlaylist(k.playlist);}else{if(k.playlist.match(/^http[s]?\:\/\/|\.xml$/i)){this.parser.parseFile(k.playlist,function(m){i.setPlaylist(m);});}else{if(g){g.call(jQuery.media.commands.getPlaylist,function(m){i.setPlaylist(m);},null,k.playlist,k.pageLimit,k.pageIndex,this.args);}}}return true;}return false;};this.setPlaylist=function(m){if(m&&m.nodes){var j=[];jQuery.media.utils.checkVisibility(this.display,j);if(this.pager){this.pager.setTotalItems(m.total_rows);}if(this.activePager){this.activePager.setTotalItems(m.total_rows);}this.scrollRegion.clear();this.resetTeasers();var l=m.nodes.length;for(var k=0;k<l;k++){this.addTeaser(m.nodes[k],k);}this.scrollRegion.activate();if(this.pager){this.pager.loadNext(this.setActive);}if(this.activePager){this.activePager.loadNext(this.setActive);}jQuery.media.utils.resetVisibility(j);}this.loading(false);};this.onVoteSet=function(j){if(j){var l=this.teasers.length;while(l--){var k=this.teasers[l];if(k.node.nodeInfo.nid==j.content_id){k.node.voter.updateVote(j);}}}};this.addTeaser=function(l,j){var k=this.scrollRegion.newItem().mediateaser(g,l,j,f);if(k){k.display.unbind("click").bind("click",k,function(m){i.activateTeaser(m.data);});if(this.activeTeaser){this.activeTeaser.setActive(l.nid==this.activeTeaser.node.nodeInfo.nid);}if(this.selectedTeaser){this.selectedTeaser.setSelected(l.nid==this.selectedTeaser.node.nodeInfo.nid);}this.teasers.push(k);}};this.resetTeasers=function(){var j=this.teasers.length;while(j--){this.teasers[j].reset();}this.teasers=[];};this.setArgs=function(k){if(k){this.args=f.args;var l=k.length;while(l){l--;var j=k[l];if(j&&(j!=f.wildcard)){this.args[l]=j;}}}};this.selectTeaser=function(j){if(this.selectedTeaser){this.selectedTeaser.setSelected(false);}this.selectedTeaser=j;if(this.selectedTeaser){this.selectedTeaser.setSelected(true);this.scrollRegion.setVisible(j.index);}};this.activateTeaser=function(j){this.selectTeaser(j);if(this.activeTeaser){this.activeTeaser.setActive(false);}this.activeTeaser=j;if(this.activeTeaser){this.activeTeaser.setActive(true);if(this.pager){this.pager.activeIndex=this.pager.currentIndex=j.index;}if(this.activePager){this.activePager.activeIndex=this.activePager.currentIndex=j.index;}this.display.trigger("playlistload",j.node.nodeInfo);}};})(e,this,d);};jQuery.media.ids=jQuery.extend(jQuery.media.ids,{linkText:"#medialinktext"});jQuery.fn.playlistlink=function(e,d){return new (function(h,g,f){g=jQuery.media.utils.getSettings(g);this.display=h;this.arg=f.arg;this.text=f.text;this.index=f.index;this.display.medialink(g,function(i){_this.display.trigger("linkclick",i.data);},this);this.setActive=function(i){if(g.template.onLinkSelect){g.template.onLinkSelect(_this,i);}};this.display.find(g.ids.linkText).html(this.text);})(this,e,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{rotatorTimeout:5000,rotatorTransition:"fade",rotatorEasing:"swing",rotatorSpeed:"slow",rotatorHover:false});jQuery.fn.mediarotator=function(d){if(this.length===0){return null;}return new (function(g,f){f=jQuery.media.utils.getSettings(f);var h=this;this.images=[];this.imageIndex=0;this.imageInterval=null;this.width=0;this.height=0;this.onImageLoaded=function(){this.width=this.images[0].imgLoader.width;this.height=this.images[0].imgLoader.height;g.css({width:this.width,height:this.height});var i=(f.rotatorTransition=="hscroll")?(2*this.width):this.width;var j=(f.rotatorTransition=="vscroll")?(2*this.height):this.height;this.display.css({width:i,height:j});};this.addImage=function(){var i=c("<div></div>").mediaimage(null,true);this.display.append(i.display);if((f.rotatorTransition=="hscroll")||(f.rotatorTransition=="vscroll")){i.display.css({"float":"left"});}else{i.display.css({position:"absolute",zIndex:(200-this.images.length),top:0,left:0});}return i;};this.loadImages=function(i){this.images=[];this.imageIndex=0;jQuery.each(i,function(j){var k=h.addImage();if(j===0){k.display.unbind("imageLoaded").bind("imageLoaded",function(){h.onImageLoaded();}).show();}k.loadImage(this);h.images.push(k);});if(f.rotatorHover){this.display.unbind("mouseenter").bind("mouseenter",function(){h.startRotator();}).unbind("mouseleave").bind("mouseleave",function(){clearInterval(h.imageInterval);});}else{this.startRotator();}};this.startRotator=function(){clearInterval(this.imageInterval);this.imageInterval=setInterval(function(){h.showNextImage();},f.rotatorTimeout);};this.showNextImage=function(){this.hideImage(this.images[this.imageIndex].display);this.imageIndex=(this.imageIndex+1)%this.images.length;this.showImage(this.images[this.imageIndex].display);};this.showImage=function(i){if(f.rotatorTransition==="fade"){i.fadeIn(f.rotatorSpeed);}else{i.css({marginLeft:0,marginTop:0}).show();}};this.hideImage=function(i){switch(f.rotatorTransition){case"fade":i.fadeOut(f.rotatorSpeed);break;case"hscroll":i.animate({marginLeft:-this.width},f.rotatorSpeed,f.rotatorEasing,function(){i.css({marginLeft:0}).remove();h.display.append(i);});break;case"vscroll":i.animate({marginTop:-this.height},f.rotatorSpeed,f.rotatorEasing,function(){i.css({marginTop:0}).remove();h.display.append(i);});break;default:i.hide();break;}};var e=[];g.find("img").each(function(){e.push(c(this).attr("src"));});g.empty().css("overflow","hidden").append(c('<div class="imagerotatorinner"></div>'));this.display=g.find(".imagerotatorinner");if(e.length){this.loadImages(e);}})(this,d);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{gateway:""});jQuery.media=jQuery.extend({},{rpc:function(d){return new (function(e){e=jQuery.media.utils.getSettings(e);var f=this;this.parseObject=function(k){var g="";if(k instanceof Date){g="<dateTime.iso8601>";g+=k.getFullYear();g+=k.getMonth();g+=k.getDate();g+="T";g+=k.getHours()+":";g+=k.getMinutes()+":";g+=k.getSeconds();g+="</dateTime.iso8601>";}else{if(k instanceof Array){g="<array><data>\n";for(var j=0;j<k.length;j++){g+="  <value>"+this.serializeToXML(k[j])+"</value>\n";}g+="</data></array>";}else{g="<struct>\n";for(var h in k){if(k.hasOwnProperty(h)){g+="  <member><name>"+h+"</name><value>";g+=this.serializeToXML(k[h])+"</value></member>\n";}}g+="</struct>";}}return g;};this.serializeToXML=function(h){switch(typeof h){case"boolean":return"<boolean>"+((h)?"1":"0")+"</boolean>";case"number":var g=parseInt(h,10);if(g==h){return"<int>"+h+"</int>";}return"<double>"+h+"</double>";case"string":return"<string>"+h+"</string>";case"object":return this.parseObject(h);default:break;}return"";};this.parseXMLValue=function(h){var o=jQuery(h).children();var m=o.length;var p=function(i){return function(){i.push(f.parseXMLValue(this));};};var n=function(i){return function(){i[jQuery("> name",this).text()]=f.parseXMLValue(jQuery("value",this));};};for(var k=0;k<m;k++){var l=o[k];switch(l.tagName){case"boolean":return(jQuery(l).text()==1);case"int":return parseInt(jQuery(l).text(),10);case"double":return parseFloat(jQuery(l).text());case"string":return jQuery(l).text();case"array":var g=[];jQuery("> data > value",l).each(p(g));return g;case"struct":var j={};jQuery("> member",l).each(n(j));return j;case"dateTime.iso8601":return NULL;default:break;}}return null;};this.parseXML=function(h){var g={};g.version="1.0";jQuery("methodResponse params param > value",h).each(function(i){g.result=f.parseXMLValue(this);});jQuery("methodResponse fault > value",h).each(function(i){g.error=f.parseXMLValue(this);});return g;};this.xmlRPC=function(l,k){var g='<?xml version="1.0"?>';g+="<methodCall>";g+="<methodName>"+l+"</methodName>";if(k.length>0){g+="<params>";var j=k.length;for(var h=0;h<j;h++){if(k[h]){g+="<param><value>"+this.serializeToXML(k[h])+"</value></param>";}}g+="</params>";}g+="</methodCall>";return g;};this.call=function(k,j,g,i,h){if(e.gateway){jQuery.ajax({url:e.gateway,dataType:"xml",type:"POST",data:this.xmlRPC(k,i),error:function(l,n,m){if(g){g(n);}else{if(window.console&&console.log){console.log("Error: "+n);}}},success:function(m){var l=f.parseXML(m);if(l.error){if(g){g(l.error);}else{if(window.console&&console.dir){console.dir(l.error);}}}else{if(j){j(l.result);}}},processData:false,contentType:"text/xml"});}else{if(j){j(null);}}};})(d);}},jQuery.media);jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{vertical:true,scrollSpeed:20,updateTimeout:40,hysteresis:40,showScrollbar:true,scrollMode:"auto"});jQuery.media.ids=jQuery.extend(jQuery.media.ids,{listMask:"#medialistmask",list:"#medialist",scrollWrapper:"#mediascrollbarwrapper",scrollBar:"#mediascrollbar",scrollTrack:"#mediascrolltrack",scrollHandle:"#mediascrollhandle",scrollUp:"#mediascrollup",scrollDown:"#mediascrolldown"});jQuery.fn.mediascroll=function(d){return new (function(e,g){g=jQuery.media.utils.getSettings(g);this.display=e;var h=this;this.spanMode=(g.scrollMode=="span");this.listMask=e.find(g.ids.listMask);if(this.spanMode||(g.scrollMode=="auto")){this.listMask.unbind("mouseenter").bind("mouseenter",function(i){h.onMouseOver(i);});this.listMask.unbind("mouseleave").bind("mouseleave",function(i){h.onMouseOut(i);});this.listMask.unbind("mousemove").bind("mousemove",function(i){h.onMouseMove(i);});}else{if(g.scrollMode=="mouse"){this.display.bind("mousewheel",function(k,l,j,i){k.preventDefault();h.onMouseScroll(j,i);});}}this.listMask.css("overflow","hidden");this.list=e.find(g.ids.list);var f=this.list.children().eq(0);this.elementWidth=f.width();this.elementHeight=f.height();this.elementSize=g.vertical?f.outerHeight(true):f.outerWidth(true);if(jQuery.browser.msie&&parseInt(jQuery.fn.jquery.replace(".",""),10)<132){this.template=c("<div></div>").append(jQuery.media.utils.cloneFix(f)).html();}else{this.template=c("<div></div>").append(f.clone()).html();}this.list.empty();this.pagePos=g.vertical?"pageY":"pageX";this.margin=g.vertical?"marginTop":"marginLeft";this.scrollSize=g.vertical?0:this.listMask.width();this.scrollMid=0;this.mousePos=0;this.listPos=0;this.scrollInterval=0;this.shouldScroll=false;this.bottomPos=0;this.ratio=0;this.elements=[];this.listSize=0;this.scrollBar=e.find(g.ids.scrollTrack).mediaslider(g.ids.scrollHandle,g.vertical);this.scrollUp=e.find(g.ids.scrollUp).medialink(g,function(){h.scroll(true);});this.scrollDown=e.find(g.ids.scrollDown).medialink(g,function(){h.scroll(false);});if(this.scrollBar){this.scrollBar.display.unbind("updatevalue").bind("updatevalue",function(i,j){h.setScrollPos(j*h.bottomPos,false);});this.scrollBar.display.unbind("setvalue").bind("setvalue",function(i,j){h.setScrollPos(j*h.bottomPos,true);});this.scrollBar.display.bind("mousewheel",function(k,l,j,i){k.preventDefault();h.onMouseScroll(j,i);});}this.setScrollSize=function(i){if(i){this.scrollSize=i;this.scrollMid=this.scrollSize/2;var j=this.scrollSize-(g.hysteresis*2);this.bottomPos=(this.listSize-this.scrollSize);this.ratio=((this.listSize-j)/j);this.shouldScroll=(this.bottomPos>0);}};this.clear=function(){this.mousePos=0;this.shouldScroll=false;this.bottomPos=0;this.ratio=0;this.scrolling=false;this.elements=[];this.listSize=0;this.list.css(this.margin,0);this.list.children().unbind();clearInterval(this.scrollInterval);this.list.empty();};this.getOffset=function(){return g.vertical?this.listMask.offset().top:this.listMask.offset().left;};this.activate=function(){this.setScrollSize(g.vertical?this.listMask.height():this.listMask.width());this.setScrollPos(0,true);};this.newItem=function(){var j=c(this.template);this.list.append(j);var i=this.getElement(j,this.elements.length);this.listSize+=i.size;if(g.vertical){this.list.css({height:this.listSize});}else{this.list.css({width:this.listSize});}this.elements.push(i);return i.obj;};this.getElement=function(k,i){var j=this.elementSize;var l=this.listSize;return{obj:k,size:j,position:l,bottom:(l+j),mid:(j/2),index:i};};this.scroll=function(i){var j=this.getElementAtPosition(i?0:this.scrollSize);if(j){var l=(j.straddle||i)?j:this.elements[j.index+1];if(l){var k=i?l.position:(l.bottom-this.scrollSize);this.setScrollPos(k,true);}}};this.onMouseScroll=function(j,i){var k=g.vertical?-i:j;this.setScrollPos(this.listPos+(g.scrollSpeed*k));};this.onMouseMove=function(i){this.mousePos=i[this.pagePos]-this.getOffset();if(this.shouldScroll&&this.spanMode){this.setScrollPos((this.mousePos-g.hysteresis)*this.ratio);}};this.onMouseOver=function(i){if(this.shouldScroll){clearInterval(this.scrollInterval);this.scrollInterval=setInterval(function(){h.update();},g.updateTimeout);}};this.onMouseOut=function(i){clearInterval(this.scrollInterval);};this.align=function(i){var j=this.getElementAtPosition(i?0:this.scrollSize);if(j){var k=i?j.position:(j.bottom-this.scrollSize);this.setScrollPos(k,true);}};this.setVisible=function(i){var k=this.elements[i];if(k){var j=this.listPos;if(k.position<this.listPos){j=k.position;}else{if((k.bottom-this.listPos)>this.scrollSize){j=k.bottom-this.scrollSize;}}if(j!=this.listPos){this.setScrollPos(j,true);}}};this.getElementAtPosition=function(j){var l=null;var k=this.elements.length;while(k--){l=this.elements[k];if(((l.position-this.listPos)<j)&&((l.bottom-this.listPos)>=j)){l.straddle=((l.bottom-this.listPos)!=j);break;}}return l;};this.update=function(){var j=this.mousePos-this.scrollMid;if(Math.abs(j)>g.hysteresis){var i=(j>0)?-g.hysteresis:g.hysteresis;j=g.scrollSpeed*((this.mousePos+i-this.scrollMid)/this.scrollMid);this.setScrollPos(this.listPos+j);}};this.setScrollPos=function(k,j){k=(k<0)?0:k;if(this.shouldScroll&&(k>this.bottomPos)){k=this.bottomPos;}this.listPos=k;if(this.scrollBar){var i=this.bottomPos?(this.listPos/this.bottomPos):0;this.scrollBar.setPosition(i);}if(j){if(g.vertical){this.list.animate({marginTop:-this.listPos},(g.scrollSpeed*10));}else{this.list.animate({marginLeft:-this.listPos},(g.scrollSpeed*10));}}else{this.list.css(this.margin,-this.listPos);}};})(this,d);};jQuery.media=jQuery.extend({},{sha256:function(){function d(V,U){d.charSize=8;d.b64pad="";d.hexCase=0;var S=null;var Q=null;var z=function(p){var o=[];var s=(1<<d.charSize)-1;var r=p.length*d.charSize;for(var q=0;q<r;q+=d.charSize){o[q>>5]|=(p.charCodeAt(q/d.charSize)&s)<<(32-d.charSize-q%32);}return o;};var x=function(p){var o=[];var s=p.length;for(var q=0;q<s;q+=2){var r=parseInt(p.substr(q,2),16);if(!isNaN(r)){o[q>>3]|=r<<(24-(4*(q%8)));}else{return"INVALID HEX STRING";}}return o;};var n=null;var l=null;if("HEX"===U){if(0!==(V.length%2)){return"TEXT MUST BE IN BYTE INCREMENTS";}n=V.length*4;l=x(V);}else{if(("ASCII"===U)||("undefined"===typeof(U))){n=V.length*d.charSize;l=z(V);}else{return"UNKNOWN TEXT INPUT TYPE";}}var T=function(p){var o=d.hexCase?"0123456789ABCDEF":"0123456789abcdef";var s="";var r=p.length*4;for(var q=0;q<r;q++){s+=o.charAt((p[q>>2]>>((3-q%4)*8+4))&15)+o.charAt((p[q>>2]>>((3-q%4)*8))&15);}return s;};var R=function(p){var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var v="";var u=p.length*4;for(var r=0;r<u;r+=3){var s=(((p[r>>2]>>8*(3-r%4))&255)<<16)|(((p[r+1>>2]>>8*(3-(r+1)%4))&255)<<8)|((p[r+2>>2]>>8*(3-(r+2)%4))&255);for(var q=0;q<4;q++){if(r*8+q*6>p.length*32){v+=d.b64pad;}else{v+=o.charAt((s>>6*(3-q))&63);}}}return v;};var K=function(o,p){if(p<32){return(o>>>p)|(o<<(32-p));}else{return o;}};var H=function(o,p){if(p<32){return o>>>p;}else{return 0;}};var y=function(o,q,p){return(o&q)^(~o&p);};var t=function(o,q,p){return(o&q)^(o&p)^(q&p);};var m=function(o){return K(o,2)^K(o,13)^K(o,22);};var k=function(o){return K(o,6)^K(o,11)^K(o,25);};var j=function(o){return K(o,7)^K(o,18)^H(o,3);};var i=function(o){return K(o,17)^K(o,19)^H(o,10);};var h=function(p,r){var q=(p&65535)+(r&65535);var o=(p>>>16)+(r>>>16)+(q>>>16);return((o&65535)<<16)|(q&65535);};var g=function(p,o,u,s){var r=(p&65535)+(o&65535)+(u&65535)+(s&65535);var q=(p>>>16)+(o>>>16)+(u>>>16)+(s>>>16)+(r>>>16);return((q&65535)<<16)|(r&65535);};var f=function(p,o,v,u,s){var r=(p&65535)+(o&65535)+(v&65535)+(u&65535)+(s&65535);var q=(p>>>16)+(o>>>16)+(v>>>16)+(u>>>16)+(s>>>16)+(r>>>16);return((q&65535)<<16)|(r&65535);};var e=function(B,A,w){var o=[];var M,L,J,I,G,F,E,D;var v,s;var q;var p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];if(w==="SHA-224"){q=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428];}else{q=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];}B[A>>5]|=128<<(24-A%32);B[((A+1+64>>9)<<4)+15]=A;var u=B.length;for(var C=0;C<u;C+=16){M=q[0];L=q[1];J=q[2];I=q[3];G=q[4];F=q[5];E=q[6];D=q[7];for(var r=0;r<64;r++){if(r<16){o[r]=B[r+C];}else{o[r]=g(i(o[r-2]),o[r-7],j(o[r-15]),o[r-16]);}v=f(D,k(G),y(G,F,E),p[r],o[r]);s=h(m(M),t(M,L,J));D=E;E=F;F=G;G=h(I,v);I=J;J=L;L=M;M=h(v,s);}q[0]=h(M,q[0]);q[1]=h(L,q[1]);q[2]=h(J,q[2]);q[3]=h(I,q[3]);q[4]=h(G,q[4]);q[5]=h(F,q[5]);q[6]=h(E,q[6]);q[7]=h(D,q[7]);}switch(w){case"SHA-224":return[q[0],q[1],q[2],q[3],q[4],q[5],q[6]];case"SHA-256":return q;default:return[];}};this.getHash=function(p,o){var r=null;var q=l.slice();switch(o){case"HEX":r=T;break;case"B64":r=R;break;default:return"FORMAT NOT RECOGNIZED";}switch(p){case"SHA-224":if(S===null){S=e(q,n,p);}return r(S);case"SHA-256":if(Q===null){Q=e(q,n,p);}return r(Q);default:return"HASH NOT RECOGNIZED";}};this.getHMAC=function(D,C,B,A){var w=null;var v=null;var u=[];var s=[];var q=null;var p=null;var o=null;switch(A){case"HEX":w=T;break;case"B64":w=R;break;default:return"FORMAT NOT RECOGNIZED";}switch(B){case"SHA-224":o=224;break;case"SHA-256":o=256;break;default:return"HASH NOT RECOGNIZED";}if("HEX"===C){if(0!==(D.length%2)){return"KEY MUST BE IN BYTE INCREMENTS";}v=x(D);p=D.length*4;}else{if("ASCII"===C){v=z(D);p=D.length*d.charSize;}else{return"UNKNOWN KEY INPUT TYPE";}}if(512<p){v=e(v,p,B);v[15]&=4294967040;}else{if(512>p){v[15]&=4294967040;}}for(var r=0;r<=15;r++){u[r]=v[r]^909522486;s[r]=v[r]^1549556828;}q=e(u.concat(l),512+n,B);q=e(s.concat(q),512+o,B);return(w(q));};}this.encrypt=function(g,e){var f=new d(e,"ASCII");return f.getHMAC(g,"ASCII","SHA-256","HEX");};}},jQuery.media);jQuery.fn.mediaslider=function(d,f,e){if(this.length===0){return null;}return new (function(j,g,i,h){var k=this;this.display=j.css({cursor:"pointer"});this.dragging=false;this.value=0;this.handle=this.display.find(g);this.pagePos=i?"pageY":"pageX";this.handlePos=0;if(this.handle.length>0){this.handleSize=i?this.handle.height():this.handle.width();this.handleMid=(this.handleSize/2);}this.onResize=function(){this.setTrackSize();this.updateValue(this.value);};this.setTrackSize=function(){this.trackSize=i?this.display.height():this.display.width();this.trackSize-=this.handleSize;this.trackSize=(this.trackSize>0)?this.trackSize:1;};this.setValue=function(l){this.setPosition(l);this.display.trigger("setvalue",this.value);};this.updateValue=function(l){this.setPosition(l);this.display.trigger("updatevalue",this.value);};this.setPosition=function(l){l=(l<0)?0:l;l=(l>1)?1:l;this.value=l;this.handlePos=h?(1-this.value):this.value;this.handlePos*=this.trackSize;this.handle.css((i?"marginTop":"marginLeft"),this.handlePos);};this.display.unbind("mousedown").bind("mousedown",function(l){l.preventDefault();k.dragging=true;});this.getOffset=function(){var l=i?this.display.offset().top:this.display.offset().left;return(l+(this.handleSize/2));};this.getPosition=function(l){var m=(l-this.getOffset())/this.trackSize;m=(m<0)?0:m;m=(m>1)?1:m;m=h?(1-m):m;return m;};this.display.unbind("mousemove").bind("mousemove",function(l){l.preventDefault();if(k.dragging){k.updateValue(k.getPosition(l[k.pagePos]));}});this.display.unbind("mouseleave").bind("mouseleave",function(l){l.preventDefault();if(k.dragging){k.dragging=false;k.setValue(k.getPosition(l[k.pagePos]));}});this.display.unbind("mouseup").bind("mouseup",function(l){l.preventDefault();if(k.dragging){k.dragging=false;k.setValue(k.getPosition(l[k.pagePos]));}});this.onResize();})(this,d,f,e);};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{pageLink:false});jQuery.fn.mediateaser=function(f,d,g,e){if(this.length===0){return null;}return new (function(l,i,m,h,j){j=jQuery.media.utils.getSettings(j);var n=this;this.display=h;this.display.unbind("mouseenter").bind("mouseenter",function(o){if(j.template.onTeaserOver){j.template.onTeaserOver(n);}});this.display.unbind("mouseleave").bind("mouseleave",function(o){if(j.template.onTeaserOut){j.template.onTeaserOut(n);}});this.index=m;this.node=this.display.medianode(l,j);if(this.node){this.node.loadNode(i);}if(this.node&&j.pageLink){var k=j.baseURL;k+=i.path?i.path:("node/"+i.nid);this.node.display.wrap('<a href="'+k+'"></a>');}this.reset=function(){if(this.node){this.node.display.unbind();}};this.setActive=function(o){if(j.template.onTeaserActivate){j.template.onTeaserActivate(this,o);}};this.setSelected=function(o){if(j.template.onTeaserSelect){j.template.onTeaserSelect(this,o);}};if(j.template.onTeaserLoad){j.template.onTeaserLoad(this);}})(f,d,g,this,e);};jQuery.media.ids=jQuery.extend(jQuery.media.ids,{titleLinks:"#mediatitlelinks"});jQuery.fn.mediatitlebar=function(d){if(this.length===0){return null;}return new (function(e,f){var g=this;this.display=e;this.titleLinks=this.display.find(f.ids.titleLinks);this.display.find("a").each(function(){var h=c(this).attr("href");c(this).medialink(f,function(i){i.preventDefault();g.display.trigger(i.data.id);},{id:h.substr(1),obj:c(this)});});})(this,d);};jQuery.media=jQuery.extend({},{utils:{getBaseURL:function(){var d=new RegExp(/^(http[s]?\:[\\\/][\\\/])([^\\\/\?]+)/);var e=d.exec(location.href);return e?e[0]:"";},timer:{},stopElementHide:{},showThenHide:function(d,h,e,f,g){if(d){d.show(e);if(jQuery.media.utils.timer.hasOwnProperty(h)){clearTimeout(jQuery.media.utils.timer[h]);}jQuery.media.utils.timer[h]=setTimeout(function(){if(!jQuery.media.utils.stopElementHide[h]){d.hide(f,function(){if(jQuery.media.utils.stopElementHide[h]){d.show();}if(g){g();}});}},5000);}},stopHide:function(d,e){jQuery.media.utils.stopElementHide[e]=true;clearTimeout(jQuery.media.utils.timer[e]);},stopHideOnOver:function(d,e){if(d){jQuery.media.utils.stopElementHide[e]=false;d.unbind("mouseover").bind("mouseover",{id:e},function(f){jQuery.media.utils.stopElementHide[f.data.id]=true;}).unbind("mouseout").bind("mouseout",{id:e},function(f){jQuery.media.utils.stopElementHide[f.data.id]=false;});}},getSettings:function(d){if(!d){d={};}if(!d.initialized){d=jQuery.extend({},jQuery.media.defaults,d);d.ids=jQuery.extend({},jQuery.media.ids,d.ids);d.baseURL=d.baseURL?d.baseURL:jQuery.media.utils.getBaseURL();d.baseURL+=d.baseURL?"/":"";d.initialized=true;}return d;},getId:function(d){return d.attr("id")?d.attr("id"):d.attr("class")?d.attr("class"):"mediaplayer";},getScaledRect:function(d,g){var f={};f.x=g.x?g.x:0;f.y=g.y?g.y:0;f.width=g.width?g.width:0;f.height=g.height?g.height:0;if(d){var e=(g.width/g.height);f.height=(e>d)?g.height:Math.floor(g.width/d);f.width=(e>d)?Math.floor(g.height*d):g.width;f.x=Math.floor((g.width-f.width)/2);f.y=Math.floor((g.height-f.height)/2);}return f;},checkVisibility:function(f,e){var d=true;f.parents().each(function(){var g=jQuery(this);if(!g.is(":visible")){d=false;var h=g.attr("class");e.push({obj:g,attr:h});g.removeClass(h);}});},resetVisibility:function(d){var e=d.length;while(e){e--;d[e].obj.addClass(d[e].attr);}},getFlash:function(j,d,e,k,g,f){var l=window.location.protocol;if(l.charAt(l.length-1)==":"){l=l.substring(0,l.length-1);}var i=jQuery.param(g);var h='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';h+='codebase="'+l+'://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ';h+='width="'+e+'" ';h+='height="'+k+'" ';h+='id="'+d+'" ';h+='name="'+d+'"> ';h+='<param name="allowScriptAccess" value="always"></param>';h+='<param name="allowfullscreen" value="true" />';h+='<param name="movie" value="'+j+'"></param>';h+='<param name="wmode" value="'+f+'"></param>';h+='<param name="quality" value="high"></param>';h+='<param name="FlashVars" value="'+i+'"></param>';h+='<embed src="'+j+'" quality="high" width="'+e+'" height="'+k+'" ';h+='id="'+d+'" name="'+d+'" swLiveConnect="true" allowScriptAccess="always" wmode="'+f+'"';h+='allowfullscreen="true" type="application/x-shockwave-flash" FlashVars="'+i+'" ';h+='pluginspage="'+l+'://www.macromedia.com/go/getflashplayer" />';h+="</object>";return h;},removeFlash:function(e,f){if(typeof(swfobject)!="undefined"){swfobject.removeSWF(f);}else{var d=e.find("object").eq(0)[0];if(d){d.parentNode.removeChild(d);}}},insertFlash:function(j,m,e,f,n,h,g,l){jQuery.media.utils.removeFlash(j,e);j.children().remove();j.append('<div id="'+e+'"><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p></div>');if(typeof(swfobject)!="undefined"){var i={allowScriptAccess:"always",allowfullscreen:"true",wmode:g,quality:"high"};swfobject.embedSWF(m,e,f,n,"9.0.0","expressInstall.swf",h,i,{},function(o){l(o.ref);});}else{var k=jQuery.media.utils.getFlash(m,e,f,n,h,g);var d=j.find("#"+e).eq(0);if(jQuery.browser.msie){d[0].outerHTML=k;l(j.find("object").eq(0)[0]);}else{d.replaceWith(k);l(j.find("embed").eq(0)[0]);}}},cloneFix:function(g,f){var d=g.map(function(){var i=this.outerHTML;if(!i){var j=this.ownerDocument.createElement("div");j.appendChild(this.cloneNode(true));i=j.innerHTML;}return jQuery.clean([i.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0];});if(f===true){var h=g.find("*").andSelf(),e=0;d.find("*").andSelf().each(function(){if(this.nodeName!==h[e].nodeName){return;}var i=jQuery.data(h[e],"events");for(var k in i){if(i.hasOwnProperty(k)){for(var j in i[k]){if(i[k].hasOwnProperty(j)){jQuery.event.add(this,k,i[k][j],i[k][j].data);}}}}e++;});}return d;}}},jQuery.media);window.onVimeoReady=function(d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onReady();};window.onVimeoFinish=function(d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onFinished();};window.onVimeoLoading=function(e,d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onLoading(e);};window.onVimeoPlay=function(d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onPlaying();};window.onVimeoPause=function(d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onPaused();};window.onVimeoProgress=function(e,d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onProgress(e);};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{vimeo:function(d){return(d.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i)===0);}});jQuery.fn.mediavimeo=function(e,d){return new (function(h,g,f){this.display=h;var i=this;this.player=null;this.videoFile=null;this.ready=false;this.bytesLoaded=0;this.bytesTotal=0;this.currentVolume=1;this.createMedia=function(l,n){this.videoFile=l;this.ready=false;var k=(g.id+"_media");var j={clip_id:this.getId(l.path),width:"100%",height:"100%",js_api:"1",js_onLoad:"onVimeoReady",js_swf_id:k};var m=Math.floor(Math.random()*1000000);var o="http://vimeo.com/moogaloop.swf?rand="+m;jQuery.media.utils.insertFlash(this.display,o,k,"100%","100%",j,g.wmode,function(p){i.player=p;i.loadPlayer();});};this.getId=function(k){var j=/^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;return(k.search(j)===0)?k.replace(j,"$3"):k;};this.loadMedia=function(j){this.bytesLoaded=0;this.bytesTotal=0;this.createMedia(j);};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player&&this.player.api_addEventListener){this.player.api_addEventListener("onProgress","onVimeoProgress");this.player.api_addEventListener("onFinish","onVimeoFinish");this.player.api_addEventListener("onLoading","onVimeoLoading");this.player.api_addEventListener("onPlay","onVimeoPlay");this.player.api_addEventListener("onPause","onVimeoPause");f({type:"playerready"});this.playMedia();}};this.onFinished=function(){f({type:"complete"});};this.onLoading=function(j){this.bytesLoaded=j.bytesLoaded;this.bytesTotal=j.bytesTotal;};this.onPlaying=function(){f({type:"playing",busy:"hide"});};this.onPaused=function(){f({type:"paused",busy:"hide"});};this.playMedia=function(){f({type:"playing",busy:"hide"});if(this.player.api_play){this.player.api_play();}};this.onProgress=function(j){f({type:"progress"});};this.pauseMedia=function(){f({type:"paused",busy:"hide"});if(this.player.api_pause){this.player.api_pause();}};this.stopMedia=function(){this.pauseMedia();if(this.player.api_unload){this.player.api_unload();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(g.id+"_media"));this.display.children().remove();};this.seekMedia=function(j){if(this.player.api_seekTo){this.player.api_seekTo(j);}};this.setVolume=function(j){this.currentVolume=j;if(this.player.api_setVolume){this.player.api_setVolume((j*100));}};this.getVolume=function(){return this.currentVolume;};this.getDuration=function(){return this.player.api_getDuration?this.player.api_getDuration():0;};this.getCurrentTime=function(){return this.player.api_getCurrentTime?this.player.api_getCurrentTime():0;};this.getBytesLoaded=function(){return this.bytesLoaded;};this.getBytesTotal=function(){return this.bytesTotal;};this.setQuality=function(j){};this.getQuality=function(){return"";};this.hasControls=function(){return true;};this.showControls=function(j){};this.getEmbedCode=function(){return"This video cannot be embedded.";};this.getMediaLink=function(){return"This video currently does not have a link.";};})(this,e,d);};jQuery.fn.mediavoter=function(d,f,e){if(this.length===0){return null;}return new (function(h,g,j,i){this.display=h;var k=this;this.nodeId=0;this.votes=[];this.tag=this.display.attr("tag");this.display.find("div").each(function(){if(i){c(this).css("cursor","pointer");c(this).unbind("click").bind("click",function(l){k.setVote(parseInt(c(this).attr("vote"),10));});c(this).unbind("mouseenter").bind("mouseenter",function(l){k.updateVote({value:parseInt(c(this).attr("vote"),10)},true);});}k.votes.push({vote:parseInt(c(this).attr("vote"),10),display:c(this)});});this.votes.sort(function(m,l){return(m.vote-l.vote);});if(i){this.display.unbind("mouseleave").bind("mouseleave",function(l){k.updateVote({value:0},true);});}this.updateVote=function(l,m){if(l&&g.template.updateVote){g.template.updateVote(this,l.value,m);}};this.getVote=function(m){if(m&&m.nid){this.nodeId=parseInt(m.nid,10);if(m.vote){var l=i?m.vote.uservote:m.vote.vote;this.updateVote(m.vote.vote,false);this.display.trigger("voteGet",l);}else{if(j&&m.nid&&(this.display.length>0)){this.display.trigger("processing");var n=i?jQuery.media.commands.getUserVote:jQuery.media.commands.getVote;j.call(n,function(o){k.updateVote(o,false);k.display.trigger("voteGet",o);},null,"node",this.nodeId,this.tag);}}}};this.setVote=function(l){if(j&&this.nodeId){this.display.trigger("processing");this.updateVote({value:l},false);j.call(jQuery.media.commands.setVote,function(m){k.display.trigger("voteSet",m);},null,"node",this.nodeId,l,this.tag);}};this.deleteVote=function(){if(j&&this.nodeId){this.display.trigger("processing");j.call(jQuery.media.commands.deleteVote,function(l){k.updateVote(l,false);k.display.trigger("voteDelete",l);},null,"node",this.nodeId,this.tag);}};})(this,d,f,e);};window.onYouTubePlayerReady=function(d){d=d.replace(/\_media$/,"");jQuery.media.players[d].node.player.media.player.onReady();};jQuery.media.playerTypes=jQuery.extend(jQuery.media.playerTypes,{youtube:function(d){return(d.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i)===0);}});jQuery.fn.mediayoutube=function(e,d){return new (function(h,g,f){this.display=h;var i=this;this.player=null;this.videoFile=null;this.loaded=false;this.ready=false;this.qualities=[];this.createMedia=function(k,m){this.videoFile=k;this.ready=false;var j=(g.id+"_media");var l=Math.floor(Math.random()*1000000);var n="http://www.youtube.com/apiplayer?rand="+l+"&amp;version=3&amp;enablejsapi=1&amp;playerapiid="+j;jQuery.media.utils.insertFlash(this.display,n,j,"100%","100%",{},g.wmode,function(o){i.player=o;i.loadPlayer();});};this.getId=function(k){var j=/^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i;return(k.search(j)===0)?k.replace(j,"$2"):k;};this.loadMedia=function(j){if(this.player){this.loaded=false;this.videoFile=j;f({type:"playerready"});if(this.player.loadVideoById){this.player.loadVideoById(this.getId(this.videoFile.path),0,g.quality);}}};this.onReady=function(){this.ready=true;this.loadPlayer();};this.loadPlayer=function(){if(this.ready&&this.player){window[g.id+"StateChange"]=function(j){i.onStateChange(j);};window[g.id+"PlayerError"]=function(j){i.onError(j);};window[g.id+"QualityChange"]=function(j){i.quality=j;};if(this.player.addEventListener){this.player.addEventListener("onStateChange",g.id+"StateChange");this.player.addEventListener("onError",g.id+"PlayerError");this.player.addEventListener("onPlaybackQualityChange",g.id+"QualityChange");}if(this.player.getAvailableQualityLevels){this.qualities=this.player.getAvailableQualityLevels();}f({type:"playerready"});if(this.player.loadVideoById){this.player.loadVideoById(this.getId(this.videoFile.path),0);}}};this.onStateChange=function(k){var j=this.getPlayerState(k);f({type:j.state,busy:j.busy});if(!this.loaded&&j=="playing"){this.loaded=true;f({type:"meta"});}};this.onError=function(k){var j="An unknown error has occured: "+k;if(k==100){j="The requested video was not found.  ";j+="This occurs when a video has been removed (for any reason), ";j+="or it has been marked as private.";}else{if((k==101)||(k==150)){j="The video requested does not allow playback in an embedded player.";}}if(window.console&&console.log){console.log(j);}f({type:"error",data:j});};this.getPlayerState=function(j){switch(j){case 5:return{state:"ready",busy:false};case 3:return{state:"buffering",busy:"show"};case 2:return{state:"paused",busy:"hide"};case 1:return{state:"playing",busy:"hide"};case 0:return{state:"complete",busy:false};case -1:return{state:"stopped",busy:false};default:return{state:"unknown",busy:false};}return"unknown";};this.playMedia=function(){f({type:"buffering",busy:"show"});if(this.player.playVideo){this.player.playVideo();}};this.pauseMedia=function(){if(this.player.pauseVideo){this.player.pauseVideo();}};this.stopMedia=function(){if(this.player.stopVideo){this.player.stopVideo();}};this.destroy=function(){this.stopMedia();jQuery.media.utils.removeFlash(this.display,(g.id+"_media"));this.display.children().remove();};this.seekMedia=function(j){f({type:"buffering",busy:"show"});if(this.player.seekTo){this.player.seekTo(j,true);}};this.setVolume=function(j){if(this.player.setVolume){this.player.setVolume(j*100);}};this.setQuality=function(j){if(this.player.setPlaybackQuality){this.player.setPlaybackQuality(j);}};this.getVolume=function(){return this.player.getVolume?(this.player.getVolume()/100):0;};this.getDuration=function(){return this.player.getDuration?this.player.getDuration():0;};this.getCurrentTime=function(){return this.player.getCurrentTime?this.player.getCurrentTime():0;};this.getQuality=function(){return this.player.getPlaybackQuality?this.player.getPlaybackQuality():0;};this.getEmbedCode=function(){return this.player.getVideoEmbedCode?this.player.getVideoEmbedCode():0;};this.getMediaLink=function(){return this.player.getVideoUrl?this.player.getVideoUrl():0;};this.getBytesLoaded=function(){return this.player.getVideoBytesLoaded?this.player.getVideoBytesLoaded():0;};this.getBytesTotal=function(){return this.player.getVideoBytesTotal?this.player.getVideoBytesTotal():0;};this.hasControls=function(){return false;};this.showControls=function(j){};})(this,e,d);};})(jQuery);;
/**
 *  Copyright (c) 2010 Alethia Inc,
 *  http://www.alethia-inc.com
 *  Developed by Travis Tidwell | travist at alethia-inc.com 
 *
 *  License:  GPL version 3.
 *
 *  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(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{prefix:"",controllerOnly:false,playlistOnly:false});jQuery.media.templates=jQuery.extend({},{"default":function(b,c){return new (function(d,e){e=jQuery.media.utils.getSettings(e);var f=this;this.player=null;this.titleLinks=null;this.nodeWidth=0;this.nodeHeight=0;this.dialogWidth=0;this.dialogHeight=0;this.controlHeight=0;this.showController=true;this.isFireFox=(typeof document.body.style.MozBoxShadow==="string");this.initialize=function(g){this.nodeWidth=d.display.width();this.nodeHeight=d.display.height();this.dialogWidth=d.dialog.width();this.dialogHeight=d.dialog.height();this.controlHeight=d.controller?d.controller.display.height():0;this.player=d.node?d.node.player:null;this.titleLinks=d.titleBar?d.titleBar.titleLinks:null;this.setPlaylistHeight();};this.setPlaylistHeight=function(){if(e.vertical&&d.playlist&&d.playlist.scrollRegion){var h=d.playlist.display.height();if(h){var g=d.playlist.pager?d.playlist.pager.display.height():0;d.playlist.scrollRegion.display.height(h-g);}}};this.onResize=function(){this.setPlaylistHeight();};this.onMenu=function(g){if(d.menu){if(g){d.menu.display.show("normal");}else{d.menu.display.hide("normal");}}};this.onMaximize=function(h){var g=d.display.position();g=e.vertical?g.left:g.top;var i=e.vertical?h?{width:(this.dialogWidth-g)+"px"}:{width:this.nodeWidth+"px"}:h?{height:(this.dialogHeight-g)+"px"}:{height:this.nodeHeight+"px"};d.display.animate(i,250,"linear",function(){d.onResize();});};this.setFullScreenPos=function(){var i=this.player.media.display.offset();var h=parseInt(this.player.media.display.css("marginLeft"),10);var g=parseInt(this.player.media.display.css("marginTop"),10);this.player.media.display.css({marginLeft:(a(document).scrollLeft()-i.left+h)+"px",marginTop:(a(document).scrollTop()-i.top+g)+"px",width:a(window).width(),height:a(window).height()});};this.onFullScreen=function(h){if(h){if(this.player){a(window).bind("mousemove",function(){if(!f.player.hasControls()&&f.showController){jQuery.media.utils.showThenHide(d.controller.display,"display","fast","slow");}jQuery.media.utils.showThenHide(f.titleLinks,"links","fast","slow");});if(!this.player.hasControls()&&this.showController){jQuery.media.utils.showThenHide(d.controller.display,"display","fast","slow");jQuery.media.utils.stopHideOnOver(d.controller.display,"display");}jQuery.media.utils.showThenHide(this.titleLinks,"links","fast","slow");jQuery.media.utils.stopHideOnOver(this.titleLinks,"links");}d.dialog.addClass(e.prefix+"mediafullscreen");d.dialog.find("#"+e.prefix+"mediamaxbutton").hide();d.showNativeControls(true);if(this.player&&this.player.media){if(this.isFireFox){this.setFullScreenPos();var g=0;a(window).bind("scroll",function(){clearTimeout(g);g=setTimeout(function(){f.setFullScreenPos();},100);});var i=0;a(window).bind("resize",function(){clearTimeout(i);i=setTimeout(function(){f.setFullScreenPos();},100);});}else{this.player.media.display.css({position:"fixed",overflow:"hidden"});}}}else{a(window).unbind("mousemove");jQuery.media.utils.stopHide(d.controller.display,"display");jQuery.media.utils.stopHide(this.titleLinks,"links");if(this.showController){d.controller.display.show();}if(this.titleLinks){this.titleLinks.show();}d.dialog.find("#"+e.prefix+"mediamaxbutton").show();d.dialog.removeClass(e.prefix+"mediafullscreen");d.showNativeControls(false);if(this.player&&this.player.media){if(this.isFireFox){a(window).unbind("scroll");a(window).unbind("resize");this.player.media.display.css({marginLeft:"0px",marginTop:"0px",width:"100%",height:"100%"});}else{this.player.media.display.css({position:"absolute",overflow:"inherit"});}}}d.onResize();};this.onMenuSelect=function(i,h,g){if(g){h.show("normal");i.addClass(e.prefix+"ui-tabs-selected "+e.prefix+"ui-state-active");}else{h.hide("normal");i.removeClass(e.prefix+"ui-tabs-selected "+e.prefix+"ui-state-active");}};this.onLinkOver=function(g){g.addClass(e.prefix+"ui-state-hover");};this.onLinkOut=function(g){g.removeClass(e.prefix+"ui-state-hover");};this.onLinkSelect=function(h,g){if(g){a(h.display).addClass(e.prefix+"active");}else{a(h.display).removeClass(e.prefix+"active");}};this.onTeaserOver=function(g){a(g.node.display).addClass(e.prefix+"ui-state-hover");};this.onTeaserOut=function(g){a(g.node.display).removeClass(e.prefix+"ui-state-hover");};this.onTeaserSelect=function(g,h){if(h){a(g.node.display).addClass(e.prefix+"ui-state-hover");}else{a(g.node.display).removeClass(e.prefix+"ui-state-hover");}};this.onTeaserActivate=function(g,h){if(h){a(g.node.display).addClass(e.prefix+"ui-state-active");}else{a(g.node.display).removeClass(e.prefix+"ui-state-active");}};this.onMediaUpdate=function(g){if(d.fullScreen&&g.type=="playerready"){d.showNativeControls(true);}if(d.controller&&d.node){if(g.type=="reset"){this.showController=true;d.controller.display.show();d.node.display.css("bottom",this.controlHeight+"px");}else{if(g.type=="nomedia"){this.showController=false;d.controller.display.hide();d.node.display.css("bottom","0px");}}}};this.updateVote=function(l,m,k){var h=0;var j=l.votes.length;while(j--){var g=l.votes[j];g.display.removeClass(k?(e.prefix+"ui-state-highlight"):(e.prefix+"ui-state-active"));g.display.removeClass(k?"":(e.prefix+"ui-state-active"));if(m>=g.vote){g.display.addClass(k?(e.prefix+"ui-state-highlight"):(e.prefix+"ui-state-active"));}h=g.vote;}};this.formatTime=false;})(b,c);}},jQuery.media.templates);})(jQuery);;

