
// '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_110_page1
// ---------------------------------------------------------------------

// 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_110_page1 = {};

// 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_110_page1 = (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_110_page1roar');


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

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


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

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

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

if("right" == "center"){
var stacks_in_110_page1negleftmargin = 300 / 2;
var stacks_in_110_page1negtopmargin = $(".stacks_in_110_page1wrapper").height() / 2;

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

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

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

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



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

if(itsIEnine){
	$(".stacks_in_110_page1wrapper").css({
    "background" : "#333333"
    });
}
else{
    $(".stacks_in_110_page1wrapper").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_110_page1wrapper").fadeIn();
    }
});
}else if("timed" == "timed"){
$(".stacks_in_110_page1wrapper").delay("3" * 1000).queue(function(){ 
  $(".stacks_in_110_page1wrapper").fadeIn();
  $(this).dequeue(); 
});
}else{
	$(window).load(
    function() {
        $(".stacks_in_110_page1wrapper").fadeIn();
    }
);
}




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

 
 });

} // end cookie check


deleteCookie('stacks_in_110_page1roar');


});





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


// Javascript for stacks_in_941_page1
// ---------------------------------------------------------------------

// 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_941_page1 = {};

// 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_941_page1 = (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
// TABBY STACK BY http://www.doobox.co.uk XXXXXXX
// COPYRIGHT@2010 MR JG SIMPSON, TRADING AS DOOBOX
// ALL RIGHTS RESERVED XXXXXXXXXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

/*
PIE: CSS3 rendering for IE
Version 1.0beta4
http://css3pie.com
Dual-licensed for use under the Apache License Version 2.0 or the General Public License (GPL) Version 2.
*/


$(document).ready(function() {

if(typeof String.prototype.trim !== 'function') {
			String.prototype.trim = function() {
			return this.replace(/^\s+|\s+$/, '');
			}
		}
       
      var stacks_in_941_page1thiscat;
      var stacks_in_941_page1catTrimed;
	$("#stacks_in_941_page1 .stacks_in_941_page1dootabcontainer").each(function() {
		stacks_in_941_page1thiscat = $(".stacks_in_941_page1doocat .stacks_in_941_page1tabname", this).text().trim();
		var stacks_in_941_page1thiscatArray = stacks_in_941_page1thiscat.split(',');
		var stacks_in_941_page1doothis = $(this);
		// stacks_in_941_page1thiscatArray now holds this instance of cats and any multi cats in this section
		// next we loop through each pulled cat from this section, each cat is in a var named catname.
		$.each(stacks_in_941_page1thiscatArray, function(index, catname) {
		stacks_in_941_page1catTrimed = catname.trim().replace(/[^a-z0-9]/gi,"");
		$(stacks_in_941_page1doothis).addClass(stacks_in_941_page1catTrimed);

		if($("#" + stacks_in_941_page1catTrimed).length == 0){
		$("#stacks_in_941_page1tabpicker").append('<a href="#" id="'+stacks_in_941_page1catTrimed+'" class="stacks_in_941_page1doofilter">'+catname+'</a> ');
		}
		});
	});


       

   
   $(".stacks_in_941_page1doofilter").click(function(){
        var thisFilter = $(this).attr("id");
        var filterboxheight = $("#stacks_in_941_page1").height();
        $(".stacks_in_941_page1overalltabcontainer").css("min-height",filterboxheight);
        $(".stacks_in_941_page1dootabcontainer").slideUp();
        $("."+ thisFilter).slideDown('slow', function() {
        	 $(".stacks_in_941_page1overalltabcontainer").animate({"min-height":"10px"},"slow");
 		 });
        $("#stacks_in_941_page1tabpicker a").removeClass("stacks_in_941_page1current");
        $(this).addClass("stacks_in_941_page1current");
        return false;
   });
   

   $("#stacks_in_941_page1tabpicker a:first-child").addClass("stacks_in_941_page1current");


});



// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// END DOOBOX TABBY STACK XXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	return stack;
})(stacks.stacks_in_941_page1);


// Javascript for stacks_in_951_page1
// ---------------------------------------------------------------------

// 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_951_page1 = {};

// 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_951_page1 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

/*
 * Portfolio Zoom Slider Stack By WeaverAddons.com
 * Version 1.0.0
 *
 * Visit http://weaveraddons.com for more information on how to use this stack in RapidWeaver.
 *
 */



(function(b){function o(b){for(var d=1;d<arguments.length;d++)b=b.replace("%"+(d-1),arguments[d]);return b}function G(i,d){var c=b("img",i),j,g=null,k=null,h=null,n=null,m=null,v=null,r,B=0,s,t,C=0,D=0,w=0,x=0,E=0,z,A,y=this,F;setTimeout(function(){if(null===k){var b=i.width();i.parent().append(o('<div style="width:%0px;position:absolute;top:75%;left:%1px;text-align:center" class="cloud-zoom-loading" >Loading...</div>',b/3,b/2-b/6)).find(":last").css("opacity",0.5)}},200);this.removeBits=function(){h&&
(h.remove(),h=null);n&&(n.remove(),n=null);m&&(m.remove(),m=null);null!==v&&(v.remove(),v=null);b(".cloud-zoom-loading",i.parent()).remove()};this.destroy=function(){i.data("zoom",null);k&&(k.unbind(),k.remove(),k=null);g&&(g.remove(),g=null);this.removeBits()};this.fadedOut=function(){g&&(g.remove(),g=null);this.removeBits()};this.controlLoop=function(){if(h){var b=z-c.offset().left-0.5*s>>0,f=A-c.offset().top-0.5*t>>0;0>b?b=0:b>c.outerWidth()-s&&(b=c.outerWidth()-s);0>f?f=0:f>c.outerHeight()-t&&
(f=c.outerHeight()-t);h.css({left:b,top:f});h.css("background-position",-b+"px "+-f+"px");C=b/c.outerWidth()*r.width>>0;D=f/c.outerHeight()*r.height>>0;x+=(C-x)/d.smoothMove;w+=(D-w)/d.smoothMove;g.css("background-position",-(x>>0)+"px "+(-(w>>0)+"px"))}B=setTimeout(function(){y.controlLoop()},30)};this.init2=function(b,c){E++;1===c&&(r=b);2===E&&this.init()};this.init=function(){b(".cloud-zoom-loading",i.parent()).remove();k=i.parent().append(o("<div class='mousetrap' style='background-image:url(\".\");z-index:999;position:absolute;width:%0px;height:%1px;left:%2px;top:%3px;'></div>",
c.outerWidth(),c.outerHeight(),0,0)).find(":last");k.bind("mousemove",this,function(b){z=b.pageX;A=b.pageY});k.bind("mouseleave",this,function(){clearTimeout(B);h&&h.fadeOut(299);n&&n.fadeOut(299);m&&m.fadeOut(299);g.fadeOut(300,function(){y.fadedOut()});return!1});k.bind("mouseenter",this,function(e){z=e.pageX;A=e.pageY;F=e.data;g&&(g.stop(!0,!1),g.remove());var e=d.adjustX,f=d.adjustY,j=c.outerWidth(),u=c.outerHeight(),p=d.zoomWidth,q=d.zoomHeight;"auto"==d.zoomWidth&&(p=j);"auto"==d.zoomHeight&&
(q=u);var l=i.parent();switch(d.position){case "top":f-=q;break;case "right":e+=j;break;case "body-right":f=c.offset().top+6-0;e=j+c.offset().left+0+10;l=b("body");break;case "body-left":f=c.offset().top+6-0;e=c.offset().left-20-0-p;l=b("body");break;case "body-bottom":e=c.offset().left-j/2;f=c.offset().top+u+0+10;l=b("body");break;case "body-top":e=c.offset().left-j/2;f=c.offset().top-q-10-0;
l=b("body");break;case "bottom":f+=u;break;case "left":e-=p;break;case "inside":p=j;q=u;break;default:l=b("#"+d.position),l.length?(p=l.innerWidth(),q=l.innerHeight()):(l=i,e+=j,f+=u)}g=l.append(o('<div id="cloud-zoom-big" class="cloud-zoom-big" style="display:none;position:absolute;left:%0px;top:%1px;width:%2px;height:%3px;background-image:url(\'%4\');z-index:999;"></div>',e,f,p,q,r.src)).find(":last");c.attr("title")&&d.showTitle&&g.append(o('<div class="cloud-zoom-title">%0</div>',c.attr("title"))).find(":last").css("opacity",
d.titleOpacity);b.browser.msie&&7>b.browser.version&&(v=b('<iframe frameborder="0" src="#"></iframe>').css({position:"absolute",left:e,top:f,zIndex:99,width:p,height:q}).insertBefore(g));g.fadeIn(500);h&&(h.remove(),h=null);s=c.outerWidth()/r.width*g.width();t=c.outerHeight()/r.height*g.height();h=i.append(o("<div class = 'cloud-zoom-lens' style='display:none;z-index:98;position:absolute;width:%0px;height:%1px;'></div>",s,t)).find(":last");k.css("cursor",h.css("cursor"));e=!1;d.tint&&(h.css("background",
'url("'+c.attr("src")+'")'),n=i.append(o('<div style="display:none;position:absolute; left:0px; top:0px; width:%0px; height:%1px; background-color:%2;" />',c.outerWidth(),c.outerHeight(),d.tint)).find(":last"),n.css("opacity",d.tintOpacity),e=!0,n.fadeIn(500));d.softFocus&&(h.css("background",'url("'+c.attr("src")+'")'),m=i.append(o('<div style="position:absolute;display:none;top:2px; left:2px; width:%0px; height:%1px;" />',c.outerWidth()-2,c.outerHeight()-2,d.tint)).find(":last"),m.css("background",
'url("'+c.attr("src")+'")'),m.css("opacity",0.5),e=!0,m.fadeIn(500));e||h.css("opacity",d.lensOpacity);"inside"!==d.position&&h.fadeIn(500);F.controlLoop()})};j=new Image;b(j).load(function(){y.init2(this,0)});j.src=c.attr("src");j=new Image;b(j).load(function(){y.init2(this,1)});j.src=i.attr("href")}b.fn.CloudZoom=function(i){try{document.execCommand("BackgroundImageCache",!1,!0)}catch(d){}this.each(function(){var c,d;eval("var\ta = {"+b(this).attr("rel")+"}");c=a;b(this).is(".cloud-zoom")?(b(this).css({position:"relative",
display:"block"}),b("img",b(this)).css({display:"block"}),"wrap"!=b(this).parent().attr("id")&&b(this).wrap('<div id="wrap" style="top:0px;z-index:9999;position:relative;"></div>'),d=b.extend({},b.fn.CloudZoom.defaults,i),d=b.extend({},d,c),b(this).data("zoom",new G(b(this),d))):b(this).is(".cloud-zoom-gallery")&&(d=b.extend({},c,i),b(this).data("relOpts",d),b(this).bind("click",b(this),function(c){var d=c.data.data("relOpts");b("#"+d.useZoom).data("zoom").destroy();b("#"+d.useZoom).attr("href",c.data.attr("href"));
b("#"+d.useZoom+" img").attr("src",c.data.data("relOpts").smallImage);b("#"+c.data.data("relOpts").useZoom).CloudZoom();return!1}))});return this};b.fn.CloudZoom.defaults={zoomWidth:"auto",zoomHeight:"auto",position:"right",tint:!1,tintOpacity:0.5,lensOpacity:0.5,softFocus:!1,smoothMove:3,showTitle:!0,titleOpacity:0.5,adjustX:0,adjustY:0}})(jQuery);





/*
 * 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. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright Â© 2001 Robert Penner
 * 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. 
 *
 */




/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.4
*
* Requires: 1.2.2+
*/

(function(d){function g(a){var b=a||window.event,i=[].slice.call(arguments,1),c=0,h=0,e=0;a=d.event.fix(b);a.type="mousewheel";if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;e=c;if(b.axis!==undefined&&b.axis===b.HORIZONTAL_AXIS){e=0;h=-1*c}if(b.wheelDeltaY!==undefined)e=b.wheelDeltaY/120;if(b.wheelDeltaX!==undefined)h=-1*b.wheelDeltaX/120;i.unshift(a,c,h,e);return d.event.handle.apply(this,i)}var f=["DOMMouseScroll","mousewheel"];d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=
f.length;a;)this.addEventListener(f[--a],g,false);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],g,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);



/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 *
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 *
 * Version: 1.3.4 (11/11/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

(function(a){var l,q,r,e,y,k,z,h,u,v,o=0,d={},m=[],n=0,c={},i=[],B=null,s=new Image,D=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,O=/[^\.]\.(swf)\s*$/i,E,F=1,w=0,t="",p,g,j=!1,x=a.extend(a("<div/>")[0],{prop:0}),G=a.browser.msie&&7>a.browser.version&&!window.XMLHttpRequest,H=function(){q.hide();s.onerror=s.onload=null;B&&B.abort();l.empty()},I=function(){!1===d.onError(m,o,d)?(q.hide(),j=!1):(d.titleShow=!1,d.width="auto",d.height="auto",l.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>'),
A())},C=function(){var b=m[o],f,c,e,g,i,h;H();d=a.extend({},a.fn.fancybox.defaults,"undefined"==typeof a(b).data("fancybox")?d:a(b).data("fancybox"));h=d.onStart(m,o,d);if(!1===h)j=!1;else{"object"==typeof h&&(d=a.extend(d,h));e=d.title||(b.nodeName?a(b).attr("title"):b.title)||"";if(b.nodeName&&!d.orig)d.orig=a(b).children("img:first").length?a(b).children("img:first"):a(b);""===e&&d.orig&&d.titleFromAlt&&(e=d.orig.attr("alt"));f=d.href||(b.nodeName?a(b).attr("href"):b.href)||null;if(/^(?:javascript)/i.test(f)||
"#"==f)f=null;if(d.type){if(c=d.type,!f)f=d.content}else d.content?c="html":f&&(c=f.match(D)?"image":f.match(O)?"swf":a(b).hasClass("iframe")?"iframe":0===f.indexOf("#")?"inline":"ajax");if(c){"inline"==c&&(b=f.substr(f.indexOf("#")),c=0<a(b).length?"inline":"ajax");d.type=c;d.href=f;d.title=e;if(d.autoDimensions)"html"==d.type||"inline"==d.type||"ajax"==d.type?(d.width="auto",d.height="auto"):d.autoDimensions=!1;if(d.modal)d.overlayShow=!0,d.hideOnOverlayClick=!1,d.hideOnContentClick=!1,d.enableEscapeButton=
!1,d.showCloseButton=!1;d.padding=parseInt(d.padding,10);d.margin=parseInt(d.margin,10);l.css("padding",d.padding+d.margin);a(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){a(this).replaceWith(k.children())});switch(c){case "html":l.html(d.content);A();break;case "inline":if(!0===a(b).parent().is("#fancybox-content")){j=!1;break}a('<div class="fancybox-inline-tmp" />').hide().insertBefore(a(b)).bind("fancybox-cleanup",function(){a(this).replaceWith(k.children())}).bind("fancybox-cancel",
function(){a(this).replaceWith(l.children())});a(b).appendTo(l);A();break;case "image":j=!1;a.fancybox.showActivity();s=new Image;s.onerror=function(){I()};s.onload=function(){j=!0;s.onerror=s.onload=null;d.width=s.width;d.height=s.height;a("<img />").attr({id:"fancybox-img",src:s.src,alt:d.title}).appendTo(l);J()};s.src=f;break;case "swf":d.scrolling="no";g='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+d.width+'" height="'+d.height+'"><param name="movie" value="'+f+'"></param>';
i="";a.each(d.swf,function(b,a){g+='<param name="'+b+'" value="'+a+'"></param>';i+=" "+b+'="'+a+'"'});g+='<embed src="'+f+'" type="application/x-shockwave-flash" width="'+d.width+'" height="'+d.height+'"'+i+"></embed></object>";l.html(g);A();break;case "ajax":j=!1;a.fancybox.showActivity();d.ajax.win=d.ajax.success;B=a.ajax(a.extend({},d.ajax,{url:f,data:d.ajax.data||{},error:function(b){0<b.status&&I()},success:function(b,a,c){if(200==("object"==typeof c?c:B).status){if("function"==typeof d.ajax.win){h=
d.ajax.win(f,b,a,c);if(!1===h){q.hide();return}if("string"==typeof h||"object"==typeof h)b=h}l.html(b);A()}}}));break;case "iframe":J()}}else I()}},A=function(){var b=d.width,c=d.height,b=-1<b.toString().indexOf("%")?parseInt((a(window).width()-2*d.margin)*parseFloat(b)/100,10)+"px":"auto"==b?"auto":b+"px",c=-1<c.toString().indexOf("%")?parseInt((a(window).height()-2*d.margin)*parseFloat(c)/100,10)+"px":"auto"==c?"auto":c+"px";l.wrapInner('<div style="width:'+b+";height:"+c+";overflow: "+("auto"==
d.scrolling?"auto":"yes"==d.scrolling?"scroll":"hidden")+';position:relative;"></div>');d.width=l.width();d.height=l.height();J()},J=function(){var b,f;q.hide();if(e.is(":visible")&&!1===c.onCleanup(i,n,c))a.event.trigger("fancybox-cancel"),j=!1;else{j=!0;a(k.add(r)).unbind();a(window).unbind("resize.fb scroll.fb");a(document).unbind("keydown.fb");e.is(":visible")&&"outside"!==c.titlePosition&&e.css("height",e.height());i=m;n=o;c=d;if(c.overlayShow){if(r.css({"background-color":c.overlayColor,opacity:c.overlayOpacity,
cursor:c.hideOnOverlayClick?"pointer":"auto",height:a(document).height()}),!r.is(":visible")){if(G)a("select:not(#fancybox-tmp select)").filter(function(){return"hidden"!==this.style.visibility}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});r.show()}}else r.hide();g=P();t=c.title||"";w=0;h.empty().removeAttr("style").removeClass();if(!1!==c.titleShow&&(t=a.isFunction(c.titleFormat)?c.titleFormat(t,i,n,c):t&&t.length?"float"==c.titlePosition?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+
t+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+c.titlePosition+'">'+t+"</div>":!1)&&""!==t)switch(h.addClass("fancybox-title-"+c.titlePosition).html(t).appendTo("body").show(),c.titlePosition){case "inside":h.css({width:g.width-2*c.padding,marginLeft:c.padding,marginRight:c.padding});w=h.outerHeight(!0);h.appendTo(y);g.height+=w;break;case "over":h.css({marginLeft:c.padding,width:g.width-2*c.padding,bottom:c.padding}).appendTo(y);break;case "float":h.css("left",
-1*parseInt((h.width()-g.width-40)/2,10)).appendTo(e);break;default:h.css({width:g.width-2*c.padding,paddingLeft:c.padding,paddingRight:c.padding}).appendTo(e)}h.hide();if(e.is(":visible"))a(z.add(u).add(v)),b=e.position(),p={top:b.top,left:b.left,width:e.width(),height:e.height()},f=p.width==g.width&&p.height==g.height,k.fadeTo(c.changeFade,0.3,function(){var b=function(){k.html(l.contents()).fadeTo(c.changeFade,1,K)};a.event.trigger("fancybox-change");k.empty().removeAttr("filter").css({"border-width":c.padding,
width:g.width-2*c.padding,height:d.autoDimensions?"auto":g.height-w-2*c.padding});f?b():(x.prop=0,a(x).animate({prop:1},{duration:c.changeSpeed,easing:c.easingChange,step:L,complete:b}))});else if(e.removeAttr("style"),k.css("border-width",c.padding),"elastic"==c.transitionIn){p=N();k.html(l.contents());e.show();if(c.opacity)g.opacity=0;x.prop=0;a(x).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:L,complete:K})}else"inside"==c.titlePosition&&0<w&&h.show(),k.css({width:g.width-2*c.padding,
height:d.autoDimensions?"auto":g.height-w-2*c.padding}).html(l.contents()),e.css(g).fadeIn("none"==c.transitionIn?0:c.speedIn,K)}},Q=function(){(c.enableEscapeButton||c.enableKeyboardNav)&&a(document).bind("keydown.fb",function(b){if(27==b.keyCode&&c.enableEscapeButton)b.preventDefault(),a.fancybox.close();else if((37==b.keyCode||39==b.keyCode)&&c.enableKeyboardNav&&"INPUT"!==b.target.tagName&&"TEXTAREA"!==b.target.tagName&&"SELECT"!==b.target.tagName)b.preventDefault(),a.fancybox[37==b.keyCode?"prev":
"next"]()});c.showNavArrows?(c.cyclic&&1<i.length||0!==n?u.show():u.hide(),c.cyclic&&1<i.length||n!=i.length-1?v.show():v.hide()):(u.hide(),v.hide())},K=function(){a.support.opacity||(k.get(0).style.removeAttribute("filter"),e.get(0).style.removeAttribute("filter"));d.autoDimensions&&k.css("height","auto");e.css("height","auto");t&&t.length&&h.show();c.showCloseButton&&z.show();Q();c.hideOnContentClick&&k.bind("click",a.fancybox.close);c.hideOnOverlayClick&&r.bind("click",a.fancybox.close);a(window).bind("resize.fb",
a.fancybox.resize);c.centerOnScroll&&a(window).bind("scroll.fb",a.fancybox.center);"iframe"==c.type&&a('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(a.browser.msie?'allowtransparency="true""':"")+' scrolling="'+d.scrolling+'" src="'+c.href+'"></iframe>').appendTo(k);e.show();j=!1;a.fancybox.center();c.onComplete(i,n,c);var b,f;if(i.length-1>n&&(b=i[n+1].href,"undefined"!==typeof b&&b.match(D)))f=new Image,f.src=b;if(0<n&&(b=i[n-1].href,"undefined"!==
typeof b&&b.match(D)))f=new Image,f.src=b},L=function(b){var a={width:parseInt(p.width+(g.width-p.width)*b,10),height:parseInt(p.height+(g.height-p.height)*b,10),top:parseInt(p.top+(g.top-p.top)*b,10),left:parseInt(p.left+(g.left-p.left)*b,10)};if("undefined"!==typeof g.opacity)a.opacity=0.5>b?0.5:b;e.css(a);k.css({width:a.width-2*c.padding,height:a.height-w*b-2*c.padding})},M=function(){return[a(window).width()-2*c.margin,a(window).height()-2*c.margin,a(document).scrollLeft()+c.margin,a(document).scrollTop()+
c.margin]},P=function(){var b=M(),a={},e=c.autoScale,g=2*c.padding;a.width=-1<c.width.toString().indexOf("%")?parseInt(b[0]*parseFloat(c.width)/100,10):c.width+g;a.height=-1<c.height.toString().indexOf("%")?parseInt(b[1]*parseFloat(c.height)/100,10):c.height+g;if(e&&(a.width>b[0]||a.height>b[1]))if("image"==d.type||"swf"==d.type){e=c.width/c.height;if(a.width>b[0])a.width=b[0],a.height=parseInt((a.width-g)/e+g,10);if(a.height>b[1])a.height=b[1],a.width=parseInt((a.height-g)*e+g,10)}else a.width=Math.min(a.width,
b[0]),a.height=Math.min(a.height,b[1]);a.top=parseInt(Math.max(b[3]-20,b[3]+0.5*(b[1]-a.height-40)),10);a.left=parseInt(Math.max(b[2]-20,b[2]+0.5*(b[0]-a.width-40)),10);return a},N=function(){var b=d.orig?a(d.orig):!1,f={};b&&b.length?(f=b.offset(),f.top+=parseInt(b.css("paddingTop"),10)||0,f.left+=parseInt(b.css("paddingLeft"),10)||0,f.top+=parseInt(b.css("border-top-width"),10)||0,f.left+=parseInt(b.css("border-left-width"),10)||0,f.width=b.width(),f.height=b.height(),f={width:f.width+2*c.padding,
height:f.height+2*c.padding,top:f.top-c.padding-20,left:f.left-c.padding-20}):(b=M(),f={width:2*c.padding,height:2*c.padding,top:parseInt(b[3]+0.5*b[1],10),left:parseInt(b[2]+0.5*b[0],10)});return f},R=function(){q.is(":visible")?(a("div",q).css("top",-40*F+"px"),F=(F+1)%12):clearInterval(E)};a.fn.fancybox=function(b){if(!a(this).length)return this;a(this).data("fancybox",a.extend({},b,a.metadata?a(this).metadata():{})).unbind("click.fb").bind("click.fb",function(b){b.preventDefault();j||(j=!0,a(this).blur(),
m=[],o=0,b=a(this).attr("rev")||"",!b||""==b||"nofollow"===b?m.push(this):(m=a("a[rev="+b+"], area[rev="+b+"]"),o=m.index(this)),C())});return this};a.fancybox=function(b,c){var d;if(!j){j=!0;d="undefined"!==typeof c?c:{};m=[];o=parseInt(d.index,10)||0;if(a.isArray(b)){for(var e=0,g=b.length;e<g;e++)"object"==typeof b[e]?a(b[e]).data("fancybox",a.extend({},d,b[e])):b[e]=a({}).data("fancybox",a.extend({content:b[e]},d));m=jQuery.merge(m,b)}else"object"==typeof b?a(b).data("fancybox",a.extend({},d,
b)):b=a({}).data("fancybox",a.extend({content:b},d)),m.push(b);if(o>m.length||0>o)o=0;C()}};a.fancybox.showActivity=function(){clearInterval(E);q.show();E=setInterval(R,66)};a.fancybox.hideActivity=function(){q.hide()};a.fancybox.next=function(){return a.fancybox.pos(n+1)};a.fancybox.prev=function(){return a.fancybox.pos(n-1)};a.fancybox.pos=function(a){j||(a=parseInt(a),m=i,-1<a&&a<i.length?(o=a,C()):c.cyclic&&1<i.length&&(o=a>=i.length?0:i.length-1,C()))};a.fancybox.cancel=function(){j||(j=!0,a.event.trigger("fancybox-cancel"),
H(),d.onCancel(m,o,d),j=!1)};a.fancybox.close=function(){function b(){r.fadeOut("fast");h.empty().hide();e.hide();a.event.trigger("fancybox-cleanup");k.empty();c.onClosed(i,n,c);i=d=[];n=o=0;c=d={};j=!1}if(!j&&!e.is(":hidden"))if(j=!0,c&&!1===c.onCleanup(i,n,c))j=!1;else if(H(),a(z.add(u).add(v)).hide(),a(k.add(r)).unbind(),a(window).unbind("resize.fb scroll.fb"),a(document).unbind("keydown.fb"),k.find("iframe").attr("src",G&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank"),
"inside"!==c.titlePosition&&h.empty(),e.stop(),"elastic"==c.transitionOut){p=N();var f=e.position();g={top:f.top,left:f.left,width:e.width(),height:e.height()};if(c.opacity)g.opacity=1;h.empty().hide();x.prop=1;a(x).animate({prop:0},{duration:c.speedOut,easing:c.easingOut,step:L,complete:b})}else e.fadeOut("none"==c.transitionOut?0:c.speedOut,b)};a.fancybox.resize=function(){r.is(":visible")&&r.css("height",a(document).height());a.fancybox.center(!0)};a.fancybox.center=function(a){var d,g;if(!j&&
(g=!0===a?1:0,d=M(),g||!(e.width()>d[0]||e.height()>d[1])))e.stop().animate({top:parseInt(Math.max(d[3]-20,d[3]+0.5*(d[1]-k.height()-40)-c.padding)),left:parseInt(Math.max(d[2]-20,d[2]+0.5*(d[0]-k.width()-40)-c.padding))},"number"==typeof a?a:200)};a.fancybox.init=function(){a("#fancybox-wrap").length||(a("body").append(l=a('<div id="fancybox-tmp"></div>'),q=a('<div id="fancybox-loading"><div></div></div>'),r=a('<div id="fancybox-overlay"></div>'),e=a('<div id="fancybox-wrap"></div>')),y=a('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(e),
y.append(k=a('<div id="fancybox-content"></div>'),z=a('<a id="fancybox-close"></a>'),h=a('<div id="fancybox-title"></div>'),u=a('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),v=a('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')),z.click(a.fancybox.close),q.click(a.fancybox.cancel),u.click(function(b){b.preventDefault();a.fancybox.prev()}),v.click(function(b){b.preventDefault();a.fancybox.next()}),
a.fn.mousewheel&&e.bind("mousewheel.fb",function(b,c){if(j)b.preventDefault();else if(0==a(b.target).get(0).clientHeight||a(b.target).get(0).scrollHeight===a(b.target).get(0).clientHeight)b.preventDefault(),a.fancybox[0<c?"prev":"next"]()}),a.support.opacity||e.addClass("fancybox-ie"),G&&(q.addClass("fancybox-ie6"),e.addClass("fancybox-ie6"),a('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(y)))};
a.fn.fancybox.defaults={padding:10,margin:40,opacity:!1,modal:!1,cyclic:!1,scrolling:"auto",width:560,height:340,autoScale:!0,autoDimensions:!0,centerOnScroll:!1,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:!0,hideOnContentClick:!1,overlayShow:!0,overlayOpacity:0.7,overlayColor:"#777",titleShow:!0,titlePosition:"float",titleFormat:null,titleFromAlt:!1,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:!0,
showNavArrows:!0,enableEscapeButton:!0,enableKeyboardNav:!0,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};a(document).ready(function(){a.fancybox.init()})})(jQuery);




$(function(){
	var portfolio = $('#stacks_in_951_page1portfolio div.stacks_in_951_page1item');
	var data = [];
	
	$.each(portfolio, function(i, item) {		
		var title = '';
		var description = $(item).find('div.stacks_in_951_page1slice:first').html();
		
		var images = $(item).find('ul.stacks_in_951_page1images img');
		
		if (!images.length) {
			return true;
		}
		
		var imagesSrc = [];
		
		$.each(images, function(i, image) {
			var parent = $(image).parent();
			if (parent.is('a')) {
				fullsizeSrc = parent.attr('href');
			} else {
				fullsizeSrc = $(image).attr('src');
			}
			
			thumbnailSrc = $(image).attr('src');
			
			imagesSrc.push({'thumbnail': thumbnailSrc, 'fullsize': fullsizeSrc});
		});
		
		data.push({
			title: title, 
			description: description,
			images: imagesSrc
		})
	});
		
	portfolio.empty();
	
	var output = '';
	var j = 1;
	
	if ("randomize" == "reverse") {
		data = data.reverse();
	} else if ("randomize" == "randomize") {
		function random_sort() {
			return (0.5 - Math.random() );
		}
		
		data.sort(random_sort);
	}
	
	$.each(data, function(i, item) {
		output += '<div class="item"><div class="thumb_wrapper"><div class="thumb"><ul class="images_wrapper">';
		$.each(item.images, function(i, image) {
			output += '<li><a rev="group' + j + '" rel="zoomHeight:300, zoomWidth:300, position: \'body-right\', adjustX: 10, adjustY: -4" class="cloud-zoom" href="' + image.fullsize + '"><img src="' + image.thumbnail + '" width="75" height="100" /></a></li>';
		});
		output += '</ul></div>';
		
		if (item.images.length > 1) {
			output += '<a class="prev" href="#"></a><a class="next" href="#"></a>';
		}
		output += ($.trim('Hover to zoom, click to view') ? '<span>Hover to zoom, click to view</span>' : '') + '</div>';
		output += '<div class="description">' + (item.title ? '<h2>' + item.title + '</h2>' : '') + (item.description ? '<p>' + item.description + '</p>' : '') + '</div><div style="clear:both"></div></div>';
		j++;
	});
	
	$('#stacks_in_951_page1container').html(output);
	
	if (true) {
		$('.cloud-zoom, .cloud-zoom-gallery').CloudZoom();
	}
	
	if (true) {
		$("#stacks_in_951_page1container .cloud-zoom").fancybox({
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'fade',
			'speedIn'		:	400,
			'speedOut'		:	200,
			'overlayShow'	:	true,
			'overlayColor'	:	'#000',
			'cyclic'		:	true,
			'easingIn'		:	'easeInOutExpo'
		});
		
		$("#stacks_in_951_page1container .mousetrap").live('click',function(){
			$(this).prev().trigger('click');
		});
	}
	
	
	var $content	= $('#stacks_in_951_page1container'),
	$thumb_list = $content.find('.thumb > ul');
	
	$thumb_list.each(function(){
		var $this_list	= $(this),
		total_w		= 0,
		loaded		= 0,
		//preload all the images first
		$images		= $this_list.find('img'),
		total_images= $images.length;
		$images.each(function(){
			var $img	= $(this);
			$('<img alt="">').load(function(){
				++loaded;
				if (loaded == total_images){
					$this_list.data('current',0).children().each(function(){
						total_w	+= $(this).width();
					});
					$this_list.css('width', total_w + 'px');

					//next / prev events

					$this_list.parent()
					.siblings('.next')
					.bind('click',function(e){
						var current = $this_list.data('current');
						if(current == $this_list.children().length -1) return false;
						var	next	= ++current,
						ml		= -next * $this_list.children(':first').width();

						$this_list.data('current',next)
						.stop()
						.animate({
							'marginLeft'	: ml + 'px'
						},400);
						e.preventDefault();
					})
					.end()
					.siblings('.prev')
					.bind('click',function(e){
						var current = $this_list.data('current');
						if(current == 0) return false;
						var	prev	= --current,
						ml		= -prev * $this_list.children(':first').width();

						$this_list.data('current',prev)
						.stop()
						.animate({
							'marginLeft'	: ml + 'px'
						},400);
						e.preventDefault();
					});
				}
			}).attr('src',$img.attr('src'));
		});
	});
});

	return stack;
})(stacks.stacks_in_951_page1);



