/*!
 * jQuery Tools dev - The missing UI library for the Web
 * 
 * tabs/tabs.js
 * tabs/tabs.slideshow.js
 * overlay/overlay.js
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 */
$(function(a) {
  a.tools = a.tools || {version:"@VERSION"},a.tools.tabs = {conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:!1,history:!1},addEffect:function(a , c) {b[a] = c}};
  var b = {"default":function(a , b) {this.getPanes().hide().eq( a ).show(),b.call()},fade:function(a , b) {
    var c = this.getConf(),d = c.fadeOutSpeed,e = this.getPanes();
    d ? e.fadeOut( d ) : e.hide(),e.eq( a ).fadeIn( c.fadeInSpeed , b )
  },slide:function(a , b) {this.getPanes().slideUp( 200 ),this.getPanes().eq( a ).slideDown( 400 , b )},ajax:function(a , b) {this.getPanes().eq( 0 ).load( this.getTabs().eq( a ).attr( "href" ) , b )}},c;
  a.tools.tabs.addEffect( "horizontal" , function(b , d) {c || (c = this.getPanes().eq( 0 ).width()),this.getCurrentPane().animate( {width:0} , function() {a( this ).hide()} ),this.getPanes().eq( b ).animate( {width:c} , function() {a( this ).show(),d.call()} )} );
  function d(c , d , e) {
    var f = this,g = c.add( this ),h = c.find( e.tabs ),i = d.jquery ? d : c.children( d ),j;
    h.length || (h = c.children()),i.length || (i = c.parent().find( d )),i.length || (i = a( d )),a.extend( this , {click:function(c , d) {
      var i = h.eq( c );
      typeof c == "string" && c.replace( "#" , "" ) && (i = h.filter( "[href*=" + c.replace( "#" , "" ) + "]" ),c = Math.max( h.index( i ) , 0 ));
      if ( e.rotate ) {
        var k = h.length - 1;
        if ( c < 0 )return f.click( k , d );
        if ( c > k )return f.click( 0 , d )
      }
      if ( !i.length ) {
        if ( j >= 0 )return f;
        c = e.initialIndex,i = h.eq( c )
      }
      if ( c === j )return f;
      d = d || a.Event(),d.type = "onBeforeClick",g.trigger( d , [c] );
      if ( !d.isDefaultPrevented() ) {
        b[e.effect].call( f , c , function() {d.type = "onClick",g.trigger( d , [c] )} ),j = c,h.removeClass( e.current ),i.addClass( e.current );
        return f
      }
    },getConf:function() {return e},getTabs:function() {return h},getPanes:function() {return i},getCurrentPane:function() {return i.eq( j )},getCurrentTab:function() {return h.eq( j )},getIndex:function() {return j},next:function() {return f.click( j + 1 )},prev:function() {return f.click( j - 1 )},destroy:function() {
      h.unbind( e.event ).removeClass( e.current ),i.find( "a[href^=#]" ).unbind( "click.T" );
      return f
    }} ),a.each( "onBeforeClick,onClick".split( "," ) , function(b , c) {
      a.isFunction( e[c] ) && a( f ).bind( c , e[c] ),f[c] = function(b) {
        b && a( f ).bind( c , b );
        return f
      }
    } ),e.history && a.fn.history && (a.tools.history.init( h ),e.event = "history"),h.each( function(b) {
      a( this ).bind( e.event , function(a) {
        f.click( b , a );
        return a.preventDefault()
      } )
    } ),i.find( "a[href^=#]" ).bind( "click.T" , function(b) {f.click( a( this ).attr( "href" ) , b )} ),location.hash && e.tabs == "a" && c.find( "[href=" + location.hash + "]" ).length ? f.click( location.hash ) : (e.initialIndex === 0 || e.initialIndex > 0) && f.click( e.initialIndex )
  }
  a.fn.tabs = function(b , c) {
    var e = this.data( "tabs" );
    e && (e.destroy(),this.removeData( "tabs" )),a.isFunction( c ) && (c = {onBeforeClick:c}),c = a.extend( {} , a.tools.tabs.conf , c ),this.each( function() {e = new d( a( this ) , b , c ),a( this ).data( "tabs" , e )} );
    return c.api ? e : this
  }
});

$( function(a) {
  var b;
  b = a.tools.tabs.slideshow = {conf:{next:".forward",prev:".backward",disabledClass:"disabled",autoplay:!1,autopause:!0,interval:3e3,clickable:!0,api:!1}};
  function c(b , c) {
    var d = this,e = b.add( this ),f = b.data( "tabs" ),g,h = !0;
    function i(c) {
      var d = a( c );
      return d.length < 2 ? d : b.parent().find( c )
    }
    var j = i( c.next ).click( function() {f.next()} ),k = i( c.prev ).click( function() {f.prev()} );
    a.extend( d , {getTabs:function() {return f},getConf:function() {return c},play:function() {
      if ( g )return d;
      var b = a.Event( "onBeforePlay" );
      e.trigger( b );
      if ( b.isDefaultPrevented() )return d;
      g = setInterval( f.next , c.interval ),h = !1,e.trigger( "onPlay" );
      return d
    },pause:function() {
      if ( !g )return d;
      var b = a.Event( "onBeforePause" );
      e.trigger( b );
      if ( b.isDefaultPrevented() )return d;
      g = clearInterval( g ),e.trigger( "onPause" );
      return d
    },stop:function() {d.pause(),h = !0}} ),a.each( "onBeforePlay,onPlay,onBeforePause,onPause".split( "," ) , function(b , e) {a.isFunction( c[e] ) && a( d ).bind( e , c[e] ),d[e] = function(b) {return a( d ).bind( e , b )}} ),c.autopause && f.getTabs().add( j ).add( k ).add( f.getPanes() ).hover( d.pause , function() {h || d.play()} ),c.autoplay && d.play(),c.clickable && f.getPanes().click( function() {f.next()} );
    if ( !f.getConf().rotate ) {
      var l = c.disabledClass;
      f.getIndex() || k.addClass( l ),f.onBeforeClick( function(a , b) {k.toggleClass( l , !b ),j.toggleClass( l , b == f.getTabs().length - 1 )} )
    }
  }
  a.fn.slideshow = function(d) {
    var e = this.data( "slideshow" );
    if ( e )return e;
    d = a.extend( {} , b.conf , d ),this.each( function() {e = new c( a( this ) , d ),a( this ).data( "slideshow" , e )} );
    return d.api ? e : this
  }
} );
$( function(a) {
  a.tools = a.tools || {version:"@VERSION"},a.tools.overlay = {addEffect:function(a , b , d) {c[a] = [b,d]},conf:{close:null,closeOnClick:!0,closeOnEsc:!0,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie || a.browser.version > 6,left:"center",load:!1,mask:null,oneInstance:!0,speed:"normal",target:null,top:"10%"}};
  var b = [],c = {};
  a.tools.overlay.addEffect( "default" , function(b , c) {
    var d = this.getConf(),e = a( window );
    d.fixed || (b.top += e.scrollTop(),b.left += e.scrollLeft()),b.position = d.fixed ? "fixed" : "absolute",this.getOverlay().css( b ).fadeIn( d.speed , c )
  } , function(a) {this.getOverlay().fadeOut( this.getConf().closeSpeed , a )} );
  function d(d , e) {
    var f = this,g = d.add( f ),h = a( window ),i,j,k,l = a.tools.expose && (e.mask || e.expose),m = Math.random().toString().slice( 10 );
    l && (typeof l == "string" && (l = {color:l}),l.closeOnClick = l.closeOnEsc = !1);
    var n = e.target || d.attr( "rel" );
    j = n ? a( n ) : null || d;
    if ( !j.length )throw"Could not find Overlay: " + n;
    d && d.index( j ) == -1 && d.click( function(a) {
      f.load( a );
      return a.preventDefault()
    } ),a.extend( f , {load:function(d) {
      if ( f.isOpened() )return f;
      var i = c[e.effect];
      if ( !i )throw"Overlay: cannot find effect : \"" + e.effect + "\"";
      e.oneInstance && a.each( b , function() {this.close( d )} ),d = d || a.Event(),d.type = "onBeforeLoad",g.trigger( d );
      if ( d.isDefaultPrevented() )return f;
      k = !0,l && a( j ).expose( l );
      var n = e.top,o = e.left,p = j.outerWidth( {margin:!0} ),q = j.outerHeight( {margin:!0} );
      typeof n == "string" && (n = n == "center" ? Math.max( (h.height() - q) / 2 , 0 ) : parseInt( n , 10 ) / 100 * h.height()),o == "center" && (o = Math.max( (h.width() - p) / 2 , 0 )),i[0].call( f , {top:n,left:o} , function() {k && (d.type = "onLoad",g.trigger( d ))} ),l && e.closeOnClick && a.mask.getMask().one( "click" , f.close ),e.closeOnClick && a( document ).bind( "click." + m , function(b) {a( b.target ).parents( j ).length || f.close( b )} ),e.closeOnEsc && a( document ).bind( "keydown." + m , function(a) {a.keyCode == 27 && f.close( a )} );
      return f
    },close:function(b) {
      if ( !f.isOpened() )return f;
      b = b || a.Event(),b.type = "onBeforeClose",g.trigger( b );
      if ( !b.isDefaultPrevented() ) {
        k = !1,c[e.effect][1].call( f , function() {b.type = "onClose",g.trigger( b )} ),a( document ).unbind( "click." + m ).unbind( "keydown." + m ),l && a.mask.close();
        return f
      }
    },getOverlay:function() {return j},getTrigger:function() {return d},getClosers:function() {return i},isOpened:function() {return k},getConf:function() {return e}} ),a.each( "onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split( "," ) , function(b , c) {
      a.isFunction( e[c] ) && a( f ).bind( c , e[c] ),f[c] = function(b) {
        b && a( f ).bind( c , b );
        return f
      }
    } ),i = j.find( e.close || ".close" ),!i.length && !e.close && (i = a( "<a class=\"close\"></a>" ),j.prepend( i )),i.click( function(a) {f.close( a )} ),e.load && f.load()
  }
  a.fn.overlay = function(c) {
    var e = this.data( "overlay" );
    if ( e )return e;
    a.isFunction( c ) && (c = {onBeforeLoad:c}),c = a.extend( !0 , {} , a.tools.overlay.conf , c ),this.each( function() {e = new d( a( this ) , c ),b.push( e ),a( this ).data( "overlay" , e )} );
    return c.api ? e : this
  }
} );
