Template:WUR script.js

From 2012.igem.org

(Difference between revisions)
Line 825: Line 825:
}).appendTo("head");
}).appendTo("head");
-
+
// Sliders
-
// Slider
+
$('#detection_slider').nivoSlider({
-
$("<link/>", {
+
effect: 'fade',
-
rel: "stylesheet",
+
directionNav: true,
-
type: "text/css",
+
controlNav: false,
-
href: nivoCssUrl
+
pauseTime: 4000,
-
}).appendTo("head");
+
animSpeed: 500
-
$.getScript(nivoJsUrl, function(){
+
-
//http://nivo.dev7studios.com/support/jquery-plugin-usage/
+
-
$('#detection_slider').nivoSlider({
+
-
effect: 'fade',
+
-
directionNav: true,
+
-
controlNav: false,
+
-
pauseTime: 4000,
+
-
animSpeed: 500
+
-
});
+
});
});

Revision as of 09:07, 25 September 2012

/* START JQUERY PLUGINS */


/*jshint eqnull:true */ /*!

* jQuery Cookie Plugin v1.2
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2011, Klaus Hartl
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/GPL-2.0
*/

(function ($, document, undefined) {

var pluses = /\+/g;

function raw(s) { return s; }

function decoded(s) { return decodeURIComponent(s.replace(pluses, ' ')); }

var config = $.cookie = function (key, value, options) {

// write if (value !== undefined) { options = $.extend({}, config.defaults, options);

if (value === null) { options.expires = -1; }

if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); }

value = config.json ? JSON.stringify(value) : String(value);

return (document.cookie = [ encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value), options.expires ? '; expires=' + options.expires.toUTCString() : , // use expires attribute, max-age is not supported by IE options.path  ? '; path=' + options.path : , options.domain  ? '; domain=' + options.domain : , options.secure  ? '; secure' : ].join()); }

// read var decode = config.raw ? raw : decoded; var cookies = document.cookie.split('; '); for (var i = 0, parts; (parts = cookies[i] && cookies[i].split('=')); i++) { if (decode(parts.shift()) === key) { var cookie = decode(parts.join('=')); return config.json ? JSON.parse(cookie) : cookie; } }

return null; };

config.defaults = {};

$.removeCookie = function (key, options) { if ($.cookie(key) !== null) { $.cookie(key, null, options); return true; } return false; };

})(jQuery, document);



/*

* jQuery Nivo Slider v3.0.1
* http://nivo.dev7studios.com
*
* Copyright 2012, Dev7studios
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/

(function($) {

   var NivoSlider = function(element, options){
       // Defaults are below
       var settings = $.extend({}, $.fn.nivoSlider.defaults, options);
       // Useful variables. Play carefully.
       var vars = {
           currentSlide: 0,
           currentImage: ,
           totalSlides: 0,
           running: false,
           paused: false,
           stop: false,
           controlNavEl: false
       };
       // Get this slider
       var slider = $(element);
       slider.data('nivo:vars', vars).addClass('nivoSlider');
       // Find our slider children
       var kids = slider.children();
       kids.each(function() {
           var child = $(this);
           var link = ;
           if(!child.is('img')){
               if(child.is('a')){
                   child.addClass('nivo-imageLink');
                   link = child;
               }
               child = child.find('img:first');
           }
           // Get img width & height
           var childWidth = (childWidth === 0) ? child.attr('width') : child.width(),
               childHeight = (childHeight === 0) ? child.attr('height') : child.height();
           if(link !== ){
               link.css('display','none');
           }
           child.css('display','none');
           vars.totalSlides++;
       });
        
       // If randomStart
       if(settings.randomStart){
           settings.startSlide = Math.floor(Math.random() * vars.totalSlides);
       }
       
       // Set startSlide
       if(settings.startSlide > 0){
           if(settings.startSlide >= vars.totalSlides) { settings.startSlide = vars.totalSlides - 1; }
           vars.currentSlide = settings.startSlide;
       }
       
       // Get initial image
       if($(kids[vars.currentSlide]).is('img')){
           vars.currentImage = $(kids[vars.currentSlide]);
       } else {
           vars.currentImage = $(kids[vars.currentSlide]).find('img:first');
       }
       
       // Show initial link
       if($(kids[vars.currentSlide]).is('a')){
           $(kids[vars.currentSlide]).css('display','block');
       }
       
       // Set first background
       var sliderImg = $('<img class="nivo-main-image" src="#" />');
       sliderImg.attr('src', vars.currentImage.attr('src')).show();
       slider.append(sliderImg);
       // Detect Window Resize
       $(window).resize(function() {
           slider.children('img').width(slider.width());
           sliderImg.attr('src', vars.currentImage.attr('src'));
           sliderImg.stop().height('auto');
           $('.nivo-slice').remove();
           $('.nivo-box').remove();
       });
       //Create caption
slider.append($('
'));
       // Process caption function
       var processCaption = function(settings){
           var nivoCaption = $('.nivo-caption', slider);
           if(vars.currentImage.attr('title') !=  && vars.currentImage.attr('title') != undefined){
               var title = vars.currentImage.attr('title');
               if(title.substr(0,1) == '#') title = $(title).html();   
               if(nivoCaption.css('display') == 'block'){
                   setTimeout(function(){
                       nivoCaption.html(title);
                   }, settings.animSpeed);
               } else {
                   nivoCaption.html(title);
                   nivoCaption.stop().fadeIn(settings.animSpeed);
               }
           } else {
               nivoCaption.stop().fadeOut(settings.animSpeed);
           }
       }
       
       //Process initial  caption
       processCaption(settings);
       
       // In the words of Super Mario "let's a go!"
       var timer = 0;
       if(!settings.manualAdvance && kids.length > 1){
           timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
       }
       
       // Add Direction nav
       if(settings.directionNav){
slider.append('
<a class="nivo-prevNav">'+ settings.prevText +'</a><a class="nivo-nextNav">'+ settings.nextText +'</a>
');
           // Hide Direction nav
           if(settings.directionNavHide){
               $('.nivo-directionNav', slider).hide();
               slider.hover(function(){
                   $('.nivo-directionNav', slider).show();
               }, function(){
                   $('.nivo-directionNav', slider).hide();
               });
           }
           
           $('a.nivo-prevNav', slider).live('click', function(){
               if(vars.running) { return false; }
               clearInterval(timer);
               timer = ;
               vars.currentSlide -= 2;
               nivoRun(slider, kids, settings, 'prev');
           });
           
           $('a.nivo-nextNav', slider).live('click', function(){
               if(vars.running) { return false; }
               clearInterval(timer);
               timer = ;
               nivoRun(slider, kids, settings, 'next');
           });
       }
       
       // Add Control nav
       if(settings.controlNav){
vars.controlNavEl = $('
');
           slider.after(vars.controlNavEl);
           for(var i = 0; i < kids.length; i++){
               if(settings.controlNavThumbs){
                   vars.controlNavEl.addClass('nivo-thumbs-enabled');
                   var child = kids.eq(i);
                   if(!child.is('img')){
                       child = child.find('img:first');
                   }
                   if(child.attr('data-thumb')) vars.controlNavEl.append('<a class="nivo-control" rel="'+ i +'"><img src="'+ child.attr('data-thumb') +'" alt="" /></a>');
               } else {
                   vars.controlNavEl.append('<a class="nivo-control" rel="'+ i +'">'+ (i + 1) +'</a>');
               }
           }
           //Set initial active link
           $('a:eq('+ vars.currentSlide +')', vars.controlNavEl).addClass('active');
           
           $('a', vars.controlNavEl).bind('click', function(){
               if(vars.running) return false;
               if($(this).hasClass('active')) return false;
               clearInterval(timer);
               timer = ;
               sliderImg.attr('src', vars.currentImage.attr('src'));
               vars.currentSlide = $(this).attr('rel') - 1;
               nivoRun(slider, kids, settings, 'control');
           });
       }
       
       //For pauseOnHover setting
       if(settings.pauseOnHover){
           slider.hover(function(){
               vars.paused = true;
               clearInterval(timer);
               timer = ;
           }, function(){
               vars.paused = false;
               // Restart the timer
               if(timer ===  && !settings.manualAdvance){
                   timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
               }
           });
       }
       
       // Event when Animation finishes
       slider.bind('nivo:animFinished', function(){
           sliderImg.attr('src', vars.currentImage.attr('src'));
           vars.running = false; 
           // Hide child links
           $(kids).each(function(){
               if($(this).is('a')){
                  $(this).css('display','none');
               }
           });
           // Show current link
           if($(kids[vars.currentSlide]).is('a')){
               $(kids[vars.currentSlide]).css('display','block');
           }
           // Restart the timer
           if(timer ===  && !vars.paused && !settings.manualAdvance){
               timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
           }
           // Trigger the afterChange callback
           settings.afterChange.call(this);
       }); 
       
       // Add slices for slice animations
       var createSlices = function(slider, settings, vars) {
       	if($(vars.currentImage).parent().is('a')) $(vars.currentImage).parent().css('display','block');
           $('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').width(slider.width()).css('visibility', 'hidden').show();
           var sliceHeight = ($('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').parent().is('a')) ? $('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').parent().height() : $('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').height();
           for(var i = 0; i < settings.slices; i++){
               var sliceWidth = Math.round(slider.width()/settings.slices);
               
               if(i === settings.slices-1){
                   slider.append(
$('
<img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block !important; top:0; left:-'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px;" />
').css({
                           left:(sliceWidth*i)+'px', 
                           width:(slider.width()-(sliceWidth*i))+'px',
                           height:sliceHeight+'px', 
                           opacity:'0',
                           overflow:'hidden'
                       })
                   );
               } else {
                   slider.append(
$('
<img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block !important; top:0; left:-'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px;" />
').css({
                           left:(sliceWidth*i)+'px', 
                           width:sliceWidth+'px',
                           height:sliceHeight+'px',
                           opacity:'0',
                           overflow:'hidden'
                       })
                   );
               }
           }
           
           $('.nivo-slice', slider).height(sliceHeight);
           sliderImg.stop().animate({
               height: $(vars.currentImage).height()
           }, settings.animSpeed);
       };
       
       // Add boxes for box animations
       var createBoxes = function(slider, settings, vars){
       	if($(vars.currentImage).parent().is('a')) $(vars.currentImage).parent().css('display','block');
           $('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').width(slider.width()).css('visibility', 'hidden').show();
           var boxWidth = Math.round(slider.width()/settings.boxCols),
               boxHeight = Math.round($('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').height() / settings.boxRows);
           
                       
           for(var rows = 0; rows < settings.boxRows; rows++){
               for(var cols = 0; cols < settings.boxCols; cols++){
                   if(cols === settings.boxCols-1){
                       slider.append(
$('
<img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block; top:-'+ (boxHeight*rows) +'px; left:-'+ (boxWidth*cols) +'px;" />
').css({
                               opacity:0,
                               left:(boxWidth*cols)+'px', 
                               top:(boxHeight*rows)+'px',
                               width:(slider.width()-(boxWidth*cols))+'px'
                               
                           })
                       );
                       $('.nivo-box[name="'+ cols +'"]', slider).height($('.nivo-box[name="'+ cols +'"] img', slider).height()+'px');
                   } else {
                       slider.append(
$('
<img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block; top:-'+ (boxHeight*rows) +'px; left:-'+ (boxWidth*cols) +'px;" />
').css({
                               opacity:0,
                               left:(boxWidth*cols)+'px', 
                               top:(boxHeight*rows)+'px',
                               width:boxWidth+'px'
                           })
                       );
                       $('.nivo-box[name="'+ cols +'"]', slider).height($('.nivo-box[name="'+ cols +'"] img', slider).height()+'px');
                   }
               }
           }
           
           sliderImg.stop().animate({
               height: $(vars.currentImage).height()
           }, settings.animSpeed);
       };
       // Private run method
       var nivoRun = function(slider, kids, settings, nudge){          
           // Get our vars
           var vars = slider.data('nivo:vars');
           
           // Trigger the lastSlide callback
           if(vars && (vars.currentSlide === vars.totalSlides - 1)){ 
               settings.lastSlide.call(this);
           }
           
           // Stop
           if((!vars || vars.stop) && !nudge) { return false; }
           
           // Trigger the beforeChange callback
           settings.beforeChange.call(this);
           // Set current background before change
           if(!nudge){
               sliderImg.attr('src', vars.currentImage.attr('src'));
           } else {
               if(nudge === 'prev'){
                   sliderImg.attr('src', vars.currentImage.attr('src'));
               }
               if(nudge === 'next'){
                   sliderImg.attr('src', vars.currentImage.attr('src'));
               }
           }
           
           vars.currentSlide++;
           // Trigger the slideshowEnd callback
           if(vars.currentSlide === vars.totalSlides){ 
               vars.currentSlide = 0;
               settings.slideshowEnd.call(this);
           }
           if(vars.currentSlide < 0) { vars.currentSlide = (vars.totalSlides - 1); }
           // Set vars.currentImage
           if($(kids[vars.currentSlide]).is('img')){
               vars.currentImage = $(kids[vars.currentSlide]);
           } else {
               vars.currentImage = $(kids[vars.currentSlide]).find('img:first');
           }
           
           // Set active links
           if(settings.controlNav){
               $('a', vars.controlNavEl).removeClass('active');
               $('a:eq('+ vars.currentSlide +')', vars.controlNavEl).addClass('active');
           }
           
           // Process caption
           processCaption(settings);            
           
           // Remove any slices from last transition
           $('.nivo-slice', slider).remove();
           
           // Remove any boxes from last transition
           $('.nivo-box', slider).remove();
           
           var currentEffect = settings.effect,
               anims = ;
               
           // Generate random effect
           if(settings.effect === 'random'){
               anims = new Array('sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade',
               'boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse');
               currentEffect = anims[Math.floor(Math.random()*(anims.length + 1))];
               if(currentEffect === undefined) { currentEffect = 'fade'; }
           }
           
           // Run random effect from specified set (eg: effect:'fold,fade')
           if(settings.effect.indexOf(',') !== -1){
               anims = settings.effect.split(',');
               currentEffect = anims[Math.floor(Math.random()*(anims.length))];
               if(currentEffect === undefined) { currentEffect = 'fade'; }
           }
           
           // Custom transition as defined by "data-transition" attribute
           if(vars.currentImage.attr('data-transition')){
               currentEffect = vars.currentImage.attr('data-transition');
           }
       
           // Run effects
           vars.running = true;
           var timeBuff = 0,
               i = 0,
               slices = ,
               firstSlice = ,
               totalBoxes = ,
               boxes = ;
           
           if(currentEffect === 'sliceDown' || currentEffect === 'sliceDownRight' || currentEffect === 'sliceDownLeft'){
               createSlices(slider, settings, vars);
               timeBuff = 0;
               i = 0;
               slices = $('.nivo-slice', slider);
               if(currentEffect === 'sliceDownLeft') { slices = $('.nivo-slice', slider)._reverse(); }
               
               slices.each(function(){
                   var slice = $(this);
                   slice.css({ 'top': '0px' });
                   if(i === settings.slices-1){
                       setTimeout(function(){
                           slice.animate({opacity:'1.0' }, settings.animSpeed, , function(){ slider.trigger('nivo:animFinished'); });
                       }, (100 + timeBuff));
                   } else {
                       setTimeout(function(){
                           slice.animate({opacity:'1.0' }, settings.animSpeed);
                       }, (100 + timeBuff));
                   }
                   timeBuff += 50;
                   i++;
               });
           } else if(currentEffect === 'sliceUp' || currentEffect === 'sliceUpRight' || currentEffect === 'sliceUpLeft'){
               createSlices(slider, settings, vars);
               timeBuff = 0;
               i = 0;
               slices = $('.nivo-slice', slider);
               if(currentEffect === 'sliceUpLeft') { slices = $('.nivo-slice', slider)._reverse(); }
               
               slices.each(function(){
                   var slice = $(this);
                   slice.css({ 'bottom': '0px' });
                   if(i === settings.slices-1){
                       setTimeout(function(){
                           slice.animate({opacity:'1.0' }, settings.animSpeed, , function(){ slider.trigger('nivo:animFinished'); });
                       }, (100 + timeBuff));
                   } else {
                       setTimeout(function(){
                           slice.animate({opacity:'1.0' }, settings.animSpeed);
                       }, (100 + timeBuff));
                   }
                   timeBuff += 50;
                   i++;
               });
           } else if(currentEffect === 'sliceUpDown' || currentEffect === 'sliceUpDownRight' || currentEffect === 'sliceUpDownLeft'){
               createSlices(slider, settings, vars);
               timeBuff = 0;
               i = 0;
               var v = 0;
               slices = $('.nivo-slice', slider);
               if(currentEffect === 'sliceUpDownLeft') { slices = $('.nivo-slice', slider)._reverse(); }
               
               slices.each(function(){
                   var slice = $(this);
                   if(i === 0){
                       slice.css('top','0px');
                       i++;
                   } else {
                       slice.css('bottom','0px');
                       i = 0;
                   }
                   
                   if(v === settings.slices-1){
                       setTimeout(function(){
                           slice.animate({opacity:'1.0' }, settings.animSpeed, , function(){ slider.trigger('nivo:animFinished'); });
                       }, (100 + timeBuff));
                   } else {
                       setTimeout(function(){
                           slice.animate({opacity:'1.0' }, settings.animSpeed);
                       }, (100 + timeBuff));
                   }
                   timeBuff += 50;
                   v++;
               });
           } else if(currentEffect === 'fold'){
               createSlices(slider, settings, vars);
               timeBuff = 0;
               i = 0;
               
               $('.nivo-slice', slider).each(function(){
                   var slice = $(this);
                   var origWidth = slice.width();
                   slice.css({ top:'0px', width:'0px' });
                   if(i === settings.slices-1){
                       setTimeout(function(){
                           slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed, , function(){ slider.trigger('nivo:animFinished'); });
                       }, (100 + timeBuff));
                   } else {
                       setTimeout(function(){
                           slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed);
                       }, (100 + timeBuff));
                   }
                   timeBuff += 50;
                   i++;
               });
           } else if(currentEffect === 'fade'){
               createSlices(slider, settings, vars);
               
               firstSlice = $('.nivo-slice:first', slider);
               firstSlice.css({
                   'width': slider.width() + 'px'
               });
   
               firstSlice.animate({ opacity:'1.0' }, (settings.animSpeed*2), , function(){ slider.trigger('nivo:animFinished'); });
           } else if(currentEffect === 'slideInRight'){
               createSlices(slider, settings, vars);
               
               firstSlice = $('.nivo-slice:first', slider);
               firstSlice.css({
                   'width': '0px',
                   'opacity': '1'
               });
               firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), , function(){ slider.trigger('nivo:animFinished'); });
           } else if(currentEffect === 'slideInLeft'){
               createSlices(slider, settings, vars);
               
               firstSlice = $('.nivo-slice:first', slider);
               firstSlice.css({
                   'width': '0px',
                   'opacity': '1',
                   'left': ,
                   'right': '0px'
               });
               firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), , function(){ 
                   // Reset positioning
                   firstSlice.css({
                       'left': '0px',
                       'right': 
                   });
                   slider.trigger('nivo:animFinished'); 
               });
           } else if(currentEffect === 'boxRandom'){
               createBoxes(slider, settings, vars);
               
               totalBoxes = settings.boxCols * settings.boxRows;
               i = 0;
               timeBuff = 0;
               boxes = shuffle($('.nivo-box', slider));
               boxes.each(function(){
                   var box = $(this);
                   if(i === totalBoxes-1){
                       setTimeout(function(){
                           box.animate({ opacity:'1' }, settings.animSpeed, , function(){ slider.trigger('nivo:animFinished'); });
                       }, (100 + timeBuff));
                   } else {
                       setTimeout(function(){
                           box.animate({ opacity:'1' }, settings.animSpeed);
                       }, (100 + timeBuff));
                   }
                   timeBuff += 20;
                   i++;
               });
           } else if(currentEffect === 'boxRain' || currentEffect === 'boxRainReverse' || currentEffect === 'boxRainGrow' || currentEffect === 'boxRainGrowReverse'){
               createBoxes(slider, settings, vars);
               
               totalBoxes = settings.boxCols * settings.boxRows;
               i = 0;
               timeBuff = 0;
               
               // Split boxes into 2D array
               var rowIndex = 0;
               var colIndex = 0;
               var box2Darr = [];
               box2Darr[rowIndex] = [];
               boxes = $('.nivo-box', slider);
               if(currentEffect === 'boxRainReverse' || currentEffect === 'boxRainGrowReverse'){
                   boxes = $('.nivo-box', slider)._reverse();
               }
               boxes.each(function(){
                   box2Darr[rowIndex][colIndex] = $(this);
                   colIndex++;
                   if(colIndex === settings.boxCols){
                       rowIndex++;
                       colIndex = 0;
                       box2Darr[rowIndex] = [];
                   }
               });
               
               // Run animation
               for(var cols = 0; cols < (settings.boxCols * 2); cols++){
                   var prevCol = cols;
                   for(var rows = 0; rows < settings.boxRows; rows++){
                       if(prevCol >= 0 && prevCol < settings.boxCols){
                           /* Due to some weird JS bug with loop vars 
                           being used in setTimeout, this is wrapped
                           with an anonymous function call */
                           (function(row, col, time, i, totalBoxes) {
                               var box = $(box2Darr[row][col]);
                               var w = box.width();
                               var h = box.height();
                               if(currentEffect === 'boxRainGrow' || currentEffect === 'boxRainGrowReverse'){
                                   box.width(0).height(0);
                               }
                               if(i === totalBoxes-1){
                                   setTimeout(function(){
                                       box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3, , function(){ slider.trigger('nivo:animFinished'); });
                                   }, (100 + time));
                               } else {
                                   setTimeout(function(){
                                       box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3);
                                   }, (100 + time));
                               }
                           })(rows, prevCol, timeBuff, i, totalBoxes);
                           i++;
                       }
                       prevCol--;
                   }
                   timeBuff += 100;
               }
           }           
       };
       
       // Shuffle an array
       var shuffle = function(arr){
           for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i, 10), x = arr[--i], arr[i] = arr[j], arr[j] = x);
           return arr;
       };
       
       // For debugging
       var trace = function(msg){
           if(this.console && typeof console.log !== 'undefined') { console.log(msg); }
       };
       
       // Start / Stop
       this.stop = function(){
           if(!$(element).data('nivo:vars').stop){
               $(element).data('nivo:vars').stop = true;
               trace('Stop Slider');
           }
       };
       
       this.start = function(){
           if($(element).data('nivo:vars').stop){
               $(element).data('nivo:vars').stop = false;
               trace('Start Slider');
           }
       };
       
       // Trigger the afterLoad callback
       settings.afterLoad.call(this);
       
       return this;
   };
       
   $.fn.nivoSlider = function(options) {
       return this.each(function(key, value){
           var element = $(this);
           // Return early if this element already has a plugin instance
           if (element.data('nivoslider')) { return element.data('nivoslider'); }
           // Pass options to plugin constructor
           var nivoslider = new NivoSlider(this, options);
           // Store plugin object in this element's data
           element.data('nivoslider', nivoslider);
       });
   };
   
   //Default settings
   $.fn.nivoSlider.defaults = {
       effect: 'random',
       slices: 15,
       boxCols: 8,
       boxRows: 4,
       animSpeed: 500,
       pauseTime: 3000,
       startSlide: 0,
       directionNav: true,
       directionNavHide: true,
       controlNav: true,
       controlNavThumbs: false,
       pauseOnHover: true,
       manualAdvance: false,
       prevText: 'Prev',
       nextText: 'Next',
       randomStart: false,
       beforeChange: function(){},
       afterChange: function(){},
       slideshowEnd: function(){},
       lastSlide: function(){},
       afterLoad: function(){}
   };
   $.fn._reverse = [].reverse;
   

})(jQuery);




/*! fancyBox v2.1.0 fancyapps.com | fancyapps.com/fancybox/#license */ (function(u,p,f,q){var o=f(u),n=f(p),b=f.fancybox=function(){b.open.apply(this,arguments)},z=null,m=p.createTouch!==q,x=function(a){return a&&a.hasOwnProperty&&a instanceof f},s=function(a){return a&&"string"===f.type(a)},C=function(a){return s(a)&&0<a.indexOf("%")},k=function(a,c){var e=parseInt(a,10);c&&C(a)&&(e*=b.getViewport()[c]/100);return Math.ceil(e)},v=function(a,b){return k(a,b)+"px"};f.extend(b,{version:"2.1.0",defaults:{padding:15,margin:20,width:800,height:600,minWidth:100,minHeight:100, maxWidth:9999,maxHeight:9999,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!m,autoCenter:!m,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},keys:{next:{13:"left",34:"up",39:"left",40:"up"},

prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'
',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0"'+ (f.browser.msie?' allowtransparency="true"':"")+"></iframe>",error:'

The requested content cannot be loaded.
Please try again later.

',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",

openOpacity:!0,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:{closeClick:!0,speedOut:200,showEarly:!0,css:{}},title:{type:"float"}},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop}, group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,c){if(a&&(f.isPlainObject(c)||(c={}),!1!==b.close(!0)))return f.isArray(a)||(a=x(a)?f(a).get():[a]),f.each(a,function(e,d){var j={},g,h,i,l,k;"object"===f.type(d)&&(d.nodeType&&(d=f(d)),x(d)?(j={href:d.attr("href"),title:d.attr("title"),isDom:!0,element:d},f.metadata&& f.extend(!0,j,d.metadata())):j=d);g=c.href||j.href||(s(d)?d:null);h=c.title!==q?c.title:j.title||"";l=(i=c.content||j.content)?"html":c.type||j.type;!l&&j.isDom&&(l=d.data("fancybox-type"),l||(l=(l=d.prop("class").match(/fancybox\.(\w+)/))?l[1]:null));if(s(g)&&(l||(b.isImage(g)?l="image":b.isSWF(g)?l="swf":"#"===g.charAt(0)?l="inline":s(d)&&(l="html",i=d)),"ajax"===l))k=g.split(/\s+/,2),g=k.shift(),k=k.shift();i||("inline"===l?g?i=f(s(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):j.isDom&&(i=d):"html"===l? i=g:!l&&(!g&&j.isDom)&&(l="inline",i=d));f.extend(j,{href:g,type:l,content:i,title:h,selector:k});a[e]=j}),b.opts=f.extend(!0,{},b.defaults,c),c.keys!==q&&(b.opts.keys=c.keys?f.extend({},b.defaults.keys,c.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0).trigger("onReset").remove(),b.current|| b.trigger("afterClose"),b.coming=null)},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),"fixed"===b.wrap.css("position")&&b.wrap.css(b._getPosition(!0)),b.transitions[b.current.closeMethod]()))},play:function(a){var c=function(){clearTimeout(b.player.timer)}, e=function(){c();b.current&&b.player.isActive&&(b.player.timer=setTimeout(b.next,b.current.playSpeed))},d=function(){c();f("body").unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index=d.index?"next":"prev"],b.router=e||"jumpto",d.loop&&(0>a&&(a=d.group.length+a%d.group.length),a%=d.group.length),d.group[a]!==q))b.cancel(),b._start(a)},reposition:function(a,c){var e;b.isOpen&&(e=b._getPosition(c),a&&"scroll"===a.type?(delete e.position,b.wrap.stop(!0, !0).animate(e,200)):b.wrap.css(e))},update:function(a){var c=a&&a.type,e=!c||"orientationchange"===c;e&&(clearTimeout(z),z=null);if(b.isOpen&&!z){if(e||m)b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate");z=setTimeout(function(){var d=b.current;if(d){b.wrap.removeClass("fancybox-tmp");c!=="scroll"&&b._setDimension();c==="scroll"&&d.canShrink||b.reposition(a);b.trigger("onUpdate");z=null}},m?500:e?20:300)}},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?

a:!b.current.fitToView,b.update())},hideLoading:function(){n.unbind("keypress.fb");f("#fancybox-loading").remove()},showLoading:function(){var a,c;b.hideLoading();n.bind("keypress.fb",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});a=f('
').click(b.cancel).appendTo("body");b.defaults.fixed||(c=b.getViewport(),a.css({position:"absolute",top:0.5*c.h+c.y,left:0.5*c.w+c.x}))},getViewport:function(){var a=b.current?b.current.locked:!1,

c={x:o.scrollLeft(),y:o.scrollTop()};a?(c.w=a[0].clientWidth,c.h=a[0].clientHeight):(c.w=m&&u.innerWidth?u.innerWidth:o.width(),c.h=m&&u.innerHeight?u.innerHeight:o.height());return c},unbindEvents:function(){b.wrap&&x(b.wrap)&&b.wrap.unbind(".fb");n.unbind(".fb");o.unbind(".fb")},bindEvents:function(){var a=b.current,c;a&&(o.bind("orientationchange.fb"+(m?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(c=a.keys)&&n.bind("keydown.fb",function(e){var d=e.which||e.keyCode,j=e.target|| e.srcElement;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!j||!j.type&&!f(j).is("[contenteditable]")))&&f.each(c,function(c,j){if(1<a.group.length&&j[d]!==q)return b[c](j[d]),e.preventDefault(),!1;if(-1<f.inArray(d,j))return b[c](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(c,d,j,g){for(var h=f(c.target||null),i=!1;h.length&&!i&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)i=h[0]&&!(h[0].style.overflow&&"hidden"===h[0].style.overflow)&& (h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==d&&!i&&1<b.group.length&&!a.canShrink){if(0<g||0<j)b.prev(0<g?"down":"left");else if(0>g||0>j)b.next(0>g?"up":"right");c.preventDefault()}}))},trigger:function(a,c){var e,d=c||b.coming||b.current;if(d){f.isFunction(d[a])&&(e=d[a].apply(d,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;"onCancel"===a&&!b.isOpened&&(b.isActive=!1);d.helpers&&f.each(d.helpers, function(c,e){if(e&&b.helpers[c]&&f.isFunction(b.helpers[c][a]))b.helpers[c][a](e,d)});f.event.trigger(a+".fb")}},isImage:function(a){return s(a)&&a.match(/\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$/i)},isSWF:function(a){return s(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var c={},e,d,a=k(a);e=b.group[a]||null;if(!e)return!1;c=f.extend(!0,{},b.opts,e);e=c.margin;d=c.padding;"number"===f.type(e)&&(c.margin=[e,e,e,e]);"number"===f.type(d)&&(c.padding=[d,d,d,d]);c.modal&&f.extend(!0,c, {closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});c.autoSize&&(c.autoWidth=c.autoHeight=!0);"auto"===c.width&&(c.autoWidth=!0);"auto"===c.height&&(c.autoHeight=!0);c.group=b.group;c.index=a;b.coming=c;if(!1===b.trigger("beforeLoad"))b.coming=null;else{d=c.type;e=c.href;if(!d)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===d||"swf"===d)c.autoHeight=c.autoWidth= !1,c.scrolling="visible";"image"===d&&(c.aspectRatio=!0);"iframe"===d&&m&&(c.scrolling="scroll");c.wrap=f(c.tpl.wrap).addClass("fancybox-"+(m?"mobile":"desktop")+" fancybox-type-"+d+" fancybox-tmp "+c.wrapCSS).appendTo(c.parent);f.extend(c,{skin:f(".fancybox-skin",c.wrap),outer:f(".fancybox-outer",c.wrap),inner:f(".fancybox-inner",c.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){c.skin.css("padding"+b,v(c.padding[a]))});b.trigger("onReady");if("inline"===d||"html"===d){if(!c.content|| !c.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===d?b._loadImage():"ajax"===d?b._loadAjax():"iframe"===d?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width;b.coming.height=this.height; b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;(a.complete===q||!a.complete)&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(c,e){"success"===e&&(a.content=c,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,c=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling", m?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),c.one("load",function(){f(this).data("ready",1);m||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=c.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,c=b.current, e=a.length,d=c.preload?Math.min(c.preload,e-1):0,f,g;for(g=1;g<=d;g+=1)f=a[(c.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,c=b.current,e,d,j,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,c))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{c&&(b.trigger("beforeChange",c),c.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove(),"fixed"===c.wrap.css("position")&&c.wrap.css(b._getPosition(!0)));

b.unbindEvents();e=a.content;d=a.type;j=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:c});g=a.href;switch(d){case "inline":case "ajax":case "html":a.selector?e=f("
").html(e).find(a.selector):x(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",

false)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e=e+('<param name="'+a+'" value="'+b+'"></param>');h=h+(" "+a+'="'+b+'"')}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!x(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow"); a.inner.css("overflow","yes"===j?"scroll":"no"===j?"hidden":j);b._setDimension();a.wrap.removeClass("fancybox-tmp");a.pos=f.extend({},a.dim,b._getPosition(!0));b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(c.prevMethod)b.transitions[c.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),c=0,e=!1,d=!1,e=b.wrap,j=b.skin,g=b.inner,h= b.current,d=h.width,i=h.height,l=h.minWidth,t=h.minHeight,m=h.maxWidth,n=h.maxHeight,s=h.scrolling,q=h.scrollOutside?h.scrollbarWidth:0,w=h.margin,o=w[1]+w[3],p=w[0]+w[2],x,r,u,A,y,D,z,B,E;e.add(j).add(g).width("auto").height("auto");w=j.outerWidth(!0)-j.width();x=j.outerHeight(!0)-j.height();r=o+w;u=p+x;A=C(d)?(a.w-r)*k(d)/100:d;y=C(i)?(a.h-u)*k(i)/100:i;if("iframe"===h.type){if(E=h.content,h.autoHeight&&1===E.data("ready"))try{E[0].contentWindow.document.location&&(g.width(A).height(9999),D=E.contents().find("body"), q&&D.css("overflow-x","hidden"),y=D.height())}catch(F){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(A),h.autoHeight||g.height(y),h.autoWidth&&(A=g.width()),h.autoHeight&&(y=g.height()),g.removeClass("fancybox-tmp");d=k(A);i=k(y);B=A/y;l=k(C(l)?k(l,"w")-r:l);m=k(C(m)?k(m,"w")-r:m);t=k(C(t)?k(t,"h")-u:t);n=k(C(n)?k(n,"h")-u:n);D=m;z=n;o=a.w-o;p=a.h-p;if(h.aspectRatio){if(d>m&&(d=m,i=d/B),i>n&&(i=n,d=i*B),d<l&&(d=l,i=d/B),i<t)i=t,d=i*B}else d=Math.max(l,Math.min(d, m)),i=Math.max(t,Math.min(i,n));if(h.fitToView)if(m=Math.min(a.w-r,m),n=Math.min(a.h-u,n),g.width(k(d)).height(k(i)),e.width(k(d+w)),a=e.width(),r=e.height(),h.aspectRatio)for(;(a>o||r>p)&&(d>l&&i>t)&&!(19<c++);)i=Math.max(t,Math.min(n,i-10)),d=i*B,d<l&&(d=l,i=d/B),d>m&&(d=m,i=d/B),g.width(k(d)).height(k(i)),e.width(k(d+w)),a=e.width(),r=e.height();else d=Math.max(l,Math.min(d,d-(a-o))),i=Math.max(t,Math.min(i,i-(r-p)));q&&("auto"===s&&i<y&&d+w+q<o)&&(d+=q);g.width(k(d)).height(k(i));e.width(k(d+ w));a=e.width();r=e.height();e=(a>o||r>p)&&d>l&&i>t;d=h.aspectRatio?d<D&&i<z&&d<A&&i<y:(d<D||i<z)&&(d<A||i<y);f.extend(h,{dim:{width:v(a),height:v(r)},origWidth:A,origHeight:y,canShrink:e,canExpand:d,wPadding:w,hPadding:x,wrapSpace:r-j.outerHeight(!0),skinSpace:j.height()-i});!E&&(h.autoHeight&&i>t&&i<n&&!d)&&g.height("auto")},_getPosition:function(a){var c=b.current,e=b.getViewport(),d=c.margin,f=b.wrap.width()+d[1]+d[3],g=b.wrap.height()+d[0]+d[2],d={position:"absolute",top:d[0],left:d[3]};c.autoCenter&& c.fixed&&!a&&g<=e.h&&f<=e.w?d.position="fixed":c.locked||(d.top+=e.y,d.left+=e.x);d.top=v(Math.max(d.top,d.top+(e.h-g)*c.topRatio));d.left=v(Math.max(d.left,d.left+(e.w-f)*c.leftRatio));return d},_afterZoomIn:function(){var a=b.current;a&&((b.isOpen=b.isOpened=!0,b.wrap.addClass("fancybox-opened").css("overflow","visible"),b.reposition(),(a.closeClick||a.nextClick)&&b.inner.css("cursor","pointer").bind("click.fb",function(c){if(!f(c.target).is("a")&&!f(c.target).parent().is("a"))b[a.closeClick?"close": "next"]()}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",b.close),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1)?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(){var a=b.current;f(".fancybox-wrap").stop(!0).trigger("onReset").remove(); f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,c=a.element,e=a.orig,d={},f=50,g=50,h=a.hPadding,i=a.wPadding,l=b.getViewport();!e&&(a.isDom&&c.is(":visible"))&&(e=c.find("img:first"),e.length||(e=c));x(e)?(d=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())):(d.top=l.y+(l.h-g)*a.topRatio,d.left=l.x+(l.w-f)* a.leftRatio);a.locked&&(d.top-=l.y,d.left-=l.x);return d={top:v(d.top-h*a.topRatio),left:v(d.left-i*a.leftRatio),width:v(f+i),height:v(g+h)}},step:function(a,c){var e,d,f=c.prop;d=b.current;var g=d.wrapSpace,h=d.skinSpace;if("width"===f||"height"===f)e=c.end===c.start?1:(a-c.start)/(c.end-c.start),b.isClosing&&(e=1-e),d="width"===f?d.wPadding:d.hPadding,d=a-d,b.skin[f](k("width"===f?d:d-g*e)),b.inner[f](k("width"===f?d:d-g*e-h*e))},zoomIn:function(){var a=b.current,c=a.pos,e=a.openEffect,d="elastic"=== e,j=f.extend({opacity:1},c);delete j.position;d?(c=this.getOrigPosition(),a.openOpacity&&(c.opacity=0.1)):"fade"===e&&(c.opacity=0.1);b.wrap.css(c).animate(j,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:d?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,c=a.closeEffect,e="elastic"===c,d={opacity:0.1};e&&(d=this.getOrigPosition(),a.closeOpacity&&(d.opacity=0.1));b.wrap.animate(d,{duration:"none"===c?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null, complete:b._afterZoomOut})},changeIn:function(){var a=b.current,c=a.nextEffect,e=a.pos,d={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===c&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=v(k(e[g])-200),d[g]="+=200px"):(e[g]=v(k(e[g])+200),d[g]="-=200px"));"none"===c?b._afterZoomIn():b.wrap.css(e).animate(d,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a=b.previous,c=a.prevEffect,e={opacity:0.1},d=b.direction;"elastic"===c&& (e["down"===d||"up"===d?"top":"left"]=("up"===d||"left"===d?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===c?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={overlay:null,update:function(){var a="100%",b;this.overlay.width(a).height("100%");f.browser.msie?(b=Math.max(p.documentElement.offsetWidth,p.body.offsetWidth),n.width()>b&&(a=n.width())):n.width()>o.width()&&(a=n.width());this.overlay.width(a).height(n.height())},onReady:function(a,

b){f(".fancybox-overlay").stop(!0,!0);this.overlay||f.extend(this,{overlay:f('
').appendTo(b.parent),margin:n.height()>o.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,el:p.all&&!p.querySelector?f("html"):f("body")});b.fixed&&!m&&(this.overlay.addClass("fancybox-overlay-fixed"),b.autoCenter&&(this.overlay.append(b.wrap),b.locked=this.overlay));!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,c){var e=

this.overlay.unbind(".fb").width("auto").height("auto").css(a.css);a.closeClick&&e.bind("click.fb",function(a){f(a.target).hasClass("fancybox-overlay")&&b.close()});c.fixed&&!m?c.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",k(this.margin)+c.scrollbarWidth)):this.update();e.show()},onUpdate:function(a,b){(!b.fixed||m)&&this.update()},afterClose:function(a){var c=this,a=a.speedOut||0;c.overlay&&!b.isActive&&c.overlay.fadeOut(a||0,function(){f("body").css("margin-right",

c.margin);c.el.removeClass("fancybox-lock");c.overlay.remove();c.overlay=null})}};b.helpers.title={beforeShow:function(a){var c=b.current.title,e=a.type;if(s(c)&&""!==f.trim(c)){c=f('
'+c+"
");switch(e){case "inside":e=b.skin;break;case "outside":e=b.wrap;break;case "over":e=b.inner;break;default:e=b.skin,c.appendTo("body").width(c.width()).wrapInner(''),b.current.margin[2]+=Math.abs(k(c.css("margin-bottom")))}"top"===

a.position?c.prependTo(e):c.appendTo(e)}}};f.fn.fancybox=function(a){var c,e=f(this),d=this.selector||"",j=function(g){var h=f(this).blur(),i=c,j,k;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(j=a.groupAttr||"data-fancybox-group",k=h.attr(j),k||(j="rel",k=h.get(0)[j]),k&&(""!==k&&"nofollow"!==k)&&(h=d.length?f(d):e,h=h.filter("["+j+'="'+k+'"]'),i=h.index(this)),a.index=i,!1!==b.open(h,a)&&g.preventDefault())},a=a||{};c=a.index||0;!d||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",

j):n.undelegate(d,"click.fb-start").delegate(d+":not('.fancybox-item, .fancybox-nav')","click.fb-start",j);return this};n.ready(function(){f.scrollbarWidth===q&&(f.scrollbarWidth=function(){var a=f('
<div/>
').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===q){var a=f.support,c=f('
').appendTo("body"),e=20===c[0].offsetTop||

15===c[0].offsetTop;c.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")})})})(window,document,jQuery);


/* END JQUERY PLUGINS */

/* START SCRIPT */


var cssUrl = "https://2012.igem.org/Template:WUR_style.css?action=raw&ctype=text/css"; var nivoJsUrl = 'https://2012.igem.org/Template:WUR_nivo.js?action=raw&ctype=text/javascript'; var nivoCssUrl = "https://2012.igem.org/Template:WUR_nivo.css?action=raw&ctype=text/css"; var prefixfreeUrl = 'https://2012.igem.org/Template:WUR_prefixfree.js?action=raw&ctype=text/javascript';

var headerImgUrl = "";

jQuery(document).ready(function(){

// CSS $("<link/>", { rel: "stylesheet", type: "text/css", href: cssUrl }).appendTo("head");

// Sliders $('#detection_slider').nivoSlider({ effect: 'fade', directionNav: true, controlNav: false, pauseTime: 4000, animSpeed: 500 });

// Move menu var menu = $('#navContainer'); $('#navContainer').remove(); $('#content').prepend(menu);

// Move header var header = $('#header_wrapper'); $('#header_wrapper').remove(); $('#content').prepend(header);

// Decorate menu function decorateMenu(el, i) { switch(i) { case 1: el.addClass('ulc1'); i += 1; break;

case 2: el.addClass('ulc2'); i += 1; break;

case 3: i = 1; break;

default: i += 1; } return i; } var i = 0; var ii = 0; menu.find('li').each(function(){ i = decorateMenu($(this),i); ii = $(this).find('ul').find('li').each(function(){decorateMenu($(this),ii);}); });

// Remove title attributes from the menu. // Though this is a bad practice, the design advantage weighted // heavier than the few optically impaired people who visit the // website. menu.find('[title]').removeAttr('title');

// Google Analytics var ga_script = "\ <script type=\"text/javascript\">\ var _gaq = _gaq || [];\ _gaq.push(['_setAccount', 'UA-33423824-1']);\ _gaq.push(['_trackPageview']);\ (function() {\ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\ })();\ </script>"; $('head').append(ga_script);

// Move the Footer $('#contentfooter').appendTo('#content');

$('.bigbutton').hover(function(){ $(this).find('img').animate({ 'margin-top': '-175px' },'fast'); },function(){ $(this).find('img').animate({ 'margin-top': '0px' },'fast'); });

// If an anchor-link was pressed, make sure the scrolling was done correctly. if(location.hash) { var sId = location.hash.substr(1); var sEl = document.getElementById(sId); var sJQ = $(sEl);

setTimeout(function(){ $(document).scrollTop(sJQ.offset().top); }, 250);

}

// Fix prefixes for CSS3 styles $.getScript(prefixfreeUrl, function(){});

// Animate the project overview $('#poPnas, #poVLPs, #poOutside, #poInside, #poApplications').hide(); $('#poPnas').fadeIn(500, function(){ $('#poVLPs').fadeIn(500, function(){ $('#poOutside').fadeIn(500, function(){ $('#poInside').fadeIn(500, function(){ $('#poApplications').fadeIn(500, function(){}); }); }); }); });

// Click actions for the project overview function poLoad(url) { $('#poTextClose').fadeOut(); $('#poText').slideUp().fadeOut('fast', function(){ $('#poLoading').fadeIn('fast'); $('#poText').load(url, function(){ $('#poLoading').fadeOut('fast'); $('#poTextClose').fadeIn(); $(this).fadeIn().slideDown(); }); }); } $('#poTextClose').click(function() { $('#poText').slideUp().fadeOut(); $('#poTextClose').fadeOut(); }); $('#poPnas').click(function(){ poLoad('https://2012.igem.org/Team:Wageningen_UR/Pnas_ProjectOverview?action=render'); }); $('#poVLPs').click(function(){ poLoad('https://2012.igem.org/Team:Wageningen_UR/VLPs_ProjectOverview?action=render'); }); $('#poOutside').click(function(){ poLoad('https://2012.igem.org/Team:Wageningen_UR/OutsideModification_ProjectOverview?action=render'); }); $('#poInside').click(function(){ poLoad('https://2012.igem.org/Team:Wageningen_UR/InsideModification_ProjectOverview?action=render'); }); $('#poApplications').click(function(){ poLoad('https://2012.igem.org/Team:Wageningen_UR/Applications_ProjectOverview?action=render'); });

// Achievements animation $('.achievement').click(function(){ $(this).find('.achievement-desc').slideDown('fast'); }); $('.achievement').hover(function(){ //$(this).find('.achievement-desc').slideDown('fast'); },function(){ $(this).find('.achievement-desc').slideUp('fast'); });

// IE8 column correction if($.browser.msie && parseInt($.browser.version,10) < 9) { $('.col').css('width','296px'); }

// Team photos $('#teamScatter').hover(function(){ $('#teamScatter > div.Hover').fadeIn(); },function(){ $('#teamScatter > div.Hover').fadeOut(); }); $('#teamScatter').mousemove(function(e){ $('#teamScatter > div.Hover').css({ 'left': e.pageX - $(this).offset().left - 100, 'top': e.pageY - $(this).offset().top + 20 }); }); $('#teamScatter area').mouseover(function(){ $('#teamScatter > div.Hover').text($(this).attr('alt')); });

// Fancybox $('a.fancybox').fancybox(); //$('.fancybox').click(function(e){ e.preventDefault(); alert('test'); });

});


//Load YouTube player api asynchronously. var tag = document.createElement('script'); tag.src = "//www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var player; function onYouTubeIframeAPIReady() {

   player = new YT.Player('projectVideoPlayer', {
     height: '360',
     width: '480',
     videoId: '19JbFIIyi5c',
     playerVars: {'rel': 0, 'autohide': 1, 'showinfo': 0, 'theme': 'light'},
     events: {
       'onReady': onPlayerReady,
       'onStateChange': onPlayerStateChange
     }
   });

} function onPlayerReady(evt) { if($.cookie('igemWURwatchedVideo') == 'watchedAll') { endVideo(evt); } else {

   evt.target.playVideo();
 }

} function endVideo(evt) { $('#projectVideoPlayerContainer').slideUp('slow', function(){ $('#projectIntro, #projectVideo').animate({'height': '50px'}, 'slow', function(){ $('#projectVideo a').fadeIn(); $('#projectVideo a').click(function(){ $('#projectVideo a').fadeOut(); $('#projectIntro, #projectVideo').animate({'height': '340px'}, 'slow'); $('#projectVideoPlayerContainer').slideDown('slow',function(){ evt.target.playVideo(); }); }); }); }); } function onPlayerStateChange(evt) {

   if(evt.data == YT.PlayerState.PAUSED ) {
   	endVideo(evt);
   }
   if(evt.data == YT.PlayerState.ENDED) {
   	$.cookie('igemWURwatchedVideo', 'watchedAll');
   }

} function stopVideo() {

   player.stopVideo();
}