(function ($) {

/**
 * A progressbar object. Initialized with the given id. Must be inserted into
 * the DOM afterwards through progressBar.element.
 *
 * method is the function which will perform the HTTP request to get the
 * progress bar state. Either "GET" or "POST".
 *
 * e.g. pb = new progressBar('myProgressBar');
 *      some_element.appendChild(pb.element);
 */
Drupal.progressBar = function (id, updateCallback, method, errorCallback) {
  var pb = this;
  this.id = id;
  this.method = method || 'GET';
  this.updateCallback = updateCallback;
  this.errorCallback = errorCallback;

  // The WAI-ARIA setting aria-live="polite" will announce changes after users
  // have completed their current activity and not interrupt the screen reader.
  this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id);
  this.element.html('<div class="bar"><div class="filled"></div></div>' +
                    '<div class="percentage"></div>' +
                    '<div class="message">&nbsp;</div>');
};

/**
 * Set the percentage and status message for the progressbar.
 */
Drupal.progressBar.prototype.setProgress = function (percentage, message) {
  if (percentage >= 0 && percentage <= 100) {
    $('div.filled', this.element).css('width', percentage + '%');
    $('div.percentage', this.element).html(percentage + '%');
  }
  $('div.message', this.element).html(message);
  if (this.updateCallback) {
    this.updateCallback(percentage, message, this);
  }
};

/**
 * Start monitoring progress via Ajax.
 */
Drupal.progressBar.prototype.startMonitoring = function (uri, delay) {
  this.delay = delay;
  this.uri = uri;
  this.sendPing();
};

/**
 * Stop monitoring progress via Ajax.
 */
Drupal.progressBar.prototype.stopMonitoring = function () {
  clearTimeout(this.timer);
  // This allows monitoring to be stopped from within the callback.
  this.uri = null;
};

/**
 * Request progress data from server.
 */
Drupal.progressBar.prototype.sendPing = function () {
  if (this.timer) {
    clearTimeout(this.timer);
  }
  if (this.uri) {
    var pb = this;
    // When doing a post request, you need non-null data. Otherwise a
    // HTTP 411 or HTTP 406 (with Apache mod_security) error may result.
    $.ajax({
      type: this.method,
      url: this.uri,
      data: '',
      dataType: 'json',
      success: function (progress) {
        // Display errors.
        if (progress.status == 0) {
          pb.displayError(progress.data);
          return;
        }
        // Update display.
        pb.setProgress(progress.percentage, progress.message);
        // Schedule next timer.
        pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay);
      },
      error: function (xmlhttp) {
        pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri));
      }
    });
  }
};

/**
 * Display errors on the page.
 */
Drupal.progressBar.prototype.displayError = function (string) {
  var error = $('<div class="messages error"></div>').html(string);
  $(this.element).before(error).hide();

  if (this.errorCallback) {
    this.errorCallback(this);
  }
};

})(jQuery);
;
// ColorBox v1.3.17.2 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(a,b,c){function bc(b){if(!U){P=b,_(),y=a(P),Q=0,K.rel!=="nofollow"&&(y=a("."+g).filter(function(){var b=a.data(this,e).rel||this.rel;return b===K.rel}),Q=y.index(P),Q===-1&&(y=y.add(P),Q=y.length-1));if(!S){S=T=!0,r.show();if(K.returnFocus)try{P.blur(),a(P).one(l,function(){try{this.focus()}catch(a){}})}catch(c){}q.css({opacity:+K.opacity,cursor:K.overlayClose?"pointer":"auto"}).show(),K.w=Z(K.initialWidth,"x"),K.h=Z(K.initialHeight,"y"),X.position(),o&&z.bind("resize."+p+" scroll."+p,function(){q.css({width:z.width(),height:z.height(),top:z.scrollTop(),left:z.scrollLeft()})}).trigger("resize."+p),ba(h,K.onOpen),J.add(D).hide(),I.html(K.close).show()}X.load(!0)}}function bb(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;K.slideshow&&y[1]?(d=function(){F.text(K.slideshowStop).unbind(c).bind(j,function(){if(Q<y.length-1||K.loop)a=setTimeout(X.next,K.slideshowSpeed)}).bind(i,function(){clearTimeout(a)}).one(c+" "+k,e),r.removeClass(b+"off").addClass(b+"on"),a=setTimeout(X.next,K.slideshowSpeed)},e=function(){clearTimeout(a),F.text(K.slideshowStart).unbind([j,i,k,c].join(" ")).one(c,d),r.removeClass(b+"on").addClass(b+"off")},K.slideshowAuto?d():e()):r.removeClass(b+"off "+b+"on")}function ba(b,c){c&&c.call(P),a.event.trigger(b)}function _(b){K=a.extend({},a.data(P,e));for(b in K)a.isFunction(K[b])&&b.substring(0,2)!=="on"&&(K[b]=K[b].call(P));K.rel=K.rel||P.rel||"nofollow",K.href=K.href||a(P).attr("href"),K.title=K.title||P.title,typeof K.href=="string"&&(K.href=a.trim(K.href))}function $(a){return K.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(a)}function Z(a,b){return Math.round((/%/.test(a)?(b==="x"?z.width():z.height())/100:1)*parseInt(a,10))}function Y(c,d,e){e=b.createElement("div"),c&&(e.id=f+c),e.style.cssText=d||"";return a(e)}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:!1},e="colorbox",f="cbox",g=f+"Element",h=f+"_open",i=f+"_load",j=f+"_complete",k=f+"_cleanup",l=f+"_closed",m=f+"_purge",n=a.browser.msie&&!a.support.opacity,o=n&&a.browser.version<7,p=f+"_IE6",q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X;X=a.fn[e]=a[e]=function(b,c){var f=this;b=b||{};if(!f[0]){if(f.selector)return f;f=a("<a/>"),b.open=!0}c&&(b.onComplete=c),f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(g)}),(a.isFunction(b.open)&&b.open.call(f)||b.open)&&bc(f[0]);return f},X.init=function(){z=a(c),r=Y().attr({id:e,"class":n?f+(o?"IE6":"IE"):""}),q=Y("Overlay",o?"position:absolute":"").hide(),s=Y("Wrapper"),t=Y("Content").append(A=Y("LoadedContent","width:0; height:0; overflow:hidden"),C=Y("LoadingOverlay").add(Y("LoadingGraphic")),D=Y("Title"),E=Y("Current"),G=Y("Next"),H=Y("Previous"),F=Y("Slideshow").bind(h,bb),I=Y("Close")),s.append(Y().append(Y("TopLeft"),u=Y("TopCenter"),Y("TopRight")),Y(!1,"clear:left").append(v=Y("MiddleLeft"),t,w=Y("MiddleRight")),Y(!1,"clear:left").append(Y("BottomLeft"),x=Y("BottomCenter"),Y("BottomRight"))).children().children().css({"float":"left"}),B=Y(!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(q,r.append(s,B)),t.children().hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")}).addClass("hover"),L=u.height()+x.height()+t.outerHeight(!0)-t.height(),M=v.width()+w.width()+t.outerWidth(!0)-t.width(),N=A.outerHeight(!0),O=A.outerWidth(!0),r.css({"padding-bottom":L,"padding-right":M}).hide(),G.click(function(){X.next()}),H.click(function(){X.prev()}),I.click(function(){X.close()}),J=G.add(H).add(E).add(F),t.children().removeClass("hover"),q.click(function(){K.overlayClose&&X.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;S&&K.escKey&&b===27&&(a.preventDefault(),X.close()),S&&K.arrowKey&&y[1]&&(b===37?(a.preventDefault(),H.click()):b===39&&(a.preventDefault(),G.click()))})},X.remove=function(){r.add(q).remove(),a("."+g).removeData(e).removeClass(g)},X.position=function(a,c){function g(a){u[0].style.width=x[0].style.width=t[0].style.width=a.style.width,C[0].style.height=C[1].style.height=t[0].style.height=v[0].style.height=w[0].style.height=a.style.height}var d=0,e=0;z.unbind("resize."+f),r.hide(),K.fixed&&!o?r.css({position:"fixed"}):(d=z.scrollTop(),e=z.scrollLeft(),r.css({position:"absolute"})),K.right!==!1?e+=Math.max(z.width()-K.w-O-M-Z(K.right,"x"),0):K.left!==!1?e+=Z(K.left,"x"):e+=Math.round(Math.max(z.width()-K.w-O-M,0)/2),K.bottom!==!1?d+=Math.max(b.documentElement.clientHeight-K.h-N-L-Z(K.bottom,"y"),0):K.top!==!1?d+=Z(K.top,"y"):d+=Math.round(Math.max(b.documentElement.clientHeight-K.h-N-L,0)/2),r.show(),a=r.width()===K.w+O&&r.height()===K.h+N?0:a||0,s[0].style.width=s[0].style.height="9999px",r.dequeue().animate({width:K.w+O,height:K.h+N,top:d,left:e},{duration:a,complete:function(){g(this),T=!1,s[0].style.width=K.w+O+M+"px",s[0].style.height=K.h+N+L+"px",c&&c(),setTimeout(function(){z.bind("resize."+f,X.position)},1)},step:function(){g(this)}})},X.resize=function(a){if(S){a=a||{},a.width&&(K.w=Z(a.width,"x")-O-M),a.innerWidth&&(K.w=Z(a.innerWidth,"x")),A.css({width:K.w}),a.height&&(K.h=Z(a.height,"y")-N-L),a.innerHeight&&(K.h=Z(a.innerHeight,"y"));if(!a.innerHeight&&!a.height){var b=A.wrapInner("<div style='overflow:auto'></div>").children();K.h=b.height(),b.replaceWith(b.children())}A.css({height:K.h}),X.position(K.transition==="none"?0:K.speed)}},X.prep=function(b){function h(){K.h=K.h||A.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h;return K.h}function g(){K.w=K.w||A.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w;return K.w}if(!!S){var c,d=K.transition==="none"?0:K.speed;A.remove(),A=Y("LoadedContent").append(b),A.hide().appendTo(B.show()).css({width:g(),overflow:K.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(t),B.hide(),a(R).css({"float":"none"}),o&&a("select").not(r.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(k,function(){this.style.visibility="inherit"}),c=function(){function o(){n&&r[0].style.removeAttribute("filter")}var b,c,g,h,i=y.length,k,l;!S||(l=function(){clearTimeout(W),C.hide(),ba(j,K.onComplete)},n&&R&&A.fadeIn(100),D.html(K.title).add(A).show(),i>1?(typeof K.current=="string"&&E.html(K.current.replace("{current}",Q+1).replace("{total}",i)).show(),G[K.loop||Q<i-1?"show":"hide"]().html(K.next),H[K.loop||Q?"show":"hide"]().html(K.previous),b=Q?y[Q-1]:y[i-1],g=Q<i-1?y[Q+1]:y[0],K.slideshow&&F.show(),K.preloading&&(h=a.data(g,e).href||g.href,c=a.data(b,e).href||b.href,h=a.isFunction(h)?h.call(g):h,c=a.isFunction(c)?c.call(b):c,$(h)&&(a("<img/>")[0].src=h),$(c)&&(a("<img/>")[0].src=c))):J.hide(),K.iframe?(k=a("<iframe/>").addClass(f+"Iframe")[0],K.fastIframe?l():a(k).one("load",l),k.name=f+ +(new Date),k.src=K.href,K.scrolling||(k.scrolling="no"),n&&(k.frameBorder=0,k.allowTransparency="true"),a(k).appendTo(A).one(m,function(){k.src="//about:blank"})):l(),K.transition==="fade"?r.fadeTo(d,1,o):o())},K.transition==="fade"?r.fadeTo(d,0,function(){X.position(0,c)}):X.position(d,c)}},X.load=function(b){var c,d,e=X.prep;T=!0,R=!1,P=y[Q],b||_(),ba(m),ba(i,K.onLoad),K.h=K.height?Z(K.height,"y")-N-L:K.innerHeight&&Z(K.innerHeight,"y"),K.w=K.width?Z(K.width,"x")-O-M:K.innerWidth&&Z(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=Z(K.maxWidth,"x")-O-M,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=Z(K.maxHeight,"y")-N-L,K.mh=K.h&&K.h<K.mh?K.h:K.mh),c=K.href,W=setTimeout(function(){C.show()},100),K.inline?(Y().hide().insertBefore(a(c)[0]).one(m,function(){a(this).replaceWith(A.children())}),e(a(c))):K.iframe?e(" "):K.html?e(K.html):$(c)?(a(R=new Image).addClass(f+"Photo").error(function(){K.title=!1,e(Y("Error").text("This image could not be loaded"))}).load(function(){var a;R.onload=null,K.scalePhotos&&(d=function(){R.height-=R.height*a,R.width-=R.width*a},K.mw&&R.width>K.mw&&(a=(R.width-K.mw)/R.width,d()),K.mh&&R.height>K.mh&&(a=(R.height-K.mh)/R.height,d())),K.h&&(R.style.marginTop=Math.max(K.h-R.height,0)/2+"px"),y[1]&&(Q<y.length-1||K.loop)&&(R.style.cursor="pointer",R.onclick=function(){X.next()}),n&&(R.style.msInterpolationMode="bicubic"),setTimeout(function(){e(R)},1)}),setTimeout(function(){R.src=c},1)):c&&B.load(c,K.data,function(b,c,d){e(c==="error"?Y("Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},X.next=function(){!T&&y[1]&&(Q<y.length-1||K.loop)&&(Q=Q<y.length-1?Q+1:0,X.load())},X.prev=function(){!T&&y[1]&&(Q||K.loop)&&(Q=Q?Q-1:y.length-1,X.load())},X.close=function(){S&&!U&&(U=!0,S=!1,ba(k,K.onCleanup),z.unbind("."+f+" ."+p),q.fadeTo(200,0),r.stop().fadeTo(300,0,function(){r.add(q).css({opacity:1,cursor:"auto"}).hide(),ba(m),A.remove(),setTimeout(function(){U=!1,ba(l,K.onClosed)},1)}))},X.element=function(){return a(P)},X.settings=d,V=function(a){a.button!==0&&typeof a.button!="undefined"||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),bc(this))},a.fn.delegate?a(b).delegate("."+g,"click",V):a("."+g).live("click",V),a(X.init)})(jQuery,document,this);;
(function ($) {

Drupal.behaviors.initColorbox = {
  attach: function (context, settings) {
    if (!$.isFunction($.colorbox)) {
      return;
    }
    $('a, area, input', context)
      .filter('.colorbox')
      .once('init-colorbox-processed')
      .colorbox(settings.colorbox);
  }
};

{
  $(document).bind('cbox_complete', function () {
    Drupal.attachBehaviors('#cboxLoadedContent');
  });
}

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

  Drupal.behaviors.featuredContent = {
    attach: function (context) {
      // show manual or filter fieldset depending on type selection
      var type = $('#edit-featured-content-block-type');
      if (type) {
        showHideFeaturedBlockSettings(type);
      }
      $('#edit-featured-content-block-type').bind('change', {}, onchangeFeaturedBlockSettings);
    
      // show style select list depending on display selection
      var display = $('#edit-featured-content-block-display');
      if (display) {
        showHideFeaturedBlockStyleSettings(display);
      }
      $('#edit-featured-content-block-display').bind('change', {}, onchangeFeaturedBlockStyleSettings);
    
      // show read more fields depending on more selection
      var more = $('#edit-featured-content-block-more-display');
      if (more) {
        showHideFeaturedBlockMoreSettings(more);
      }
      $('#edit-featured-content-block-more-display').bind('change', {}, onchangeFeaturedBlockMoreSettings);
    
      // show rss fields depending on rss selection
      var rss = $('#edit-featured-content-block-rss-display');
      if (rss) {
        showHideFeaturedBlockRSSSettings(rss);
      }
      $('#edit-featured-content-block-rss-display').bind('change', {}, onchangeFeaturedBlockRSSSettings);
    }
  };

  function onchangeFeaturedBlockSettings(event) {
    showHideFeaturedBlockSettings($(this));
  }

  function showHideFeaturedBlockSettings(select) {
    var choice = select.attr('value');
    if (choice == 'manual') {
      $('fieldset.featured-content-block-filter').hide();
      $('fieldset.featured-content-block-cck').hide();
      $('fieldset.featured-content-block-search').hide();
      $('fieldset.featured-content-block-manual').show();
    }
    else if (choice == 'filter') {
      $('fieldset.featured-content-block-manual').hide();
      $('fieldset.featured-content-block-cck').hide();
      $('fieldset.featured-content-block-search').hide();
      $('fieldset.featured-content-block-filter').show();
    }
    else if (choice == 'cck') {
      $('fieldset.featured-content-block-manual').hide();
      $('fieldset.featured-content-block-filter').hide();
      $('fieldset.featured-content-block-search').hide();
      $('fieldset.featured-content-block-cck').show();
    }
    else if (choice == 'search') {
      $('fieldset.featured-content-block-manual').hide();
      $('fieldset.featured-content-block-filter').hide();
      $('fieldset.featured-content-block-cck').hide();
      $('fieldset.featured-content-block-search').show();
    }
  }

  function onchangeFeaturedBlockStyleSettings(event) {
    showHideFeaturedBlockStyleSettings($(this));
  }

  function showHideFeaturedBlockStyleSettings(select) {
    var choice = select.attr('value');
    if (choice == 'links') {
      $('.form-item-featured-content-block-style').show();
    }
    else {
      $('.form-item-featured-content-block-style').hide();
    }
  }

  function onchangeFeaturedBlockMoreSettings(event) {
    showHideFeaturedBlockMoreSettings($(this));
  }

  function showHideFeaturedBlockMoreSettings(select) {
    var choice = select.attr('value');
    if (choice == 'custom') {
      $('fieldset#edit-more').show();
      $('.form-item-featured-content-block-more-text').show();
      $('.form-item-featured-content-block-more-url').show();
      $('.form-item-featured-content-block-more-num').hide();
      $('.form-item-featured-content-block-more-style').hide();
      $('.form-item-featured-content-block-more-title').hide();
      $('.form-item-featured-content-block-more-header').hide();
      $('.form-item-featured-content-block-more-footer').hide();
    }
    else if (choice == 'none') {
      $('fieldset#edit-more').hide();
    }
    else if (choice == 'links') {
      $('fieldset#edit-more').show();
      $('.form-item-featured-content-block-more-text').show();
      $('.form-item-featured-content-block-more-url').hide();
      $('.form-item-featured-content-block-more-num').show();
      $('.form-item-featured-content-block-more-style').show();
      $('.form-item-featured-content-block-more-title').show();
      $('.form-item-featured-content-block-more-header').show();
      $('.form-item-featured-content-block-more-footer').show();
    }
    else {
      $('fieldset#edit-more').show();
      $('.form-item-featured-content-block-more-text').show();
      $('.form-item-featured-content-block-more-url').hide();
      $('.form-item-featured-content-block-more-num').show();
      $('.form-item-featured-content-block-more-style').hide();
      $('.form-item-featured-content-block-more-title').show();
      $('.form-item-featured-content-block-more-header').show();
      $('.form-item-featured-content-block-more-footer').show();
    }
  }

  function onchangeFeaturedBlockRSSSettings(event) {
    showHideFeaturedBlockRSSSettings($(this));
  }

  function showHideFeaturedBlockRSSSettings(checkbox) {
    if (checkbox.attr('checked')) {
      $('fieldset#edit-rss').show();
    }
    else {
      $('fieldset#edit-rss').hide();
    }
  }

})(jQuery);
;

(function ($) {
  Drupal.Panels = {};

  Drupal.Panels.autoAttach = function() {
    if ($.browser.msie) {
      // If IE, attach a hover event so we can see our admin links.
      $("div.panel-pane").hover(
        function() {
          $('div.panel-hide', this).addClass("panel-hide-hover"); return true;
        },
        function() {
          $('div.panel-hide', this).removeClass("panel-hide-hover"); return true;
        }
      );
      $("div.admin-links").hover(
        function() {
          $(this).addClass("admin-links-hover"); return true;
        },
        function(){
          $(this).removeClass("admin-links-hover"); return true;
        }
      );
    }
  };

  $(Drupal.Panels.autoAttach);
})(jQuery);
;
(function ($) {
  Drupal.viewsSlideshow = Drupal.viewsSlideshow || {};

  /**
   * Views Slideshow Controls
   */
  Drupal.viewsSlideshowControls = Drupal.viewsSlideshowControls || {};

  /**
   * Implement the play hook for controls.
   */
  Drupal.viewsSlideshowControls.play = function (options) {
    // Route the control call to the correct control type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play == 'function') {
        Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play == 'function') {
        Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };

  /**
   * Implement the pause hook for controls.
   */
  Drupal.viewsSlideshowControls.pause = function (options) {
    // Route the control call to the correct control type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause == 'function') {
        Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause == 'function') {
        Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };


  /**
   * Views Slideshow Text Controls
   */

  // Add views slieshow api calls for views slideshow text controls.
  Drupal.behaviors.viewsSlideshowControlsText = {
    attach: function (context) {

      // Process previous link
      $('.views_slideshow_controls_text_previous:not(.views-slideshow-controls-text-previous-processed)', context).addClass('views-slideshow-controls-text-previous-processed').each(function() {
        var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_previous_', '');
        $(this).click(function() {
          Drupal.viewsSlideshow.action({ "action": 'previousSlide', "slideshowID": uniqueID });
          return false;
        });
      });

      // Process next link
      $('.views_slideshow_controls_text_next:not(.views-slideshow-controls-text-next-processed)', context).addClass('views-slideshow-controls-text-next-processed').each(function() {
        var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_next_', '');
        $(this).click(function() {
          Drupal.viewsSlideshow.action({ "action": 'nextSlide', "slideshowID": uniqueID });
          return false;
        });
      });

      // Process pause link
      $('.views_slideshow_controls_text_pause:not(.views-slideshow-controls-text-pause-processed)', context).addClass('views-slideshow-controls-text-pause-processed').each(function() {
        var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', '');
        $(this).click(function() {
          if (Drupal.settings.viewsSlideshow[uniqueID].paused) {
            Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID, "force": true });
          }
          else {
            Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID, "force": true });
          }
          return false;
        });
      });
    }
  };

  Drupal.viewsSlideshowControlsText = Drupal.viewsSlideshowControlsText || {};

  /**
   * Implement the pause hook for text controls.
   */
  Drupal.viewsSlideshowControlsText.pause = function (options) {
    var pauseText = Drupal.theme.prototype['viewsSlideshowControlsPause'] ? Drupal.theme('viewsSlideshowControlsPause') : '';
    $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(pauseText);
  };

  /**
   * Implement the play hook for text controls.
   */
  Drupal.viewsSlideshowControlsText.play = function (options) {
    var playText = Drupal.theme.prototype['viewsSlideshowControlsPlay'] ? Drupal.theme('viewsSlideshowControlsPlay') : '';
    $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(playText);
  };

  // Theme the resume control.
  Drupal.theme.prototype.viewsSlideshowControlsPause = function () {
    return Drupal.t('Resume');
  };

  // Theme the pause control.
  Drupal.theme.prototype.viewsSlideshowControlsPlay = function () {
    return Drupal.t('Pause');
  };

  /**
   * Views Slideshow Pager
   */
  Drupal.viewsSlideshowPager = Drupal.viewsSlideshowPager || {};

  /**
   * Implement the transitionBegin hook for pagers.
   */
  Drupal.viewsSlideshowPager.transitionBegin = function (options) {
    // Route the pager call to the correct pager type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };

  /**
   * Implement the goToSlide hook for pagers.
   */
  Drupal.viewsSlideshowPager.goToSlide = function (options) {
    // Route the pager call to the correct pager type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };

  /**
   * Implement the previousSlide hook for pagers.
   */
  Drupal.viewsSlideshowPager.previousSlide = function (options) {
    // Route the pager call to the correct pager type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };

  /**
   * Implement the nextSlide hook for pagers.
   */
  Drupal.viewsSlideshowPager.nextSlide = function (options) {
    // Route the pager call to the correct pager type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };


  /**
   * Views Slideshow Pager Fields
   */

  // Add views slieshow api calls for views slideshow pager fields.
  Drupal.behaviors.viewsSlideshowPagerFields = {
    attach: function (context) {
      // Process pause on hover.
      $('.views_slideshow_pager_field:not(.views-slideshow-pager-field-processed)', context).addClass('views-slideshow-pager-field-processed').each(function() {
        // Parse out the location and unique id from the full id.
        var pagerInfo = $(this).attr('id').split('_');
        var location = pagerInfo[2];
        pagerInfo.splice(0, 3);
        var uniqueID = pagerInfo.join('_');

        // Add the activate and pause on pager hover event to each pager item.
        if (Drupal.settings.viewsSlideshowPagerFields[uniqueID][location].activatePauseOnHover) {
          $(this).children().each(function(index, pagerItem) {
            var mouseIn = function() {
              Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index });
              Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID });
            }
            
            var mouseOut = function() {
              Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID });
            }
          
            if (jQuery.fn.hoverIntent) {
              $(pagerItem).hoverIntent(mouseIn, mouseOut);
            }
            else {
              $(pagerItem).hover(mouseIn, mouseOut);
            }
            
          });
        }
        else {
          $(this).children().each(function(index, pagerItem) {
            $(pagerItem).click(function() {
              Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index });
            });
          });
        }
      });
    }
  };

  Drupal.viewsSlideshowPagerFields = Drupal.viewsSlideshowPagerFields || {};

  /**
   * Implement the transitionBegin hook for pager fields pager.
   */
  Drupal.viewsSlideshowPagerFields.transitionBegin = function (options) {
    for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
      // Remove active class from pagers
      $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');

      // Add active class to active pager.
      $('#views_slideshow_pager_field_item_'+ pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active');
    }

  };

  /**
   * Implement the goToSlide hook for pager fields pager.
   */
  Drupal.viewsSlideshowPagerFields.goToSlide = function (options) {
    for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
      // Remove active class from pagers
      $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');

      // Add active class to active pager.
      $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active');
    }
  };

  /**
   * Implement the previousSlide hook for pager fields pager.
   */
  Drupal.viewsSlideshowPagerFields.previousSlide = function (options) {
    for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
      // Get the current active pager.
      var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', '');

      // If we are on the first pager then activate the last pager.
      // Otherwise activate the previous pager.
      if (pagerNum == 0) {
        pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length() - 1;
      }
      else {
        pagerNum--;
      }

      // Remove active class from pagers
      $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');

      // Add active class to active pager.
      $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + pagerNum).addClass('active');
    }
  };

  /**
   * Implement the nextSlide hook for pager fields pager.
   */
  Drupal.viewsSlideshowPagerFields.nextSlide = function (options) {
    for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
      // Get the current active pager.
      var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', '');
      var totalPagers = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length();

      // If we are on the last pager then activate the first pager.
      // Otherwise activate the next pager.
      pagerNum++;
      if (pagerNum == totalPagers) {
        pagerNum = 0;
      }

      // Remove active class from pagers
      $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');

      // Add active class to active pager.
      $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + slideNum).addClass('active');
    }
  };


  /**
   * Views Slideshow Slide Counter
   */

  Drupal.viewsSlideshowSlideCounter = Drupal.viewsSlideshowSlideCounter || {};

  /**
   * Implement the transitionBegin for the slide counter.
   */
  Drupal.viewsSlideshowSlideCounter.transitionBegin = function (options) {
    $('#views_slideshow_slide_counter_' + options.slideshowID + ' .num').text(options.slideNum + 1);
  };

  /**
   * This is used as a router to process actions for the slideshow.
   */
  Drupal.viewsSlideshow.action = function (options) {
    // Set default values for our return status.
    var status = {
      'value': true,
      'text': ''
    }

    // If an action isn't specified return false.
    if (typeof options.action == 'undefined' || options.action == '') {
      status.value = false;
      status.text =  Drupal.t('There was no action specified.');
      return error;
    }

    // If we are using pause or play switch paused state accordingly.
    if (options.action == 'pause') {
      Drupal.settings.viewsSlideshow[options.slideshowID].paused = 1;
      // If the calling method is forcing a pause then mark it as such.
      if (options.force) {
        Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 1;
      }
    }
    else if (options.action == 'play') {
      // If the slideshow isn't forced pause or we are forcing a play then play
      // the slideshow.
      // Otherwise return telling the calling method that it was forced paused.
      if (!Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce || options.force) {
        Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0;
        Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 0;
      }
      else {
        status.value = false;
        status.text += ' ' + Drupal.t('This slideshow is forced paused.');
        return status;
      }
    }

    // We use a switch statement here mainly just to limit the type of actions
    // that are available.
    switch (options.action) {
      case "goToSlide":
      case "transitionBegin":
      case "transitionEnd":
        // The three methods above require a slide number. Checking if it is
        // defined and it is a number that is an integer.
        if (typeof options.slideNum == 'undefined' || typeof options.slideNum !== 'number' || parseInt(options.slideNum) != (options.slideNum - 0)) {
          status.value = false;
          status.text = Drupal.t('An invalid integer was specified for slideNum.');
        }
      case "pause":
      case "play":
      case "nextSlide":
      case "previousSlide":
        // Grab our list of methods.
        var methods = Drupal.settings.viewsSlideshow[options.slideshowID]['methods'];

        // if the calling method specified methods that shouldn't be called then
        // exclude calling them.
        var excludeMethodsObj = {};
        if (typeof options.excludeMethods !== 'undefined') {
          // We need to turn the excludeMethods array into an object so we can use the in
          // function.
          for (var i=0; i < excludeMethods.length; i++) {
            excludeMethodsObj[excludeMethods[i]] = '';
          }
        }

        // Call every registered method and don't call excluded ones.
        for (i = 0; i < methods[options.action].length; i++) {
          if (Drupal[methods[options.action][i]] != undefined && typeof Drupal[methods[options.action][i]][options.action] == 'function' && !(methods[options.action][i] in excludeMethodsObj)) {
            Drupal[methods[options.action][i]][options.action](options);
          }
        }
        break;

      // If it gets here it's because it's an invalid action.
      default:
        status.value = false;
        status.text = Drupal.t('An invalid action "!action" was specified.', { "!action": options.action });
    }
    return status;
  };
})(jQuery);
;
(function ($) {
/**
 *  @file
 *  Views Slideshow DDblock admin page functionality 
 */


function initPagerPositionOptions(key, value) {
  this.key = key;
  this.value = value;
}

function setPagerPositionOptions(pagerPositionOptions) {
  var oldPagerPosition = $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager-position').val();
  $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager-position').find('option').remove();
  var options = '' ;
  for (var i = 0; i < pagerPositionOptions.length; i++) {
    if (i==0) { 
      options += '<option selected value="' + pagerPositionOptions[i].key + '">' + pagerPositionOptions[i].value + '</option>'; 
    }
    else {
      options += '<option value="' + pagerPositionOptions[i].key + '">' + pagerPositionOptions[i].value + '</option>';
    }
  }
  // populate select box with array
  $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager-position').html(options);  
  $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager-position').val(oldPagerPosition);  
}

/**
 * Change pager container depending on the pager.
 */
Drupal.behaviors.ddblockChangePagerContainerOptions = {
  attach: function(context, settings) {
  // Change pager container option depending on select.
  $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager:not(.ddblock-change-pager-container-options-processed)', context)
  .addClass('ddblock-change-pager-container-options-processed')
  .bind("change", function() {
    val = $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager').val();
    switch (val) {
      case "number-pager" :
      case "prev-next-pager" :
      case "custom-pager" :
        $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager-container').val('.custom-pager-item');
      break;
      case "scrollable-pager" :
        $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager-container').val('.scrollable-pager-item');
      break;
    }
    return false;
  }).trigger('change').trigger('change')
}
};



/**
 * Show/hide custom template settings sections on the views_slideshow_ddblock configuration page.
 */
Drupal.behaviors.ddblockShowHideCustomTemplateOptions = {
  attach: function(context, settings) {

  // Show/hide imagefolder/contenttype options depending on the select.
  $('#edit-style-options-views-slideshow-ddblock-template:not(.ddblock-show-hide-custom-template-options-processed)', context)
  .addClass('ddblock-show-hide-custom-template-options-processed')
  .bind("change", function() {
    val = $('#edit-style-options-views-slideshow-ddblock-template').val();
    if (val.match('default') == "default" ) {
      $('#ddblock-pager-settings-wrapper').hide();
      $('#edit-style-options-views-slideshow-ddblock-settings-pager-toggle-wrapper').hide();
      $('#edit-style-options-views-slideshow-ddblock-settings-pager2-settings-pager2-position-pager-wrapper').hide();
      $('ddblock-pager2-pager-settings-wrapper').hide();
      $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager').find('option').remove().end().append('<option value="custom-pager">Custom pager</option>').val('custom-pager');
      $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager-container').val('.custom-pager-item');
      $('#ddblock-nr-of-pager-items-wrapper').hide();
    }  
    else {
      $('#ddblock-pager-settings-wrapper').show();
      $('#edit-style-options-views-slideshow-ddblock-settings-pager-toggle-wrapper').show();
      $('#edit-style-options-views-slideshow-ddblock-settings-pager2-settings-pager2-position-pager-wrapper').show();
      $('#ddblock-pager2-pager-settings-wrapper').show();
    }      
    if (val.match("10p") == "10p" || val.match("10l") == "10l") {
      $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager-container').val('.custom-pager-item');
      $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager').find('option').remove().end().append('<option value="number-pager">Number pager</option>').val('number-pager');
      $('#ddblock-nr-of-pager-items-wrapper').hide();
    }
    else {
      if (val.match("20p") == "20p" || val.match("20l") == "20l") {
        $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager-container').val('.custom-pager-item');
        $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager').find('option').remove().end().append('<option value="prev-next-pager">Prev/Next pager</option>').val('prev-next-pager');
        $('#ddblock-nr-of-pager-items-wrapper').hide();
      }
      else {
        if (val.match("30p") == "30p" || val.match("30l") == "30l" ||
            val.match("40p") == "40p" || val.match("40l") == "40l" ||
            val.match("50p") == "50p" || val.match("50l") == "50l") {
          $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager-container').val('.custom-pager-item');
          $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager').find('option').remove().end().append('<option value="custom-pager">Custom pager</option>').val('custom-pager');
          $('#ddblock-nr-of-pager-items-wrapper').show();
        }
        else {
          if (val.match("60p") == "60p" || val.match("60l") == "60l") {
            $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager').val('scrollable-pager');
            $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager-container').val('.scrollable-pager-item');
          $('#edit-style-options-views-slideshow-ddblock-settings-pager-settings-pager').find('option').remove().end().append('<option value="scrollable-pager">Scrollable pager</option>').val('scrollable-pager');
          $('#ddblock-nr-of-pager-items-wrapper').show();
          }
        }  
      }  
    }    
    // portrait themes
    if (val.match("10p") == "10p" || val.match("20p") == "20p" ||
        val.match("30p") == "30p" || val.match("40p") == "40p" ||
        val.match("50p") == "50p" || val.match("60p") == "60p") {
      var pagerPositionOptions = new Array();  
      pagerPositionOptions[0] = new initPagerPositionOptions('top', 'Top');
      pagerPositionOptions[1] = new initPagerPositionOptions('bottom', 'Bottom');
      
      setPagerPositionOptions(pagerPositionOptions);
    }
    // landscape themes
    else {
      var pagerPositionOptions = new Array();  
      pagerPositionOptions[0] = new initPagerPositionOptions('left', 'Left');
      pagerPositionOptions[1] = new initPagerPositionOptions('right', 'Right');
 
      setPagerPositionOptions(pagerPositionOptions);
    }           
    return false;
  }).trigger('change').trigger('change')
}
};

})(jQuery);;

if(!this.JSON){JSON={};}
(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapeable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapeable.lastIndex=0;return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==='string'){return c;}
return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(typeof value.length==='number'&&!value.propertyIsEnumerable('length')){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}})();;

/**
 *  @file
 *  Set Views Slideshow DDblock jQuery Cycle plugin functionality 
 */
 
(function ($) {
  Drupal.behaviors.viewsSlideshowDdblockCycle = {
    attach: function (context) {



      //helper function to clone the options object
      function CloneObject(inObj) {
        for (i in inObj)
        {
            this[i] = inObj[i];
        }
      }

      // cycle Plugin onBefore function to add functionality before the next slide shows up
      // can be used to add the following effects to slide-text
      // fadeOut - Fade out all matched elements by adjusting their opacity and firing an optional callback after completion.
      // slideUp - Hide all matched elements by adjusting their height and firing an optional callback after completion.
      // hide - Hide all matched elements using a graceful animation and firing an optional callback after completion.
      
      // Todo: create variables for 
      // $("#views-slideshow-ddblock-" + opts.ddblocknr + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition)
      function onBefore(curr, next, opts, fwd) {
        if (opts.slideTextjQuery == 1){
          if (opts.slideTextEffectBeforeSpeed == 0) {
            opts.slideTextEffectBeforeSpeed = 1;
          };
          switch (opts.slideTextEffectBefore) {
          case "fadeOut":
            $("#views-slideshow-ddblock-"+ opts.ddblocknr + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition)
            .stop(true,true)
            .fadeOut(opts.slideTextEffectBeforeSpeed);
          break;
          case "slideUp":
            $("#views-slideshow-ddblock-"+ opts.ddblocknr + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition)
            .stop(true,true)
            .slideUp(opts.slideTextEffectBeforeSpeed);
          break;
          default:
            $("#views-slideshow-ddblock-"+ opts.ddblocknr + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition)
            .stop(true,true)
            .hide(opts.slideTextEffectBeforeSpeed);
          }
        }  
      }

      // cycle Plugin onAfter function to add functionality after the next slide shows up
      // can be used to add the following effects to slide-text
      // fadein - Fade in all matched elements by adjusting their opacity and firing an optional callback after completion.
      // slideDown - Reveal all matched elements by adjusting their height and firing an optional callback after completion.
      // show - Show all matched elements using a graceful animation and firing an optional callback after completion.
      
      // Todo: create variables for 
      // $("#views-slideshow-ddblock-" + opts.ddblocknr + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition)
      // and $("#views-slideshow-ddblock-" + opts.ddblocknr + ' div.slide-' + opts.nextSlide + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition)
      function onAfter(curr, next, opts, fwd) {
        if (opts.slideTextjQuery == 1){
          if (opts.slideTextEffectAfterSpeed == 0) {
            opts.slideTextEffectAfterSpeed = 1;
          };
          switch (opts.slideTextEffectAfter) {
          case "fadeIn":
           $("#views-slideshow-ddblock-" + opts.ddblocknr + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition)
           .fadeIn(opts.slideTextEffectAfterSpeed);
           $("#views-slideshow-ddblock-" + opts.ddblocknr + ' div.slide-' + opts.nextSlide + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition).css({"display":"none"});
          break;
          case 'slideDown':
           $("#views-slideshow-ddblock-" + opts.ddblocknr + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition)
           .slideDown(opts.slideTextEffectAfterSpeed);
           $("#views-slideshow-ddblock-" + opts.ddblocknr + ' div.slide-' + opts.nextSlide + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition).css({"display":"none"});
          break;
          default:
           $("#views-slideshow-ddblock-" + opts.ddblocknr + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition)
           .show(opts.slideTextEffectAfterSpeed);
           $("#views-slideshow-ddblock-" + opts.ddblocknr + ' div.slide-' + opts.nextSlide + ' ' + opts.slideTextContainer + '-' + opts.slideTextPosition).css({"display":"none"});
          }
        }  

        // stop slideshow when video is started used with flowplayer
        //$f(opts.currSlide).onStart(function() { 
          //alert('stop slideshow ('+opts.currSlide+')');
        //  $container.cycle('pause');
        //});

        //when scrollable pager is used set active pager-item to current slide
        if (opts.pager1 == 'scrollable-pager' ){
          opts.myScrollable.click(opts.currSlide);
        }

        // show pager count (0 of x)
        $("#views-slideshow-ddblock-"+ opts.ddblocknr + ' ' + 'a.count').html((opts.currSlide + 1) + " " + Drupal.t("of") + " " + opts.slideCount);

        // For prev/next pager in the pager. Only show prev if previous slide exist - Only show next if next slide exist
        var index = $(this).parent().children().index(this);
        if (opts.pager2PagerHide == 1) {
          $("#views-slideshow-ddblock-"+ opts.ddblocknr + ' li.pager-prev ' + 'a.prev')[index == 0 ? 'hide' : 'show']();
          $("#views-slideshow-ddblock-"+ opts.ddblocknr + ' li.pager-next ' + 'a.next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
        }

        // For prev/next pager in the slides. Only show prev if previous slide exist - Only show next if next slide exist
        var index = $(this).parent().children().index(this);
        if (opts.pager2SlideHide == 1) {
          $("#views-slideshow-ddblock-"+ opts.ddblocknr + ' div.prev-container ' + 'a.prev')[index == 0 ? 'hide' : 'show']();
          $("#views-slideshow-ddblock-"+ opts.ddblocknr + ' div.next-container ' + 'a.next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
        }
      }

      i=0;
      for (var base in Drupal.settings.viewsSlideshowDdblockContent) {
        // new options var for every block
        var options = new CloneObject($.fn.cycle.defaults);

        // simplify variable name
        var ViewsSlideshowDdblockSettings = Drupal.settings.viewsSlideshowDdblockContent[base];
        var block = ViewsSlideshowDdblockSettings.block;
        //alert(ViewsSlideshowDdblockSettings.nrOfItems);
        var custom = ViewsSlideshowDdblockSettings.custom;
        var pager = ViewsSlideshowDdblockSettings.pager;
        //alert(base);
        var pager2 = ViewsSlideshowDdblockSettings.pager2;
        var contentContainer = ViewsSlideshowDdblockSettings.contentContainer;
        var pagerContainer = ViewsSlideshowDdblockSettings.pagerContainer;

        // if not processed
        if (!$('#views-slideshow-ddblock-' + block + '.ddblock-processed', context).size()) {

          // set transition option
          options.fx = ViewsSlideshowDdblockSettings.fx;

          //set delay option for the blocks at different values so they less interfere with eachother
          options.delay = i * -1000;

          // set pager. You can have only one pager per block this way
          if (pager == 'image-pager' || pager == 'number-pager' || pager == 'custom-pager' || pager == 'scrollable-pager') {
            // number pager, image pager and custom pager and scrollable pager
            options.pager = "#views-slideshow-ddblock-" + pager + "-" + block;
            //store pager1 
            options.pager1 = pager;
            if (pager == 'number-pager') {
              options.pagerAnchorBuilder = function(idx, slide) {
                // return selector string for existing anchor
                return "#views-slideshow-ddblock-" + pager + "-" + block + " li.number-pager-item:eq(" + idx + ") a.pager-link";
              }
            }
            if (pager == 'image-pager') {
              options.pagerAnchorBuilder = function(idx, slide) {
                // return selector string for existing anchor
                return "#views-slideshow-ddblock-" + pager + "-" + block + " li.image-pager-item:eq(" + idx + ") a.pager-link";
              }
            }
            if (pager == 'custom-pager') {
              options.pagerAnchorBuilder = function(idx, slide) {
                // return selector string for existing anchor
                return "#views-slideshow-ddblock-" + pager + "-" + block + " " 
                + pagerContainer + ":eq(" + idx + ") a.pager-link";
              }
            }
            if (pager == 'scrollable-pager') {
              options.pagerAnchorBuilder = function(idx, slide) {
                // return selector string for existing anchor
                return "#views-slideshow-ddblock-" + pager + "-" + block + " " 
                + pagerContainer + ":eq(" + idx + ") a.pager-link";
              }
            }
          }

          //set event which drives the pager navigation
          options.pagerEvent = ViewsSlideshowDdblockSettings.pagerEvent;
          options.prevNextEvent = ViewsSlideshowDdblockSettings.pager2Event;

          // If pager fast set use fastOnEvent pager
          options.fastOnEvent = (ViewsSlideshowDdblockSettings.pagerFast == 1) ? 1 : 0;

          // pause slideshow on pager hover
          options.pauseOnPagerHover = (ViewsSlideshowDdblockSettings.pagerPause == 1) ? 1 : 0;

          // disable click if pager is mouseover
          if (ViewsSlideshowDdblockSettings.pagerEvent == 'mouseover') {
            if (ViewsSlideshowDdblockSettings.pagerDisableClick == 1) {
              $("#views-slideshow-ddblock-" + pager + "-" + ViewsSlideshowDdblockSettings.block + " a.pager-link").click(function() {
                return false;
              });
            }
            else {
              $("#views-slideshow-ddblock-" + pager + "-" + ViewsSlideshowDdblockSettings.block + " a.pager-link").click(function() {
                location.href = this.href;
              });
            }
          }
          // disable click if prev/next pager is mouseover
          if (ViewsSlideshowDdblockSettings.pager2Event == 'mouseover') {
              $("#views-slideshow-ddblock-"+ ViewsSlideshowDdblockSettings.block + ' a.prev').click(function() {
                return false;
              });
              $("#views-slideshow-ddblock-"+ ViewsSlideshowDdblockSettings.block + ' a.next').click(function() {
                return false;
              });
          }

          //add prev next pager
          if (pager2 == 1) {
            options.prev = "#views-slideshow-ddblock-"+ ViewsSlideshowDdblockSettings.block + ' a.prev';
            options.next = "#views-slideshow-ddblock-"+ ViewsSlideshowDdblockSettings.block + ' a.next';
          } 
          else {
            //set next
            if (ViewsSlideshowDdblockSettings.next) {
                options.next = "#views-slideshow-ddblock-"+ ViewsSlideshowDdblockSettings.block + ' ' + contentContainer;
            }
          }

          //set expression for selecting slides (if something other than all children is required)
          options.slideExpr = contentContainer;

          //set speed of the transition (any valid fx speed value)
          options.speed = ViewsSlideshowDdblockSettings.speed;
          if (options.speed == 0) {
            options.speed = 1;
          };

          //set timeout in milliseconds between slide transitions (0 to disable auto advance)
          options.timeout = ViewsSlideshowDdblockSettings.timeOut;

          //set pause, true to enable "pause on hover"
          if (ViewsSlideshowDdblockSettings.pause) {
            options.pause = ViewsSlideshowDdblockSettings.pause;
          }

          //set custom options
          if (custom) {
            // get the \r\n from the string
            var custom1 = custom.replace(/\r\n/gi,"");

            // parse into JSON object
            var custom2 = JSON.parse(JSON.stringify(custom1));

            // merge custom2 with options object
            jQuery.extend(true, options, custom2);
          }

          // redefine Cycle's updateActivePagerLink function
          $.fn.cycle.updateActivePagerLink = function(pager, currSlide) {
            $(pager)
              .find('a.pager-link')
              .removeClass('activeSlide')
              .filter('a.pager-link:eq('+currSlide+')')
              .addClass('activeSlide');
            $(pager)
              .find('.custom-pager-item')
              .removeClass('active-pager-item')
              .filter('.custom-pager-item:eq('+currSlide+')')
              .addClass('active-pager-item');
            $(pager)
              .find('.scrollable-pager-item')
              .removeClass('active-pager-item')
              .filter('.scrollable-pager-item:eq('+currSlide+')')
              .addClass('active-pager-item');
          };

          options.pager2PagerHide = ViewsSlideshowDdblockSettings.pager2PagerHide;
          options.pager2SlideHide = ViewsSlideshowDdblockSettings.pager2SlideHide;
          options.ddblocknr = block;
          options.before = onBefore;
          options.after = onAfter;

          if (ViewsSlideshowDdblockSettings.slideText == 1) {
            //set slidetext options
            options.slideTextContainer = ViewsSlideshowDdblockSettings.slideTextContainer;
            options.slideTextPosition = ViewsSlideshowDdblockSettings.slideTextPosition;
            options.slideTextEffectBefore = ViewsSlideshowDdblockSettings.slideTextEffectBefore;
            options.slideTextEffectBeforeSpeed = ViewsSlideshowDdblockSettings.slideTextEffectBeforeSpeed;
            options.slideTextEffectAfter = ViewsSlideshowDdblockSettings.slideTextEffectAfter;
            options.slideTextEffectAfterSpeed = ViewsSlideshowDdblockSettings.slideTextEffectAfterSpeed;
            options.slideTextjQuery = ViewsSlideshowDdblockSettings.slideTextjQuery;
          }

          options.pagerContainer = ViewsSlideshowDdblockSettings.pagerContainer;

          if (pager == 'scrollable-pager') {
            // set scrollableVertical to true when pager at left of right right, otherwise the scrollableVertical to false
            if (ViewsSlideshowDdblockSettings.pagerPosition == 'left' || ViewsSlideshowDdblockSettings.pagerPosition == 'right') {
              scrollableVertical = true;
            } 
            else {
              scrollableVertical = false;
            }
            // create one scrollable element and return the API by enabling the "api" property
            var myScrollable = $('#views-slideshow-ddblock-scrollable-pager-' + 
                                  block + 
                                  ' div.vsd-scrollable-pager').scrollable({ 

              // number of items vissible in scrollable pager 
              size: ViewsSlideshowDdblockSettings.nrOfPagerItems,

              //vertical slideshow
              vertical:scrollableVertical,

              //nextitem navigation, default used
              //next: '.next',

              //previtem navigation, default used
              //prev: '.prev',

              //enable api property
              api:true

            });
            //activate slide 1
            myScrollable.click(0);

            //set scrollable pager option
            options.myScrollable = myScrollable;
          }

          //start with slidenr from URL
          function getUrlVars() {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for(var i = 0; i < hashes.length; i++) {
              hash = hashes[i].split('=');
              vars.push(hash[0]);
              vars[hash[0]] = hash[1];
            }
            return vars;
          }  

          var startThisSlide = getUrlVars()["slidenum"];
          if (startThisSlide > 0 ){
            options.startingSlide = startThisSlide;
          }

          //Use the parent of the slides as the parent container so the children function can be used for the second pager
          if (ViewsSlideshowDdblockSettings.nrOfItems == 1) {
            var $container = $('#views-slideshow-ddblock-' + block + ' ' + contentContainer).parent();
            $container
            .css('visibility', 'visible')
            .addClass('ddblock-processed');
            $(contentContainer, $container).css('display', 'block');
            var $slideshowContainer = $('#views-slideshow-ddblock-' + block);
            //hide the pager
            $('div.views-slideshow-ddblock-pager', $slideshowContainer).css('display', 'none');
            //hide the pager on the slide
            $('div.views-slideshow-ddblock-prev-next-slide', $slideshowContainer).css('display', 'none');
          }

          else {
            var $container = $('#views-slideshow-ddblock-' + block + ' ' + contentContainer).parent();
            $container
            .cycle(options)
            .css('visibility', 'visible')
            .addClass('ddblock-processed');

            // stop slideshow when hover on scrollable pager container
            if (pager == 'scrollable-pager') {
              if (ViewsSlideshowDdblockSettings.pagerPause == 1) {
                $('#views-slideshow-ddblock-' + block + ' .scrollable-pager').hover(
                  function() {
                    $container.cycle('pause');
                  },
                  function() {
                    $container.cycle('resume');
                  }
                );
              }
            }
          }
        }
      }
      
      
    }
  };
})(jQuery);


;
/*
 * jquery.scrollable 1.0.5 - Scroll your HTML with eye candy.
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/scrollable.html
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 *
 * Launch  : March 2008
 * Date: 2009-06-12 11:02:45 +0000 (Fri, 12 Jun 2009)
 * Revision: 1911 
 */
(function(b){b.tools=b.tools||{version:{}};b.tools.version.scrollable="1.0.5";var c=null;function a(p,m){var s=this;if(!c){c=s}function n(t,u){b(s).bind(t,function(w,v){if(u&&u.call(this,v.index)===false&&v){v.proceed=false}});return s}b.each(m,function(t,u){if(b.isFunction(u)){n(t,u)}});var d=!m.vertical;var f=b(m.items,p);var j=0;function l(u,t){return u.indexOf("#")!=-1?b(u).eq(0):t.siblings(u).eq(0)}var q=l(m.navi,p);var g=l(m.prev,p);var i=l(m.next,p);var h=l(m.prevPage,p);var o=l(m.nextPage,p);b.extend(s,{getIndex:function(){return j},getConf:function(){return m},getSize:function(){return s.getItems().size()},getPageAmount:function(){return Math.ceil(this.getSize()/m.size)},getPageIndex:function(){return Math.ceil(j/m.size)},getRoot:function(){return p},getItemWrap:function(){return f},getItems:function(){return f.children()},getVisibleItems:function(){return s.getItems().slice(j,j+m.size)},seekTo:function(w,u,A){if(u===undefined){u=m.speed}if(b.isFunction(u)){A=u;u=m.speed}if(w<0){w=0}if(w>s.getSize()-m.size){return s}var B=s.getItems().eq(w);if(!B.length){return s}var t={index:w,proceed:true};b(s).trigger("onBeforeSeek",t);if(!t.proceed){return s}if(d){var v=-B.position().left;f.animate({left:v},u,m.easing,A?function(){A.call(s)}:null)}else{var z=-B.position().top;f.animate({top:z},u,m.easing,A?function(){A.call(s)}:null)}if(q.length){var x=m.activeClass;var y=Math.ceil(w/m.size);y=Math.min(y,q.children().length-1);q.children().removeClass(x).eq(y).addClass(x)}if(w===0){g.add(h).addClass(m.disabledClass)}else{g.add(h).removeClass(m.disabledClass)}if(w>=s.getSize()-m.size){i.add(o).addClass(m.disabledClass)}else{i.add(o).removeClass(m.disabledClass)}c=s;j=w;b(s).trigger("onSeek",{index:w});return s},move:function(v,u,t){var w=j+v;if(m.loop&&w>(s.getSize()-m.size)){w=0}return this.seekTo(w,u,t)},next:function(u,t){return this.move(1,u,t)},prev:function(u,t){return this.move(-1,u,t)},movePage:function(v,u,t){return this.move(m.size*v,u,t)},setPage:function(x,y,v){var u=m.size;var t=u*x;var w=t+u>=this.getSize();if(w){t=this.getSize()-m.size}return this.seekTo(t,y,v)},prevPage:function(u,t){return this.setPage(this.getPageIndex()-1,u,t)},nextPage:function(u,t){return this.setPage(this.getPageIndex()+1,u,t)},begin:function(u,t){return this.seekTo(0,u,t)},end:function(u,t){return this.seekTo(this.getSize()-m.size,u,t)},reload:function(){return r()},click:function(u,x,v){var w=s.getItems().eq(u);var t=m.activeClass;if(u<0||u>=this.getSize()){return s}if(m.size==2){if(u==s.getIndex()){u--}s.getItems().removeClass(t);w.addClass(t);return this.seekTo(u,x,v)}if(!w.hasClass(t)){s.getItems().removeClass(t);w.addClass(t);var z=Math.floor(m.size/2);var y=u-z;if(y>s.getSize()-m.size){y=s.getSize()-m.size}if(y!==u){return this.seekTo(y,x,v)}}return s},onBeforeSeek:function(t){return n("onBeforeSeek",t)},onSeek:function(t){return n("onSeek",t)}});if(b.isFunction(b.fn.mousewheel)){p.bind("mousewheel.scrollable",function(u,v){var t=b.browser.opera?1:-1;s.move(v>0?t:-t,50);return false})}g.addClass(m.disabledClass).click(function(){s.prev()});i.click(function(){s.next()});o.click(function(){s.nextPage()});h.addClass(m.disabledClass).click(function(){s.prevPage()});if(m.keyboard){b(document).unbind("keydown.scrollable").bind("keydown.scrollable",function(t){var u=c;if(!u||t.altKey||t.ctrlKey){return}if(d&&(t.keyCode==37||t.keyCode==39)){u.move(t.keyCode==37?-1:1);return t.preventDefault()}if(!d&&(t.keyCode==38||t.keyCode==40)){u.move(t.keyCode==38?-1:1);return t.preventDefault()}return true})}function r(){if(q.is(":empty")||q.data("me")==s){q.empty();q.data("me",s);for(var u=0;u<s.getPageAmount();u++){var v=b("<"+m.naviItem+"/>").attr("href",u).click(function(x){var w=b(this);w.parent().children().removeClass(m.activeClass);w.addClass(m.activeClass);s.setPage(w.attr("href"));return x.preventDefault()});if(u===0){v.addClass(m.activeClass)}q.append(v)}}else{var t=q.children();t.each(function(w){var x=b(this);x.attr("href",w);if(w===0){x.addClass(m.activeClass)}x.click(function(){q.find("."+m.activeClass).removeClass(m.activeClass);x.addClass(m.activeClass);s.setPage(x.attr("href"))})})}if(m.clickable){s.getItems().each(function(x,w){var y=b(this);if(!y.data("set")){y.bind("click.scrollable",function(){s.click(x)});y.data("set",true)}})}if(m.hoverClass){s.getItems().hover(function(){b(this).addClass(m.hoverClass)},function(){b(this).removeClass(m.hoverClass)})}return s}r();var e=null;function k(){if(e){return}e=setInterval(function(){if(m.interval===0){clearInterval(e);e=0;return}s.next()},m.interval)}if(m.interval>0){p.hover(function(){clearInterval(e);e=0},function(){k()});k()}}b.fn.scrollable=function(d){var e=this.eq(typeof d=="number"?d:0).data("scrollable");if(e){return e}var f={size:5,vertical:false,clickable:true,loop:false,interval:0,speed:400,keyboard:true,activeClass:"active",disabledClass:"disabled",hoverClass:null,easing:"swing",items:".items",prev:".prev",next:".next",prevPage:".prevPage",nextPage:".nextPage",navi:".navi",naviItem:"a",api:false,onBeforeSeek:null,onSeek:null};b.extend(f,d);this.each(function(){e=new a(b(this),f);b(this).data("scrollable",e)});return f.api?e:this}})(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);;

