
// 'stacks' is the Stacks global object.
// All of the other Stacks related Javascript will 
// be attatched to it.
var stacks = {};


// this call to jQuery gives us access to the globaal
// jQuery object. 
// 'noConflict' removes the '$' variable.
// 'true' removes the 'jQuery' variable.
// removing these globals reduces conflicts with other 
// jQuery versions that might be running on this page.
stacks.jQuery = jQuery.noConflict(true);

// Javascript for stacks_in_155_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_155_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_155_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/**
 * Sprightly by http://www.doobox.co.uk integrated for rapidweaver from the code http://dev.artutkin.ru/desaturate/example.html 
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
 $(document).ready(function() {
 
$.desaturate = {
  defaults: {
    'iefix': true, // autofix png for IE
    'level': 1,    // level of desaturation, ignored in IE
    'rgb': [0.3333, 0.3333, 0.3333] // levels of RGB for compose grayscale, ignored in IE
  },
  customClass: 'js-desaturate-fixed' // usually no need to change this
};

$.desaturate.Image = function(obj) {
    this.image = obj;
    this.jImage = $(this.image);

    this.src = this.jImage.attr('src');
    this.isPNG = this.jImage.is("IMG[src$=.png]");

    var styleWidth  = new String(this.jImage.css('width')); styleWidth = styleWidth.replace(/px/, '');
    var styleHeight = new String(this.jImage.css('height')); styleHeight = styleHeight.replace(/px/, '');

    this.width = this.jImage.width() ? this.jImage.width() : (styleWidth ? styleWidth : this.jImage.attr('width'));
    this.height = this.jImage.height() ? this.jImage.height() : (styleHeight ? styleHeight : this.jImage.attr('height'));

//      var styles = ['padding', 'margin', 'border'];
//      for (var i in styles) {
//        this.imgCustomStyles += styles[i] + ':' + this.image.style[styles[i]]+';';
//        this.image.style[styles[i]] = '';
//      }

    this.imgFilter = '';
    if (this.image.style.filter) {
      this.imgFilter = 'filter:'+this.image.style.filter+';';
      this.image.style.filter = '';
    }

    this.image.style.width = '';
    this.image.style.height = '';

    this.imgId    = this.jImage.attr('id') ? 'id="' + this.jImage.attr('id') + '" ' : '';
    this.imgClass = 'class="' + this.jImage.attr('class') + ' ' + $.desaturate.customClass + '" ';
    this.imgTitle = this.jImage.attr('title') ? 'title="' + this.jImage.attr('title') + '" ' : '';
    this.imgAlt   = this.jImage.attr('alt') ? 'alt="' + this.jImage.attr('alt') + '" ' : '';

    this.imgStyles  = this.image.style.cssText;
    this.imgStyles += this.jImage.attr('align') ? 'float:' + this.jImage.attr('align') + ';' : '';
    this.imgStyles += this.jImage.parent().attr('href') ? 'cursor:hand;' : '';

    // nulled filter present as FILTER: in cssText
    this.imgStyles = this.imgStyles.replace(/filter:/i,'');


    this.imgCssSize = (this.width && this.height) ? 'width:' + this.width + 'px;' + 'height:' + this.height + 'px;' : '';
};

$.desaturate.Image.prototype.replace = function(html) {
      return $(html).replaceAll(this.image).get(0);
};

$.desaturate.Image.prototype.getCanvas = function(options) {
    var canvasStr = '<canvas style="display:block;' + this.imgStyles + this.imgCssSize + '" ';               // amended changed from inline-block to block
    canvasStr += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '></canvas>';

    var canvas = $(canvasStr).get(0);
    var canvasContext = canvas.getContext('2d');

    var imgW = this.width;
    var imgH = this.height;
    canvas.width = imgW;
    canvas.height = imgH;

    canvasContext.drawImage(this.image, 0, 0);

    var imgPixels = canvasContext.getImageData(0, 0, imgW, imgH);

    for(var y = 0; y < imgPixels.height; y++){
      for(var x = 0; x < imgPixels.width; x++){
        var i = (y * 4) * imgPixels.width + x * 4;
        var avg = imgPixels.data[i]*options.rgb[0] + imgPixels.data[i + 1]*options.rgb[1] + imgPixels.data[i + 2]*options.rgb[2];
        imgPixels.data[i] = avg*options.level + imgPixels.data[i]*(1-options.level);
        imgPixels.data[i + 1] = avg*options.level + imgPixels.data[i + 1]*(1-options.level);
        imgPixels.data[i + 2] = avg*options.level + imgPixels.data[i + 2]*(1-options.level);
      }
    }

    canvasContext.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
    return canvas;
}

$.desaturate.Image.prototype.getIeFix = function(options) {
    /* Some $ operations like fadeIn/Out can reset filter atribute, so we need 3 SPAN's: 1st for styles and
     * correct work with $'s animation, 2rd for grayScale filter and last one for alpha image filter.
     * Combined 2 filters in one span won't work too.
     */
    var blockInit = 'display:block;background:transparent;padding:0;margin:0;';
    var strNewHTML = '<span style="display:inline-block;' + this.imgStyles + this.imgCssSize + '" ';
    strNewHTML += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '>';
      strNewHTML += '<span style="' + blockInit + this.imgCssSize + this.imgFilter + '">';
      if (this.isPNG) {
        strNewHTML += '<span style="' + blockInit + this.imgCssSize;
        strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.src + '\', sizingMethod=\'crop\');">';
        strNewHTML += '</span>';
      } else {
        strNewHTML += '<img style="' + blockInit + this.imgCssSize + '" ' + this.imgTitle + this.imgAlt;
        strNewHTML += ' src="' + this.src + '">';
      }
      strNewHTML += '</span>';
    strNewHTML += '</span>';

    return $(strNewHTML).get(0);
}

$.fn.desaturate = function(options) {

  var ret = [];
  var _opt = $.extend(true, {}, $.desaturate.defaults, options);

  this.each(function() {
    var el = this;
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(el).metadata() : {}, $(el).data('desaturate'));

    if ($.browser.msie && $(el).is("IMG") && $opt.iefix) {
      // autofix IE images
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getIeFix($opt));
    }

    if ($.browser.msie && ($(el).is("IMG") || $(el).hasClass($.desaturate.customClass))) {
      // apply filter for IE
        var el1 = el;
        if ($(el).hasClass($.desaturate.customClass))
        {
          // if this element is our imgage fixed by pngIE - set grayscale filter to child span
          el1 = $("SPAN", el).get(0);
        }
        el1.style.filter = (el1.style.filter ? el1.style.filter+' ' : '') +
                            'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';
    }

    if (!$.browser.msie && ($(el).is("IMG"))) {
      // convert image to canvas
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getCanvas($opt));
    }

    ret.push(el);
  });

  return this.pushStack(ret, "desaturate", "");
};

$.fn.desaturateImgFix = function(options) {
  if (!$.browser.msie) {
    return this;
  }

  var _opt = $.extend(true, {}, $.desaturate.defaults, options);
  var ret = [];

  this.each(function() {
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(this).metadata() : {}, $(this).data('desaturate'));
    if (!$(this).is("IMG")) {
      ret.push(this);
    } else {
      var image = new $.desaturate.Image(this);
      ret.push(image.replace(image.getIeFix($opt)));
    }
  });

  return this.pushStack(ret, "desaturateImgFix", "");
};
 

});


// start new code

 $(window).load(function() {

        
        var paircount = 0;
        var $thisSprite = $("#stacks_in_155_page0 img.imageStyle");
        var reverse = "";




        if ($.browser.msie)
        {
          // I need this only if desaturate png with aplha channel
          $thisSprite = $thisSprite.desaturateImgFix();
        }
        
 if(reverse == ""){

    // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_155_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_155_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_155_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_155_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_155_page0pair').toggle().toggleClass('stacks_in_155_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_155_page0);


// Javascript for stacks_in_157_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_157_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_157_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/**
 * Sprightly by http://www.doobox.co.uk integrated for rapidweaver from the code http://dev.artutkin.ru/desaturate/example.html 
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
 $(document).ready(function() {
 
$.desaturate = {
  defaults: {
    'iefix': true, // autofix png for IE
    'level': 1,    // level of desaturation, ignored in IE
    'rgb': [0.3333, 0.3333, 0.3333] // levels of RGB for compose grayscale, ignored in IE
  },
  customClass: 'js-desaturate-fixed' // usually no need to change this
};

$.desaturate.Image = function(obj) {
    this.image = obj;
    this.jImage = $(this.image);

    this.src = this.jImage.attr('src');
    this.isPNG = this.jImage.is("IMG[src$=.png]");

    var styleWidth  = new String(this.jImage.css('width')); styleWidth = styleWidth.replace(/px/, '');
    var styleHeight = new String(this.jImage.css('height')); styleHeight = styleHeight.replace(/px/, '');

    this.width = this.jImage.width() ? this.jImage.width() : (styleWidth ? styleWidth : this.jImage.attr('width'));
    this.height = this.jImage.height() ? this.jImage.height() : (styleHeight ? styleHeight : this.jImage.attr('height'));

//      var styles = ['padding', 'margin', 'border'];
//      for (var i in styles) {
//        this.imgCustomStyles += styles[i] + ':' + this.image.style[styles[i]]+';';
//        this.image.style[styles[i]] = '';
//      }

    this.imgFilter = '';
    if (this.image.style.filter) {
      this.imgFilter = 'filter:'+this.image.style.filter+';';
      this.image.style.filter = '';
    }

    this.image.style.width = '';
    this.image.style.height = '';

    this.imgId    = this.jImage.attr('id') ? 'id="' + this.jImage.attr('id') + '" ' : '';
    this.imgClass = 'class="' + this.jImage.attr('class') + ' ' + $.desaturate.customClass + '" ';
    this.imgTitle = this.jImage.attr('title') ? 'title="' + this.jImage.attr('title') + '" ' : '';
    this.imgAlt   = this.jImage.attr('alt') ? 'alt="' + this.jImage.attr('alt') + '" ' : '';

    this.imgStyles  = this.image.style.cssText;
    this.imgStyles += this.jImage.attr('align') ? 'float:' + this.jImage.attr('align') + ';' : '';
    this.imgStyles += this.jImage.parent().attr('href') ? 'cursor:hand;' : '';

    // nulled filter present as FILTER: in cssText
    this.imgStyles = this.imgStyles.replace(/filter:/i,'');


    this.imgCssSize = (this.width && this.height) ? 'width:' + this.width + 'px;' + 'height:' + this.height + 'px;' : '';
};

$.desaturate.Image.prototype.replace = function(html) {
      return $(html).replaceAll(this.image).get(0);
};

$.desaturate.Image.prototype.getCanvas = function(options) {
    var canvasStr = '<canvas style="display:block;' + this.imgStyles + this.imgCssSize + '" ';               // amended changed from inline-block to block
    canvasStr += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '></canvas>';

    var canvas = $(canvasStr).get(0);
    var canvasContext = canvas.getContext('2d');

    var imgW = this.width;
    var imgH = this.height;
    canvas.width = imgW;
    canvas.height = imgH;

    canvasContext.drawImage(this.image, 0, 0);

    var imgPixels = canvasContext.getImageData(0, 0, imgW, imgH);

    for(var y = 0; y < imgPixels.height; y++){
      for(var x = 0; x < imgPixels.width; x++){
        var i = (y * 4) * imgPixels.width + x * 4;
        var avg = imgPixels.data[i]*options.rgb[0] + imgPixels.data[i + 1]*options.rgb[1] + imgPixels.data[i + 2]*options.rgb[2];
        imgPixels.data[i] = avg*options.level + imgPixels.data[i]*(1-options.level);
        imgPixels.data[i + 1] = avg*options.level + imgPixels.data[i + 1]*(1-options.level);
        imgPixels.data[i + 2] = avg*options.level + imgPixels.data[i + 2]*(1-options.level);
      }
    }

    canvasContext.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
    return canvas;
}

$.desaturate.Image.prototype.getIeFix = function(options) {
    /* Some $ operations like fadeIn/Out can reset filter atribute, so we need 3 SPAN's: 1st for styles and
     * correct work with $'s animation, 2rd for grayScale filter and last one for alpha image filter.
     * Combined 2 filters in one span won't work too.
     */
    var blockInit = 'display:block;background:transparent;padding:0;margin:0;';
    var strNewHTML = '<span style="display:inline-block;' + this.imgStyles + this.imgCssSize + '" ';
    strNewHTML += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '>';
      strNewHTML += '<span style="' + blockInit + this.imgCssSize + this.imgFilter + '">';
      if (this.isPNG) {
        strNewHTML += '<span style="' + blockInit + this.imgCssSize;
        strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.src + '\', sizingMethod=\'crop\');">';
        strNewHTML += '</span>';
      } else {
        strNewHTML += '<img style="' + blockInit + this.imgCssSize + '" ' + this.imgTitle + this.imgAlt;
        strNewHTML += ' src="' + this.src + '">';
      }
      strNewHTML += '</span>';
    strNewHTML += '</span>';

    return $(strNewHTML).get(0);
}

$.fn.desaturate = function(options) {

  var ret = [];
  var _opt = $.extend(true, {}, $.desaturate.defaults, options);

  this.each(function() {
    var el = this;
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(el).metadata() : {}, $(el).data('desaturate'));

    if ($.browser.msie && $(el).is("IMG") && $opt.iefix) {
      // autofix IE images
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getIeFix($opt));
    }

    if ($.browser.msie && ($(el).is("IMG") || $(el).hasClass($.desaturate.customClass))) {
      // apply filter for IE
        var el1 = el;
        if ($(el).hasClass($.desaturate.customClass))
        {
          // if this element is our imgage fixed by pngIE - set grayscale filter to child span
          el1 = $("SPAN", el).get(0);
        }
        el1.style.filter = (el1.style.filter ? el1.style.filter+' ' : '') +
                            'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';
    }

    if (!$.browser.msie && ($(el).is("IMG"))) {
      // convert image to canvas
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getCanvas($opt));
    }

    ret.push(el);
  });

  return this.pushStack(ret, "desaturate", "");
};

$.fn.desaturateImgFix = function(options) {
  if (!$.browser.msie) {
    return this;
  }

  var _opt = $.extend(true, {}, $.desaturate.defaults, options);
  var ret = [];

  this.each(function() {
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(this).metadata() : {}, $(this).data('desaturate'));
    if (!$(this).is("IMG")) {
      ret.push(this);
    } else {
      var image = new $.desaturate.Image(this);
      ret.push(image.replace(image.getIeFix($opt)));
    }
  });

  return this.pushStack(ret, "desaturateImgFix", "");
};
 

});


// start new code

 $(window).load(function() {

        
        var paircount = 0;
        var $thisSprite = $("#stacks_in_157_page0 img.imageStyle");
        var reverse = "";




        if ($.browser.msie)
        {
          // I need this only if desaturate png with aplha channel
          $thisSprite = $thisSprite.desaturateImgFix();
        }
        
 if(reverse == ""){

    // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_157_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_157_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_157_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_157_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_157_page0pair').toggle().toggleClass('stacks_in_157_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_157_page0);


// Javascript for stacks_in_210_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_210_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_210_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/**
 * Sprightly by http://www.doobox.co.uk integrated for rapidweaver from the code http://dev.artutkin.ru/desaturate/example.html 
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
 $(document).ready(function() {
 
$.desaturate = {
  defaults: {
    'iefix': true, // autofix png for IE
    'level': 1,    // level of desaturation, ignored in IE
    'rgb': [0.3333, 0.3333, 0.3333] // levels of RGB for compose grayscale, ignored in IE
  },
  customClass: 'js-desaturate-fixed' // usually no need to change this
};

$.desaturate.Image = function(obj) {
    this.image = obj;
    this.jImage = $(this.image);

    this.src = this.jImage.attr('src');
    this.isPNG = this.jImage.is("IMG[src$=.png]");

    var styleWidth  = new String(this.jImage.css('width')); styleWidth = styleWidth.replace(/px/, '');
    var styleHeight = new String(this.jImage.css('height')); styleHeight = styleHeight.replace(/px/, '');

    this.width = this.jImage.width() ? this.jImage.width() : (styleWidth ? styleWidth : this.jImage.attr('width'));
    this.height = this.jImage.height() ? this.jImage.height() : (styleHeight ? styleHeight : this.jImage.attr('height'));

//      var styles = ['padding', 'margin', 'border'];
//      for (var i in styles) {
//        this.imgCustomStyles += styles[i] + ':' + this.image.style[styles[i]]+';';
//        this.image.style[styles[i]] = '';
//      }

    this.imgFilter = '';
    if (this.image.style.filter) {
      this.imgFilter = 'filter:'+this.image.style.filter+';';
      this.image.style.filter = '';
    }

    this.image.style.width = '';
    this.image.style.height = '';

    this.imgId    = this.jImage.attr('id') ? 'id="' + this.jImage.attr('id') + '" ' : '';
    this.imgClass = 'class="' + this.jImage.attr('class') + ' ' + $.desaturate.customClass + '" ';
    this.imgTitle = this.jImage.attr('title') ? 'title="' + this.jImage.attr('title') + '" ' : '';
    this.imgAlt   = this.jImage.attr('alt') ? 'alt="' + this.jImage.attr('alt') + '" ' : '';

    this.imgStyles  = this.image.style.cssText;
    this.imgStyles += this.jImage.attr('align') ? 'float:' + this.jImage.attr('align') + ';' : '';
    this.imgStyles += this.jImage.parent().attr('href') ? 'cursor:hand;' : '';

    // nulled filter present as FILTER: in cssText
    this.imgStyles = this.imgStyles.replace(/filter:/i,'');


    this.imgCssSize = (this.width && this.height) ? 'width:' + this.width + 'px;' + 'height:' + this.height + 'px;' : '';
};

$.desaturate.Image.prototype.replace = function(html) {
      return $(html).replaceAll(this.image).get(0);
};

$.desaturate.Image.prototype.getCanvas = function(options) {
    var canvasStr = '<canvas style="display:block;' + this.imgStyles + this.imgCssSize + '" ';               // amended changed from inline-block to block
    canvasStr += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '></canvas>';

    var canvas = $(canvasStr).get(0);
    var canvasContext = canvas.getContext('2d');

    var imgW = this.width;
    var imgH = this.height;
    canvas.width = imgW;
    canvas.height = imgH;

    canvasContext.drawImage(this.image, 0, 0);

    var imgPixels = canvasContext.getImageData(0, 0, imgW, imgH);

    for(var y = 0; y < imgPixels.height; y++){
      for(var x = 0; x < imgPixels.width; x++){
        var i = (y * 4) * imgPixels.width + x * 4;
        var avg = imgPixels.data[i]*options.rgb[0] + imgPixels.data[i + 1]*options.rgb[1] + imgPixels.data[i + 2]*options.rgb[2];
        imgPixels.data[i] = avg*options.level + imgPixels.data[i]*(1-options.level);
        imgPixels.data[i + 1] = avg*options.level + imgPixels.data[i + 1]*(1-options.level);
        imgPixels.data[i + 2] = avg*options.level + imgPixels.data[i + 2]*(1-options.level);
      }
    }

    canvasContext.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
    return canvas;
}

$.desaturate.Image.prototype.getIeFix = function(options) {
    /* Some $ operations like fadeIn/Out can reset filter atribute, so we need 3 SPAN's: 1st for styles and
     * correct work with $'s animation, 2rd for grayScale filter and last one for alpha image filter.
     * Combined 2 filters in one span won't work too.
     */
    var blockInit = 'display:block;background:transparent;padding:0;margin:0;';
    var strNewHTML = '<span style="display:inline-block;' + this.imgStyles + this.imgCssSize + '" ';
    strNewHTML += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '>';
      strNewHTML += '<span style="' + blockInit + this.imgCssSize + this.imgFilter + '">';
      if (this.isPNG) {
        strNewHTML += '<span style="' + blockInit + this.imgCssSize;
        strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.src + '\', sizingMethod=\'crop\');">';
        strNewHTML += '</span>';
      } else {
        strNewHTML += '<img style="' + blockInit + this.imgCssSize + '" ' + this.imgTitle + this.imgAlt;
        strNewHTML += ' src="' + this.src + '">';
      }
      strNewHTML += '</span>';
    strNewHTML += '</span>';

    return $(strNewHTML).get(0);
}

$.fn.desaturate = function(options) {

  var ret = [];
  var _opt = $.extend(true, {}, $.desaturate.defaults, options);

  this.each(function() {
    var el = this;
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(el).metadata() : {}, $(el).data('desaturate'));

    if ($.browser.msie && $(el).is("IMG") && $opt.iefix) {
      // autofix IE images
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getIeFix($opt));
    }

    if ($.browser.msie && ($(el).is("IMG") || $(el).hasClass($.desaturate.customClass))) {
      // apply filter for IE
        var el1 = el;
        if ($(el).hasClass($.desaturate.customClass))
        {
          // if this element is our imgage fixed by pngIE - set grayscale filter to child span
          el1 = $("SPAN", el).get(0);
        }
        el1.style.filter = (el1.style.filter ? el1.style.filter+' ' : '') +
                            'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';
    }

    if (!$.browser.msie && ($(el).is("IMG"))) {
      // convert image to canvas
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getCanvas($opt));
    }

    ret.push(el);
  });

  return this.pushStack(ret, "desaturate", "");
};

$.fn.desaturateImgFix = function(options) {
  if (!$.browser.msie) {
    return this;
  }

  var _opt = $.extend(true, {}, $.desaturate.defaults, options);
  var ret = [];

  this.each(function() {
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(this).metadata() : {}, $(this).data('desaturate'));
    if (!$(this).is("IMG")) {
      ret.push(this);
    } else {
      var image = new $.desaturate.Image(this);
      ret.push(image.replace(image.getIeFix($opt)));
    }
  });

  return this.pushStack(ret, "desaturateImgFix", "");
};
 

});


// start new code

 $(window).load(function() {

        
        var paircount = 0;
        var $thisSprite = $("#stacks_in_210_page0 img.imageStyle");
        var reverse = "";




        if ($.browser.msie)
        {
          // I need this only if desaturate png with aplha channel
          $thisSprite = $thisSprite.desaturateImgFix();
        }
        
 if(reverse == ""){

    // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_210_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_210_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_210_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_210_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_210_page0pair').toggle().toggleClass('stacks_in_210_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_210_page0);


// Javascript for stacks_in_159_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_159_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_159_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/**
 * Sprightly by http://www.doobox.co.uk integrated for rapidweaver from the code http://dev.artutkin.ru/desaturate/example.html 
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
 $(document).ready(function() {
 
$.desaturate = {
  defaults: {
    'iefix': true, // autofix png for IE
    'level': 1,    // level of desaturation, ignored in IE
    'rgb': [0.3333, 0.3333, 0.3333] // levels of RGB for compose grayscale, ignored in IE
  },
  customClass: 'js-desaturate-fixed' // usually no need to change this
};

$.desaturate.Image = function(obj) {
    this.image = obj;
    this.jImage = $(this.image);

    this.src = this.jImage.attr('src');
    this.isPNG = this.jImage.is("IMG[src$=.png]");

    var styleWidth  = new String(this.jImage.css('width')); styleWidth = styleWidth.replace(/px/, '');
    var styleHeight = new String(this.jImage.css('height')); styleHeight = styleHeight.replace(/px/, '');

    this.width = this.jImage.width() ? this.jImage.width() : (styleWidth ? styleWidth : this.jImage.attr('width'));
    this.height = this.jImage.height() ? this.jImage.height() : (styleHeight ? styleHeight : this.jImage.attr('height'));

//      var styles = ['padding', 'margin', 'border'];
//      for (var i in styles) {
//        this.imgCustomStyles += styles[i] + ':' + this.image.style[styles[i]]+';';
//        this.image.style[styles[i]] = '';
//      }

    this.imgFilter = '';
    if (this.image.style.filter) {
      this.imgFilter = 'filter:'+this.image.style.filter+';';
      this.image.style.filter = '';
    }

    this.image.style.width = '';
    this.image.style.height = '';

    this.imgId    = this.jImage.attr('id') ? 'id="' + this.jImage.attr('id') + '" ' : '';
    this.imgClass = 'class="' + this.jImage.attr('class') + ' ' + $.desaturate.customClass + '" ';
    this.imgTitle = this.jImage.attr('title') ? 'title="' + this.jImage.attr('title') + '" ' : '';
    this.imgAlt   = this.jImage.attr('alt') ? 'alt="' + this.jImage.attr('alt') + '" ' : '';

    this.imgStyles  = this.image.style.cssText;
    this.imgStyles += this.jImage.attr('align') ? 'float:' + this.jImage.attr('align') + ';' : '';
    this.imgStyles += this.jImage.parent().attr('href') ? 'cursor:hand;' : '';

    // nulled filter present as FILTER: in cssText
    this.imgStyles = this.imgStyles.replace(/filter:/i,'');


    this.imgCssSize = (this.width && this.height) ? 'width:' + this.width + 'px;' + 'height:' + this.height + 'px;' : '';
};

$.desaturate.Image.prototype.replace = function(html) {
      return $(html).replaceAll(this.image).get(0);
};

$.desaturate.Image.prototype.getCanvas = function(options) {
    var canvasStr = '<canvas style="display:block;' + this.imgStyles + this.imgCssSize + '" ';               // amended changed from inline-block to block
    canvasStr += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '></canvas>';

    var canvas = $(canvasStr).get(0);
    var canvasContext = canvas.getContext('2d');

    var imgW = this.width;
    var imgH = this.height;
    canvas.width = imgW;
    canvas.height = imgH;

    canvasContext.drawImage(this.image, 0, 0);

    var imgPixels = canvasContext.getImageData(0, 0, imgW, imgH);

    for(var y = 0; y < imgPixels.height; y++){
      for(var x = 0; x < imgPixels.width; x++){
        var i = (y * 4) * imgPixels.width + x * 4;
        var avg = imgPixels.data[i]*options.rgb[0] + imgPixels.data[i + 1]*options.rgb[1] + imgPixels.data[i + 2]*options.rgb[2];
        imgPixels.data[i] = avg*options.level + imgPixels.data[i]*(1-options.level);
        imgPixels.data[i + 1] = avg*options.level + imgPixels.data[i + 1]*(1-options.level);
        imgPixels.data[i + 2] = avg*options.level + imgPixels.data[i + 2]*(1-options.level);
      }
    }

    canvasContext.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
    return canvas;
}

$.desaturate.Image.prototype.getIeFix = function(options) {
    /* Some $ operations like fadeIn/Out can reset filter atribute, so we need 3 SPAN's: 1st for styles and
     * correct work with $'s animation, 2rd for grayScale filter and last one for alpha image filter.
     * Combined 2 filters in one span won't work too.
     */
    var blockInit = 'display:block;background:transparent;padding:0;margin:0;';
    var strNewHTML = '<span style="display:inline-block;' + this.imgStyles + this.imgCssSize + '" ';
    strNewHTML += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '>';
      strNewHTML += '<span style="' + blockInit + this.imgCssSize + this.imgFilter + '">';
      if (this.isPNG) {
        strNewHTML += '<span style="' + blockInit + this.imgCssSize;
        strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.src + '\', sizingMethod=\'crop\');">';
        strNewHTML += '</span>';
      } else {
        strNewHTML += '<img style="' + blockInit + this.imgCssSize + '" ' + this.imgTitle + this.imgAlt;
        strNewHTML += ' src="' + this.src + '">';
      }
      strNewHTML += '</span>';
    strNewHTML += '</span>';

    return $(strNewHTML).get(0);
}

$.fn.desaturate = function(options) {

  var ret = [];
  var _opt = $.extend(true, {}, $.desaturate.defaults, options);

  this.each(function() {
    var el = this;
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(el).metadata() : {}, $(el).data('desaturate'));

    if ($.browser.msie && $(el).is("IMG") && $opt.iefix) {
      // autofix IE images
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getIeFix($opt));
    }

    if ($.browser.msie && ($(el).is("IMG") || $(el).hasClass($.desaturate.customClass))) {
      // apply filter for IE
        var el1 = el;
        if ($(el).hasClass($.desaturate.customClass))
        {
          // if this element is our imgage fixed by pngIE - set grayscale filter to child span
          el1 = $("SPAN", el).get(0);
        }
        el1.style.filter = (el1.style.filter ? el1.style.filter+' ' : '') +
                            'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';
    }

    if (!$.browser.msie && ($(el).is("IMG"))) {
      // convert image to canvas
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getCanvas($opt));
    }

    ret.push(el);
  });

  return this.pushStack(ret, "desaturate", "");
};

$.fn.desaturateImgFix = function(options) {
  if (!$.browser.msie) {
    return this;
  }

  var _opt = $.extend(true, {}, $.desaturate.defaults, options);
  var ret = [];

  this.each(function() {
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(this).metadata() : {}, $(this).data('desaturate'));
    if (!$(this).is("IMG")) {
      ret.push(this);
    } else {
      var image = new $.desaturate.Image(this);
      ret.push(image.replace(image.getIeFix($opt)));
    }
  });

  return this.pushStack(ret, "desaturateImgFix", "");
};
 

});


// start new code

 $(window).load(function() {

        
        var paircount = 0;
        var $thisSprite = $("#stacks_in_159_page0 img.imageStyle");
        var reverse = "";




        if ($.browser.msie)
        {
          // I need this only if desaturate png with aplha channel
          $thisSprite = $thisSprite.desaturateImgFix();
        }
        
 if(reverse == ""){

    // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_159_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_159_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_159_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_159_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_159_page0pair').toggle().toggleClass('stacks_in_159_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_159_page0);


// Javascript for stacks_in_24_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_24_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_24_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
function setCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires ;
}

function getCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function deleteCookie(name) {
    setCookie(name,"");
}


$(document).ready(function() {



// Get lz cookie
var cooky = getCookie('doo_lz_cookie_set');

 // Create the new lz cookie and store it for 1 day
deleteCookie('doo_lz_cookie_set');

$("#stacks_in_24_page0").css("margin" , 0);
var orgonal = $("#stacks_in_24_page0");
var slidedelay = (4000) ;
var slidespeed = (2000) ;

var position = $("#stacks_in_24_page0").offset();

if (cooky == "lzcookyset"){

}

if (cooky != "lzcookyset"){
  
   
$("<div/>", {
  "class": "doosuperoverlay"
})
.prependTo("body")
.delay(3000)
.fadeOut(2000);


var orgStackWidth = $("#stacks_in_24_page0").width();
var tempClone = $("#stacks_in_24_page0").clone();
$(tempClone).css({
"position" : "relative",
"width" : orgStackWidth + "px",
"text-align" : "left"
});

$(tempClone).fadeIn(1000).appendTo(".doosuperoverlay").css(position)
.delay(3000)
.fadeOut(2000);
  // showstack once
var dooremoveoverlaytimer = 3000 + 2000 + 500;
setTimeout(function(){ $('.doosuperoverlay').remove(); }, dooremoveoverlaytimer);

}  // end if cookie exists

$(orgonal).delay(slidedelay).slideUp(slidespeed);;

 
$('.lzeffect').remove();



if("$(orgonal).delay(slidedelay).slideUp(slidespeed);" != ""){
var doodelaylz = slidedelay + slidespeed + 1000 + 3000 + 2000;
setTimeout(function(){ $("#stacks_in_24_page0").remove(); }, doodelaylz + 1000);
}

});


	return stack;
})(stacks.stacks_in_24_page0);


// Javascript for stacks_in_8_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_8_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_8_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

/*
FX Slider Stack 1.0.1 - http://www.weaveraddons.com/stacks/fx-slider for more information
*/

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

/*
 Dual licensed under the MIT or GPL Version 2 licenses
 @example http://thiagosf.net/projects/jquery/skitter/
*/

var img=new Image;img.src="rw_common/plugins/stacks/fxslider/ajax-loader.gif";jQuery.easing.jswing=jQuery.easing.swing;
jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(c,a,d,b,e){return jQuery.easing[jQuery.easing.def](c,a,d,b,e)},easeInQuad:function(c,a,d,b,e){return b*(a/=e)*a+d},easeOutQuad:function(c,a,d,b,e){return-b*(a/=e)*(a-2)+d},easeInOutQuad:function(c,a,d,b,e){return(a/=e/2)<1?b/2*a*a+d:-b/2*(--a*(a-2)-1)+d},easeInCubic:function(c,a,d,b,e){return b*(a/=e)*a*a+d},easeOutCubic:function(c,a,d,b,e){return b*((a=a/e-1)*a*a+1)+d},easeInOutCubic:function(c,a,d,b,e){return(a/=e/2)<1?b/2*a*a*a+d:b/
2*((a-=2)*a*a+2)+d},easeInQuart:function(c,a,d,b,e){return b*(a/=e)*a*a*a+d},easeOutQuart:function(c,a,d,b,e){return-b*((a=a/e-1)*a*a*a-1)+d},easeInOutQuart:function(c,a,d,b,e){return(a/=e/2)<1?b/2*a*a*a*a+d:-b/2*((a-=2)*a*a*a-2)+d},easeInQuint:function(c,a,d,b,e){return b*(a/=e)*a*a*a*a+d},easeOutQuint:function(c,a,d,b,e){return b*((a=a/e-1)*a*a*a*a+1)+d},easeInOutQuint:function(c,a,d,b,e){return(a/=e/2)<1?b/2*a*a*a*a*a+d:b/2*((a-=2)*a*a*a*a+2)+d},easeInSine:function(c,a,d,b,e){return-b*Math.cos(a/
e*(Math.PI/2))+b+d},easeOutSine:function(c,a,d,b,e){return b*Math.sin(a/e*(Math.PI/2))+d},easeInOutSine:function(c,a,d,b,e){return-b/2*(Math.cos(Math.PI*a/e)-1)+d},easeInExpo:function(c,a,d,b,e){return a==0?d:b*Math.pow(2,10*(a/e-1))+d},easeOutExpo:function(c,a,d,b,e){return a==e?d+b:b*(-Math.pow(2,-10*a/e)+1)+d},easeInOutExpo:function(c,a,d,b,e){return a==0?d:a==e?d+b:(a/=e/2)<1?b/2*Math.pow(2,10*(a-1))+d:b/2*(-Math.pow(2,-10*--a)+2)+d},easeInCirc:function(c,a,d,b,e){return-b*(Math.sqrt(1-(a/=e)*
a)-1)+d},easeOutCirc:function(c,a,d,b,e){return b*Math.sqrt(1-(a=a/e-1)*a)+d},easeInOutCirc:function(c,a,d,b,e){return(a/=e/2)<1?-b/2*(Math.sqrt(1-a*a)-1)+d:b/2*(Math.sqrt(1-(a-=2)*a)+1)+d},easeInElastic:function(c,a,d,b,e){var c=1.70158,f=0,m=b;if(a==0)return d;if((a/=e)==1)return d+b;f||(f=e*0.3);m<Math.abs(b)?(m=b,c=f/4):c=f/(2*Math.PI)*Math.asin(b/m);return-(m*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/f))+d},easeOutElastic:function(c,a,d,b,e){var c=1.70158,f=0,m=b;if(a==0)return d;if((a/=
e)==1)return d+b;f||(f=e*0.3);m<Math.abs(b)?(m=b,c=f/4):c=f/(2*Math.PI)*Math.asin(b/m);return m*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/f)+b+d},easeInOutElastic:function(c,a,d,b,e){var c=1.70158,f=0,m=b;if(a==0)return d;if((a/=e/2)==2)return d+b;f||(f=e*0.3*1.5);m<Math.abs(b)?(m=b,c=f/4):c=f/(2*Math.PI)*Math.asin(b/m);return a<1?-0.5*m*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/f)+d:m*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/f)*0.5+b+d},easeInBack:function(c,a,d,b,e,f){f==void 0&&
(f=1.70158);return b*(a/=e)*a*((f+1)*a-f)+d},easeOutBack:function(c,a,d,b,e,f){f==void 0&&(f=1.70158);return b*((a=a/e-1)*a*((f+1)*a+f)+1)+d},easeInOutBack:function(c,a,d,b,e,f){f==void 0&&(f=1.70158);return(a/=e/2)<1?b/2*a*a*(((f*=1.525)+1)*a-f)+d:b/2*((a-=2)*a*(((f*=1.525)+1)*a+f)+2)+d},easeInBounce:function(c,a,d,b,e){return b-jQuery.easing.easeOutBounce(c,e-a,0,b,e)+d},easeOutBounce:function(c,a,d,b,e){return(a/=e)<1/2.75?b*7.5625*a*a+d:a<2/2.75?b*(7.5625*(a-=1.5/2.75)*a+0.75)+d:a<2.5/2.75?b*
(7.5625*(a-=2.25/2.75)*a+0.9375)+d:b*(7.5625*(a-=2.625/2.75)*a+0.984375)+d},easeInOutBounce:function(c,a,d,b,e){return a<e/2?jQuery.easing.easeInBounce(c,a*2,0,b,e)*0.5+d:jQuery.easing.easeOutBounce(c,a*2-e,0,b,e)*0.5+b*0.5+d}});
Utils=function(){return{wait:function(c){var c=$.extend({until:function(){return false},success:function(){},error:function(){Galleria.raise("Could not complete wait function.")},timeout:3E3},c),a=Utils.timestamp(),d,b,e=function(){b=Utils.timestamp();d=b-a;if(c.until(d))return c.success(),false;if(b>=a+c.timeout)return c.error(),false;window.setTimeout(e,10)};window.setTimeout(e,10)},timestamp:function(){return(new Date).getTime()},toggleQuality:function(c,a){if(!(IE!==7&&IE!==8)&&c)typeof a==="undefined"&&
(a=c.style.msInterpolationMode==="nearest-neighbor"),c.style.msInterpolationMode=a?"bicubic":"nearest-neighbor"}}}();
(function(c){var a=0,d=[];c.fn.skitter=function(h){return this.each(function(){c(this).data("skitter_number",a);d.push(new e(this,h,a));++a})};var b={v:1,i:2500,a:"",nr:true,n:true,lb:true,b:null,ti:null,il:null,ia:null,lia:null,laa:null,w:null,h:null,ii:1,ian:false,ih:false,ria:null,sr:false,th:false,aou:{backgroundColor:"#333",color:"#fff"},ao:{backgroundColor:"#000",color:"#fff"},aa:{backgroundColor:"#cc3333",color:"#fff"},ht:false,f:false,x:false,d:false,wl:null,o:0.75,iie:300,ioe:500,l:null,
is:null,mnh:20,ls:true,fl:1,ahl:true,s:'<a href="#" class="prev_button">prev</a><a href="#" class="next_button">next</a><span class="info_slide"></span><div class="border_skitter"><div class="container_skitter"><div class="image"><a href=""><img class="image_main" /></a><div class="label_skitter"></div></div></div></div>'};c.skitter=function(h,a,o){this.b=c(h);this.timer=null;this.s=c.extend({},b,a||{});this.number_skitter=o;this.ca=0;this.oc=this.at=false;this.setup()};var e=c.skitter;e.fn=e.prototype=
{};e.fn.extend=c.extend;e.fn.extend({setup:function(){var h=this;this.at=this.s.a.replace(/,/g," ").split(/\s+/);if(this.at.length<=1)this.at=false;this.b.append(this.s.s);if(this.s.v>=2)this.s.v=1.3;if(this.s.v<=0)this.s.v=1;!this.s.nr&&!this.s.th&&!this.s.d&&this.b.find(".info_slide").hide();this.s.lb||this.b.find(".label_skitter").hide();this.s.n||(this.b.find(".prev_button").hide(),this.b.find(".next_button").hide());if(this.s.f)this.s.w=c(window).width(),this.s.h=c(window).height(),this.b.css({position:"absolute",
top:0,left:0,"z-index":1E3}),c("body").css({overflown:"hidden"});else if(!this.s.w||!this.s.h){var a=h.b.find(".skitter_size_info:first"),o=h.b.find("img:first");if(a.length)this.s.w=a.data("width")||a.attr("data-width"),this.s.h=a.data("height")||a.attr("data-height");else if(o.length){if(this.s.w=o.attr("width"),this.s.h=o.attr("height"),!this.s.w||!this.s.h){a=false;o=o.parent().html();if(a=o.match(/width\s*=\s*["']?([0-9]+)/))this.s.w=a[1];if(a=o.match(/height\s*=\s*["']?([0-9]+)/))this.s.h=a[1]}}else this.s.w=
800,this.s.h=300}this.s.w=parseInt(this.s.w,10);this.s.h=parseInt(this.s.h,10);if(this.s.w==0||this.s.h==0)this.s.w=800,this.s.h=300;this.b.width(this.s.w+this.s.bw*2).height(this.s.h+this.s.bw*2);this.b.find(".container_skitter").width(this.s.w).height(this.s.h);this.s.bw&&this.b.find(".border_skitter").css("border","0px solid #000000");this.s.sbr&&this.b.css({"margin-bottom":this.s.sbr+5+"px","margin-top":this.s.sbr+5+"px"});o=this.s.wl?this.s.wl:this.s.w;this.b.find(".label_skitter").width(o);
var o=" image_number_select",k=0;this.s.il=[];this.s.x?c.ajax({type:"GET",url:this.s.x,async:false,dataType:"xml",success:function(a){c("<ul></ul>");c(a).find("skitter slide").each(function(){++k;var a=c(this).find("link").text()?c(this).find("link").text():"#",o=c(this).find("image").text(),g=c(this).find("image").attr("type"),b=c(this).find("label").text();h.s.il.push([o,a,g,b])})}}):this.s.json||this.b.find("ul li").each(function(){++k;var a=c(this).find("a").length?c(this).find("a").attr("href"):
"#",o=c(this).find("img").attr("src"),g=c(this).find("img").attr("alt");g&&g.match(/Stacks Image [0-9+]/i)&&(g="");typeof o!="undefined"&&h.s.il.push([o,a,"",g])});if(this.s.il.length>1){this.s.sr&&this.s.il.sort(function(){return Math.random()-0.5});for(i=0;i<this.s.il.length;i++)this.s.th?(a="",a=this.s.w>this.s.h?'height="100"':'width="100"',this.b.find(".info_slide").append('<span class="image_number'+o+'" rel="'+i+'" id="image_n_'+(i+1)+"_"+this.number_skitter+'"><img src="'+this.s.il[i][0]+
'" '+a+" /></span> ")):this.b.find(".info_slide").append('<span class="image_number'+o+'" rel="'+i+'" id="image_n_'+(i+1)+"_"+this.number_skitter+'">'+(i+1)+"</span> "),o=""}if(h.s.th){h.s.aou={opacity:0.5,width:"70px"};h.s.ao={opacity:1,width:"70px"};h.s.aa={opacity:1,width:"70px"};h.b.find(".info_slide").addClass("info_slide_thumb");o=k*55+75;h.b.find(".info_slide_thumb").width(o);h.b.css({height:h.b.height()+h.b.find(".info_slide").height()+5});h.s.lb=false;h.s.nl=="top"?h.b.find(".border_skitter").prepend('<div class="container_thumbs"></div>'):
(h.s.nl="bottom",h.b.find(".border_skitter").append('<div class="container_thumbs"></div>'));a=h.b.find(".info_slide").clone();h.b.find(".info_slide").remove();h.b.find(".container_thumbs").width(h.s.w).height(50).append(a);var b=0,u=this.s.w,j=this.s.h,g=0,d=h.b.find(".info_slide_thumb"),e=h.b.offset().left,n=h.b.offset().top;d.find(".image_number").each(function(){b+=c(this).width()+parseInt(c(this).css("marginLeft"))+parseInt(c(this).css("marginRight"))+parseInt(c(this).css("paddingLeft"))+parseInt(c(this).css("paddingRight"))});
d.width(b+"px");g=d.width();width_valor=this.s.w;width_valor=u-100;e+=90;o>h.s.w&&h.b.mousemove(function(a){var c=a.pageX,a=a.pageY,k=0;c-=e;a-=n;novo_width=g-width_valor;k=-(novo_width*c/width_valor);k>0&&(k=0);k<-(g-u-5)&&(k=-(g-u-5));(h.s.nl=="bottom"&&a>j||h.s.nl=="top"&&a<50)&&d.css({left:k})});h.b.find(".scroll_thumbs").css({left:10});o<h.s.w&&(h.b.find(".info_slide").width(h.s.w),h.b.find(".box_scroll_thumbs").hide())}else if(h.s.d||h.s.nr){o={};h.s.d?(a=Math.round(h.s.ds*1.8),a<15?a=15:a>
50&&(a=45)):a=30;if(h.s.nl=="top")o.top="-"+a+"px",o.bottom="auto",(!this.s.sbr||this.s.sbr<a)&&h.b.css("margin-top",a+"px");else if(h.s.nl=="bottom")o.bottom="-"+a+"px",o.top="auto",(!this.s.sbr||this.s.sbr<a)&&h.b.css("margin-bottom",a+"px");a=h.b.find(".info_slide");if(h.s.d)a.addClass("info_slide_dots").removeClass("info_slide");else if(h.s.nl=="top"||h.s.nl=="bottom")a.addClass("info_slide_numbers"),a.height()>h.s.mnh&&a.hide();h.s.nl=="top"||h.s.nl=="bottom"?o.left=(h.s.w+this.s.bw*2-a.width())/
2:(o.top=15+this.s.bw,o.left=15+this.s.bw);a.css(o)}this.b.find("ul").hide();this.s.ia=this.s.il[0][0];this.s.lia=this.s.il[0][1];this.s.laa=this.s.il[0][3];this.s.il.length>1&&(this.b.find(".prev_button").click(function(){var a=h.s.ii-2;a<0&&(a=h.s.il.length+a);h.jumpToImage(a);return false}),this.b.find(".next_button").click(function(){h.jumpToImage(h.s.ii);return false}),this.b.find(".next_button, .prev_button").hover(function(){c(this).stop().animate({opacity:1},200)},function(){c(this).stop().animate({opacity:0.75},
200)}),this.b.find(".image_number").hover(function(){c(this).attr("class")!="image_number image_number_select"&&c(this).css(h.s.ao)},function(){c(this).attr("class")!="image_number image_number_select"&&c(this).css(h.s.aou)}),this.b.find(".image_number").click(function(){if(c(this).attr("class")!="image_number image_number_select"){var a=c(this).attr("rel");h.jumpToImage(a)}return false}),this.b.find(".image_number").css(h.s.aou),this.b.find(".image_number:eq(0)").css(h.s.aa));this.s.ht&&this.hideTools();
this.loadImages()},loadImages:function(){var h=this;this.b.append(c('<div class="loading">Loading</div>'));var a=this.s.il.length,o=0;c.each(this.s.il,function(){var k=c('<span class="image_loading"></span>');k.css({position:"absolute",top:"-9999em"});h.b.append(k);k=new Image;c(k).load(function(){++o;o==a&&(h.b.find(".loading").remove(),h.b.find(".image_loading").remove(),h.start())}).error(function(){h.b.find(".loading, .image_loading, .image_number, .next_button, .prev_button").remove();h.b.html('<p style="color:white;background:black;">Error loading images. One or more images were not found.</p>')}).attr("src",
this[0])})},start:function(){var h=this;this.setLinkAtual();this.b.find(".image a img").attr({src:this.s.ia});img_link=this.b.find(".image a");img_link=this.resizeImage(img_link);img_link.find("img").fadeIn(1500);this.setValueBoxText();this.showBoxText();this.stopOnMouseOver();this.s.il.length>1?this.timer=setTimeout(function(){h.nextImage()},this.s.i):this.b.find(".loading, .image_loading, .image_number, .next_button, .prev_button").remove();c.isFunction(this.s.l)&&this.s.l()},jumpToImage:function(h){this.s.ian==
false?(this.b.find(".box_clone").stop(),this.clearTimer(true),this.s.ii=Math.floor(h),this.b.find(".image a").attr({href:this.s.lia}),this.b.find(".image_main").attr({src:this.s.ia}),this.b.find(".box_clone").remove(),this.nextImage()):this.oc=h},nextImage:function(){animations_functions="cube,cuberandom,block,cubestop,cubestoprandom,cubehide,cubesize,horizontal,showbars,showbarsrandom,tube,fade,fadefour,paralell,blind,blindheight,blindwidth,directiontop,directionbottom,directionright,directionleft,cubespread,glasscube,glassblock,circles,circlesinside,circlesrotate".split(",");
if(this.at&&!this.s.il[this.s.ii][2]){if(animation_type=this.at[this.ca],this.ca++,this.ca>=this.at.length)this.ca=0}else animation_type=this.s.il[this.s.ii][2]?this.s.il[this.s.ii][2]:this.s.a==""?"randomsmart":this.s.a;if(animation_type=="randomsmart"){if(!this.s.ria)animations_functions.sort(function(){return 0.5-Math.random()}),this.s.ria=animations_functions;animation_type=this.s.ria[this.s.ii]}else if(animation_type=="random"){var h=parseInt(Math.random()*animations_functions.length);animation_type=
animations_functions[h]}animation_type=animation_type.toLowerCase();h={};if(animation_type.match(/random/i))animation_type=animation_type.replace(/random/i,""),h.random=true;else{var a={blindheight:{height:true},blindwidth:{height:false,time_animate:400,delay:50},directiontop:{direction:"top"},directionbottom:{direction:"bottom"},directionright:{direction:"right",total:5},directionleft:{direction:"left",total:5}};a[animation_type]&&(h=a[animation_type],animation_type=animation_type.replace(/width|height|top|bottom|left|right/i,
""))}easing="easeOutQuad";this.s.ian=true;a="animation"+animation_type.charAt(0).toUpperCase()+animation_type.slice(1);if(this[a])this[a](h);else this.animationTube()},animationCube:function(h){var a=this;easing="easeOutBack";var c=700/this.s.v;this.setActualLevel();var k=Math.ceil(this.s.w/(this.s.w/8)),b=Math.ceil(this.s.h/(this.s.h/3)),u=k*b,k=Math.ceil(this.s.w/k),j=Math.ceil(this.s.h/b),g=init_left=this.s.h+200,d=0,e=0;for(i=0;i<u;i++){var n=this.getBoxClone();n.hide();var f={left:this.s.w/2,
top:this.s.h+50,width:k,height:j};if(h.random)f.left=(i%2==0?init_left:-init_left)+k*e+e*50+"px",f.top=(i%2==0?g:-g)+j*d+d*50+"px";n.css(f);n.find("img").css({left:-(k*e),top:-(j*d)});this.addBoxClone(n);var f=40*e,p=i==u-1?function(){a.finishAnimation()}:"";n.show().delay(f).animate({top:j*d+"px",left:k*e+"px"},c,easing,p);d++;d==b&&(d=0,e++)}},animationBlock:function(){var h=this,a=500/this.s.v;this.setActualLevel();var c=Math.ceil(this.s.w/(this.s.w/10)),k=Math.ceil(this.s.w/c),b=this.s.h;for(i=
0;i<c;i++){var d=k*i,j=this.getBoxClone();j.css({left:this.s.w,top:0,width:k,height:b});j.find("img").css({left:-(k*i),top:0});this.addBoxClone(j);var g=i==c-1?function(){h.finishAnimation()}:"";j.delay(80*i).animate({top:0,left:d,opacity:"show"},a,easing,g)}},animationCubestop:function(h){var a=this;easing="easeOutBack";var c=800/this.s.v,k=this.b.find(".image_main").attr("src");this.setActualLevel();this.setLinkAtual();this.b.find(".image_main").attr({src:this.s.ia});var b=Math.ceil(this.s.w/(this.s.w/
8)),d=Math.ceil(this.s.h/(this.s.w/8)),j=b*d,b=Math.ceil(this.s.w/b),g=Math.ceil(this.s.h/d),e=0,l=0,n=0,f=0,p=this.s.w/16;for(i=0;i<j;i++){var e=i%2==0?e:-e,l=i%2==0?l:-l,q=e+g*n,m=l+b*f,t=-(g*n),v=-(b*f),x=q-p,w=m-p,s=this.getBoxClone(k);s.css({left:m+"px",top:q+"px",width:b,height:g});s.find("img").css({left:v,top:t});this.addBoxClone(s);s.show();t=30*i;h.random&&(c=1E3/this.s.v,x=q,w=m,t=30*Math.random()*30);q=i==j-1?function(){a.finishAnimation()}:"";s.delay(t).animate({opacity:"hide",top:x+
"px",left:w+"px"},c,easing,q);n++;n==d&&(n=0,f++)}},animationCubehide:function(){var h=this,a=500/this.s.v,c=this.b.find(".image_main").attr("src");this.setActualLevel();this.setLinkAtual();this.b.find(".image_main").attr({src:this.s.ia});var k=Math.ceil(this.s.w/(this.s.w/8)),b=Math.ceil(this.s.h/(this.s.h/3)),d=k*b,k=Math.ceil(this.s.w/k),j=Math.ceil(this.s.h/b),g=0,e=0,l=0,n=0;for(i=0;i<d;i++){var g=i%2==0?g:-g,e=i%2==0?e:-e,f=g+j*l,p=e+k*n,q=-(j*l),m=-(k*n),t=this.getBoxClone(c);t.css({left:p+
"px",top:f+"px",width:k,height:j});t.find("img").css({left:m,top:q});this.addBoxClone(t);t.show();f=50*i;f=i==d-1?d*50:f;p=i==d-1?function(){h.finishAnimation()}:"";t.delay(f).animate({opacity:"hide"},a,easing,p);l++;l==b&&(l=0,n++)}},animationCubejelly:function(){var h=this;easing="easeInBack";var a=300/this.s.v,c=this.b.find(".image_main").attr("src");this.setActualLevel();this.setLinkAtual();this.b.find(".image_main").attr({src:this.s.ia});var k=Math.ceil(this.s.w/(this.s.w/8)),b=Math.ceil(this.s.h/
(this.s.h/3)),d=k*b,k=Math.ceil(this.s.w/k),e=Math.ceil(this.s.h/b),g=0,r=0,l=0,f=0,m=-1;for(i=0;i<d;i++){f%2!=0?(l==0&&(m=m+b+1),m--):(f>0&&l==0&&(m+=2),m++);var g=i%2==0?g:-g,r=i%2==0?r:-r,p=g+e*l,q=r+k*f,s=-(e*l),t=-(k*f),v=this.getBoxClone(c);v.css({left:q+"px",top:p+"px",width:k,height:e});v.find("img").css({left:t,top:s});this.addBoxClone(v);v.show();p=i==d-1?function(){h.finishAnimation()}:"";v.delay(50*i).animate({width:"+=100px",height:"+=100px",top:"-=20px",left:"-=20px",opacity:"hide"},
a,easing,p);l++;l==b&&(l=0,f++)}},animationCubesize:function(){var h=this;easing="easeInOutQuad";var a=600/this.s.v,c=this.b.find(".image_main").attr("src");this.setActualLevel();this.setLinkAtual();this.b.find(".image_main").attr({src:this.s.ia});var k=Math.ceil(this.s.w/(this.s.w/8)),b=Math.ceil(this.s.h/(this.s.h/3)),d=k*b,k=Math.ceil(this.s.w/k),e=Math.ceil(this.s.h/b),g=0,f=0,l=0,n=0;Math.ceil(this.s.w/6);for(i=0;i<d;i++){var g=i%2==0?g:-g,f=i%2==0?f:-f,m=g+e*l,p=f+k*n,q=-(e*l),s=-(k*n),t=this.getBoxClone(c);
t.css({left:p,top:m,width:k,height:e});t.find("img").css({left:s,top:q});this.addBoxClone(t);t.show();q=i==d-1?function(){h.finishAnimation()}:"";t.delay(50*i).animate({opacity:"hide",width:"hide",height:"hide",top:m+k*1.5,left:p+e*1.5},a,easing,q);l++;l==b&&(l=0,n++)}},animationHorizontal:function(){var h=this;easing="easeOutExpo";var a=700/this.s.v;this.setActualLevel();var c=Math.ceil(this.s.w/(this.s.w/7)),k=this.s.w,b=Math.ceil(this.s.h/c);for(i=0;i<c;i++){var d=(i%2==0?"":"")+k,e=i*b,g=this.getBoxClone();
g.css({left:d+"px",top:e+"px",width:k,height:b});g.find("img").css({left:0,top:-e});this.addBoxClone(g);d=i==c-1?function(){h.finishAnimation()}:"";g.delay(70*i).animate({opacity:"show",top:e,left:0},a,easing,d)}},animationShowbars:function(h){var a=this,c=400/this.s.v;this.setActualLevel();var k=Math.ceil(this.s.w/(this.s.w/10)),b=Math.ceil(this.s.w/k),d=this.s.h;for(i=0;i<k;i++){var e=b*i,g=this.getBoxClone();g.css({left:e,top:-50,width:b,height:d});g.find("img").css({left:-(b*i),top:0});this.addBoxClone(g);
if(h.random)var f=50*this.getRandom(k),f=i==k-1?50*k:f;else f=70*i,c-=i*2;var l=i==k-1?function(){a.finishAnimation()}:"";g.delay(f).animate({opacity:"show",top:"0px",left:e+"px"},c,easing,l)}},animationTube:function(){var h=this;easing="easeOutElastic";var a=600/this.s.v;this.setActualLevel();var c=Math.ceil(this.s.w/(this.s.w/10)),b=Math.ceil(this.s.w/c),d=this.s.h;for(i=0;i<c;i++){var e=d,j=b*i,g=this.getBoxClone();g.css({left:j,top:e,height:d,width:b});g.find("img").css({left:-j});this.addBoxClone(g);
e=40*this.getRandom(c);j=i==c-1?function(){h.finishAnimation()}:"";g.show().delay(e).animate({top:0},a,easing,j)}},animationFade:function(){var h=this,a=800/this.s.v;this.setActualLevel();var c=this.s.w,b=this.s.h;for(i=0;i<2;i++){var d=this.getBoxClone();d.css({left:0,top:0,width:c,height:b});this.addBoxClone(d);d.animate({opacity:"show",left:0,top:0},a,easing,i==1?function(){h.finishAnimation()}:"")}},animationFadefour:function(){var h=this,a=500/this.s.v;this.setActualLevel();var c=this.s.w,b=
this.s.h;for(i=0;i<4;i++){if(i==0)var d="-100px",e="-100px";else i==1?(d="-100px",e="100px"):i==2?(d="100px",e="-100px"):i==3&&(e=d="100px");var j=this.getBoxClone();j.css({left:e,top:d,width:c,height:b});this.addBoxClone(j);j.animate({opacity:"show",left:0,top:0},a,easing,i==3?function(){h.finishAnimation()}:"")}},animationParalell:function(){var h=this;easing="easeOutCirc";var a=400/this.s.v;this.setActualLevel();var c=Math.ceil(this.s.w/(this.s.w/16)),b=Math.ceil(this.s.w/c),d=this.s.h;for(i=0;i<
c;i++){var e=b*i,j=this.getBoxClone();j.css({left:e,top:0-this.s.h,width:b,height:d});j.find("img").css({left:-(b*i),top:0});this.addBoxClone(j);var g;i<=c/2-1?g=1400-i*200:i>c/2-1&&(g=(i-c/2)*200);g/=2.5;var f=i==c-1?function(){h.finishAnimation()}:"";j.show().delay(g).animate({top:"0px",left:e+"px"},a,easing,f)}},animationBlind:function(h){var a=this,c=400/this.s.v;this.setActualLevel();var b=Math.ceil(this.s.w/(this.s.w/16)),d=Math.ceil(this.s.w/b),e=this.s.h;for(i=0;i<b;i++){var j=d*i,g=this.getBoxClone();
g.css({left:j,top:0,width:d,height:e});g.find("img").css({left:-(d*i),top:0});this.addBoxClone(g);var f;if(h.height)i<=b/2-1?f=200+i*200:i>b/2-1&&(f=(b/2-i)*200+b*100),l=i==b/2?function(){a.finishAnimation()}:"";else{i<=b/2-1?f=1400-i*200:i>b/2-1&&(f=(i-b/2)*200);var l=i==b-1?function(){a.finishAnimation()}:""}f/=2.5;h.height?(c+=i*2,easing="easeOutQuad",g.delay(f).animate({opacity:"show",top:"0px",left:j+"px",height:"show"},c,easing,l)):g.delay(f).animate({opacity:"show",top:"0px",left:j+"px",width:"show"},
c,easing,l)}},animationBlinddimension:function(a){var b=this,a=c.extend({},{height:true,time_animate:500,delay:100},a||{}),d=a.time_animate/this.s.v;this.setActualLevel();var e=Math.ceil(this.s.w/(this.s.w/16)),f=Math.ceil(this.s.w/e),u=this.s.h;for(i=0;i<e;i++){var j=f*i,g=this.getBoxClone();g.css({left:j,top:0,width:f,height:u});g.find("img").css({left:-(f*i),top:0});this.addBoxClone(g);var r=a.delay*i,l=i==e-1?function(){b.finishAnimation()}:"";a.height?(easing="easeOutQuad",g.delay(r).animate({opacity:"show",
top:"0px",left:j+"px",height:"show"},d,easing,l)):g.delay(r).animate({opacity:"show",top:"0px",left:j+"px",width:"show"},d,easing,l)}},animationDirection:function(a){var b=this,a=c.extend({},{direction:"top",delay_type:"sequence",total:7},a||{});easing="easeInOutExpo";var d=1200/this.s.v,e=this.b.find(".image_main").attr("src");this.setActualLevel();this.setLinkAtual();this.b.find(".image_main").attr({src:this.s.ia});this.b.find(".image_main").hide();var f=a.total;for(i=0;i<f;i++){switch(a.direction){default:case "top":var u=
Math.ceil(this.s.w/f),j=this.s.h,g=0,r=u*i,l=-j,n=r,m=j,p=r,q=0,s=r,t=0,v=-r;break;case "bottom":u=Math.ceil(this.s.w/f);j=this.s.h;g=0;r=u*i;l=j;n=r;m=-j;p=r;q=0;s=r;t=0;v=-r;break;case "right":u=this.s.w;j=Math.ceil(this.s.h/f);g=j*i;r=0;l=g;n=u;m=g;p=-n;q=g;s=0;t=-g;v=0;break;case "left":u=this.s.w,j=Math.ceil(this.s.h/f),g=j*i,r=0,l=g,n=-u,m=g,p=-n,q=g,s=0,t=-g,v=0}switch(a.delay_type){default:var x=i%2==0?0:150;break;case "random":x=30*Math.random()*30;break;case "sequence":x=i*100}var w=this.getBoxClone(e);
w.find("img").css({left:v,top:t});w.css({top:g,left:r,width:u,height:j});this.addBoxClone(w);w.show();w.delay(x).animate({top:l,left:n},d,easing);g=this.getBoxClone();g.find("img").css({left:v,top:t});g.css({top:m,left:p,width:u,height:j});this.addBoxClone(g);g.show();u=i==f-1?function(){b.finishAnimation()}:"";g.delay(x).animate({top:q,left:s},d,easing,u)}},animationCubespread:function(){var a=this;easing="easeInOutQuad";var c=700/this.s.v;this.setActualLevel();var b=Math.ceil(this.s.w/(this.s.w/
8)),d=Math.ceil(this.s.h/(this.s.w/8)),e=b*d,b=Math.ceil(this.s.w/b),f=Math.ceil(this.s.h/d),j=0,g=0,r=0,l=0,n=[],m=[];for(i=0;i<e;i++){var j=i%2==0?j:-j,g=i%2==0?g:-g,p=j+f*r,q=g+b*l;n[i]=[p,q];r++;r==d&&(r=0,l++)}for(i=l=r=0;i<e;i++)m[i]=i;m=a.shuffleArray(m);for(i=0;i<e;i++){var j=i%2==0?j:-j,g=i%2==0?g:-g,p=j+f*r,q=g+b*l,s=-(f*r),t=-(b*l),v=p,x=q,p=n[m[i]][0],q=n[m[i]][1],w=this.getBoxClone();w.css({left:q+"px",top:p+"px",width:b,height:f});w.find("img").css({left:t,top:s});this.addBoxClone(w);
p=30*Math.random()*30;i==e-1&&(p=900);q=i==e-1?function(){a.finishAnimation()}:"";w.delay(p).animate({opacity:"show",top:v+"px",left:x+"px"},c,easing,q);r++;r==d&&(r=0,l++)}},animationGlasscube:function(){var a=this;easing="easeOutExpo";var c=500/this.s.v;this.setActualLevel();var b=Math.ceil(this.s.w/(this.s.w/10))*2,d=Math.ceil(this.s.w/b)*2,e=this.s.h/2,f=0;for(i=0;i<b;i++){mod=i%2==0?true:false;var j=d*f,g=mod?-a.s.h:a.s.h,m=d*f,l=mod?0:e,n=-(d*f),s=mod?0:-e,p=120*f,q=this.getBoxClone();q.css({left:j,
top:g,width:d,height:e});q.find("img").css({left:n+d/1.5,top:s}).delay(p).animate({left:n,top:s},c*1.9,"easeOutQuad");this.addBoxClone(q);j=i==b-1?function(){a.finishAnimation()}:"";q.show().delay(p).animate({top:l,left:m},c,easing,j);i%2!=0&&f++}},animationGlassblock:function(){var a=this;easing="easeOutExpo";var c=700/this.s.v;this.setActualLevel();var b=Math.ceil(this.s.w/(this.s.w/10)),d=Math.ceil(this.s.w/b),e=this.s.h;for(i=0;i<b;i++){var f=d*i,j=d*i,g=-(d*i),m=100*i,l=this.getBoxClone();l.css({left:f,
top:0,width:d,height:e});l.find("img").css({left:g+d/1.5,top:0}).delay(m).animate({left:g,top:0},c*1.1,"easeInOutQuad");this.addBoxClone(l);f=i==b-1?function(){a.finishAnimation()}:"";l.delay(m).animate({top:0,left:j,opacity:"show"},c,easing,f)}},animationCircles:function(){var a=this;easing="easeInQuad";var c=500/this.s.v;this.setActualLevel();var b=Math.ceil(this.s.w/(this.s.w/10)),d=100,e=Math.sqrt(Math.pow(this.s.w,2)+Math.pow(this.s.h,2)),e=Math.ceil(e);for(i=0;i<b;i++){var f=a.s.w/2-d/2,j=a.s.h/
2-d/2,g=f,m=j,l=this.getBoxClone();l.css({left:f,top:j,width:d,height:d}).css3({"border-radius":e+"px"});l.find("img").css({left:-f,top:-j});d+=100;this.addBoxClone(l);f=i==b-1?function(){a.finishAnimation()}:"";l.delay(70*i).animate({top:m,left:g,opacity:"show"},c,easing,f)}},animationCirclesinside:function(){var a=this;easing="easeInQuad";var c=500/this.s.v,b=this.b.find(".image_main").attr("src");this.setActualLevel();this.setLinkAtual();this.b.find(".image_main").attr({src:this.s.ia});var d=Math.ceil(this.s.w/
(this.s.w/10)),e=Math.sqrt(Math.pow(this.s.w,2)+Math.pow(this.s.h,2)),f=e=Math.ceil(e);for(i=0;i<d;i++){var j=a.s.w/2-f/2,g=a.s.h/2-f/2,m=j,l=g,n=this.getBoxClone(b);n.css({left:j,top:g,width:f,height:f}).css3({"border-radius":e+"px"});n.find("img").css({left:-j,top:-g});f-=100;this.addBoxClone(n);n.show();j=i==d-1?function(){a.finishAnimation()}:"";n.delay(70*i).animate({top:l,left:m,opacity:"hide"},c,easing,j)}},animationCirclesrotate:function(){var a=this,c=500/this.s.v,b=this.b.find(".image_main").attr("src");
this.setActualLevel();this.setLinkAtual();this.b.find(".image_main").attr({src:this.s.ia});var d=Math.ceil(this.s.w/(this.s.w/10)),e=Math.sqrt(Math.pow(this.s.w,2)+Math.pow(this.s.h,2)),f=e=Math.ceil(e);for(i=0;i<d;i++){var j=a.s.w/2-f/2,g=a.s.h/2-f/2,m=j,l=g,n=this.getBoxClone(b);n.css({left:j,top:g,width:f,height:f}).css3({"border-radius":e+"px"});n.find("img").css({left:-j,top:-g});f-=100;this.addBoxClone(n);n.show();j=i==d-1?function(){a.finishAnimation()}:"";g=i%2==0?"20deg":"-20deg";n.delay(100*
i).animate({top:l,left:m,opacity:"hide",rotate:g},c,easing,j)}},finishAnimation:function(){var a=this;this.b.find(".image_main").show();this.showBoxText();this.s.ian=false;if(a.oc!==false)a.jumpToImage(a.oc),a.oc=false;else if((!this.s.poh||!this.s.ih)&&(this.s.ls||this.s.fl))this.timer=setTimeout(function(){a.completeMove()},this.s.i),this.b.find(".image_main").attr({src:this.s.ia}),this.b.find(".image a").attr({href:this.s.lia})},completeMove:function(){var a=true;if(!this.s.ls&&this.s.fl&&(this.s.fl++,
this.s.fl>=this.s.il.length))a=this.s.fl=false;this.clearTimer(true);this.b.find(".box_clone").remove();a&&this.nextImage()},setActualLevel:function(){var a=this;c.isFunction(this.s.is)&&this.s.imageSwitched(this.s.ii,this);var b=this.s.il[this.s.ii][1],d=this.s.il[this.s.ii][3];this.s.ia=this.s.il[this.s.ii][0];this.s.lia=b;this.s.laa=d;this.b.find(".image_number_select").css(a.s.aou).removeClass("image_number_select");c("#image_n_"+(this.s.ii+1)+"_"+a.number_skitter).css(a.s.aa).addClass("image_number_select");
this.s.ahl?this.b.find(".label_skitter").slideUp(200,function(){a.setValueBoxText()}):(a.setValueBoxText(),(this.s.laa==void 0||this.s.laa=="")&&this.b.find(".label_skitter").css("display","none"));this.s.ii++;if(this.s.ii==this.s.il.length)this.s.ii=0},getBoxClone:function(a){a=this.s.lia!="#"?c('<a href="'+this.s.lia+'"><img src="'+(a?a:this.s.ia)+'" /></a>'):c('<img src="'+(a?a:this.s.ia)+'" />');a=this.resizeImage(a);return c('<div class="box_clone"></div>').append(a)},resizeImage:function(a){this.s.f&&
a.find("img").height(this.s.h);return a},addBoxClone:function(a){this.b.find(".container_skitter").append(a)},getRandom:function(a){return Math.floor(Math.random()*a)},setValueBoxText:function(){this.b.find(".label_skitter").html("<p>"+this.s.laa+"</p>")},showBoxText:function(){this.s.laa!=void 0&&this.s.laa!=""&&this.s.lb&&(this.s.ahl?this.b.find(".label_skitter").slideDown(400):this.b.find(".label_skitter").css("display","block"))},stopOnMouseOver:function(){var a=this,c=a.s.o,b=a.s.iie,d=a.s.iie;
a.b.hover(function(){a.s.ht&&(a.s.nl!="top"&&a.s.nl!="bottom"&&a.b.find(".info_slide,.info_slide_dots").show().css({opacity:0}).animate({opacity:c},b),a.s.n&&(a.b.find(".prev_button").show().css({opacity:0}).animate({opacity:c},b),a.b.find(".next_button").show().css({opacity:0}).animate({opacity:c},b)));a.s.poh&&a.clearTimer(true);a.s.ih=true},function(){a.s.ht&&(a.s.nl!="top"&&a.s.nl!="bottom"&&a.b.find(".info_slide,.info_slide_dots").queue("fx",[]).show().css({opacity:c}).animate({opacity:0},d),
a.s.n&&(a.b.find(".prev_button").queue("fx",[]).show().css({opacity:c}).animate({opacity:0},d),a.b.find(".next_button").queue("fx",[]).show().css({opacity:c}).animate({opacity:0},d)));if(a.s.poh&&(a.clearTimer(true),!a.s.ian&&a.s.il.length>1&&(a.s.fl||a.s.ls)))a.timer=setTimeout(function(){a.timer=setTimeout(function(){a.completeMove()},a.s.i);a.b.find(".image_main").attr({src:a.s.ia});a.b.find(".image a").attr({href:a.s.lia})},a.s.i);a.s.ih=false})},clearTimer:function(){clearInterval(this.timer)},
setLinkAtual:function(){this.s.lia!="#"?this.b.find(".image a").attr({href:this.s.lia}):this.b.find(".image a").removeAttr("href")},hideTools:function(){this.s.nl!="top"&&this.s.nl!="bottom"&&this.b.find(".info_slide,.info_slide_dots").hide();this.b.find(".prev_button,.next_button,.label_skitter").hide()},shuffleArray:function(a){for(var c=[],b;a.length>0;)b=this.randomUnique(0,a.length-1),c[c.length]=a[b],a.splice(b,1);return c},randomUnique:function(a,c){var b;do b=Math.random();while(b==1);return b*
(c-a+1)+a|0}});c.fn.css3=function(a){var c={},b=["moz","ms","o","webkit"],d;for(d in a){for(var e=0;e<b.length;e++)c["-"+b[e]+"-"+d]=a[d];c[d]=a[d]}this.css(c);return this};var f="deg";c.fn.rotate=function(a){var b=c(this).css("transform")||"none";if(typeof a=="undefined")return b&&(a=b.match(/rotate\(([^)]+)\)/))&&a[1]?a[1]:0;if(a=a.toString().match(/^(-?\d+(\.\d+)?)(.+)?$/))a[3]&&(f=a[3]),c(this).css("transform",b.replace(/none|rotate\([^)]*\)/,"")+"rotate("+a[1]+f+")");return this};c.fn.scale=
function(a){var b=c(this).css("transform");if(typeof a=="undefined")return b&&(a=b.match(/scale\(([^)]+)\)/))&&a[1]?a[1]:1;c(this).css("transform",b.replace(/none|scale\([^)]*\)/,"")+"scale("+a+")");return this};var m=c.fx.prototype.cur;c.fx.prototype.cur=function(){if(this.prop=="rotate")return parseFloat(c(this.elem).rotate());else if(this.prop=="scale")return parseFloat(c(this.elem).scale());return m.apply(this,arguments)};c.fx.step.rotate=function(a){c(a.elem).rotate(a.now+f)};c.fx.step.scale=
function(a){c(a.elem).scale(a.now)};var y=c.fn.animate;c.fn.animate=function(a){if(typeof a.rotate!="undefined"){var b=a.rotate.toString().match(/^(([+-]=)?(-?\d+(\.\d+)?))(.+)?$/);b&&b[5]&&(f=b[5]);a.rotate=b[1]}return y.apply(this,arguments)};var s=null,z=c.fn.css;c.fn.css=function(a,b){s===null&&(s=typeof c.cssProps!="undefined"?c.cssProps:typeof c.props!="undefined"?c.props:{});if(typeof s.transform=="undefined"&&(a=="transform"||typeof a=="object"&&typeof a.transform!="undefined")){var d=s,e;
a:{e=this.get(0);for(var f=["transform","WebkitTransform","msTransform","MozTransform","OTransform"],m;m=f.shift();)if(typeof e.style[m]!="undefined"){e=m;break a}e="transform"}d.transform=e}if(s.transform!="transform")if(a=="transform"){if(a=s.transform,typeof b=="undefined"&&jQuery.style)return jQuery.style(this.get(0),a)}else if(typeof a=="object"&&typeof a.transform!="undefined")a[s.transform]=a.transform,delete a.transform;return z.apply(this,arguments)}})(jQuery);


$(function(){
	$('#stacks_in_8_page0images img').appendTo($('#stacks_in_8_page0container'));
	$('#stacks_in_8_page0container').skitter({'a': 'random', 
								 'd': ('dots'.match(/dots/i) != null), 
								 'nr': ('dots'.match(/number/i) != null), 
								 'th': ('dots'.match(/thumb/i) != null),
								 'ds': 6,
								 'nl': 'inside', 
								 'al': '',
								 'sr': false, 
								 'i': 3.5*1000, 
								 'ls': true,
								 'ht': true,
								 'ahl': true,
								 'bw': 0, 
								 'sbr': 0,								
								 'aou': {backgroundColor: '#333333', color: '#FFFFFF'},
								 'ao': {backgroundColor: '#000000', color: '#FFFFFF'},
								 'aa': {backgroundColor: '#FFF324', color: '#FFFFFF'}, 
								 'poh': true});
});

	return stack;
})(stacks.stacks_in_8_page0);


// Javascript for stacks_in_29_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_29_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_29_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

//-- Exposé Stack v1.0.3 by Joe Workman --//
/* jQuery Tools Overlay 1.2.5 - The missing UI library for the Web */
(function(a){function t(d,b){var c=this,j=d.add(c),o=a(window),k,f,m,g=a.tools.expose&&(b.mask||b.expose),n=Math.random().toString().slice(10);if(g){if(typeof g=="string")g={color:g};g.closeOnClick=g.closeOnEsc=false}var p=b.target||d.attr("rel");f=p?a(p):d;if(!f.length)throw"Could not find Overlay: "+p;d&&d.index(f)==-1&&d.click(function(e){c.load(e);return e.preventDefault()});a.extend(c,{load:function(e){if(c.isOpened())return c;var h=q[b.effect];if(!h)throw'Overlay: cannot find effect : "'+b.effect+
'"';b.oneInstance&&a.each(s,function(){this.close(e)});e=e||a.Event();e.type="onBeforeLoad";j.trigger(e);if(e.isDefaultPrevented())return c;m=true;g&&a(f).expose(g);var i=b.top,r=b.left,u=f.outerWidth({margin:true}),v=f.outerHeight({margin:true});if(typeof i=="string")i=i=="center"?Math.max((o.height()-v)/2,0):parseInt(i,10)/100*o.height();if(r=="center")r=Math.max((o.width()-u)/2,0);h[0].call(c,{top:i,left:r},function(){if(m){e.type="onLoad";j.trigger(e)}});g&&b.closeOnClick&&a.mask.getMask().one("click",
c.close);b.closeOnClick&&a(document).bind("click."+n,function(l){a(l.target).parents(f).length||c.close(l)});b.closeOnEsc&&a(document).bind("keydown."+n,function(l){l.keyCode==27&&c.close(l)});return c},close:function(e){if(!c.isOpened())return c;e=e||a.Event();e.type="onBeforeClose";j.trigger(e);if(!e.isDefaultPrevented()){m=false;q[b.effect][1].call(c,function(){e.type="onClose";j.trigger(e)});a(document).unbind("click."+n).unbind("keydown."+n);g&&a.mask.close();return c}},getOverlay:function(){return f},
getTrigger:function(){return d},getClosers:function(){return k},isOpened:function(){return m},getConf:function(){return b}});a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(e,h){a.isFunction(b[h])&&a(c).bind(h,b[h]);c[h]=function(i){i&&a(c).bind(h,i);return c}});k=f.find(b.close||".close");if(!k.length&&!b.close){k=a('<a class="close"></a>');f.prepend(k)}k.click(function(e){c.close(e)});b.load&&c.load()}a.tools=a.tools||{version:"1.2.5"};a.tools.overlay={addEffect:function(d,
b,c){q[d]=[b,c]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var s=[],q={};a.tools.overlay.addEffect("default",function(d,b){var c=this.getConf(),j=a(window);if(!c.fixed){d.top+=j.scrollTop();d.left+=j.scrollLeft()}d.position=c.fixed?"fixed":"absolute";this.getOverlay().css(d).fadeIn(c.speed,b)},function(d){this.getOverlay().fadeOut(this.getConf().closeSpeed,
d)});a.fn.overlay=function(d){var b=this.data("overlay");if(b)return b;if(a.isFunction(d))d={onBeforeLoad:d};d=a.extend(true,{},a.tools.overlay.conf,d);this.each(function(){b=new t(a(this),d);s.push(b);a(this).data("overlay",b)});return d.api?b:this}})(jQuery);
(function(b){function k(){if(b.browser.msie){var a=b(document).height(),d=b(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a-d<20?d:a]}return[b(document).width(),b(document).height()]}function h(a){if(a)return a.call(b.mask)}b.tools=b.tools||{version:"1.2.5"};var l;l=b.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.8,startOpacity:0,color:"#fff",onLoad:null,
onClose:null}};var c,i,e,g,j;b.mask={load:function(a,d){if(e)return this;if(typeof a=="string")a={color:a};a=a||g;g=a=b.extend(b.extend({},l.conf),a);c=b("#"+a.maskId);if(!c.length){c=b("<div/>").attr("id",a.maskId);b("body").append(c)}var m=k();c.css({position:"absolute",top:0,left:0,width:m[0],height:m[1],display:"none",opacity:a.startOpacity,zIndex:a.zIndex});a.color&&c.css("backgroundColor",a.color);if(h(a.onBeforeLoad)===false)return this;a.closeOnEsc&&b(document).bind("keydown.mask",function(f){f.keyCode==
27&&b.mask.close(f)});a.closeOnClick&&c.bind("click.mask",function(f){b.mask.close(f)});b(window).bind("resize.mask",function(){b.mask.fit()});if(d&&d.length){j=d.eq(0).css("zIndex");b.each(d,function(){var f=b(this);/relative|absolute|fixed/i.test(f.css("position"))||f.css("position","relative")});i=d.css({zIndex:Math.max(a.zIndex+1,j=="auto"?0:j)})}c.css({display:"block"}).fadeTo(a.loadSpeed,a.opacity,function(){b.mask.fit();h(a.onLoad);e="full"});e=true;return this},close:function(){if(e){if(h(g.onBeforeClose)===
false)return this;c.fadeOut(g.closeSpeed,function(){h(g.onClose);i&&i.css({zIndex:j});e=false});b(document).unbind("keydown.mask");c.unbind("click.mask");b(window).unbind("resize.mask")}return this},fit:function(){if(e){var a=k();c.css({width:a[0],height:a[1]})}},getMask:function(){return c},isLoaded:function(a){return a?e=="full":e},getConf:function(){return g},getExposed:function(){return i}};b.fn.mask=function(a){b.mask.load(a);return this};b.fn.expose=function(a){b.mask.load(a,this);return this}})(jQuery);

jQuery.fn.exists = function(){return jQuery(this).length>0;}

$(document).ready(function() {
	var bg_color = $('#stacks_in_29_page0').css('background-color');
	if (bg_color) { 
		$('#stacks_in_29_page0').css({'background-color': 'transparent'});	
		$('#expose_stacks_in_29_page0').css({'background-color': bg_color });	
	}

	var bg_border_style = $('#stacks_in_29_page0').css('border-bottom-style');
	if (bg_border_style) { 
		var bg_border_color  = $('#stacks_in_29_page0').css('border-bottom-color');
		var bg_border_top 	 = $('#stacks_in_29_page0').css('border-top-width');
		var bg_border_right  = $('#stacks_in_29_page0').css('border-right-width');
		var bg_border_bottom = $('#stacks_in_29_page0').css('border-bottom-width');
		var bg_border_left 	 = $('#stacks_in_29_page0').css('border-left-width');
		$('#stacks_in_29_page0').css({'border-width':0});	
		$('#expose_stacks_in_29_page0').css({	'border-style':bg_border_style,
							 		'border-color':bg_border_color,
									'border-top-width':bg_border_top,
									'border-right-width':bg_border_right,
									'border-bottom-width':bg_border_bottom,	
									'border-left-width':bg_border_left
		});	
	}
	var custom_bg_src = $("#custom_bg_stacks_in_29_page0 img").attr("src");
	if (custom_bg_src) { 
	    $("#expose_stacks_in_29_page0").css({'background-image':'url(' + custom_bg_src + ')'});
	    var repeat_x = true;
	    var repeat_y = true;
	    
	    if (repeat_x && repeat_y) {
		    var bg_repeat = 'repeat';
	    }
	    else if (repeat_y) {
		    var bg_repeat = 'repeat-y';
	    }
	    else {
		    var bg_repeat = 'repeat-x';
	    }
	    $("#expose_stacks_in_29_page0").css({'background-repeat':bg_repeat});
	}

	// Need to append this to body to fix issues with some themes hiding it behind overlay
	$('#expose_stacks_in_29_page0').appendTo('body');

    // Build the Expose Lightbox
    $(".expose_stacks_in_29_page0").overlay({	
    		mask: {color:'#272727', opacity:0.9},
			target:'#expose_stacks_in_29_page0',
			closeOnClick: true,
			closeOnEsc: true,
			effect:	'default',
			load: false,
			fixed: true,
			oneInstance: false,
			left: 'center',
			top: '50%',
			onLoad: function() {
				if ( $('#expose_stacks_in_29_page0 iframe.vimeo_player').exists()) {
				    var player = $f($('#expose_stacks_in_29_page0 .vimeo_player')[0])
				    player.api('play');
  				}
				if ( $('#expose_stacks_in_29_page0 div.youtube_player').exists()) {
				    $('#expose_stacks_in_29_page0 div.youtube_player').tubeplayer("play");
  				}
				if ( $('#expose_stacks_in_29_page0 video.html5video').exists()) {
				    $('#expose_stacks_in_29_page0 video.html5video').get(0).play();
  				}
				if ( $('#expose_stacks_in_29_page0 audio.html5audio').exists()) {
				    $('#expose_stacks_in_29_page0 audio.html5audio').get(0).play();
  				}
				if ( $('#expose_stacks_in_29_page0 .html5audio object').exists()) {
				    $('#expose_stacks_in_29_page0 .html5audio').flowplayer(0).play();
  				}
				if ( $('#expose_stacks_in_29_page0 .html5video object').exists()) {
				    $('#expose_stacks_in_29_page0 .html5video').flowplayer(0).play();
  				}
			},
			onClose: function() {
				if ( $('#expose_stacks_in_29_page0 iframe.vimeo_player').exists()) {
				    var player = $f($('#expose_stacks_in_29_page0 .vimeo_player')[0])
				    player.api('pause');
  				}
				if ( $('#expose_stacks_in_29_page0 div.youtube_player').exists()) {
				    $('#expose_stacks_in_29_page0 div.youtube_player').tubeplayer("pause");
  				}
				if ( $('#expose_stacks_in_29_page0 video.html5video').exists()) {
				    $('#expose_stacks_in_29_page0 video.html5video').get(0).pause();
  				}
				if ( $('#expose_stacks_in_29_page0 audio.html5audio').exists()) {
				    $('#expose_stacks_in_29_page0 audio.html5audio').get(0).pause();
  				}
				if ( $('#expose_stacks_in_29_page0 .html5audio object').exists()) {
				    $('#expose_stacks_in_29_page0 .html5audio').flowplayer(0).pause();
  				}
				if ( $('#expose_stacks_in_29_page0 .html5video object').exists()) {
				    $('#expose_stacks_in_29_page0 .html5video').flowplayer(0).pause();
  				}
			}
    });    
});
//-- End Exposé Stack --//

	return stack;
})(stacks.stacks_in_29_page0);


// Javascript for stacks_in_39_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_39_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_39_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

//-- HTML5 Video Stack v2.1.0 by Joe Workman --//
// This is a customized build of html5media - http://github.com/etianen/html5media/
(function(){function n(a){if(!a||typeof a!="object")return a;var b=new a.constructor,e;for(e in a)a.hasOwnProperty(e)&&(b[e]=n(a[e]));return b}function k(a,b){if(a){var e,d=0,c=a.length;if(c===void 0)for(e in a){if(b.call(a[e],e,a[e])===!1)break}else for(e=a[0];d<c&&b.call(e,d,e)!==!1;e=a[++d]);return a}}function l(a,b,e){if(typeof b!="object")return a;a&&b&&k(b,function(d,b){if(!e||typeof b!="function")a[d]=b});return a}function f(a){var b=a.indexOf(".");if(b!=-1){var e=a.slice(0,b)||"*",d=a.slice(b+
1,a.length),c=[];k(document.getElementsByTagName(e),function(){this.className&&this.className.indexOf(d)!=-1&&c.push(this)});return c}}function r(a){a=a||window.event;a.preventDefault?(a.stopPropagation(),a.preventDefault()):(a.returnValue=!1,a.cancelBubble=!0);return!1}function m(a,b,e){a[b]=a[b]||[];a[b].push(e)}function s(){return"_"+(""+Math.random()).slice(2,10)}function o(a,h,e){var d=this,j=null,f=!1,o,u,i=[],w={},p={},t,x,v,y,q,z;l(d,{id:function(){return t},isLoaded:function(){return j!==
null&&j.fp_play!==void 0&&!f},getParent:function(){return a},hide:function(b){if(b)a.style.height="0px";if(d.isLoaded())j.style.height="0px";return d},show:function(){a.style.height=z+"px";if(d.isLoaded())j.style.height=q+"px";return d},isHidden:function(){return d.isLoaded()&&parseInt(j.style.height,10)===0},load:function(b){if(!d.isLoaded()&&d._fireEvent("onBeforeLoad")!==!1){var u=0;k(c,function(){this.unload(function(){if(++u==c.length){if((o=a.innerHTML)&&!flashembed.isSupported(h.version))a.innerHTML=
"";if(b)b.cached=!0,m(p,"onLoad",b);flashembed(a,h,{config:e})}})})}return d},unload:function(b){if(this.isFullscreen()&&/WebKit/i.test(navigator.userAgent))return b&&b(!1),d;if(o.replace(/\s/g,"")!==""){if(d._fireEvent("onBeforeUnload")===!1)return b&&b(!1),d;f=!0;try{j&&(j.fp_close(),d._fireEvent("onUnload"))}catch(e){}setTimeout(function(){j=null;a.innerHTML=o;f=!1;b&&b(!0)},50)}else b&&b(!1);return d},getClip:function(a){a===void 0&&(a=y);return i[a]},getCommonClip:function(){return u},getPlaylist:function(){return i},
getPlugin:function(a){var e=w[a];if(!e&&d.isLoaded()){var c=d._api().fp_getPlugin(a);c&&(e=new b(a,c,d),w[a]=e)}return e},getScreen:function(){return d.getPlugin("screen")},getControls:function(){return d.getPlugin("controls")._fireEvent("onUpdate")},getLogo:function(){try{return d.getPlugin("logo")._fireEvent("onUpdate")}catch(a){}},getPlay:function(){return d.getPlugin("play")._fireEvent("onUpdate")},getConfig:function(a){return a?n(e):e},getFlashParams:function(){return h},loadPlugin:function(a,
e,c,h){typeof c=="function"&&(h=c,c={});var u=h?s():"_";d._api().fp_loadPlugin(a,e,c,u);e={};e[u]=h;h=new b(a,null,d,e);return w[a]=h},getState:function(){return d.isLoaded()?j.fp_getState():-1},play:function(a,b){var e=function(){a!==void 0?d._api().fp_play(a,b):d._api().fp_play()};d.isLoaded()?e():f?setTimeout(function(){d.play(a,b)},50):d.load(function(){e()});return d},getVersion:function(){if(d.isLoaded()){var a=j.fp_getVersion();a.push("flowplayer.js 3.2.6");return a}return"flowplayer.js 3.2.6"},
_api:function(){if(!d.isLoaded())throw"Flowplayer "+d.id()+" not loaded when calling an API method";return j},setClip:function(a){d.setPlaylist([a]);return d},getIndex:function(){return v},_swfHeight:function(){return j.clientHeight}});k("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut".split(","),function(){var a="on"+this;if(a.indexOf("*")!=-1){var a=a.slice(0,a.length-1),b="onBefore"+a.slice(2);d[b]=function(a){m(p,
b,a);return d}}d[a]=function(b){m(p,a,b);return d}});k("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled".split(","),function(){var a=this;d[a]=function(b,e){if(!d.isLoaded())return d;var c=null,c=b!==void 0&&e!==void 0?j["fp_"+a](b,e):b===void 0?j["fp_"+a]():j["fp_"+a](b);return c==="undefined"||
c===void 0?d:c}});d._fireEvent=function(a){typeof a=="string"&&(a=[a]);var b=a[0],c=a[1],h=a[2],t=a[3],f=0;e.debug&&console.log("$f.fireEvent",[].slice.call(a));!d.isLoaded()&&b=="onLoad"&&c=="player"&&(j=j||document.getElementById(x),q=d._swfHeight(),k(i,function(){this._fireEvent("onLoad")}),k(w,function(a,b){b._fireEvent("onUpdate")}),u._fireEvent("onLoad"));if(!(b=="onLoad"&&c!="player")){if(b=="onError"&&(typeof c=="string"||typeof c=="number"&&typeof h=="number"))c=h,h=t;if(b=="onContextMenu")k(e.contextMenu[c],
function(a,b){b.call(d)});else if(b=="onPluginEvent"||b=="onBeforePluginEvent"){if(t=w[c.name||c])return t._fireEvent("onUpdate",c),t._fireEvent(h,a.slice(3))}else{if(b=="onPlaylistReplace"){i=[];var l=0;k(c,function(){i.push(new g(this,l++,d))})}if(b=="onClipAdd"){if(c.isInStream)return;c=new g(c,h,d);i.splice(h,0,c);for(f=h+1;f<i.length;f++)i[f].index++}var v=!0;if(typeof c=="number"&&c<i.length&&(y=c,(a=i[c])&&(v=a._fireEvent(b,h,t)),!a||v!==!1))v=u._fireEvent(b,h,t,a);k(p[b],function(){v=this.call(d,
c,h);this.cached&&p[b].splice(f,1);if(v===!1)return!1;f++});return v}}};if(typeof a=="string"){var A=document.getElementById(a);if(!A)throw"Flowplayer cannot access element: "+a;a=A}(function(){function j(a){var b=d.hasiPadSupport&&d.hasiPadSupport();if(/iPad|iPhone|iPod/i.test(navigator.userAgent)&&!/.flv$/i.test(i[0].url)&&!b)return!0;!d.isLoaded()&&d._fireEvent("onBeforeClick")!==!1&&d.load();return r(a)}$f(a)?($f(a).getParent().innerHTML="",v=$f(a).getIndex(),c[v]=d):(c.push(d),v=c.length-1);
z=parseInt(a.style.height,10)||a.clientHeight;t=a.id||"fp"+s();x=h.id||t+"_api";h.id=x;e.playerId=t;typeof e=="string"&&(e={clip:{url:e}});if(typeof e.clip=="string")e.clip={url:e.clip};e.clip=e.clip||{};if(a.getAttribute("href",2)&&!e.clip.url)e.clip.url=a.getAttribute("href",2);u=new g(e.clip,-1,d);e.playlist=e.playlist||[e.clip];var f=0;k(e.playlist,function(){var a=this;typeof a=="object"&&a.length&&(a={url:""+a});k(e.clip,function(b,c){c!==void 0&&a[b]===void 0&&typeof c!="function"&&(a[b]=c)});
e.playlist[f]=a;a=new g(a,f,d);i.push(a);f++});k(e,function(a,b){if(typeof b=="function"){if(u[a])u[a](b);else m(p,a,b);delete e[a]}});k(e.plugins,function(a,c){c&&(w[a]=new b(a,c,d))});if(!e.plugins||e.plugins.controls===void 0)w.controls=new b("controls",null,d);w.canvas=new b("canvas",null,d);o=a.innerHTML;setTimeout(function(){o.replace(/\s/g,"")!==""?a.addEventListener?a.addEventListener("click",j,!1):a.attachEvent&&a.attachEvent("onclick",j):(a.addEventListener&&a.addEventListener("click",r,
!1),d.load())},0)})()}function q(a){this.length=a.length;this.each=function(b){k(a,b)};this.size=function(){return a.length}}var g=function(a,b,c){var d=this,j={},f={};d.index=b;typeof a=="string"&&(a={url:a});l(this,a,!0);k("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop".split(","),function(){var a="on"+this;if(a.indexOf("*")!=-1){var a=a.slice(0,a.length-1),i="onBefore"+a.slice(2);d[i]=function(a){m(f,i,a);return d}}d[a]=function(b){m(f,a,b);
return d};b==-1&&(d[i]&&(c[i]=d[i]),d[a]&&(c[a]=d[a]))});l(this,{onCuepoint:function(a,i){if(arguments.length==1)return j.embedded=[null,a],d;typeof a=="number"&&(a=[a]);var f=s();j[f]=[a,i];c.isLoaded()&&c._api().fp_addCuepoints(a,b,f);return d},update:function(a){l(d,a);c.isLoaded()&&c._api().fp_updateClip(a,b);var i=c.getConfig();l(b==-1?i.clip:i.playlist[b],a,!0)},_fireEvent:function(a,i,g,p){if(a=="onLoad")return k(j,function(a,d){d[0]&&c._api().fp_addCuepoints(d[0],b,a)}),!1;p=p||d;if(a=="onCuepoint"){var t=
j[i];if(t)return t[1].call(c,p,g)}if(i&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(a)!=-1&&(l(p,i),i.metaData))p.duration?p.fullDuration=i.metaData.duration:p.duration=i.metaData.duration;var x=!0;k(f[a],function(){x=this.call(c,p,i,g)});return x}});if(a.onCuepoint){var g=a.onCuepoint;d.onCuepoint.apply(d,typeof g=="function"?[g]:g);delete a.onCuepoint}k(a,function(b,c){typeof c=="function"&&(m(f,b,c),delete a[b])});if(b==-1)c.onCuepoint=this.onCuepoint},b=function(a,b,c,d){var j=
this,f={},g=!1;d&&l(f,d);k(b,function(a,c){typeof c=="function"&&(f[a]=c,delete b[a])});l(this,{animate:function(d,i,g){if(!d)return j;typeof i=="function"&&(g=i,i=500);if(typeof d=="string"){var k=d,d={};d[k]=i;i=500}if(g){var t=s();f[t]=g}i===void 0&&(i=500);b=c._api().fp_animate(a,d,i,t);return j},css:function(d,f){if(f!==void 0){var g={};g[d]=f;d=g}b=c._api().fp_css(a,d);l(j,b);return j},show:function(){this.display="block";c._api().fp_showPlugin(a);return j},hide:function(){this.display="none";
c._api().fp_hidePlugin(a);return j},toggle:function(){this.display=c._api().fp_togglePlugin(a);return j},fadeTo:function(b,d,h){typeof d=="function"&&(h=d,d=500);if(h){var g=s();f[g]=h}this.display=c._api().fp_fadeTo(a,b,d,g);this.opacity=b;return j},fadeIn:function(a,b){return j.fadeTo(1,a,b)},fadeOut:function(a,b){return j.fadeTo(0,a,b)},getName:function(){return a},getPlayer:function(){return c},_fireEvent:function(b,d){if(b=="onUpdate"){var h=c._api().fp_getPlugin(a);if(!h)return;l(j,h);delete j.methods;
g||(k(h.methods,function(){var b=""+this;j[b]=function(){var d=[].slice.call(arguments),d=c._api().fp_invoke(a,b,d);return d==="undefined"||d===void 0?j:d}}),g=!0)}return(h=f[b])?(h=h.apply(j,d),b.slice(0,1)=="_"&&delete f[b],h):j}})},c=[];window.flowplayer=window.$f=function(){var a=null,b=arguments[0];if(!arguments.length)return k(c,function(){if(this.isLoaded())return a=this,!1}),a||c[0];if(arguments.length==1)if(typeof b=="number")return c[b];else{if(b=="*")return new q(c);k(c,function(){if(this.id()==
b.id||this.id()==b||this.getParent()==b)return a=this,!1});return a}if(arguments.length>1){var e=arguments[1],d=arguments.length==3?arguments[2]:{};typeof e=="string"&&(e={src:e});e=l({bgcolor:"#000000",version:[9,0],expressInstall:"http://static.flowplayer.org/swf/expressinstall.swf",cachebusting:!1},e);if(typeof b=="string")if(b.indexOf(".")!=-1){var g=[];k(f(b),function(){g.push(new o(this,n(e),n(d)))});return new q(g)}else{var m=document.getElementById(b);return new o(m!==null?m:b,e,d)}else if(b)return new o(b,
e,d)}return null};l(window.$f,{fireEvent:function(){var a=[].slice.call(arguments),b=$f(a[0]);return b?b._fireEvent(a.slice(1)):null},addPlugin:function(a,b){o.prototype[a]=b;return $f},each:k,extend:l});if(typeof jQuery=="function")jQuery.fn.flowplayer=function(a,b){if(!arguments.length||typeof arguments[0]=="number"){var c=[];this.each(function(){var a=$f(this);a&&c.push(a)});return arguments.length?c[arguments[0]]:new q(c)}return this.each(function(){$f(this,n(a),b?n(b):{})})}})();
(function(){function n(){if(g.done)return!1;var b=document;if(b&&b.getElementsByTagName&&b.getElementById&&b.body){clearInterval(g.timer);g.timer=null;for(b=0;b<g.ready.length;b++)g.ready[b].call();g.ready=null;g.done=!0}}function k(b,c){if(c)for(key in c)c.hasOwnProperty(key)&&(b[key]=c[key]);return b}function l(b){switch(f(b)){case "string":return b=b.replace(RegExp('(["\\\\])',"g"),"\\$1"),b=b.replace(/^\s?(\d+)%/,"$1pct"),'"'+b+'"';case "array":return"["+r(b,function(a){return l(a)}).join(",")+
"]";case "function":return'"function()"';case "object":var c=[],a;for(a in b)b.hasOwnProperty(a)&&c.push('"'+a+'":'+l(b[a]));return"{"+c.join(",")+"}"}return String(b).replace(/\s/g," ").replace(/\'/g,'"')}function f(b){if(b===null||b===void 0)return!1;var c=typeof b;return c=="object"&&b.push?"array":c}function r(b,c){var a=[],f;for(f in b)b.hasOwnProperty(f)&&(a[f]=c(b[f]));return a}function m(b,c){var a=k({},b),f=document.all,e='<object width="'+a.width+'" height="'+a.height+'"';if(f&&!a.id)a.id=
"_"+(""+Math.random()).substring(9);a.id&&(e+=' id="'+a.id+'"');a.cachebusting&&(a.src+=(a.src.indexOf("?")!=-1?"&":"?")+Math.random());e+=a.w3c||!f?' data="'+a.src+'" type="application/x-shockwave-flash"':' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';e+=">";if(a.w3c||f)e+='<param name="movie" value="'+a.src+'" />';a.width=a.height=a.id=a.w3c=a.src=null;for(var d in a)a[d]!==null&&(e+='<param name="'+d+'" value="'+a[d]+'" />');a="";if(c){for(var g in c)c[g]!==null&&(a+=g+"="+(typeof c[g]==
"object"?l(c[g]):c[g])+"&");a=a.substring(0,a.length-1);e+='<param name="flashvars" value=\''+a+"' />"}e+="</object>";return e}function s(b,c,a){var f=flashembed.getVersion();k(this,{getContainer:function(){return b},getConf:function(){return c},getVersion:function(){return f},getFlashvars:function(){return a},getApi:function(){return b.firstChild},getHTML:function(){return m(c,a)}});var e=c.version,d=c.expressInstall,g=!e||flashembed.isSupported(e);if(g)c.onFail=c.version=c.expressInstall=null,b.innerHTML=
m(c,a);else if(e&&d&&flashembed.isSupported([6,65]))k(c,{src:d}),a={MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title},b.innerHTML=m(c,a);else if(b.innerHTML.replace(/\s/g,"")===""&&(b.innerHTML="<h2>Flash version "+e+" or greater is required</h2><h3>"+(f[0]>0?"Your version is "+f:"You have no flash plugin installed")+"</h3>"+(b.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='http://www.adobe.com/go/getflashplayer'>here</a></p>"),
b.tagName=="A"))b.onclick=function(){location.href="http://www.adobe.com/go/getflashplayer"};if(!g&&c.onFail&&(e=c.onFail.call(this),typeof e=="string"))b.innerHTML=e;document.all&&(window[c.id]=document.getElementById(c.id))}var o=typeof jQuery=="function",q={width:"100%",height:"100%",allowfullscreen:!0,allowscriptaccess:"always",quality:"high",version:null,onFail:null,expressInstall:null,w3c:!1,cachebusting:!1};if(o)jQuery.tools=jQuery.tools||{},jQuery.tools.flashembed={version:"1.0.4",conf:q};
var g=o?jQuery:function(b){if(g.done)return b();g.timer?g.ready.push(b):(g.ready=[b],g.timer=setInterval(n,13))};window.attachEvent&&window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}});window.flashembed=function(b,c,a){if(typeof b=="string"){var f=document.getElementById(b);if(f)b=f;else{g(function(){flashembed(b,c,a)});return}}if(b)return typeof c=="string"&&(c={src:c}),f=k({},q),k(f,c),new s(b,f,a)};k(window.flashembed,{getVersion:function(){var b=
[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var c=navigator.plugins["Shockwave Flash"].description;typeof c!="undefined"&&(c=c.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),b=parseInt(c.replace(/^(.*)\..*$/,"$1"),10),c=/r/.test(c)?parseInt(c.replace(/^.*r(.*)$/,"$1"),10):0,b=[b,c])}else if(window.ActiveXObject){try{c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(a){try{c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"),b=[6,0],c.AllowScriptAccess="always"}catch(f){if(b[0]==
6)return b}try{c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}}typeof c=="object"&&(c=c.GetVariable("$version"),typeof c!="undefined"&&(c=c.replace(/^\S+\s+(.*)$/,"$1").split(","),b=[parseInt(c[0],10),parseInt(c[2],10)]))}return b},isSupported:function(b){var c=flashembed.getVersion();return c[0]>b[0]||c[0]==b[0]&&c[1]>=b[1]},domReady:g,asString:l,getHTML:m});if(o)jQuery.fn.flashembed=function(b,c){var a=null;this.each(function(){a=flashembed(this,b,c)});return b.api===!1?this:a}})();(function(){function n(){if(!o&&(o=!0,q)){for(var f=0;f<q.length;f++)q[f].call(window,[]);q=[]}}function k(f){var b=window.onload;window.onload=typeof window.onload!="function"?f:function(){b&&b();f()}}function l(){if(!s){s=!0;document.addEventListener&&!m.opera&&document.addEventListener("DOMContentLoaded",n,!1);m.msie&&window==top&&function(){if(!o){try{document.documentElement.doScroll("left")}catch(b){setTimeout(arguments.callee,0);return}n()}}();m.opera&&document.addEventListener("DOMContentLoaded",
function(){if(!o){for(var b=0;b<document.styleSheets.length;b++)if(document.styleSheets[b].disabled){setTimeout(arguments.callee,0);return}n()}},!1);if(m.safari){var f;(function(){if(!o)if(document.readyState!="loaded"&&document.readyState!="complete")setTimeout(arguments.callee,0);else{if(f===void 0){for(var b=document.getElementsByTagName("link"),c=0;c<b.length;c++)b[c].getAttribute("rel")=="stylesheet"&&f++;b=document.getElementsByTagName("style");f+=b.length}document.styleSheets.length!=f?setTimeout(arguments.callee,
0):n()}})()}k(n)}}var f=window.DomReady={},r=navigator.userAgent.toLowerCase(),m={version:(r.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(r),opera:/opera/.test(r),msie:/msie/.test(r)&&!/opera/.test(r),mozilla:/mozilla/.test(r)&&!/(compatible|webkit)/.test(r)},s=!1,o=!1,q=[];f.ready=function(f){l();o?f.call(window,[]):q.push(function(){return f.call(window,[])})};l()})();(function(n,k){function l(a,b){for(var c=[],d=0;d<a.length;d++)c.push(a[d]);for(d=0;d<c.length;d++)b(c[d])}function f(){l([g,b],function(a){l(k.getElementsByTagName(a),function(b){function c(a){return b.canPlayType(a)||e&&a.search("mp4")>-1}var d=!0,e=navigator.userAgent.toLowerCase().search("android")>-1;b.canPlayType&&(b.src?c(r(a,b.src))&&(d=!1):l(b.getElementsByTagName("source"),function(b){c(r(a,b.src,b.type))&&(d=!1)}));d?f.createFallback(a,b):e&&b.addEventListener("click",function(){b.play()},
!1)})})}function r(a,b,c){return c||i[a][b.split(".").slice(-1)[0]]||C[a]}function m(a,b){var c=a.getAttribute(b);return c==!0||typeof c=="string"}function s(a){return a.substr(0,1)=="/"?w+a:a.substr(0,1)=="."||!a.match(/^\s*\w+:\/\//)?p+a:a}function o(a,b,c){var d=a.getAttribute(b);if(d)return d+"px";if(a.currentStyle)a=a.currentStyle[b];else if(n.getComputedStyle)a=k.defaultView.getComputedStyle(a,null).getPropertyValue(b);else return c;return a=="auto"?c:a}function q(a){return a.match(/\s*([\w-]+\/[\w-]+)(;|\s|$)/)[1]}
var g="video",b="audio";k.createElement(g).canPlayType||l(["video","audio","source"],function(a){k.createElement(a)});f.flowplayerSwf="files/html5media/flowplayer.swf";f.flowplayerAudioSwf="files/html5media/flowplayer.audio.swf";f.flowplayerControlsSwf="files/html5media/flowplayer.controls.swf";var c=f.THEORA_FORMAT='video/ogg; codecs="theora, vorbis"',a=f.H264_FORMAT='video/mp4; codecs="avc1.42E01E, mp4a.40.2"',h=f.VORBIS_FORMAT='audio/ogg; codecs="vorbis"',e=f.WEBM_FORMAT="video/webm;",
d=f.M4A_FORMAT="audio/x-m4a;",j=f.MP3_FORMAT="audio/mpeg;",B=f.WAV_FORMAT='audio/wav; codecs="1"',C=f.assumedFormats={video:a,audio:j},u=f.fallbackFormats=[f.H264_FORMAT,f.M4A_FORMAT,f.MP3_FORMAT],i=f.fileExtensions={video:{ogg:c,ogv:c,avi:a,mp4:a,mkv:a,h264:a,264:a,avc:a,m4v:a,"3gp":a,"3gpp":a,"3g2":a,mpg:a,mpeg:a,webm:e},audio:{ogg:h,oga:h,aac:d,m4a:d,mp3:j,wav:B}},w=n.location.protocol+"//"+n.location.host,p=String(n.location);l(k.getElementsByTagName("base"),function(a){if(a.href)p=a.href});p=
p.split("/").slice(0,-1).join("/")+"/";f.configureFlowplayer=function(a,b,c){return c};f.createFallback=function(a,b){var c=m(b,"controls"),d=b.getAttribute("poster")||"",e=b.getAttribute("src")||"",i;e?i=r(a,e):l(b.getElementsByTagName("source"),function(b){var c=b.getAttribute("src");c&&!e&&l(u,function(d){i=r(a,c,b.getAttribute("type"));q(i)==q(d)&&(e=c)})});var h=k.createElement("span");h.id=b.id;h.className=b.className;h.title=b.title;h.style.display="block";h.style.width=o(b,"width","300px");
h.style.height=a=="audio"?"26px":o(b,"height","200px");b.parentNode.replaceChild(h,b);var n=(b.getAttribute("preload")||"").toLowerCase(),p=[];d&&p.push({url:s(d)});e&&p.push({url:s(e),autoPlay:m(b,"autoplay"),autoBuffering:m(b,"autobuffer")||m(b,"preload")&&(n==""||n=="auto"),onBeforeFinish:function(){return!m(b,"loop")}});d={controls:c&&{url:s(f.flowplayerControlsSwf),fullscreen:!1,autoHide:a==g&&"always"||"never"}||null};if(q(i)==q(j)&&(d.audio={url:s(f.flowplayerAudioSwf)},!c))d.controls={url:s(f.flowplayerControlsSwf),
display:"none"},h.style.height=0;c={play:null,playlist:p,clip:{scaling:"fit",fadeInSpeed:0,fadeOutSpeed:0},plugins:d};f.configureFlowplayer(a,b,c);flowplayer(h,{src:s(f.flowplayerSwf),wmode:"opaque"},c)};n.jQuery?jQuery(f):n.DomReady&&DomReady.ready(f);n.html5media=f})(this,document);

$(document).ready(function() {	
	var poster_src = $("#poster_stacks_in_39_page0 img").attr("src");
	if (poster_src) { 
	    $("#html5video_stacks_in_39_page0").attr('poster', poster_src);	
	}
	$('#html5video_stacks_in_39_page0 source').each(function() {
		if( $(this).attr('src').length == 0 ) { 
			$(this).remove(); 
		}
	});
});
//-- End HTML5 Video Stack --//

	return stack;
})(stacks.stacks_in_39_page0);


// Javascript for stacks_in_33_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_33_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_33_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

  

  jQuery(document).ready(function($){

function findPlainTextExceptInLinks(element, substring, callback) {
    for (var childi= element.childNodes.length; childi-->0;) {
        var child= element.childNodes[childi];
        if (child.nodeType===1) {
            if (child.tagName.toLowerCase()!=='a')
                findPlainTextExceptInLinks(child, substring, callback);
        } else if (child.nodeType===3) {
            var index= child.data.length;
            while (true) {
                index= child.data.lastIndexOf(substring, index);
                if (index===-1)
                    break;
                callback.call(window, child, index)
            }
        }
    }
}

var substring= 'facebook';
findPlainTextExceptInLinks(document.body, substring, function(node, index) {
    node.splitText(index+substring.length);
    var span= document.createElement('span');
    span.className = "teleportHere";
    span.appendChild(node.splitText(index));
    node.parentNode.insertBefore(span, node.nextSibling);
});


var injectionStack = $("#stacks_in_33_page0 .teleportMe").html();


$(".teleportHere").replaceWith(injectionStack);
$("#stacks_in_33_page0 .teleportMe").hide();

});
	return stack;
})(stacks.stacks_in_33_page0);


// Javascript for stacks_in_324_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_324_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_324_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/**
 * Sprightly by http://www.doobox.co.uk integrated for rapidweaver from the code http://dev.artutkin.ru/desaturate/example.html 
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
 $(document).ready(function() {
 
$.desaturate = {
  defaults: {
    'iefix': true, // autofix png for IE
    'level': 1,    // level of desaturation, ignored in IE
    'rgb': [0.3333, 0.3333, 0.3333] // levels of RGB for compose grayscale, ignored in IE
  },
  customClass: 'js-desaturate-fixed' // usually no need to change this
};

$.desaturate.Image = function(obj) {
    this.image = obj;
    this.jImage = $(this.image);

    this.src = this.jImage.attr('src');
    this.isPNG = this.jImage.is("IMG[src$=.png]");

    var styleWidth  = new String(this.jImage.css('width')); styleWidth = styleWidth.replace(/px/, '');
    var styleHeight = new String(this.jImage.css('height')); styleHeight = styleHeight.replace(/px/, '');

    this.width = this.jImage.width() ? this.jImage.width() : (styleWidth ? styleWidth : this.jImage.attr('width'));
    this.height = this.jImage.height() ? this.jImage.height() : (styleHeight ? styleHeight : this.jImage.attr('height'));

//      var styles = ['padding', 'margin', 'border'];
//      for (var i in styles) {
//        this.imgCustomStyles += styles[i] + ':' + this.image.style[styles[i]]+';';
//        this.image.style[styles[i]] = '';
//      }

    this.imgFilter = '';
    if (this.image.style.filter) {
      this.imgFilter = 'filter:'+this.image.style.filter+';';
      this.image.style.filter = '';
    }

    this.image.style.width = '';
    this.image.style.height = '';

    this.imgId    = this.jImage.attr('id') ? 'id="' + this.jImage.attr('id') + '" ' : '';
    this.imgClass = 'class="' + this.jImage.attr('class') + ' ' + $.desaturate.customClass + '" ';
    this.imgTitle = this.jImage.attr('title') ? 'title="' + this.jImage.attr('title') + '" ' : '';
    this.imgAlt   = this.jImage.attr('alt') ? 'alt="' + this.jImage.attr('alt') + '" ' : '';

    this.imgStyles  = this.image.style.cssText;
    this.imgStyles += this.jImage.attr('align') ? 'float:' + this.jImage.attr('align') + ';' : '';
    this.imgStyles += this.jImage.parent().attr('href') ? 'cursor:hand;' : '';

    // nulled filter present as FILTER: in cssText
    this.imgStyles = this.imgStyles.replace(/filter:/i,'');


    this.imgCssSize = (this.width && this.height) ? 'width:' + this.width + 'px;' + 'height:' + this.height + 'px;' : '';
};

$.desaturate.Image.prototype.replace = function(html) {
      return $(html).replaceAll(this.image).get(0);
};

$.desaturate.Image.prototype.getCanvas = function(options) {
    var canvasStr = '<canvas style="display:block;' + this.imgStyles + this.imgCssSize + '" ';               // amended changed from inline-block to block
    canvasStr += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '></canvas>';

    var canvas = $(canvasStr).get(0);
    var canvasContext = canvas.getContext('2d');

    var imgW = this.width;
    var imgH = this.height;
    canvas.width = imgW;
    canvas.height = imgH;

    canvasContext.drawImage(this.image, 0, 0);

    var imgPixels = canvasContext.getImageData(0, 0, imgW, imgH);

    for(var y = 0; y < imgPixels.height; y++){
      for(var x = 0; x < imgPixels.width; x++){
        var i = (y * 4) * imgPixels.width + x * 4;
        var avg = imgPixels.data[i]*options.rgb[0] + imgPixels.data[i + 1]*options.rgb[1] + imgPixels.data[i + 2]*options.rgb[2];
        imgPixels.data[i] = avg*options.level + imgPixels.data[i]*(1-options.level);
        imgPixels.data[i + 1] = avg*options.level + imgPixels.data[i + 1]*(1-options.level);
        imgPixels.data[i + 2] = avg*options.level + imgPixels.data[i + 2]*(1-options.level);
      }
    }

    canvasContext.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
    return canvas;
}

$.desaturate.Image.prototype.getIeFix = function(options) {
    /* Some $ operations like fadeIn/Out can reset filter atribute, so we need 3 SPAN's: 1st for styles and
     * correct work with $'s animation, 2rd for grayScale filter and last one for alpha image filter.
     * Combined 2 filters in one span won't work too.
     */
    var blockInit = 'display:block;background:transparent;padding:0;margin:0;';
    var strNewHTML = '<span style="display:inline-block;' + this.imgStyles + this.imgCssSize + '" ';
    strNewHTML += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '>';
      strNewHTML += '<span style="' + blockInit + this.imgCssSize + this.imgFilter + '">';
      if (this.isPNG) {
        strNewHTML += '<span style="' + blockInit + this.imgCssSize;
        strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.src + '\', sizingMethod=\'crop\');">';
        strNewHTML += '</span>';
      } else {
        strNewHTML += '<img style="' + blockInit + this.imgCssSize + '" ' + this.imgTitle + this.imgAlt;
        strNewHTML += ' src="' + this.src + '">';
      }
      strNewHTML += '</span>';
    strNewHTML += '</span>';

    return $(strNewHTML).get(0);
}

$.fn.desaturate = function(options) {

  var ret = [];
  var _opt = $.extend(true, {}, $.desaturate.defaults, options);

  this.each(function() {
    var el = this;
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(el).metadata() : {}, $(el).data('desaturate'));

    if ($.browser.msie && $(el).is("IMG") && $opt.iefix) {
      // autofix IE images
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getIeFix($opt));
    }

    if ($.browser.msie && ($(el).is("IMG") || $(el).hasClass($.desaturate.customClass))) {
      // apply filter for IE
        var el1 = el;
        if ($(el).hasClass($.desaturate.customClass))
        {
          // if this element is our imgage fixed by pngIE - set grayscale filter to child span
          el1 = $("SPAN", el).get(0);
        }
        el1.style.filter = (el1.style.filter ? el1.style.filter+' ' : '') +
                            'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';
    }

    if (!$.browser.msie && ($(el).is("IMG"))) {
      // convert image to canvas
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getCanvas($opt));
    }

    ret.push(el);
  });

  return this.pushStack(ret, "desaturate", "");
};

$.fn.desaturateImgFix = function(options) {
  if (!$.browser.msie) {
    return this;
  }

  var _opt = $.extend(true, {}, $.desaturate.defaults, options);
  var ret = [];

  this.each(function() {
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(this).metadata() : {}, $(this).data('desaturate'));
    if (!$(this).is("IMG")) {
      ret.push(this);
    } else {
      var image = new $.desaturate.Image(this);
      ret.push(image.replace(image.getIeFix($opt)));
    }
  });

  return this.pushStack(ret, "desaturateImgFix", "");
};
 

});


// start new code

 $(window).load(function() {

        
        var paircount = 0;
        var $thisSprite = $("#stacks_in_324_page0 img.imageStyle");
        var reverse = "";




        if ($.browser.msie)
        {
          // I need this only if desaturate png with aplha channel
          $thisSprite = $thisSprite.desaturateImgFix();
        }
        
 if(reverse == ""){

    // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_324_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_324_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_324_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_324_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_324_page0pair').toggle().toggleClass('stacks_in_324_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_324_page0);


// Javascript for stacks_in_322_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_322_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_322_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/**
 * Sprightly by http://www.doobox.co.uk integrated for rapidweaver from the code http://dev.artutkin.ru/desaturate/example.html 
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
 $(document).ready(function() {
 
$.desaturate = {
  defaults: {
    'iefix': true, // autofix png for IE
    'level': 1,    // level of desaturation, ignored in IE
    'rgb': [0.3333, 0.3333, 0.3333] // levels of RGB for compose grayscale, ignored in IE
  },
  customClass: 'js-desaturate-fixed' // usually no need to change this
};

$.desaturate.Image = function(obj) {
    this.image = obj;
    this.jImage = $(this.image);

    this.src = this.jImage.attr('src');
    this.isPNG = this.jImage.is("IMG[src$=.png]");

    var styleWidth  = new String(this.jImage.css('width')); styleWidth = styleWidth.replace(/px/, '');
    var styleHeight = new String(this.jImage.css('height')); styleHeight = styleHeight.replace(/px/, '');

    this.width = this.jImage.width() ? this.jImage.width() : (styleWidth ? styleWidth : this.jImage.attr('width'));
    this.height = this.jImage.height() ? this.jImage.height() : (styleHeight ? styleHeight : this.jImage.attr('height'));

//      var styles = ['padding', 'margin', 'border'];
//      for (var i in styles) {
//        this.imgCustomStyles += styles[i] + ':' + this.image.style[styles[i]]+';';
//        this.image.style[styles[i]] = '';
//      }

    this.imgFilter = '';
    if (this.image.style.filter) {
      this.imgFilter = 'filter:'+this.image.style.filter+';';
      this.image.style.filter = '';
    }

    this.image.style.width = '';
    this.image.style.height = '';

    this.imgId    = this.jImage.attr('id') ? 'id="' + this.jImage.attr('id') + '" ' : '';
    this.imgClass = 'class="' + this.jImage.attr('class') + ' ' + $.desaturate.customClass + '" ';
    this.imgTitle = this.jImage.attr('title') ? 'title="' + this.jImage.attr('title') + '" ' : '';
    this.imgAlt   = this.jImage.attr('alt') ? 'alt="' + this.jImage.attr('alt') + '" ' : '';

    this.imgStyles  = this.image.style.cssText;
    this.imgStyles += this.jImage.attr('align') ? 'float:' + this.jImage.attr('align') + ';' : '';
    this.imgStyles += this.jImage.parent().attr('href') ? 'cursor:hand;' : '';

    // nulled filter present as FILTER: in cssText
    this.imgStyles = this.imgStyles.replace(/filter:/i,'');


    this.imgCssSize = (this.width && this.height) ? 'width:' + this.width + 'px;' + 'height:' + this.height + 'px;' : '';
};

$.desaturate.Image.prototype.replace = function(html) {
      return $(html).replaceAll(this.image).get(0);
};

$.desaturate.Image.prototype.getCanvas = function(options) {
    var canvasStr = '<canvas style="display:block;' + this.imgStyles + this.imgCssSize + '" ';               // amended changed from inline-block to block
    canvasStr += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '></canvas>';

    var canvas = $(canvasStr).get(0);
    var canvasContext = canvas.getContext('2d');

    var imgW = this.width;
    var imgH = this.height;
    canvas.width = imgW;
    canvas.height = imgH;

    canvasContext.drawImage(this.image, 0, 0);

    var imgPixels = canvasContext.getImageData(0, 0, imgW, imgH);

    for(var y = 0; y < imgPixels.height; y++){
      for(var x = 0; x < imgPixels.width; x++){
        var i = (y * 4) * imgPixels.width + x * 4;
        var avg = imgPixels.data[i]*options.rgb[0] + imgPixels.data[i + 1]*options.rgb[1] + imgPixels.data[i + 2]*options.rgb[2];
        imgPixels.data[i] = avg*options.level + imgPixels.data[i]*(1-options.level);
        imgPixels.data[i + 1] = avg*options.level + imgPixels.data[i + 1]*(1-options.level);
        imgPixels.data[i + 2] = avg*options.level + imgPixels.data[i + 2]*(1-options.level);
      }
    }

    canvasContext.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
    return canvas;
}

$.desaturate.Image.prototype.getIeFix = function(options) {
    /* Some $ operations like fadeIn/Out can reset filter atribute, so we need 3 SPAN's: 1st for styles and
     * correct work with $'s animation, 2rd for grayScale filter and last one for alpha image filter.
     * Combined 2 filters in one span won't work too.
     */
    var blockInit = 'display:block;background:transparent;padding:0;margin:0;';
    var strNewHTML = '<span style="display:inline-block;' + this.imgStyles + this.imgCssSize + '" ';
    strNewHTML += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '>';
      strNewHTML += '<span style="' + blockInit + this.imgCssSize + this.imgFilter + '">';
      if (this.isPNG) {
        strNewHTML += '<span style="' + blockInit + this.imgCssSize;
        strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.src + '\', sizingMethod=\'crop\');">';
        strNewHTML += '</span>';
      } else {
        strNewHTML += '<img style="' + blockInit + this.imgCssSize + '" ' + this.imgTitle + this.imgAlt;
        strNewHTML += ' src="' + this.src + '">';
      }
      strNewHTML += '</span>';
    strNewHTML += '</span>';

    return $(strNewHTML).get(0);
}

$.fn.desaturate = function(options) {

  var ret = [];
  var _opt = $.extend(true, {}, $.desaturate.defaults, options);

  this.each(function() {
    var el = this;
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(el).metadata() : {}, $(el).data('desaturate'));

    if ($.browser.msie && $(el).is("IMG") && $opt.iefix) {
      // autofix IE images
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getIeFix($opt));
    }

    if ($.browser.msie && ($(el).is("IMG") || $(el).hasClass($.desaturate.customClass))) {
      // apply filter for IE
        var el1 = el;
        if ($(el).hasClass($.desaturate.customClass))
        {
          // if this element is our imgage fixed by pngIE - set grayscale filter to child span
          el1 = $("SPAN", el).get(0);
        }
        el1.style.filter = (el1.style.filter ? el1.style.filter+' ' : '') +
                            'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';
    }

    if (!$.browser.msie && ($(el).is("IMG"))) {
      // convert image to canvas
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getCanvas($opt));
    }

    ret.push(el);
  });

  return this.pushStack(ret, "desaturate", "");
};

$.fn.desaturateImgFix = function(options) {
  if (!$.browser.msie) {
    return this;
  }

  var _opt = $.extend(true, {}, $.desaturate.defaults, options);
  var ret = [];

  this.each(function() {
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(this).metadata() : {}, $(this).data('desaturate'));
    if (!$(this).is("IMG")) {
      ret.push(this);
    } else {
      var image = new $.desaturate.Image(this);
      ret.push(image.replace(image.getIeFix($opt)));
    }
  });

  return this.pushStack(ret, "desaturateImgFix", "");
};
 

});


// start new code

 $(window).load(function() {

        
        var paircount = 0;
        var $thisSprite = $("#stacks_in_322_page0 img.imageStyle");
        var reverse = "";




        if ($.browser.msie)
        {
          // I need this only if desaturate png with aplha channel
          $thisSprite = $thisSprite.desaturateImgFix();
        }
        
 if(reverse == ""){

    // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_322_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_322_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_322_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_322_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_322_page0pair').toggle().toggleClass('stacks_in_322_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_322_page0);


// Javascript for stacks_in_152_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_152_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_152_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/**
 * Sprightly by http://www.doobox.co.uk integrated for rapidweaver from the code http://dev.artutkin.ru/desaturate/example.html 
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
 $(document).ready(function() {
 
$.desaturate = {
  defaults: {
    'iefix': true, // autofix png for IE
    'level': 1,    // level of desaturation, ignored in IE
    'rgb': [0.3333, 0.3333, 0.3333] // levels of RGB for compose grayscale, ignored in IE
  },
  customClass: 'js-desaturate-fixed' // usually no need to change this
};

$.desaturate.Image = function(obj) {
    this.image = obj;
    this.jImage = $(this.image);

    this.src = this.jImage.attr('src');
    this.isPNG = this.jImage.is("IMG[src$=.png]");

    var styleWidth  = new String(this.jImage.css('width')); styleWidth = styleWidth.replace(/px/, '');
    var styleHeight = new String(this.jImage.css('height')); styleHeight = styleHeight.replace(/px/, '');

    this.width = this.jImage.width() ? this.jImage.width() : (styleWidth ? styleWidth : this.jImage.attr('width'));
    this.height = this.jImage.height() ? this.jImage.height() : (styleHeight ? styleHeight : this.jImage.attr('height'));

//      var styles = ['padding', 'margin', 'border'];
//      for (var i in styles) {
//        this.imgCustomStyles += styles[i] + ':' + this.image.style[styles[i]]+';';
//        this.image.style[styles[i]] = '';
//      }

    this.imgFilter = '';
    if (this.image.style.filter) {
      this.imgFilter = 'filter:'+this.image.style.filter+';';
      this.image.style.filter = '';
    }

    this.image.style.width = '';
    this.image.style.height = '';

    this.imgId    = this.jImage.attr('id') ? 'id="' + this.jImage.attr('id') + '" ' : '';
    this.imgClass = 'class="' + this.jImage.attr('class') + ' ' + $.desaturate.customClass + '" ';
    this.imgTitle = this.jImage.attr('title') ? 'title="' + this.jImage.attr('title') + '" ' : '';
    this.imgAlt   = this.jImage.attr('alt') ? 'alt="' + this.jImage.attr('alt') + '" ' : '';

    this.imgStyles  = this.image.style.cssText;
    this.imgStyles += this.jImage.attr('align') ? 'float:' + this.jImage.attr('align') + ';' : '';
    this.imgStyles += this.jImage.parent().attr('href') ? 'cursor:hand;' : '';

    // nulled filter present as FILTER: in cssText
    this.imgStyles = this.imgStyles.replace(/filter:/i,'');


    this.imgCssSize = (this.width && this.height) ? 'width:' + this.width + 'px;' + 'height:' + this.height + 'px;' : '';
};

$.desaturate.Image.prototype.replace = function(html) {
      return $(html).replaceAll(this.image).get(0);
};

$.desaturate.Image.prototype.getCanvas = function(options) {
    var canvasStr = '<canvas style="display:block;' + this.imgStyles + this.imgCssSize + '" ';               // amended changed from inline-block to block
    canvasStr += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '></canvas>';

    var canvas = $(canvasStr).get(0);
    var canvasContext = canvas.getContext('2d');

    var imgW = this.width;
    var imgH = this.height;
    canvas.width = imgW;
    canvas.height = imgH;

    canvasContext.drawImage(this.image, 0, 0);

    var imgPixels = canvasContext.getImageData(0, 0, imgW, imgH);

    for(var y = 0; y < imgPixels.height; y++){
      for(var x = 0; x < imgPixels.width; x++){
        var i = (y * 4) * imgPixels.width + x * 4;
        var avg = imgPixels.data[i]*options.rgb[0] + imgPixels.data[i + 1]*options.rgb[1] + imgPixels.data[i + 2]*options.rgb[2];
        imgPixels.data[i] = avg*options.level + imgPixels.data[i]*(1-options.level);
        imgPixels.data[i + 1] = avg*options.level + imgPixels.data[i + 1]*(1-options.level);
        imgPixels.data[i + 2] = avg*options.level + imgPixels.data[i + 2]*(1-options.level);
      }
    }

    canvasContext.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
    return canvas;
}

$.desaturate.Image.prototype.getIeFix = function(options) {
    /* Some $ operations like fadeIn/Out can reset filter atribute, so we need 3 SPAN's: 1st for styles and
     * correct work with $'s animation, 2rd for grayScale filter and last one for alpha image filter.
     * Combined 2 filters in one span won't work too.
     */
    var blockInit = 'display:block;background:transparent;padding:0;margin:0;';
    var strNewHTML = '<span style="display:inline-block;' + this.imgStyles + this.imgCssSize + '" ';
    strNewHTML += this.imgId + this.imgClass + this.imgTitle + this.imgAlt + '>';
      strNewHTML += '<span style="' + blockInit + this.imgCssSize + this.imgFilter + '">';
      if (this.isPNG) {
        strNewHTML += '<span style="' + blockInit + this.imgCssSize;
        strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.src + '\', sizingMethod=\'crop\');">';
        strNewHTML += '</span>';
      } else {
        strNewHTML += '<img style="' + blockInit + this.imgCssSize + '" ' + this.imgTitle + this.imgAlt;
        strNewHTML += ' src="' + this.src + '">';
      }
      strNewHTML += '</span>';
    strNewHTML += '</span>';

    return $(strNewHTML).get(0);
}

$.fn.desaturate = function(options) {

  var ret = [];
  var _opt = $.extend(true, {}, $.desaturate.defaults, options);

  this.each(function() {
    var el = this;
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(el).metadata() : {}, $(el).data('desaturate'));

    if ($.browser.msie && $(el).is("IMG") && $opt.iefix) {
      // autofix IE images
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getIeFix($opt));
    }

    if ($.browser.msie && ($(el).is("IMG") || $(el).hasClass($.desaturate.customClass))) {
      // apply filter for IE
        var el1 = el;
        if ($(el).hasClass($.desaturate.customClass))
        {
          // if this element is our imgage fixed by pngIE - set grayscale filter to child span
          el1 = $("SPAN", el).get(0);
        }
        el1.style.filter = (el1.style.filter ? el1.style.filter+' ' : '') +
                            'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';
    }

    if (!$.browser.msie && ($(el).is("IMG"))) {
      // convert image to canvas
      var image = new $.desaturate.Image(el);
      el = image.replace(image.getCanvas($opt));
    }

    ret.push(el);
  });

  return this.pushStack(ret, "desaturate", "");
};

$.fn.desaturateImgFix = function(options) {
  if (!$.browser.msie) {
    return this;
  }

  var _opt = $.extend(true, {}, $.desaturate.defaults, options);
  var ret = [];

  this.each(function() {
    var $opt = $.extend(true, {}, _opt, $.metadata ? $(this).metadata() : {}, $(this).data('desaturate'));
    if (!$(this).is("IMG")) {
      ret.push(this);
    } else {
      var image = new $.desaturate.Image(this);
      ret.push(image.replace(image.getIeFix($opt)));
    }
  });

  return this.pushStack(ret, "desaturateImgFix", "");
};
 

});


// start new code

 $(window).load(function() {

        
        var paircount = 0;
        var $thisSprite = $("#stacks_in_152_page0 img.imageStyle");
        var reverse = "";




        if ($.browser.msie)
        {
          // I need this only if desaturate png with aplha channel
          $thisSprite = $thisSprite.desaturateImgFix();
        }
        
 if(reverse == ""){

    // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_152_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_152_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_152_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_152_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_152_page0pair').toggle().toggleClass('stacks_in_152_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_152_page0);


// Javascript for stacks_in_59_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_59_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_59_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

/*
 * Lifestream Stack By WeaverAddons.com
 * Version 1.1.0
 *
 * Visit http://www.weaveraddons.com for more information on how to use this stack in RapidWeaver.
 *
 */

/*
 * rfc3339date.js
 * Copyright (c) 2010 Paul GALLAGHER http://tardate.com
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * jQuery Templates Plugin 1.0.0pre
 * Copyright Software Freedom Conservancy, Inc.
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * jQuery Lifestream Plug-in
 * @version 0.1.1
 * Copyright 2011, Christian Vuerings - http://denbuzze.com
 */

function parseDate(b){if(typeof b=="undefined")return false;var a=new Date(b);isValidDate(a)||(a=Date.parse(b),isValidDate(a)||(b=b.split(" "),a=new Date(Date.parse(b[1]+" "+b[2]+", "+b[5]+" "+b[3]+" UTC"))));return a}function isValidDate(b){return Object.prototype.toString.call(b)!=="[object Date]"?false:!isNaN(b.getTime())}Number.prototype.toPaddedString=function(b,a){var i=this.toString();for(typeof a=="undefined"&&(a="0");i.length<b;)i=a+i;return i};
Date.prototype.toRFC3339UTCString=function(b,a){var i=b?"":"-",f=b?"":":",c=this.getUTCFullYear().toString();c+=i+(this.getUTCMonth()+1).toPaddedString(2);c+=i+this.getUTCDate().toPaddedString(2);c+="T"+this.getUTCHours().toPaddedString(2);c+=f+this.getUTCMinutes().toPaddedString(2);c+=f+this.getUTCSeconds().toPaddedString(2);!a&&this.getUTCMilliseconds()>0&&(c+="."+this.getUTCMilliseconds().toPaddedString(3));return c+"Z"};
Date.prototype.toRFC3339LocaleString=function(b,a){var i=b?"":"-",f=b?"":":",c=this.getFullYear().toString();c+=i+(this.getMonth()+1).toPaddedString(2);c+=i+this.getDate().toPaddedString(2);c+="T"+this.getHours().toPaddedString(2);c+=f+this.getMinutes().toPaddedString(2);c+=f+this.getSeconds().toPaddedString(2);!a&&this.getMilliseconds()>0&&(c+="."+this.getMilliseconds().toPaddedString(3));i=-this.getTimezoneOffset();c+=i<0?"-":"+";c+=(i/60).toPaddedString(2);c+=f+(i%60).toPaddedString(2);return c};
Date.parseRFC3339=function(b){if(typeof b=="string"){var a;if(b=b.match(RegExp(/(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)?(:)?(\d\d)?([\.,]\d+)?($|Z|([+-])(\d\d)(:)?(\d\d)?)/i))){var i=parseInt(b[1],10),f=parseInt(b[3],10)-1,c=parseInt(b[5],10),g=parseInt(b[7],10),d=b[9]?parseInt(b[9],10):0,h=b[11]?parseInt(b[11],10):0,e=b[12]?parseFloat(String(1.5).charAt(1)+b[12].slice(1))*1E3:0;b[13]?(a=new Date,a.setUTCFullYear(i),a.setUTCMonth(f),a.setUTCDate(c),a.setUTCHours(g),a.setUTCMinutes(d),a.setUTCSeconds(h),
a.setUTCMilliseconds(e),b[13]&&b[14]&&(i=b[15]*60,b[17]&&(i+=parseInt(b[17],10)),i*=b[14]=="-"?-1:1,a.setTime(a.getTime()-i*6E4))):a=new Date(i,f,c,g,d,h,e)}return a}};if(typeof Date.parse!="function")Date.parse=Date.parseRFC3339;else{var oldparse=Date.parse;Date.parse=function(b){var a=Date.parseRFC3339(b);!a&&oldparse&&(a=oldparse(b));return a}}
(function(b){function a(a,d,c,g){g={data:g||g===0||g===false?g:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:e,nest:j,wrap:l,html:n,update:s};a&&b.extend(g,a,{nodes:[],parent:d});if(c)g.tmpl=c,g._ctnt=g._ctnt||g.tmpl(b,g),g.key=++u,(w.length?q:k)[u]=g;return g}function i(a,d,c){var g,c=c?b.map(c,function(b){return typeof b==="string"?a.key?b.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+o+'="'+a.key+'" $2'):b:i(b,a,b._ctnt)}):a;if(d)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,
function(a,d,c,e){g=b(c).get();h(g);d&&(g=f(d).concat(g));e&&(g=g.concat(f(e)))});return g?g:f(c)}function f(a){var d=document.createElement("div");d.innerHTML=a;return b.makeArray(d.childNodes)}function c(a){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+b.trim(a).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,
function(a,c,g,e,h,i,f){a=b.tmpl.tag[g];if(!a)throw"Unknown template tag: "+g;g=a._default||[];i&&!/\w$/.test(h)&&(h+=i,i="");h?(h=d(h),f=f?","+d(f)+")":i?")":"",f=i?h.indexOf(".")>-1?h+d(i):"("+h+").call($item"+f:h,i=i?f:"(typeof("+h+")==='function'?("+h+").call($item):("+h+"))"):i=f=g.$1||"null";e=d(e);return"');"+a[c?"close":"open"].split("$notnull_1").join(h?"typeof("+h+")!=='undefined' && ("+h+")!=null":"true").split("$1a").join(i).split("$1").join(f).split("$2").join(e||g.$2||"")+"__.push('"})+
"');}return __;")}function g(a,d){a._wrap=i(a,true,b.isArray(d)?d:[r.test(d)?d:b(d).html()]).join("")}function d(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function h(d){function c(d){function e(b){var y;b+=g;y=i[b]=i[b]||a(j,k[j.parent.key+g]||j.parent),j=y}var h,f=d,j,t;if(t=d.getAttribute(o)){for(;f.parentNode&&(f=f.parentNode).nodeType===1&&!(h=f.getAttribute(o)););if(h!==t){f=f.parentNode?f.nodeType===11?0:f.getAttribute(o)||0:0;if(!(j=k[t]))j=q[t],j=a(j,k[f]||q[f]),j.key=++u,
k[u]=j;p&&e(t)}d.removeAttribute(o)}else if(p&&(j=b.data(d,"tmplItem")))e(j.key),k[j.key]=j,f=(f=b.data(d.parentNode,"tmplItem"))?f.key:0;if(j){for(h=j;h&&h.key!=f;)h.nodes.push(d),h=h.parent;delete j._ctnt;delete j._wrap;b.data(d,"tmplItem",j)}}var g="_"+p,e,h,i={},f,j,m;for(f=0,j=d.length;f<j;f++)if((e=d[f]).nodeType===1){h=e.getElementsByTagName("*");for(m=h.length-1;m>=0;m--)c(h[m]);c(e)}}function e(a,b,d,c){if(!a)return w.pop();w.push({_:a,tmpl:b,item:this,data:d,options:c})}function j(a,d,c){return b.tmpl(b.template(a),
d,c,this)}function l(a,d){var c=a.options||{};c.wrapped=d;return b.tmpl(b.template(a.tmpl),a.data,c,a.item)}function n(a,d){var c=this._wrap;return b.map(b(b.isArray(c)?c.join(""):c).filter(a||"*"),function(a){if(d)a=a.innerText||a.textContent;else{var b;if(!(b=a.outerHTML))b=document.createElement("div"),b.appendChild(a.cloneNode(true)),b=b.innerHTML;a=b}return a})}function s(){var a=this.nodes;b.tmpl(null,null,null,this).insertBefore(a[0]);b(a).remove()}var m=b.fn.domManip,o="_tmplitem",r=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,
k={},q={},v,x={key:0,data:{}},u=0,p=0,w=[];b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,d){b.fn[a]=function(c){var g=[],c=b(c),h,e,f;h=this.length===1&&this[0].parentNode;v=k||{};if(h&&h.nodeType===11&&h.childNodes.length===1&&c.length===1)c[d](this[0]),g=this;else{for(e=0,f=c.length;e<f;e++)p=e,h=(e>0?this.clone(true):this).get(),b(c[e])[d](h),g=g.concat(h);p=0;g=this.pushStack(g,a,c.selector)}c=v;v=null;b.tmpl.complete(c);
return g}});b.fn.extend({tmpl:function(a,d,c){return b.tmpl(this[0],a,d,c)},tmplItem:function(){return b.tmplItem(this[0])},template:function(a){return b.template(a,this[0])},domManip:function(a,d,c,g){if(a[0]&&b.isArray(a[0])){for(var h=b.makeArray(arguments),e=a[0],f=e.length,i=0,j;i<f&&!(j=b.data(e[i++],"tmplItem")););j&&p&&(h[2]=function(a){b.tmpl.afterManip(this,a,c)});m.apply(this,h)}else m.apply(this,arguments);p=0;v||b.tmpl.complete(k);return this}});b.extend({tmpl:function(d,c,h,e){var f=
!e;if(f)e=x,d=b.template[d]||b.template(null,d),q={};else if(!d)return d=e.tmpl,k[e.key]=e,e.nodes=[],e.wrapped&&g(e,e.wrapped),b(i(e,null,e.tmpl(b,e)));if(!d)return[];typeof c==="function"&&(c=c.call(e||{}));h&&h.wrapped&&g(h,h.wrapped);c=b.isArray(c)?b.map(c,function(b){return b?a(h,e,d,b):null}):[a(h,e,d,c)];return f?b(i(e,null,c)):c},tmplItem:function(a){var d;for(a instanceof b&&(a=a[0]);a&&a.nodeType===1&&!(d=b.data(a,"tmplItem"))&&(a=a.parentNode););return d||x},template:function(a,d){return d?
(typeof d==="string"?d=c(d):d instanceof b&&(d=d[0]||{}),d.nodeType&&(d=b.data(d,"tmpl")||b.data(d,"tmpl",c(d.innerHTML))),typeof a==="string"?b.template[a]=d:d):a?typeof a!=="string"?b.template(null,a):b.template[a]||b.template(null,r.test(a)?a:b(a)):null},encode:function(a){return(""+a).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});b.extend(b.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},
open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){k={}},afterManip:function(a,
d,c){var g=d.nodeType===11?b.makeArray(d.childNodes):d.nodeType===1?[d]:[];c.call(a,d);h(g);p++}})})(jQuery);
(function(b){b.fn.lifestream=function(a){return this.each(function(){var i=b(this),f=jQuery.extend({classname:"lifestream",feedloaded:null,limit:10,list:[]},a),c=0,g=0,d=[],h=jQuery.extend(true,{},f),e=null,j=function(){i.removeClass("loading");d.sort(function(a,b){return b.date-a.date});for(var c=d.length<f.limit?d.length:f.limit,g=0,e,h=b('<ul class="'+f.classname+'"/>');g<c;g++)e=d[g],e.html&&(e=b('<li class="'+f.classname+"-"+e.config.service+(a.showIcons?"-icon":"")+'">').data("time",e.date).append(e.html),
f.showTime&&e.append(" ("+relative_time(d[g].date)+")"),e.appendTo(h));i.html(h);b.isFunction(f.feedloaded)&&f.feedloaded()},l=function(a){g++;b.merge(d,a);clearTimeout(e);f.waitUntilLoaded&&g!=c?e=setTimeout(j,1500):j()};(function(){i.addClass("loading");e=setTimeout(j,1500);var a=0,d=f.list.length;for(delete h.list;a<d;a++){var g=f.list[a];g.openLinksInNewWindow=f.openLinksInNewWindow;g.showPrefix=f.showPrefix;if(g.service.match(/rss/))g.service="rss";if(b.fn.lifestream.feeds[g.service]&&b.isFunction(b.fn.lifestream.feeds[g.service])&&
g.user&&g.user!="...")c++,g._settings=h,b.fn.lifestream.feeds[g.service](g,l)}})()})};b.fn.lifestream.createYqlUrl=function(a){return"http://query.yahooapis.com/v1/public/yql?q=__QUERY__&env=store://datatables.org/alltableswithkeys&format=json".replace("__QUERY__",encodeURIComponent(a))};b.fn.lifestream.feeds=b.fn.lifestream.feeds||{};b.fn.lifestream.feeds.blogger=function(a,i){var f=b.extend({},{posted:(a.showPrefix?"posted ":"")+'<a href="${origLink}"'+(a.openLinksInNewWindow?' target="_blank"':
"")+">${title}</a>"},a.template);b.ajax({url:b.fn.lifestream.createYqlUrl('select * from xml where url="http://'+a.user+'.blogspot.com/feeds/posts/default"'),success:function(c){var g=[],d=0,h,e,j,l;if(c.query&&c.query.count&&c.query.count>0){c=c.query.results.feed&&c.query.results.feed.entry?c.query.results.feed.entry:c.query.results.rss.channel.item;for(h=c.length;d<h;d++){e=c[d];if(!e.origLink){j=0;for(l=e.link.length;j<l;j++)if(e.link[j].rel==="alternate")e.origLink=e.link[j].href}if(e.origLink){if(e.title.content)e.title=
e.title.content;g.push({date:parseDate(e.published?e.published:e.pubDate),config:a,html:b.tmpl(f.posted,e)})}}}i(g)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.dailymotion=function(a,i){a.template={item:(a.showPrefix?"uploaded a video ":"")+'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"};a.link="http://www.dailymotion.com/rss/user/"+a.user;b.fn.lifestream.feeds.rss(a,i)};b.fn.lifestream.feeds.delicious=function(a,i){var f=b.extend({},{bookmarked:(a.showPrefix?
"bookmarked ":"")+'<a href="${u}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${d}</a>"},a.template);b.ajax({dataType:"jsonp",url:"http://feeds.delicious.com/v2/json/"+a.user,success:function(c){var g=[],d=0,h;if(c&&c.length&&c.length>0)for(h=c.length;d<h;d++){var e=c[d];g.push({date:parseDate(e.dt),config:a,html:b.tmpl(f.bookmarked,e)})}i(g)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.deviantart=function(a,i){var f=b.extend({},{posted:(a.showPrefix?"posted ":"")+'<a href="${link}"'+
(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"},a.template);b.ajax({dataType:"jsonp",url:b.fn.lifestream.createYqlUrl('select title,link,pubDate from rss where url="http://backend.deviantart.com/rss.xml?q=gallery%3A'+encodeURIComponent(a.user)+'&type=deviation" | unique(field="title")'),success:function(c){var g=[],d,h=0,e;if(c.query&&c.query.count>0){c=c.query.results.item;for(e=c.length;h<e;h++)d=c[h],g.push({date:parseDate(d.pubDate),config:a,html:b.tmpl(f.posted,d)})}i(g)},error:function(){i([])}});
return{template:f}};b.fn.lifestream.feeds.dribbble=function(a,i){var f=b.extend({},{posted:(a.showPrefix?"posted a shot ":"")+'<a href="${url}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"},a.template);b.ajax({dataType:"jsonp",url:"http://api.dribbble.com/players/"+a.user+"/shots",success:function(c){var g=[],d=0,h;if(c&&c.total)for(h=c.shots.length;d<h;d++){var e=c.shots[d];g.push({date:parseDate(e.created_at),config:a,html:b.tmpl(f.posted,e)})}i(g)},error:function(){i([])}});
return{template:f}};b.fn.lifestream.feeds.flickr=function(a,i){var f=b.extend({},{posted:(a.showPrefix?"posted a photo ":"")+'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"},a.template);b.ajax({dataType:"jsonp",jsonp:"jsoncallback",url:"http://api.flickr.com/services/feeds/photos_public.gne?id="+a.user+"&lang=en-us&format=json",success:function(c){var g=[],d=0,h;if(c&&c.items&&c.items.length>0)for(h=c.items.length;d<h;d++){var e=c.items[d];g.push({date:parseDate(e.published),
config:a,html:b.tmpl(f.posted,e)})}i(g)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.foomark=function(a,i){var f=b.extend({},{bookmarked:(a.showPrefix?"bookmarked ":"")+'<a href="${url}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${url}</a>"},a.template);b.ajax({dataType:"jsonp",url:"http://api.foomark.com/urls/list/?username="+a.user+"&format=json",success:function(c){var g=[],d=0,h;if(c&&c.length&&c.length>0)for(h=c.length;d<h;d++){var e=c[d];g.push({date:parseDate(e.created_at.replace(" ",
"T")),config:a,html:b.tmpl(f.bookmarked,e)})}i(g)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.formspring=function(a,i){a.template={item:(a.showPrefix?"answered a question ":"")+'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"};a.link="http://www.formspring.me/profile/"+a.user+".rss";b.fn.lifestream.feeds.rss(a,i)};b.fn.lifestream.feeds.forrst=function(a,i){var f=b.extend({},{posted:(a.showPrefix?"posted a ${post_type} ":"")+'<a href="${post_url}"'+
(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"},a.template);b.ajax({dataType:"jsonp",url:"http://forrst.com/api/v2/users/posts?username="+a.user,success:function(c){var g=[],d=0,h;if(c&&c.resp.length&&c.resp.length>0)for(h=c.resp.length;d<h;d++){var e=c.resp[d];g.push({date:parseDate(e.created_at.replace(" ","T")),config:a,html:b.tmpl(f.posted,e)})}i(g)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.foursquare=function(a,i){var f=b.extend({},{checkedin:(a.showPrefix?
"checked in @ ":"")+'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"},a.template);b.ajax({dataType:"jsonp",url:b.fn.lifestream.createYqlUrl('select * from rss where url="https://feeds.foursquare.com/history/'+a.user+'.rss"'),success:function(c){var g=[],d=0,h;if(c.query&&c.query.count&&c.query.count>0)for(h=c.query.count;d<h;d++){var e=c.query.results.item[d];g.push({date:parseDate(e.pubDate),config:a,html:b.tmpl(f.checkedin,e)})}i(g)},error:function(){i([])}});return{template:f}};
b.fn.lifestream.feeds.github=function(a,i){var f=b.extend({},{pushed:'<a href="${status.url}" title="{{if title}}${title} by ${author} {{/if}}"'+(a.openLinksInNewWindow?' target="_blank"':"")+'>pushed</a> to <a href="http://github.com/${repo}/tree/${branchname}"'+(a.openLinksInNewWindow?' target="_blank"':"")+'>${branchname}</a> at <a href="http://github.com/${repo}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${repo}</a>",gist:'<a href="${status.payload.url}" title="${status.payload.desc || ""}"'+
(a.openLinksInNewWindow?' target="_blank"':"")+">${status.payload.name}</a>",commented:'commented on <a href="${status.url}"'+(a.openLinksInNewWindow?' target="_blank"':"")+'>${what}</a> on <a href="http://github.com/${repo}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${repo}</a>",pullrequest:'${status.payload.action} <a href="${status.url}"'+(a.openLinksInNewWindow?' target="_blank"':"")+'>pull request #${status.payload.number}</a> on <a href="http://github.com/${repo}"'+(a.openLinksInNewWindow?
' target="_blank"':"")+">${repo}</a>",created:'created ${status.payload.ref_type || status.payload.object} <a href="${status.url}"'+(a.openLinksInNewWindow?' target="_blank"':"")+'>${status.payload.ref || status.payload.object_name}</a> for <a href="http://github.com/${repo}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${repo}</a>",createdglobal:'created ${status.payload.object} <a href="${status.url}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>",deleted:'deleted ${status.payload.ref_type} ${status.payload.ref} at <a href="http://github.com/${status.repository.owner}/${status.repository.name}"'+
(a.openLinksInNewWindow?' target="_blank"':"")+">${status.repository.owner}/${status.repository.name}</a>"},a.template),c=function(a){return a.payload.repo||(a.repository?a.repository.owner+"/"+a.repository.name:null)||a.url.split("/")[3]+"/"+a.url.split("/")[4]},g=function(a){var g,e;if(a.type==="PushEvent")return g=a.payload&&a.payload.shas&&a.payload.shas.json&&a.payload.shas.json[2],c(a),b.tmpl(f.pushed,{status:a,title:g,author:g?a.payload.shas.json[3]:"",branchname:a.payload.ref.split("/")[2],
repo:c(a)});else if(a.type==="GistEvent")return b.tmpl(f.gist,{status:a});else if(a.type==="CommitCommentEvent")return e="commit "+a.url.split("commit/")[1].split("#")[0].substring(0,7),g=c(a),b.tmpl(f.commented,{what:e,repo:g,status:a});else if(a.type==="IssueCommentEvent")return e="issue "+a.url.split("issues/")[1].split("#")[0],g=c(a),b.tmpl(f.commented,{what:e,repo:g,status:a});else if(a.type==="PullRequestEvent")return g=c(a),b.tmpl(f.pullrequest,{repo:g,status:a});else if(a.type==="CreateEvent"&&
(a.payload.ref_type==="tag"||a.payload.ref_type==="branch"||a.payload.object==="tag"))return g=c(a),b.tmpl(f.created,{repo:g,status:a});else if(a.type==="CreateEvent")return g=a.payload.object_name==="null"?a.payload.name:a.payload.object_name,b.tmpl(f.createdglobal,{title:g,status:a});else if(a.type==="DeleteEvent")return b.tmpl(f.deleted,{status:a})};b.ajax({dataType:"jsonp",url:b.fn.lifestream.createYqlUrl('select json.repository.owner,json.repository.name,json.payload,json.type,json.url, json.created_at from json where url="http://github.com/'+
a.user+'.json"'),success:function(b){var c=[],e=0,f;if(b.query&&b.query.count&&b.query.count>0)for(f=b.query.count;e<f;e++){var l=b.query.results.json[e].json;c.push({date:parseDate(l.created_at),config:a,html:g(l)})}i(c)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.googlereader=function(a,i){var f=b.extend({},{starred:(a.showPrefix?"shared ":"")+'<a href="{{if link.href}}${link.href}{{else}}${source.link.href}{{/if}}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title.content}</a>"},
a.template);b.ajax({dataType:"jsonp",url:b.fn.lifestream.createYqlUrl('select * from xml where url="www.google.com/reader/public/atom/user%2F'+a.user+'%2Fstate%2Fcom.google%2Fstarred"'),success:function(c){var g=[],d=0,h;if(c.query&&c.query.count&&c.query.count>0){c=c.query.results.feed.entry;for(h=c.length;d<h;d++){var e=c[d];g.push({date:parseDate(parseInt(e["crawl-timestamp-msec"],10)),config:a,html:b.tmpl(f.starred,e)})}}i(g)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.instapaper=
function(a,i){a.template={item:(a.showPrefix?"loved ":"")+'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"};a.link="http://www.instapaper.com/starred/rss/"+a.user;b.fn.lifestream.feeds.rss(a,i)};b.fn.lifestream.feeds.iusethis=function(a,i){var f=b.extend({},{global:(a.showPrefix?"${action} ":"")+'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${what}</a> on (${os})"},a.template);b.ajax({dataType:"jsonp",url:b.fn.lifestream.createYqlUrl('select * from xml where url="http://iphone.iusethis.com/user/feed.rss/'+
a.user+'" or url="http://osx.iusethis.com/user/feed.rss/'+a.user+'" or url="http://win.iusethis.com/user/feed.rss/'+a.user+'"'),success:function(c){var g=[],d,h,e,j,l,n=0,s,m,o,r,k,q;if(c.query&&c.query.count&&c.query.count>0&&c.query.results.rss){s=c.query.results.rss.length||1;if(s==1)c.query.results.rss=[c.query.results.rss];r="started using,stopped using,stopped loving,Downloaded,commented on,updated entry for,started loving,registered".split(",");l=r.length;for(s=2;n<s;n++)if(c.query.results.rss[n]&&
c.query.results.rss[n].channel&&c.query.results.rss[n].channel.item){q=c.query.results.rss[n].channel.link.match(/iphone/)?"iPhone":c.query.results.rss[n].channel.link.match(/osx/)?"OS X":"Windows";d=c.query.results.rss[n].channel.item;h=0;for(e=d.length;h<e;h++){m=d[h];o=m.title.replace(a.user+" ","");for(j=0;j<l;j++)if(o.indexOf(r[j])>-1){k=r[j];break}j=o.split(k);g.push({date:parseDate(m.pubDate),config:a,html:b.tmpl(f.global,{action:k.toLowerCase(),link:m.link,what:j[1],os:q})})}}}i(g)},error:function(){i([])}});
return{template:f}};b.fn.lifestream.feeds.lastfm=function(a,i){var f=b.extend({},{loved:(a.showPrefix?"loved ":"")+'<a href="${url}"'+(a.openLinksInNewWindow?' target="_blank"':"")+'>${name}</a> by <a href="${artist.url}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${artist.name}</a>"},a.template);b.ajax({dataType:"jsonp",url:b.fn.lifestream.createYqlUrl('select * from xml where url="http://ws.audioscrobbler.com/2.0/user/'+a.user+'/lovedtracks.xml"'),success:function(c){var g=[],d=0,h;if(c.query&&
c.query.count&&c.query.count>0&&c.query.results.lovedtracks&&c.query.results.lovedtracks.track){c=c.query.results.lovedtracks.track;for(h=c.length;d<h;d++){var e=c[d];g.push({date:parseDate(parseInt(e.date.uts*1E3,10)),config:a,html:b.tmpl(f.loved,e)})}}i(g)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.mlkshk=function(a,i){a.template={item:(a.showPrefix?"posted ":"")+'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"};a.link="http://mlkshk.com/shake/"+
a.user+"/rss";b.fn.lifestream.feeds.rss(a,i)};b.fn.lifestream.feeds.picplz=function(a,i){var f=b.extend({},{uploaded:(a.showPrefix?"uploaded ":"")+'<a href="${url}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"},a.template);b.ajax({dataType:"jsonp",url:"http://picplz.com/api/v2/user.json?username="+a.user+"&include_pics=1",success:function(c){var g=[],d=0,h;if((h=c.value.users[0].pics)&&h.length&&h.length>0)for(c=h.length;d<c;d++){var e=h[d];g.push({date:parseDate(e.date*1E3),config:a,
html:b.tmpl(f.uploaded,{url:e.pic_files["640r"].img_url,title:e.caption||e.id})})}i(g)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.pinboard=function(a,i){var f=b.extend({},{bookmarked:(a.showPrefix?"bookmarked ":"")+'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"},a.template);b.ajax({dataType:"jsonp",url:b.fn.lifestream.createYqlUrl('select * from xml where url="http://feeds.pinboard.in/rss/u:'+a.user+'"'),success:function(c){var g=[],d=
0,h,e;if(c.query&&c.query.count&&c.query.count>0){c=c.query.results.RDF.item;for(h=c.length;d<h;d++)e=c[d],g.push({date:parseDate(e.date),config:a,html:b.tmpl(f.bookmarked,e)})}i(g)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.posterous=function(a,i){a.link="http://"+a.user+".posterous.com/rss.xml";b.fn.lifestream.feeds.rss(a,i)};b.fn.lifestream.feeds.reddit=function(a,i){var f=b.extend({},{commented:'<a href="http://www.reddit.com/r/${item.data.subreddit}/comments/${item.data.link_id.substring(3)}/u/${item.data.name.substring(3)}?context=3"'+
(a.openLinksInNewWindow?' target="_blank"':"")+'>commented (${score})</a> in <a href="http://www.reddit.com/r/${item.data.subreddit}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${item.data.subreddit}</a>",created:'<a href="http://www.reddit.com${item.data.permalink}"'+(a.openLinksInNewWindow?' target="_blank"':"")+'>created new thread (${score})</a> in <a href="http://www.reddit.com/r/${item.data.subreddit}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${item.data.subreddit}</a>"},a.template),
c=function(a){var c=a.data.ups-a.data.downs,c={item:a,score:c>0?"+"+c:c};if(a.kind==="t1")return b.tmpl(f.commented,c);else if(a.kind==="t3")return b.tmpl(f.created,c)};b.ajax({dataType:"jsonp",url:"http://www.reddit.com/user/"+a.user+".json",success:function(b){var d=[],h=0,e;if(b&&b.data&&b.data.children&&b.data.children.length>0)for(e=b.data.children.length;h<e;h++){var f=b.data.children[h];d.push({date:parseDate(f.data.created*1E3),config:a,html:c(f)})}i(d)},error:function(){i([])}});return{template:f}};
b.fn.lifestream.feeds.slideshare=function(a,i){a.template={item:(a.showPrefix?"uploaded a presentation ":"")+'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"};a.link="http://www.slideshare.net/rss/user/"+a.user;b.fn.lifestream.feeds.rss(a,i)};b.fn.lifestream.feeds.snipplr=function(a,i){a.template={item:(a.showPrefix?"posted a snippet ":"")+'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"};a.link="http://snipplr.com/rss/users/"+a.user;
b.fn.lifestream.feeds.rss(a,i)};b.fn.lifestream.feeds.stackoverflow=function(a,i){var f=b.extend({},{global:'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${text}</a> - ${title}"},a.template),c=function(b){var c="",h="",e="",f="http://stackoverflow.com/users/"+a.user;if(b.timeline_type==="badge")c=b.timeline_type+" "+b.action+": "+b.description,h=b.detail,e=f+"?tab=reputation";else if(b.timeline_type==="revision"||b.timeline_type==="comment"||b.timeline_type==="accepted"||b.timeline_type===
"askoranswered")c=b.post_type+" "+b.action,h=b.detail||b.description||"",e="http://stackoverflow.com/questions/"+b.post_id;return{link:e,title:h,text:c}};b.ajax({dataType:"jsonp",url:"http://api.stackoverflow.com/1.1/users/"+a.user+"/timeline?jsonp",success:function(g){var d=[],h=0,e;if(g&&g.total&&g.total>0&&g.user_timelines)for(e=g.user_timelines.length;h<e;h++){var j=g.user_timelines[h];d.push({date:parseDate(j.creation_date*1E3),config:a,html:b.tmpl(f.global,c(j))})}i(d)},error:function(){i([])}});
return{template:f}};b.fn.lifestream.feeds.tumblr=function(a,i){var f=b.extend({},{posted:(a.showPrefix?"posted a ${type} ":"")+'<a href="${url}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"},a.template),c=function(a,c){return{date:parseDate(c.date),config:a,html:b.tmpl(f.posted,{type:c.type,url:c.url,title:(c["regular-title"]||c["quote-text"]||c["conversation-title"]||c["photo-caption"]||c["video-caption"]||c["audio-caption"]||c["regular-body"]||c["link-text"]||c.type||"").replace(/<.+?>/gi,
" ")})}};b.ajax({dataType:"jsonp",url:b.fn.lifestream.createYqlUrl('select * from tumblr.posts where username="'+a.user+'"'),success:function(g){var d=[],h=0,e,f;if(g.query&&g.query.count&&g.query.count>0)if(b.isArray(g.query.results.posts.post))for(e=g.query.results.posts.post.length;h<e;h++)f=g.query.results.posts.post[h],d.push(c(a,f));else b.isPlainObject(g.query.results.posts.post)&&d.push(c(a,g.query.results.posts.post));i(d)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.twitter=
function(a,i){var f=b.extend({},{posted:"{{html tweet}}"},a.template),c=function(a,b){return function(a){return a.replace(/(^|[^\w'"]+)\#([a-zA-Z0-9_]+)/g,function(a,c,g){return c+'<a href="http://search.twitter.com/search?q=%23'+g+'"'+(b?' target="_blank"':"")+">#"+g+"</a>"})}(function(a){return a.replace(/(^|[^\w]+)\@([a-zA-Z0-9_]{1,15})/g,function(a,c,g){return c+'<a href="http://twitter.com/'+g+'"'+(b?' target="_blank"':"")+">@"+g+"</a>"})}(function(a){return a.replace(/[a-z]+:\/\/[a-z0-9-_]+\.[a-z0-9-_:~%&\?\/.=]+[^:\.,\)\s*$]/ig,
function(a){return'<a href="'+a+'"'+(b?' target="_blank"':"")+">"+(a.length>25?a.substr(0,24)+"...":a)+"</a>"})}(a)))};b.ajax({dataType:"jsonp",url:b.fn.lifestream.createYqlUrl('select status.id, status.user.screen_name, status.created_at,status.text from twitter.user.timeline where screen_name="'+a.user+'"'),success:function(g){var d=[],h=0,e;if(g.query&&g.query.count&&g.query.count>0)for(e=g.query.count;h<e;h++){var j=g.query.results.statuses[h].status;d.push({date:parseDate(j.created_at),config:a,
html:b.tmpl(f.posted,{tweet:c(j.text,a.openLinksInNewWindow)+' <a href="http://twitter.com/#!/'+j.user.screen_name+"/statuses/"+j.id+'"'+(a.openLinksInNewWindow?' target="_blank"':"")+">#</a>"})})}i(d)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.vimeo=function(a,i){var f=b.extend({},{posted:(a.showPrefix?"posted ":"")+'<a href="${url}"'+(a.openLinksInNewWindow?' target="_blank"':"")+' title="${description}">${title}</a>'},a.template);b.ajax({dataType:"jsonp",url:"http://vimeo.com/api/v2/"+
a.user+"/videos.json",success:function(c){var g=[],d=0,h,e;if(c)for(h=c.length;d<h;d++)e=c[d],g.push({date:parseDate(e.upload_date.replace(" ","T")),config:a,html:b.tmpl(f.posted,{url:e.url,description:e.description.replace(/"/g,"'").replace(/<.+?>/gi,""),title:e.title})});i(g)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.rss=function(a,i){var f=b.extend({},{item:(a.showPrefix?"posted ":"")+'<a href="${link}"'+(a.openLinksInNewWindow?' target="_blank"':"")+">${title}</a>"},
a.template);parseRss=function(c){var g=[],d=0,h,e;if(c.query&&c.query.count&&c.query.count>0)if(c.query.results.rss&&c.query.results.rss.channel&&c.query.results.rss.channel.item){c=c.query.results.rss.channel.item;for(h=c.length;d<h;d++){e=c[d];if(e.date&&!e.pubDate)e.pubDate=e.date;g.push({date:parseDate(e.pubDate),config:a,html:b.tmpl(f.item,e)})}}else if(c.query.results.feed&&c.query.results.feed.entry){c=c.query.results.feed.entry;for(h=c.length;d<h;d++){e=c[d];if(e.link.href)e.link=e.link.href;
if(e.title.content)e.title=e.title.content;g.push({date:parseDate(e.published),config:a,html:b.tmpl(f.item,e)})}}else if(c.query.results.item)for(h=c.query.count;d<h;d++){e=c.query.results.item[d];if(e.date&&!e.pubDate)e.pubDate=e.date;g.push({date:parseDate(e.pubDate),config:a,html:b.tmpl(f.checkedin,e)})}return g};b.ajax({dataType:"jsonp",url:b.fn.lifestream.createYqlUrl('select * from xml where url="'+(a.link?a.link:a.user)+'"'),success:function(a){i(parseRss(a))},error:function(){i([])}});return{template:f}};
b.fn.lifestream.feeds.wordpress=function(a,i){a.link="http://"+a.user+".wordpress.com/feed";b.fn.lifestream.feeds.rss(a,i)};b.fn.lifestream.feeds.youtube=function(a,i){var f=b.extend({},{uploaded:(a.showPrefix?"uploaded ":"")+"<a href=\"${player['default']}\""+(a.openLinksInNewWindow?' target="_blank"':"")+' title="${description}">${title}</a>'},a.template);b.ajax({dataType:"jsonp",url:"http://gdata.youtube.com/feeds/api/users/"+a.user+"/uploads?v=2&alt=jsonc",success:function(c){var g=[],d=0,h,e;
if(c.data&&c.data.items)for(h=c.data.items.length;d<h;d++)e=c.data.items[d],g.push({date:parseDate(e.uploaded),config:a,html:b.tmpl(f.uploaded,e)});i(g)},error:function(){i([])}});return{template:f}};b.fn.lifestream.feeds.facebook=function(a,i){var f=b.extend({},{posted:"{{html message}}"},a.template),c=function(a){var b,c,e,f;if(a.indexOf(" ")==-1&&a.substr(4,1)=="-"&&a.substr(7,1)=="-"&&a.substr(10,1)=="T")b=a.substr(0,4),c=parseInt(a.substr(5,1)=="0"?a.substr(6,1):a.substr(5,2))-1,e=a.substr(8,
2),f=a.substr(11,2),a=a.substr(14,2),f=Date.UTC(b,c,e,f,a),f=parseDate(f);else{b=a.split(" ");if(b.length!=6||b[4]!="at")return a;f=b[5].split(":");c=f[1].substr(2);a=f[1].substr(0,2);f=parseInt(f[0]);c=="pm"&&(f+=12);f=parseDate(b[1]+" "+b[2]+" "+b[3]+" "+f+":"+a);f.setTime(f.getTime()-252E5)}return f};parseFacebook=function(g){var d=[];g.data&&b(g.data).each(function(){var g=this.type=="link"?(a.showPrefix?"posted a link ":"")+'<a href="'+this.link+'"'+(a.openLinksInNewWindow?' target="_blank"':
"")+">"+this.name+"</a>":this.type=="status"?this.message?this.message:this.name:(a.showPrefix?"posted a "+this.type+" "+(this.type=="photo"?"in ":""):"")+(this.link?'<a href="'+this.link+'"'+(a.openLinksInNewWindow?' target="_blank"':"")+">"+this.name+"</a> ":"")+(this.message&&this.message!=this.name?" - "+this.message:this.description?" - "+this.description:"");d.push({date:c(this.created_time),config:a,html:b.tmpl(f.posted,{message:g})})});return d};b.ajax({dataType:"jsonp",url:"https://graph.facebook.com/"+
a.user+"/posts?access_token="+a.access_token+"&limit=20",success:function(a){i(parseFacebook(a))},error:function(){i([])}});return{template:f}}})(jQuery);function relative_time(b){b=parseInt(((new Date).getTime()-b)/1E3);return b<60?"less than a minute ago":b<120?"about a minute ago":b<3600?parseInt(b/60).toString()+" minutes ago":b<7200?"about an hour ago":b<86400?"about "+parseInt(b/3600).toString()+" hours ago":b<172800?"1 day ago":parseInt(b/86400).toString()+" days ago"};

$(document).ready(function(){	
	$("#stacks_in_59_page0container").lifestream({
      limit: 5,
 	  waitUntilLoaded: true,
      showTime: true,
	  openLinksInNewWindow: true,
	  showPrefix: true,
      showIcons: ('icon' == 'icon' ? true : false),
      list:[
	  		  {service: "twitter", user: $.trim("")},
	  		  {service: "facebook", user: $.trim("301509673213427"), "access_token": $.trim("AAADJG8K0hu4BACHK2XiOFVenJtm3dqf5nfxSTTC4EuntGoc742eZCPZBul4EBYibZCmBYZCeF8sh45LZAWyZCuH90tB0kiBacxR2RuLUR12QZDZD")},
	  		  {service: "tumblr", user: $.trim("")},
	  		  {service: "posterous", user: $.trim($('#posterous_stacks_in_59_page0').text()) },
	  		  {service: "wordpress", user: $.trim($('#wordpress_stacks_in_59_page0').text()) },
			  {service: "youtube", user: $.trim("")},
			  {service: "vimeo", user: $.trim("")},
			  {service: "flickr", user: $.trim("")},
			  {service: "delicious", user: $.trim($('#delicious_stacks_in_59_page0').text()) },
			  {service: "lastfm", user: $.trim($('#lastfm_stacks_in_59_page0').text()) },
			  {service: "googlereader", user: $.trim($('#googlereader_stacks_in_59_page0').text()) },
		      {service: "blogger", user: $.trim($('#blogger_stacks_in_59_page0').text()) },
		      {service: "dailymotion", user: $.trim($('#dailymotion_stacks_in_59_page0').text()) },
		      {service: "deviantart", user: $.trim($('#deviantart_stacks_in_59_page0').text()) },
		      {service: "dribbble", user: $.trim($('#dribbble_stacks_in_59_page0').text()) },
		      {service: "foomark", user: $.trim($('#foomark_stacks_in_59_page0').text()) },
		      {service: "formspring", user: $.trim($('#formspring_stacks_in_59_page0').text()) },
		      {service: "forrst", user: $.trim($('#forrst_stacks_in_59_page0').text()) },
		      {service: "foursquare", user: $.trim($('#foursquare_stacks_in_59_page0').text()) },
		      {service: "github", user: $.trim($('#github_stacks_in_59_page0').text()) },
		      {service: "instapaper", user: $.trim($('#instapaper_stacks_in_59_page0').text()) },
		      {service: "iusethis", user: $.trim($('#iusethis_stacks_in_59_page0').text()) },
		      {service: "mlkshk", user: $.trim($('#mlkshk_stacks_in_59_page0').text()) },
		      {service: "picplz", user: $.trim($('#picplz_stacks_in_59_page0').text()) },
		      {service: "pinboard", user: $.trim($('#pinboard_stacks_in_59_page0').text()) },
		      {service: "reddit", user: $.trim($('#reddit_stacks_in_59_page0').text()) },
		      {service: "rss", user: $.trim($('#rss_stacks_in_59_page0').text()) },
		      {service: "rss_2", user: $.trim($('#rss_2_stacks_in_59_page0').text()) },
		      {service: "rss_3", user: $.trim($('#rss_3_stacks_in_59_page0').text()) },
		      {service: "rss_4", user: $.trim($('#rss_4_stacks_in_59_page0').text()) },
		      {service: "rss_5", user: $.trim($('#rss_5_stacks_in_59_page0').text()) },
		      {service: "slideshare", user: $.trim($('#slideshare_stacks_in_59_page0').text()) },
		      {service: "snipplr", user: $.trim($('#snipplr_stacks_in_59_page0').text()) },
		      {service: "stackoverflow", user: $.trim($('#stackoverflow_stacks_in_59_page0').text()) }
			]
    });
});

	return stack;
})(stacks.stacks_in_59_page0);



