
// '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_1104_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_1104_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_1104_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;
	

// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// Chauffeur STACK BY http://www.doobox.co.uk XXXXXXX
// COPYRIGHT@2010 MR JG SIMPSON, TRADING AS DOOBOX
// ALL RIGHTS RESERVED XXXXXXXXXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx




// DOCUMENT READY FUNCTIONS
$(document).ready(function() {

// COOKIE FUNCTIONS
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,"");
}



// GET THE FOLDER FROM THE URL FUNCTION
jQuery.url=function()
{var segments={};var parsed={};var options={url:window.location,strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};var parseUri=function()
{str=decodeURI(options.url);var m=options.parser[options.strictMode?"strict":"loose"].exec(str);var uri={};var i=14;while(i--){uri[options.key[i]]=m[i]||"";}
uri[options.q.name]={};uri[options.key[12]].replace(options.q.parser,function($0,$1,$2){if($1){uri[options.q.name][$1]=$2;}});return uri;};var key=function(key)
{if(!parsed.length)
{setUp();}
if(key=="base")
{if(parsed.port!==null&&parsed.port!=="")
{return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/";}
else
{return parsed.protocol+"://"+parsed.host+"/";}}
return(parsed[key]==="")?null:parsed[key];};var param=function(item)
{if(!parsed.length)
{setUp();}
return(parsed.queryKey[item]===null)?null:parsed.queryKey[item];};var setUp=function()
{parsed=parseUri();getSegments();};var getSegments=function()
{var p=parsed.path;segments=[];segments=parsed.path.length==1?{}:(p.charAt(p.length-1)=="/"?p.substring(1,p.length-1):path=p.substring(1)).split("/");};return{setMode:function(mode)
{strictMode=mode=="strict"?true:false;return this;},setUrl:function(newUri)
{options.url=newUri===undefined?window.location:newUri;setUp();return this;},segment:function(pos)
{if(!parsed.length)
{setUp();}
if(pos===undefined)
{return segments.length;}
return(segments[pos]===""||segments[pos]===undefined)?null:segments[pos];},attr:key,param:param};}();

var yourfolder = jQuery.url.attr("directory");
if(yourfolder == "/"){yourfolder = ""};



// CUSTOM STACK SCRIPT

// check the cookie
var cooky = getCookie('stacks_in_1104_page0roar');


// start the good stuff if there is no valid cookie
if (cooky != "stacks_in_1104_page0roar"){

if(!$(".stacks_in_1104_page0icon").find("img").attr("src")){
$(".stacks_in_1104_page0icon").html('<img width="50" height="50" src="files/roar_files/alert.png" />');
}


var h = $("body").height();
var topquarter = h / 200;

var thebutton = $(".stacks_in_1104_page0wrapper").clone();
$(".stacks_in_1104_page0wrapper").remove();
$(thebutton).prependTo("body");

$(".stacks_in_1104_page0wrapper").css({
"display":"none",
"position":"fixed",
"top":"30px",
"right":"40px",
"z-index":"1000001"
});

if("right" == "center"){
var stacks_in_1104_page0negleftmargin = 300 / 2;
var stacks_in_1104_page0negtopmargin = $(".stacks_in_1104_page0wrapper").height() / 2;

$(".stacks_in_1104_page0wrapper").css({
"display":"none",
"position":"fixed",
"top":"50%",
"left":"50%",
"marginTop": -stacks_in_1104_page0negtopmargin,
"marginLeft": -stacks_in_1104_page0negleftmargin,
"z-index":"1000001"
});
}

$(".stacks_in_1104_page0wrapper a").css({
"color":"#FFFFFF",
"textDecoration":"underline"
});

$(".stacks_in_1104_page0wrapper a:hover").css({
"color":"#FFFFFF",
"textDecoration":"underline"
});

$(".stacks_in_1104_page0wrapper a:visited").css({
"color":"#FFFFFF",
"textDecoration":"underline"
});



var itsIEnine = navigator.userAgent.match(/MSIE 9/i) != null;

if(itsIEnine){
	$(".stacks_in_1104_page0wrapper").css({
    "background" : "#123659"
    });
}
else{
    $(".stacks_in_1104_page0wrapper").css({
    "-webkit-border-radius" : "10px",
    "-moz-border-radius" : "10px",
    "border-radius" : "10px",
    "behavior":"url(" + yourfolder + "files/chauffeur_files/RBPIE.htc)" 
    });
}



// LOAD THE ROARBOX FUNCTION
if("timed" == "scroll"){
$(window).scroll(function() {
    if ($(this).scrollTop() > topquarter) {
        $(".stacks_in_1104_page0wrapper").fadeIn();
    }
});
}else if("timed" == "timed"){
$(".stacks_in_1104_page0wrapper").delay("3" * 1000).queue(function(){ 
  $(".stacks_in_1104_page0wrapper").fadeIn();
  $(this).dequeue(); 
});
}else{
	$(window).load(
    function() {
        $(".stacks_in_1104_page0wrapper").fadeIn();
    }
);
}




// X BUTTON CLICK FUNCTION
 $('.stacks_in_1104_page0thex').click(function(){
 
  $('.stacks_in_1104_page0wrapper').fadeOut( function() { $(this).remove(); });

 
 });

} // end cookie check


deleteCookie('stacks_in_1104_page0roar');


});





// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// END DOOBOX Chauffeur STACK XXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	return stack;
})(stacks.stacks_in_1104_page0);


// Javascript for stacks_in_9_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_9_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_9_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_9_page0 img.imageStyle");
        var reverse = "$thisSprite.desaturate()";




        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_9_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_9_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_9_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_9_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_9_page0pair').toggle().toggleClass('stacks_in_9_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_9_page0);


// Javascript for stacks_in_14_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_14_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_14_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_14_page0 img.imageStyle");
        var reverse = "$thisSprite.desaturate()";




        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_14_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_14_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_14_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_14_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_14_page0pair').toggle().toggleClass('stacks_in_14_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_14_page0);


// Javascript for stacks_in_21_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_21_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_21_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_21_page0 img.imageStyle");
        var reverse = "$thisSprite.desaturate()";




        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_21_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_21_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_21_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_21_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_21_page0pair').toggle().toggleClass('stacks_in_21_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_21_page0);


// Javascript for stacks_in_26_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_26_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_26_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_26_page0 img.imageStyle");
        var reverse = "$thisSprite.desaturate()";




        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_26_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_26_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_26_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_26_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_26_page0pair').toggle().toggleClass('stacks_in_26_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_26_page0);


// Javascript for stacks_in_31_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_31_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_31_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_31_page0 img.imageStyle");
        var reverse = "$thisSprite.desaturate()";




        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_31_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_31_page0color')
      .hide()
    });
     
  }
     
 else {  
   
     // modified not to desaturate the clone
    $thisSprite.each(function(){
     $(this).addClass("stacks_in_31_page0pair")
      .clone()
      .attr('id', '')
      .insertAfter($(this))
      .addClass('stacks_in_31_page0color')
      $(this).hide()
    });
    }
    
     $thisSprite.desaturate()
     
     
         // add events for switch between color/gray versions
    $('.spriteContainer').bind('mouseenter mouseleave', function(){
     $(this).find('.stacks_in_31_page0pair').toggle().toggleClass('stacks_in_31_page0color');
    });
 
 

 });

	return stack;
})(stacks.stacks_in_31_page0);


// Javascript for stacks_in_37_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_37_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_37_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;
	
$(document).ready(function(){
	$('#fadeInStackstacks_in_37_page0').fadeIn(6000);
});
	return stack;
})(stacks.stacks_in_37_page0);


// Javascript for stacks_in_790_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_790_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_790_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;
	

//-- YouTube HTML5 v1.7.0 by Joe Workman --//
/* jQuery YouTube 1.0.3 - https://github.com/nirvanatikku/jQuery-TubePlayer-Plugin */
(function(g){var d={};d.ytplayers={};d.inits=[];d.iframeScriptInited=false;d.inited=false;g.tubeplayer={};g.tubeplayer.defaults={afterReady:function(){},stateChange:function(a){var b=this.onPlayer;return function(c){if(typeof c=="object")c=c.data;switch(c){case -1:return b.unstarted[a]();case 0:return b.ended[a]();case 1:return b.playing[a]();case 2:return b.paused[a]();case 3:return b.buffering[a]();case 5:return b.cued[a]();default:return null}}},onError:function(a){var b=this.onErr;return function(c){if(typeof c==
"object")c=c.data;switch(c){case 2:return b.invalidParameter[a]();case 100:return b.notFound[a]();case 101:case 150:return b.notEmbeddable[a]();default:return null}}},qualityChange:function(a){var b=this;return function(c){if(typeof c=="object")c=c.data;return b.onQualityChange[a](c)}},onQualityChange:{},onPlayer:{unstarted:{},ended:{},playing:{},paused:{},buffering:{},cued:{}},onErr:{notFound:{},notEmbeddable:{},invalidParameter:{}}};var j={width:425,height:355,allowFullScreen:"true",initialVideo:"DkoeNLuMbcI",
start:0,preferredQuality:"default",showControls:true,showRelated:false,autoPlay:false,autoHide:true,theme:"dark",color:"red",showinfo:false,modestbranding:true,wmode:"transparent",swfobjectURL:"http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",loadSWFObject:true,allowScriptAccess:"always",playerID:"tubeplayer-player-container",iframed:true,onPlay:function(){},onPause:function(){},onStop:function(){},onSeek:function(){},onMute:function(){},onUnMute:function(){},onPlayerUnstarted:function(){},
onPlayerEnded:function(){},onPlayerPlaying:function(){},onPlayerPaused:function(){},onPlayerBuffering:function(){},onPlayerCued:function(){},onQualityChange:function(){},onErrorNotFound:function(){},onErrorNotEmbeddable:function(){},onErrorInvalidParameter:function(){}};g.fn.tubeplayer=function(a,b){var c=g(this),f=typeof a;if(arguments.length==0||f=="object")return c.each(function(){d.init(g(this),a)});else if(f=="string")return c.triggerHandler(a+".tubeplayer",b||null)};var h=function(a){return function(b,
c){var f=d.getPkg(b);if(f.ytplayer){b=a(b,c,f);if(typeof b=="undefined")b=f.$player;return b}return f.$player}};g.tubeplayer.getPlayers=function(){return d.ytplayers};d.init=function(a,b){if(a.hasClass("jquery-youtube-tubeplayer"))return a;b=g.extend({},j,b);b.playerID+=(new Date).valueOf();a.addClass("jquery-youtube-tubeplayer").data("opts.tubeplayer",b);for(e in i)a.bind(e+".tubeplayer",a,i[e]);d.initDefaults(g.tubeplayer.defaults,b);jQuery("<div></div>").attr("id",b.playerID).appendTo(a);d.initPlayer(a,
b);return a};d.getPkg=function(a){a=a.data;var b=a.data("opts.tubeplayer");return{$player:a,opts:b,ytplayer:d.ytplayers[b.playerID]}};d.iframeReady=function(a){d.inits.push(function(){new YT.Player(a.playerID,{videoId:a.initialVideo,width:a.width,height:a.height,playerVars:{autoplay:a.autoPlay?1:0,autohide:a.autoHide?1:0,controls:a.showControls?1:0,rel:a.showRelated?1:0,fs:a.allowFullScreen?1:0,wmode:a.wmode,showinfo:a.showinfo?1:0,modestbranding:a.modestbranding?1:0,start:a.start,theme:a.theme,color:a.color},
events:{onReady:function(b){d.ytplayers[a.playerID]=b.target;b=g(b.target).parents(".jquery-youtube-tubeplayer");g.tubeplayer.defaults.afterReady(b)},onPlaybackQualityChange:g.tubeplayer.defaults.qualityChange(a.playerID),onStateChange:g.tubeplayer.defaults.stateChange(a.playerID),onError:g.tubeplayer.defaults.onError(a.playerID)}})});if(d.inits.length>=1&&!d.inited)return function(){for(var b=0;b<d.inits.length;b++)d.inits[b]();d.inited=true};d.inited&&d.inits.pop()();return onYouTubePlayerAPIReady};
d.supportsHTML5=function(){return!!document.createElement("video").canPlayType};d.initDefaults=function(a,b){var c=b.playerID,f=a.onPlayer;f.unstarted[c]=b.onPlayerUnstarted;f.ended[c]=b.onPlayerEnded;f.playing[c]=b.onPlayerPlaying;f.paused[c]=b.onPlayerPaused;f.buffering[c]=b.onPlayerBuffering;f.cued[c]=b.onPlayerCued;a.onQualityChange[c]=b.onQualityChange;a=a.onErr;a.notFound[c]=b.onErrorNotFound;a.notEmbeddable[c]=b.onErrorNotEmbeddable;a.invalidParameter[c]=b.onErrorInvalidParameter};d.initPlayer=
function(a,b){b.iframed&&d.supportsHTML5()?d.initIframePlayer(a,b):d.initFlashPlayer(a,b)};d.initIframePlayer=function(a,b){if(!d.iframeScriptInited){a=document.createElement("script");a.src="http://www.youtube.com/player_api";var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(a,c);d.iframeScriptInited=true}onYouTubePlayerAPIReady=d.iframeReady(b)};d.initFlashPlayer=function(a,b){b.loadSWFObject?g.getScript(b.swfobjectURL,d.initFlashPlayerFN(b)):d.initFlashPlayerFN(b)()};d.initFlashPlayerFN=
function(a){return function(){var b=["//www.youtube.com/v/"];b.push(a.initialVideo);b.push("?fs="+(a.allowFullScreen?1:0));b.push("&enablejsapi=1&version=3");b.push("&playerapiid="+a.playerID);b.push("&rel= "+(a.showRelated?1:0));b.push("&autoplay="+(a.autoPlay?1:0));b.push("&autohide="+(a.autoHide?1:0));b.push("&controls="+(a.showControls?1:0));b.push("&showinfo="+(a.showinfo?1:0));b.push("&modestbranding="+(a.modestbranding?1:0));b.push("&start="+a.start);b.push("&theme="+a.theme);b.push("&color="+
a.color);swfobject.embedSWF(b.join(""),a.playerID,a.width,a.height,"8",null,null,{allowScriptAccess:a.allowScriptAccess,wmode:a.wmode,allowFullScreen:a.allowFullScreen},{id:a.playerID});onYouTubePlayerReady=function(c){var f=document.getElementById(c);d.ytplayers[c]=f;f.addEventListener("onStateChange","$.tubeplayer.defaults.stateChange('"+c+"')");f.addEventListener("onError","$.tubeplayer.defaults.onError('"+c+"')");f.addEventListener("onPlaybackQualityChange","$.tubeplayer.defaults.qualityChange('"+
c+"')");c=g(f).parents(".jquery-youtube-tubeplayer");g.tubeplayer.defaults.afterReady(c)}}};d.getVideoIDFromURL=function(a){var b=a.indexOf("youtube.com/watch?v=")+20,c=a.indexOf("&",b)||a.length;if(b>c)return"";return a.substring(b,c)};var i={cue:h(function(a,b,c){c.ytplayer.cueVideoById(b,c.opts.preferredQuality)}),play:h(function(a,b,c){if(typeof b=="object")c.ytplayer.loadVideoById(b.id,b.time,c.opts.preferredQuality);else b?c.ytplayer.loadVideoById(b,0,c.opts.preferredQuality):c.ytplayer.playVideo();
c.opts.onPlay(b)}),pause:h(function(a,b,c){c.ytplayer.pauseVideo();c.opts.onPause()}),stop:h(function(a,b,c){c.ytplayer.stopVideo();c.opts.onStop()}),seek:h(function(a,b,c){c.ytplayer.seekTo(b,true);c.opts.onSeek(b)}),mute:h(function(a,b,c){c.$player.attr("data-prev-mute-volume",c.ytplayer.getVolume());c.ytplayer.mute();c.opts.onMute()}),unmute:h(function(a,b,c){c.ytplayer.unMute();c.ytplayer.setVolume(c.$player.attr("data-prev-mute-volume")||50);c.opts.onUnMute()}),isMuted:h(function(a,b,c){return c.ytplayer.isMuted()}),
volume:h(function(a,b,c){if(b){c.ytplayer.setVolume(b);c.$player.attr("data-prev-mute-volume",c.ytplayer.getVolume())}else return c.ytplayer.getVolume()||0}),quality:h(function(a,b,c){if(b)c.ytplayer.setPlaybackQuality(b);else return c.ytplayer.getPlaybackQuality()}),data:h(function(a,b,c){a={};c=c.ytplayer;a.bytesLoaded=c.getVideoBytesLoaded();a.bytesTotal=c.getVideoBytesTotal();a.startBytes=c.getVideoStartBytes();a.state=c.getPlayerState();a.currentTime=c.getCurrentTime();a.availableQualityLevels=
c.getAvailableQualityLevels();a.duration=c.getDuration();a.videoURL=c.getVideoUrl();a.getVideoEmbedCode=c.getVideoEmbedCode();a.videoID=d.getVideoIDFromURL(a.videoURL);return a}),videoId:h(function(a,b,c){return d.getVideoIDFromURL(c.ytplayer.getVideoUrl())}),size:h(function(a,b,c){if(b.width&&b.height){c.ytplayer.setSize(b.width,b.height);g(c.ytplayer).css(b)}}),destroy:h(function(a,b,c){c.$player.removeClass("jquery-youtube-tubeplayer").data("opts.tubeplayer",null).unbind(".tubeplayer").html("");
delete d.ytplayers[c.opts.playerID];g(c.ytplayer).remove();return null}),player:h(function(a,b,c){return c.ytplayer})}})(jQuery);

$(document).ready(function() {
	$("#youtube_stacks_in_790_page0").tubeplayer({
		width: 560, // the width of the player
		height: 315, // the height of the player
		allowFullScreen: true, 
		initialVideo: "/y0qZYqdsYAg", 
		preferredQuality: "default",// preferred quality: default, small, medium, large, hd720
		showControls: true,
		showRelated: false,
		autoPlay: false,
		autoHide: true,
		theme: 'light', // 'dark' or 'light'
		color: 'red', // 'red' or 'white'
		showinfo: false,
		modestbranding: false,
		wmode: 'transparent' // use 'window' when optimizing for mobile devices
	});
});
//-- End YouTube HTML5 Stack --//

	return stack;
})(stacks.stacks_in_790_page0);


// Javascript for stacks_in_69_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_69_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_69_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;
	
/*!
 * RWT Stretch Script
 * Copyright (c) 2009-2010 G. Byrd
 * Version: 2.0.0 (22-JULY-2010)
 * Requires: jQuery v1.2.6 or later
 */
jQuery(document).ready(function($){
	
		jQuery("#stacks_in_69_page0 .toggle_container").hide();

		jQuery("#stacks_in_69_page0 .trigger").toggle(function(){
			jQuery(this).addClass("active"); 
			}, function () {
			jQuery(this).removeClass("active");
		});

		jQuery("#stacks_in_69_page0 .trigger").click(function(){
			jQuery(this).next(".toggle_container").slideToggle("slow,");
		});
});
	

	return stack;
})(stacks.stacks_in_69_page0);


// Javascript for stacks_in_88_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_88_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_88_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= 'dailytimes';
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_88_page0").html();


$("#stacks_in_88_page0 .teleportMe").remove();
$(".teleportHere").replaceWith(injectionStack);


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


// Javascript for stacks_in_90_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_90_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_90_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;
	
// Doo Daily Stack by http://www.doobox.co.uk
// Copyright@2010 Mr JG Simpson, trading as Doobox.
// all rights reserved.
$(document).ready(function() {

var dayname = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday','Friday', 'Saturday'];
	var now = new Date;
    var dow = now.getDay();
    var dooDay = dayname[dow];
    
if (dooDay == 'Saturday'){
$("#stacks_in_90_page0 .dooSat").css('display', 'block');
} 
else if (dooDay == 'Sunday'){
$("#stacks_in_90_page0 .dooSun").css('display', 'block');
} 
else if (dooDay == 'Monday'){
$("#stacks_in_90_page0 .dooMon").css('display', 'block');
} 
else if (dooDay == 'Tuesday'){
$("#stacks_in_90_page0 .dooTue").css('display', 'block'); 
}
else if (dooDay == 'Wednesday'){
$("#stacks_in_90_page0 .dooWed").css('display', 'block');
} 
else if (dooDay == 'Thursday'){
$("#stacks_in_90_page0 .dooThu").css('display', 'block'); 
}
else {
$("#stacks_in_90_page0 .dooFri").css('display', 'block');
}
          
});

// End Doo Daily Stack by http://www.doobox.co.uk



	return stack;
})(stacks.stacks_in_90_page0);



