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

//-- Browser Reject Stack v1.5.0 by Joe Workman --//
/* jReject (jQuery Browser Rejection Plugin)
 * Version 1.0 RC-1
 * URL: http://jreject.turnwheel.com/
 * Description: jReject gives you a customizable and easy solution to reject/allowing specific browsers access to your pages
 * Author: Steven Bower (TurnWheel Designs) http://turnwheel.com/
 * Copyright: Copyright (c) 2009-2010 Steven Bower under dual MIT/GPL license.
 * Depends On: jQuery Browser Plugin (http://jquery.thewikies.com/browser)
 */
 (function(c){c.reject=function(d){var d=c.extend(true,{reject:{all:false,msie5:true,msie6:true},display:[],browserInfo:{firefox:{text:"Firefox 3.6",url:"http://www.mozilla.com/firefox/"},safari:{text:"Safari 5",url:"http://www.apple.com/safari/download/"},opera:{text:"Opera 11",url:"http://www.opera.com/download/"},chrome:{text:"Chrome 9+",url:"http://www.google.com/chrome/"},msie:{text:"Internet Explorer 8",url:"http://www.microsoft.com/windows/Internet-explorer/"},gcf:{text:"Google Chrome Frame",url:"http://code.google.com/chrome/chromeframe/",allow:{all:false,msie:true}}},header:"Did you know that your Internet Browser is out of date?",paragraph1:"Your browser is out of date, and may not be compatible with our website. A list of the most popular web browsers can be found below.",paragraph2:"Just click on the icons to get to the download page",close:true,closeMessage:"By closing this window you acknowledge that your experience on this website may be degraded",closeLink:"Close This Window",closeURL:"#",closeESC:true,closeCookie:false,cookieSettings:{path:"/",expires:0},imagePath:"./images/",overlayBgColor:"#000",overlayOpacity:0.8,fadeInTime:"fast",fadeOutTime:"fast"},d);
 if(d.display.length<1){d.display=["firefox","chrome","msie","safari","opera","gcf"]}if(c.isFunction(d.beforeReject)){d.beforeReject(d)}if(!d.close){d.closeESC=false}var o=function(q){return(q.all?true:false)||(q[c.os.name]?true:false)||(q[c.layout.name]?true:false)||(q[c.browser.name]?true:false)||(q[c.browser.className]?true:false)};if(!o(d.reject)){if(c.isFunction(d.onFail)){d.onFail(d)}return false}if(d.close&&d.closeCookie){var f="jreject-close";var l=function(q,w){if(typeof w!="undefined"){var s="";
 if(d.cookieSettings.expires!=0){var u=new Date();u.setTime(u.getTime()+(d.cookieSettings.expires));var s="; expires="+u.toGMTString()}var y=d.cookieSettings.path||"/";document.cookie=q+"="+encodeURIComponent(w==null?"":w)+s+"; path="+y}else{var r,t=null;if(document.cookie&&document.cookie!=""){var x=document.cookie.split(";");for(var v=0;v<x.length;++v){r=c.trim(x[v]);if(r.substring(0,q.length+1)==(q+"=")){t=decodeURIComponent(r.substring(q.length+1));break}}}return t}};if(l(f)!=null){return false
 }}var j='<div id="jr_overlay"></div><div id="jr_wrap"><div id="jr_inner"><h1 id="jr_header">'+d.header+"</h1>"+(d.paragraph1===""?"":"<p>"+d.paragraph1+"</p>")+(d.paragraph2===""?"":"<p>"+d.paragraph2+"</p>")+"<ul>";var h=0;for(var n in d.display){var k=d.display[n];var g=d.browserInfo[k]||false;if(!g||(g.allow!=undefined&&!o(g.allow))){continue}var e=g.url||"#";j+='<li id="jr_'+k+'"><div class="jr_icon"></div><div><a href="'+e+'">'+(g.text||"Unknown")+"</a></div></li>";++h}j+='</ul><div id="jr_close">'+(d.close?'<a href="'+d.closeURL+'">'+d.closeLink+"</a><p>"+d.closeMessage+"</p>":"")+"</div></div></div>";
 var i=c("<div>"+j+"</div>");var p=b();var m=a();i.bind("closejr",function(){if(!d.close){return false}if(c.isFunction(d.beforeClose)){d.beforeClose(d)}c(this).unbind("closejr");c("#jr_overlay,#jr_wrap").fadeOut(d.fadeOutTime,function(){c(this).remove();if(c.isFunction(d.afterClose)){d.afterClose(d)}});c("embed, object, select, applet").show();if(d.closeCookie){l(f,"true")}return true});i.find("#jr_overlay").css({width:p[0],height:p[1],position:"absolute",top:0,left:0,background:d.overlayBgColor,zIndex:200,opacity:d.overlayOpacity,padding:0,margin:0}).next("#jr_wrap").css({position:"absolute",width:"100%",top:m[1]+(p[3]/4),left:m[0],zIndex:300,textAlign:"center",padding:0,margin:0}).children("#jr_inner").css({background:"#FFF",border:"1px solid #CCC",fontFamily:'"Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif',color:"#4F4F4F",margin:"0 auto",position:"relative",height:"auto",minWidth:h*100,maxWidth:h*140,width:c.layout.name=="trident"?h*155:"auto",padding:20,fontSize:12}).children("#jr_header").css({display:"block",fontSize:"1.3em",marginBottom:"0.5em",color:"#333",fontFamily:"Helvetica,Arial,sans-serif",fontWeight:"bold",textAlign:"left",padding:5,margin:0}).nextAll("p").css({textAlign:"left",padding:5,margin:0}).siblings("ul").css({listStyleImage:"none",listStylePosition:"outside",listStyleType:"none",margin:0,padding:0}).children("li").css({background:'transparent url("'+d.imagePath+'background_browser.gif") no-repeat scroll left top',cusor:"pointer","float":"left",width:120,height:122,margin:"0 10px 10px 10px",padding:0,textAlign:"center"}).children(".jr_icon").css({width:100,height:100,margin:"1px auto",padding:0,background:"transparent no-repeat scroll left top",cursor:"pointer"}).each(function(){var q=c(this);
 q.css("background","transparent url("+d.imagePath+"browser_"+(q.parent("li").attr("id").replace(/jr_/,""))+".gif) no-repeat scroll left top");q.click(function(){window.open(c(this).next("div").children("a").attr("href"),"jr_"+Math.round(Math.random()*11));return false})}).siblings("div").css({color:"#808080",fontSize:"0.8em",height:18,lineHeight:"17px",margin:"1px auto",padding:0,width:118,textAlign:"center"}).children("a").css({color:"#333",textDecoration:"none",padding:0,margin:0}).hover(function(){c(this).css("textDecoration","underline")
 },function(){c(this).css("textDecoration","none")}).click(function(){window.open(c(this).attr("href"),"jr_"+Math.round(Math.random()*11));return false}).parents("#jr_inner").children("#jr_close").css({margin:"0 0 0 50px",clear:"both",textAlign:"left",padding:0,margin:0}).children("a").css({color:"#000",display:"block",width:"auto",margin:0,padding:0,textDecoration:"underline"}).click(function(){c(this).trigger("closejr");if(d.closeURL==="#"){return false}}).nextAll("p").css({padding:"10px 0 0 0",margin:0});
 c("#jr_overlay").focus();c("embed, object, select, applet").hide();c("body").append(i.hide().fadeIn(d.fadeInTime));c(window).bind("resize scroll",function(){var r=b();c("#jr_overlay").css({width:r[0],height:r[1]});var q=a();c("#jr_wrap").css({top:q[1]+(r[3]/4),left:q[0]})});if(d.closeESC){c(document).bind("keydown",function(q){if(q.keyCode==27){i.trigger("closejr")}})}if(c.isFunction(d.afterReject)){d.afterReject(d)}return true};var b=function(){var f=window.innerWidth&&window.scrollMaxX?window.innerWidth+window.scrollMaxX:(document.body.scrollWidth>document.body.offsetWidth?document.body.scrollWidth:document.body.offsetWidth);
 var d=window.innerHeight&&window.scrollMaxY?window.innerHeight+window.scrollMaxY:(document.body.scrollHeight>document.body.offsetHeight?document.body.scrollHeight:document.body.offsetHeight);var e=window.innerWidth?window.innerWidth:(document.documentElement&&document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth);var g=window.innerHeight?window.innerHeight:(document.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);
 return[f<e?f:e,d<g?g:d,e,g]};var a=function(){return[window.pageXOffset?window.pageXOffset:(document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollLeft:document.body.scrollLeft),window.pageYOffset?window.pageYOffset:(document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)]}})(jQuery);(function(a){a.browserTest=function(i,e){var c=function(g,d){for(var f=0;f<d.length;f+=1){g=g.replace(d[f][0],d[f][1])
 }return g},b=function(h,d,g,f){d={name:c((d.exec(h)||["unknown","unknown"])[1],g)};d[d.name]=true;d.version=d.opera?window.opera.version():(f.exec(h)||["X","X","X","X"])[3];if(/safari/.test(d.name)&&d.version>400){d.version="2.0"}else{if(d.name==="presto"){d.version=a.browser.version>9.27?"futhark":"linear_b"}}d.versionNumber=parseFloat(d.version,10)||0;h=1;if(d.versionNumber<100&&d.versionNumber>9){h=2}d.versionX=d.version!=="X"?d.version.substr(0,h):"X";d.className=d.name+d.versionX;return d};i=(/Opera|Navigator|Minefield|KHTML|Chrome/.test(i)?c(i,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,""],["Chrome Safari","Chrome"],["KHTML","Konqueror"],["Minefield","Firefox"],["Navigator","Netscape"]]):i).toLowerCase();
 a.browser=a.extend(!e?a.browser:{},b(i,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));a.layout=b(i,/(gecko|konqueror|msie|opera|webkit)/,[["konqueror","khtml"],["msie","trident"],["opera","presto"]],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);a.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||["unknown"])[0].replace("sunos","solaris")};
 e||a("html").addClass([a.os.name,a.browser.name,a.browser.className,a.layout.name,a.layout.className].join(" "))};a.browserTest(navigator.userAgent)})(jQuery);

$(document).ready(function() {
	$.reject({ 
	        reject: { // Rejection flags for specific browsers
	            all: false, // Covers Everything (Nothing blocked)
	            msie5: true, // Covers MSIE 5-6 (Blocked by default)
	            /*
	                Possibilities are endless...

	                msie: false,msie5: true,msie6: true,msie7: false,msie8: false, // MSIE Flags (Global, 5-8)
	                firefox: false,firefox1: false,firefox2: false,firefox3: false, // Firefox Flags (Global, 1-3)
	                konqueror: false,konqueror1: false,konqueror2: false,konqueror3: false, // Konqueror Flags (Global, 1-3)
	                chrome: false,chrome1: false,chrome2: false,chrome3: false,chrome4: false, // Chrome Flags (Global, 1-4)
	                safari: false,safari2: false,safari3: false,safari4: false, // Safari Flags (Global, 1-4)
	                opera: false,opera7: false,opera8: false,opera9: false,opera10: false, // Opera Flags (Global, 7-10)
	                gecko: false,webkit: false,trident: false,khtml: false,presto: false, // Rendering Engines (Gecko, Webkit, Trident, KHTML, Presto)
	                win: false,mac: false,linux : false,solaris : false,iphone: false, // Operating Systems (Win, Mac, Linux, Solaris, iPhone)
	                unknown: false, // Unknown covers everything else
	            */
				msie6: true, unknown:false
	        },
	        display: ['safari','firefox','chrome','opera','gcf'], // What browsers to display and their order
	        header: 'Did you know that your Internet Browser is out of date?', // Header of pop-up window
	        paragraph1: 'Your browser is out of date, and may not be compatible with my website. A list of the most popular web browsers can be found below.', // Paragraph 1
	        paragraph2: 'Just click on the icons to get to the download page', // Paragraph 2
	        close: true, // Allow closing of window
	        closeMessage: 'By closing this window you acknowledge that your experience on this website may be degraded', // Message displayed below closing link
	        closeLink: 'Close This Window', // Text for closing link
	        closeURL: '#', // Close URL (Defaults '#')
	        closeESC: true, // Allow closing of window with esc key
	        closeCookie: false, // If cookies should be used to remmember if the window was closed (applies to current session only)
	        imagePath: 'files/browser-reject-images/', // Path where images are located
	        overlayBgColor: '#000000', // Background color for overlay
	        overlayOpacity: 0.8, // Background transparency (0-1)
	        fadeOutTime: 'fast' // Fade out time on close ('slow','medium','fast' or integer in ms)
	    });
});
//-- End Browser Reject Stack --//

	return stack;
})(stacks.stacks_in_34_page1);


// Javascript for stacks_in_2_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_2_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_2_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;
	
function setCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires ;
}

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

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


$(document).ready(function() {



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

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

$("#stacks_in_2_page1").css("margin" , 0);
var orgonal = $("#stacks_in_2_page1");
var slidedelay = (1000) ;
var slidespeed = (1000) ;

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

if (cooky == "lzcookyset"){

}

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


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

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

}  // end if cookie exists

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

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



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

});


	return stack;
})(stacks.stacks_in_2_page1);


// Javascript for stacks_in_18_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_18_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_18_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;
	
(function(){var r=false,u=/xyz/.test(function(){})?/\b__super\b/:/.*/,p=function(){},l=this;p.extend=function(a){function b(){!r&&this.__constructor&&this.__constructor.apply(this,arguments)}var d=this.prototype;r=true;var g=new this;r=false;for(var c in a)if(c)g[c]=typeof a[c]=="function"&&typeof d[c]=="function"&&u.test(a[c])?function(i,e){return function(){var h=this.__super;this.__super=d[i];var j=e.apply(this,arguments);this.__super=h;return j}}(c,a[c]):a[c];b.prototype=g;b.constructor=b;b.extend=
arguments.callee;return b};p=p.extend({loop:function(a,b){var d=this;if(typeof a=="number")a=Array(a);jQuery.each(a,function(g,c){b.call(d,c,g)});return a},create:function(a,b){a=a||"div";var d=document.createElement(a);if(b)d.className=b;return d},getElements:function(a){var b={};this.loop(jQuery(a),this.proxy(function(d){this.push(d,b)}));return b},setStyle:function(a,b){jQuery(a).css(b);return this},getStyle:function(a,b,d){a=jQuery(a).css(b);return d?this.parseValue(a):a},cssText:function(a){var b=
document.createElement("style");this.getElements("head")[0].appendChild(b);if(b.styleSheet)b.styleSheet.cssText=a;else{a=document.createTextNode(a);b.appendChild(a)}return this},touch:function(a){var b=a.nextSibling,d=a.parentNode;d.removeChild(a);b?d.insertBefore(a,b):d.appendChild(a);a.styleSheet&&a.styleSheet.imports.length&&this.loop(a.styleSheet.imports,function(g){a.styleSheet.addImport(g.href)})},loadCSS:function(a,b){var d=this.getElements('link[href="'+a+'"]').length;if(d){b.call(null);return d[0]}var g=
this.create("link");g.rel="stylesheet";g.href=a;typeof b=="function"&&this.wait(function(){return!!document.body},function(){var c=this.create("div","galleria-container galleria-stage");this.moveOut(c);document.body.appendChild(c);var i=this.proxy(function(){var h="",j;if(document.defaultView&&document.defaultView.getComputedStyle){j=document.defaultView.getComputedStyle(c,"");this.loop(j,function(k){h+=k+j.getPropertyValue(k)})}else if(c.currentStyle){j=c.currentStyle;this.loop(j,function(k,m){h+=
m+k})}return h}),e=i();this.wait(function(){return i()!==e},function(){document.body.removeChild(c);b.call(g)},function(){f.raise("Could not confirm theme CSS")},2E3)});l.setTimeout(this.proxy(function(){var c=this.getElements('link[rel="stylesheet"],style');c.length?c[0].parentNode.insertBefore(g,c[0]):this.getElements("head")[0].appendChild(g);f.IE&&this.loop(c,function(i){this.touch(i)})}),2);return g},moveOut:function(a){return this.setStyle(a,{position:"absolute",left:"-10000px",display:"block"})},
moveIn:function(a){return this.setStyle(a,{left:"0"})},reveal:function(a){return jQuery(a).show()},hide:function(a){return jQuery(a).hide()},mix:function(){return jQuery.extend.apply(jQuery,arguments)},proxy:function(a,b){if(typeof a!=="function")return function(){};b=b||this;return function(){return a.apply(b,Array.prototype.slice.call(arguments))}},listen:function(a,b,d){jQuery(a).bind(b,d)},forget:function(a,b,d){jQuery(a).unbind(b,d)},dispatch:function(a,b){jQuery(a).trigger(b)},clone:function(a,
b){b=b||false;return jQuery(a).clone(b)[0]},removeAttr:function(a,b){this.loop(b.split(" "),function(d){jQuery(a).removeAttr(d)})},push:function(a,b){if(typeof b.length=="undefined")b.length=0;Array.prototype.push.call(b,a);return a},width:function(a,b){return this.meassure(a,b,"Width")},height:function(a,b){return this.meassure(a,b,"Height")},meassure:function(a,b,d){var g=jQuery(a),c=b?g["outer"+d](true):g[d.toLowerCase()]();if(f.QUIRK)this.loop(d=="Width"?["left","right"]:["top","bottom"],function(i){c+=
g.css("border-"+i+"-width").replace(/[^\d]/g,"")*1;c+=g.css("padding-"+i).replace(/[^\d]/g,"")*1});return c},toggleClass:function(a,b,d){if(typeof d!=="undefined"){d=d?"addClass":"removeClass";jQuery(a)[d](b);return this}jQuery(a).toggleClass(b);return this},hideAll:function(a){jQuery(a).find("*").hide()},animate:function(a,b){b.complete=this.proxy(b.complete);var d=jQuery(a);if(d.length){b.from&&d.css(from);d.animate(b.to,{duration:b.duration||400,complete:b.complete,easing:b.easing||"swing"})}},
wait:function(a,b,d,g){a=this.proxy(a);b=this.proxy(b);d=this.proxy(d);var c=(new Date).getTime()+(g||3E3);l.setTimeout(function(){if(a()){b();return false}if((new Date).getTime()>=c){d();b();return false}l.setTimeout(arguments.callee,2)},2);return this},loadScript:function(a,b){var d=document.createElement("script");d.src=a;d.async=true;var g=false,c=this;d.onload=d.onreadystatechange=function(){if(!g&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){g=true;typeof b=="function"&&
b.call(c,this);d.onload=d.onreadystatechange=null}};var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(d,i);return this},parseValue:function(a){if(typeof a=="number")return a;else if(typeof a=="string")return(a=a.match(/\-?\d/g))&&a.constructor==Array?a.join("")*1:0;else return 0}});var q=p.extend({__constructor:function(a){this.image=null;this.elem=this.create("div","galleria-image");this.setStyle(this.elem,{overflow:"hidden",position:"relative"});this.order=a;this.orig={w:0,
h:0,r:1}},cache:{},ready:false,add:function(a){if(this.cache[a])return this.cache[a];var b=new Image;b.src=a;this.setStyle(b,{display:"block"});if(b.complete&&b.width)return this.cache[a]=b;b.onload=function(d){return function(){d.cache[a]=b}}(this);return b},isCached:function(a){return this.cache[a]?this.cache[a].complete:false},make:function(a){return this.clone(this.cache[a]||this.add(a))},load:function(a,b){b=this.proxy(b);this.elem.innerHTML="";this.image=this.make(a);this.moveOut(this.image);
this.elem.appendChild(this.image);this.wait(function(){return this.image.complete&&this.image.width},function(){this.orig={h:this.h||this.image.height,w:this.w||this.image.width};b({target:this.image,scope:this})},function(){f.raise("image not loaded in 20 seconds: "+a)},2E4);return this},scale:function(a){var b=this.mix({width:0,height:0,min:undefined,max:undefined,margin:0,complete:function(){},position:"center",crop:false},a);if(!this.image)return this;var d,g;this.wait(function(){d=b.width||this.width(this.elem);
g=b.height||this.height(this.elem);return d&&g},function(){var c=(d-b.margin*2)/this.orig.w,i=(g-b.margin*2)/this.orig.h;c={"true":Math.max(c,i),width:c,height:i,"false":Math.min(c,i)}[b.crop.toString()];if(b.max)c=Math.min(b.max,c);if(b.min)c=Math.max(b.min,c);this.setStyle(this.elem,{width:d,height:g});this.image.width=Math.ceil(this.orig.w*c);this.image.height=Math.ceil(this.orig.h*c);c=this.proxy(function(k,m,o){var n=0;if(/\%/.test(k)){k=parseInt(k)/100;n=Math.ceil(this.image[m]*-1*k+o*k)}else n=
parseInt(k);return n});var e={top:{top:0},left:{left:0},right:{left:"100%"},bottom:{top:"100%"}},h={},j={};this.loop(b.position.toLowerCase().split(" "),function(k,m){if(k=="center")k="50%";h[m?"top":"left"]=k});this.loop(h,function(k){if(e.hasOwnProperty(k))j=this.mix(j,e[k])});h=h.top?this.mix(h,j):j;h=this.mix({top:"50%",left:"50%"},h);this.setStyle(this.image,{position:"relative",top:c(h.top,"height",g),left:c(h.left,"width",d)});this.ready=true;b.complete.call(this)});return this}}),f=l.Galleria=
p.extend({__constructor:function(a){this.theme=undefined;this.options=a;this.playing=false;this.playtime=5E3;this.active=null;this.queue={};this.data={};this.dom={};var b=this.keyboard={keys:{UP:38,DOWN:40,LEFT:37,RIGHT:39,RETURN:13,ESCAPE:27,BACKSPACE:8},map:{},bound:false,press:this.proxy(function(e){var h=e.keyCode||e.which;b.map[h]&&typeof b.map[h]=="function"&&b.map[h].call(this,e)}),attach:this.proxy(function(e){for(var h in e){var j=h.toUpperCase();if(b.keys[j])b.map[b.keys[j]]=e[h]}if(!b.bound){b.bound=
true;this.listen(document,"keydown",b.press)}}),detach:this.proxy(function(){b.bound=false;this.forget(document,"keydown",b.press)})};this.timeouts={trunk:{},add:function(e,h,j,k){k=k||false;this.clear(e);if(k){var m=this,o=h;h=function(){o();m.add(e,h,j)}}this.trunk[e]=l.setTimeout(h,j)},clear:function(e){if(e&&this.trunk[e]){l.clearTimeout(this.trunk[e]);delete this.trunk[e]}else if(typeof e=="undefined")for(var h in this.trunk){l.clearTimeout(this.trunk[h]);delete this.trunk[h]}}};this.controls=
{0:null,1:null,active:0,swap:function(){this.active=this.active?0:1},getActive:function(){return this[this.active]},getNext:function(){return this[Math.abs(this.active-1)]}};var d=this.fullscreen={scrolled:0,enter:this.proxy(function(){this.toggleClass(this.get("container"),"fullscreen");d.scrolled=jQuery(l).scrollTop();this.loop(d.getElements(),function(h,j){d.styles[j]=h.getAttribute("style");h.removeAttribute("style")});this.setStyle(d.getElements(0),{position:"fixed",top:0,left:0,width:"100%",
height:"100%",zIndex:1E4});var e={height:"100%",overflow:"hidden",margin:0,padding:0};this.setStyle(d.getElements(1),e);this.setStyle(d.getElements(2),e);this.attachKeyboard({escape:this.exitFullscreen,right:this.next,left:this.prev});this.rescale(this.proxy(function(){this.trigger(f.FULLSCREEN_ENTER)}));this.listen(l,"resize",d.scale)}),scale:this.proxy(function(){this.rescale()}),exit:this.proxy(function(){this.toggleClass(this.get("container"),"fullscreen",false);if(d.styles.length){this.loop(d.getElements(),
function(e,h){e.removeAttribute("style");e.setAttribute("style",d.styles[h])});l.scrollTo(0,d.scrolled);this.detachKeyboard();this.rescale(this.proxy(function(){this.trigger(f.FULLSCREEN_EXIT)}));this.forget(l,"resize",d.scale)}}),styles:[],getElements:this.proxy(function(e){var h=[this.get("container"),document.body,this.getElements("html")[0]];return e?h[e]:h})},g=this.idle={trunk:[],bound:false,add:this.proxy(function(e,h,j){if(e){g.bound||g.addEvent();e=jQuery(e);var k={},m;for(m in h)k[m]=e.css(m);
e.data("idle",{from:k,to:h,complete:true,busy:false,fn:this.proxy(j)});g.addTimer();g.trunk.push(e)}}),remove:this.proxy(function(e){e=jQuery(e);this.loop(g.trunk,function(h,j){if(h&&!h.not(e).length){g.show(e);g.trunk.splice(j,1)}});if(!g.trunk.length){g.removeEvent();this.clearTimer("idle")}}),addEvent:this.proxy(function(){g.bound=true;this.listen(this.get("container"),"mousemove click",g.showAll)}),removeEvent:this.proxy(function(){g.bound=false;this.forget(this.get("container"),"mousemove click",
g.showAll)}),addTimer:this.proxy(function(){this.addTimer("idle",this.proxy(function(){g.hide()}),this.options.idle_time)}),hide:this.proxy(function(){this.trigger(f.IDLE_ENTER);this.loop(g.trunk,function(e){var h=e.data("idle");h.complete=false;h.fn();e.animate(h.to,{duration:600,queue:false,easing:"swing"})})}),showAll:this.proxy(function(){this.clearTimer("idle");this.loop(g.trunk,function(e){g.show(e)})}),show:this.proxy(function(e){var h=e.data("idle");if(!h.busy&&!h.complete){h.busy=true;this.trigger(f.IDLE_EXIT);
e.animate(h.from,{duration:300,queue:false,easing:"swing",complete:function(){$(this).data("idle").busy=false;$(this).data("idle").complete=true}})}g.addTimer()})},c=this.lightbox={w:0,h:0,initialized:false,active:null,init:this.proxy(function(){if(!c.initialized){c.initialized=true;this.loop("lightbox-overlay lightbox-box lightbox-content lightbox-shadow lightbox-title lightbox-info lightbox-close lightbox-prev lightbox-next lightbox-counter".split(" "),function(e){this.addElement(e);c[e.split("-")[1]]=
this.get(e)});c.image=new Galleria.Picture;this.append({"lightbox-box":["lightbox-shadow","lightbox-content","lightbox-close"],"lightbox-info":["lightbox-title","lightbox-counter","lightbox-next","lightbox-prev"],"lightbox-content":["lightbox-info"]});document.body.appendChild(c.overlay);document.body.appendChild(c.box);c.content.appendChild(c.image.elem);c.close.innerHTML="&#215;";c.prev.innerHTML="&#9668;";c.next.innerHTML="&#9658;";this.listen(c.close,"click",c.hide);this.listen(c.overlay,"click",
c.hide);this.listen(c.next,"click",c.showNext);this.listen(c.prev,"click",c.showPrev);if(this.options.lightbox_clicknext){this.setStyle(c.image.elem,{cursor:"pointer"});this.listen(c.image.elem,"click",c.showNext)}this.setStyle(c.overlay,{position:"fixed",display:"none",opacity:this.options.overlay_opacity,top:0,left:0,width:"100%",height:"100%",background:this.options.overlay_background,zIndex:99990});this.setStyle(c.box,{position:"fixed",display:"none",width:400,height:400,top:"50%",left:"50%",
marginTop:-200,marginLeft:-200,zIndex:99991});this.setStyle(c.shadow,{background:"#000",opacity:0.4,width:"100%",height:"100%",position:"absolute"});this.setStyle(c.content,{backgroundColor:"#fff",position:"absolute",top:10,left:10,right:10,bottom:10,overflow:"hidden"});this.setStyle(c.info,{color:"#444",fontSize:"11px",fontFamily:"arial,sans-serif",height:13,lineHeight:"13px",position:"absolute",bottom:10,left:10,right:10,opacity:0});this.setStyle(c.close,{background:"#fff",height:20,width:20,position:"absolute",
textAlign:"center",cursor:"pointer",top:10,right:10,lineHeight:"22px",fontSize:"16px",fontFamily:"arial,sans-serif",color:"#444",zIndex:99999});this.setStyle(c.image.elem,{top:10,left:10,right:10,bottom:30,position:"absolute"});this.loop("title prev next counter".split(" "),function(e){var h={display:"inline","float":"left"};if(e!="title"){this.mix(h,{"float":"right"});e!="counter"?this.mix(h,{cursor:"pointer"}):this.mix(h,{marginLeft:8})}this.setStyle(c[e],h)});this.loop("prev next close".split(" "),
function(e){this.listen(c[e],"mouseover",this.proxy(function(){this.setStyle(c[e],{color:"#000"})}));this.listen(c[e],"mouseout",this.proxy(function(){this.setStyle(c[e],{color:"#444"})}))});this.trigger(f.LIGHTBOX_OPEN)}}),rescale:this.proxy(function(e){var h=Math.min(this.width(l),c.w),j=Math.min(this.height(l),c.h);j=Math.min((h-60)/c.w,(j-80)/c.h);h=c.w*j+40;j=c.h*j+60;h={width:h,height:j,marginTop:Math.ceil(j/2)*-1,marginLeft:Math.ceil(h)/2*-1};e?this.setStyle(c.box,h):this.animate(c.box,{to:h,
duration:this.options.lightbox_transition_speed,easing:"galleria",complete:function(){this.trigger({type:f.LIGHTBOX_IMAGE,imageTarget:c.image.image});this.moveIn(c.image.image);this.animate(c.image.image,{to:{opacity:1},duration:this.options.lightbox_fade_speed});this.animate(c.info,{to:{opacity:1},duration:this.options.lightbox_fade_speed})}})}),hide:this.proxy(function(){c.image.image=null;this.forget(l,"resize",c.rescale);this.hide(c.box);this.setStyle(c.info,{opacity:0});this.animate(c.overlay,
{to:{opacity:0},duration:200,complete:function(){this.hide(c.overlay);this.setStyle(c.overlay,{opacity:this.options.overlay_opacity});this.trigger(f.LIGHTBOX_CLOSE)}})}),showNext:this.proxy(function(){c.show(this.getNext(c.active))}),showPrev:this.proxy(function(){c.show(this.getPrev(c.active))}),show:this.proxy(function(e){c.initialized||c.init();this.forget(l,"resize",c.rescale);e=typeof e=="number"?e:this.getIndex();c.active=e;var h=this.getData(e),j=this.data.length;this.setStyle(c.info,{opacity:0});
c.image.load(h.image,function(k){c.w=k.scope.orig.w;c.h=k.scope.orig.h;this.setStyle(k.target,{width:"100.5%",height:"100.5%",top:0,zIndex:99998,opacity:0});c.title.innerHTML=h.title;c.counter.innerHTML=e+1+" / "+j;this.listen(l,"resize",c.rescale);c.rescale()});this.reveal(c.overlay);this.reveal(c.box)})};this.thumbnails={width:0};this.stageHeight=this.stageWidth=0;var i="container stage images image-nav image-nav-left image-nav-right info info-text info-title info-description info-author thumbnails thumbnails-list thumbnails-container thumb-nav-left thumb-nav-right loader counter";
i=i.split(" ");this.loop(i,function(e){this.dom[e]=this.create("div","galleria-"+e)});(this.target=this.dom.target=a.target.nodeName?a.target:this.getElements(a.target)[0])||f.raise("Target not found.")},init:function(){this.options=this.mix(f.theme.defaults,this.options);var a=this.options=this.mix({autoplay:false,carousel:true,carousel_follow:true,carousel_speed:400,carousel_steps:"auto",clicknext:false,data_config:function(){return{}},data_image_selector:"img",data_source:this.target,data_type:"auto",
debug:false,extend:function(){},height:"auto",idle_time:3E3,image_crop:false,image_margin:0,image_pan:false,image_pan_smoothness:12,image_position:"50%",keep_source:false,lightbox_clicknext:true,lightbox_fade_speed:200,lightbox_transition_speed:300,link_source_images:true,max_scale_ratio:undefined,min_scale_ratio:undefined,on_image:function(){},overlay_opacity:0.85,overlay_background:"#0b0b0b",popup_links:false,preload:2,queue:true,show:0,show_info:true,show_counter:true,show_imagenav:true,thumb_crop:true,
thumb_fit:true,thumb_margin:0,thumb_quality:"auto",thumbnails:true,transition:f.transitions.fade,transition_speed:400},this.options);this.bind(f.DATA,function(){this.run()});if(a.clicknext){this.loop(this.data,function(b){delete b.link});this.setStyle(this.get("stage"),{cursor:"pointer"});this.listen(this.get("stage"),"click",this.proxy(function(){this.next()}))}this.bind(f.IMAGE,function(b){a.on_image.call(this,b.imageTarget,b.thumbTarget)});this.bind(f.READY,function(){f.History&&f.History.change(this.proxy(function(b){b=
parseInt(b.value.replace(/\//,""));isNaN(b)?l.history.go(-1):this.show(b,undefined,true)}));f.theme.init.call(this,a);a.extend.call(this,a);if(/^[0-9]{1,4}$/.test(s)&&f.History)this.show(s,undefined,true);else typeof a.show=="number"&&this.show(a.show);if(a.autoplay){if(typeof a.autoplay=="number")this.playtime=a.autoplay;this.trigger(f.PLAY);this.playing=true}});this.load();return this},bind:function(a,b){this.listen(this.get("container"),a,this.proxy(b));return this},unbind:function(a){this.forget(this.get("container"),
a)},trigger:function(a){a=typeof a=="object"?this.mix(a,{scope:this}):{type:a,scope:this};this.dispatch(this.get("container"),a);return this},addIdleState:function(){this.idle.add.apply(this,arguments);return this},removeIdleState:function(){this.idle.remove.apply(this,arguments);return this},enterIdleMode:function(){this.idle.hide();return this},exitIdleMode:function(){this.idle.show();return this},addTimer:function(){this.timeouts.add.apply(this.timeouts,arguments);return this},clearTimer:function(){this.timeouts.clear.apply(this.timeouts,
arguments);return this},enterFullscreen:function(){this.fullscreen.enter.apply(this,arguments);return this},exitFullscreen:function(){this.fullscreen.exit.apply(this,arguments);return this},openLightbox:function(){this.lightbox.show.apply(this,arguments)},closeLightbox:function(){this.lightbox.hide.apply(this,arguments)},getActive:function(){return this.controls.getActive()},getActiveImage:function(){return this.getActive().image||null},run:function(){var a=this.options;this.data.length||f.raise("Data is empty.");
if(!a.keep_source&&!Galleria.IE)this.target.innerHTML="";this.loop(2,function(){var e=new q;this.setStyle(e.elem,{position:"absolute",top:0,left:0});this.setStyle(this.get("images"),{position:"relative",top:0,left:0,width:"100%",height:"100%"});this.get("images").appendChild(e.elem);this.push(e,this.controls)},this);a.carousel&&this.bind(f.THUMBNAIL,this.parseCarousel);this.build();this.target.appendChild(this.get("container"));this.loop(["info","counter","image-nav"],function(e){a["show_"+e.replace(/-/,
"")]===false&&this.moveOut(this.get(e))});for(var b=0,d=0,g=0;this.data[g];g++){var c;if(a.thumbnails===true){c=new q(g);var i=this.data[g].thumb||this.data[g].image;this.get("thumbnails").appendChild(c.elem);b=this.getStyle(c.elem,"width",true);d=this.getStyle(c.elem,"height",true);a.thumb_fit&&a.thum_crop!==true&&this.setStyle(c.elem,{width:0,height:0});c.load(i,this.proxy(function(e){var h=e.target.width;e.scope.scale({width:b,height:d,crop:a.thumb_crop,margin:a.thumb_margin,complete:this.proxy(function(){var j=
["left","top"],k=["Height","Width"];this.loop(k,function(m,o){if((!a.thumb_crop||a.thumb_crop==m.toLowerCase())&&a.thumb_fit){var n={},t=k[Math.abs(o-1)].toLowerCase();n[t]=e.target[t];this.setStyle(e.target.parentNode,n);n={};n[j[o]]=0;this.setStyle(e.target,n)}e.scope["outer"+m]=this[m.toLowerCase()](e.target.parentNode,true)});this.toggleQuality(e.target,a.thumb_quality===true||a.thumb_quality=="auto"&&h<e.target.width*3);this.trigger({type:f.THUMBNAIL,thumbTarget:e.target,thumbOrder:e.scope.order})})})}));
a.preload=="all"&&c.add(this.data[g].image)}else if(a.thumbnails=="empty"){c={elem:this.create("div","galleria-image"),image:this.create("span","img")};c.elem.appendChild(c.image);this.get("thumbnails").appendChild(c.elem)}else c={elem:false,image:false};i=this.proxy(function(e){this.pause();e.preventDefault();e=e.currentTarget.rel;this.active!==e&&this.show(e)});if(a.thumbnails!==false){c.elem.rel=g;this.listen(c.elem,"click",i)}if(a.link_source_images&&a.keep_source&&this.data[g].elem){this.data[g].elem.rel=
g;this.listen(this.data[g].elem,"click",i)}this.push(c,this.thumbnails)}this.setStyle(this.get("thumbnails"),{opacity:0});a.height&&a.height!="auto"&&this.setStyle(this.get("container"),{height:a.height});this.wait(function(){this.getStyle(this.get("container"),"height",true);this.stageWidth=this.width(this.get("stage"));this.stageHeight=this.height(this.get("stage"));if(this.stageHeight<50&&a.height=="auto"){this.setStyle(this.get("container"),{height:Math.round(this.stageWidth*9/16)});this.stageHeight=
this.height(this.get("stage"))}return this.stageHeight&&this.stageWidth},function(){this.listen(this.get("image-nav-right"),"click",this.proxy(function(e){a.clicknext&&e.stopPropagation();this.pause();this.next()}));this.listen(this.get("image-nav-left"),"click",this.proxy(function(e){a.clicknext&&e.stopPropagation();this.pause();this.prev()}));this.setStyle(this.get("thumbnails"),{opacity:1});this.trigger(f.READY)},function(){f.raise("Galleria could not load properly. Make sure stage has a height and width.")},
5E3)},mousePosition:function(a){return{x:a.pageX-this.$("stage").offset().left+jQuery(document).scrollLeft(),y:a.pageY-this.$("stage").offset().top+jQuery(document).scrollTop()}},addPan:function(a){if(this.options.image_crop!==false)if(this.options.image_crop!==false){a=a||this.controls.getActive().image;a.tagName.toUpperCase()!="IMG"&&f.raise("Could not add pan");var b=a.width/2,d=a.height/2,g=destX=this.getStyle(a,"left",true)||0,c=destY=this.getStyle(a,"top",true)||0,i=0,e=0,h=false,j=(new Date).getTime(),
k=this.proxy(function(o){if(!((new Date).getTime()-j<50)){h=true;b=this.mousePosition(o).x;d=this.mousePosition(o).y}}),m=this.proxy(function(){if(h){i=a.width-this.stageWidth;e=a.height-this.stageHeight;destX=b/this.stageWidth*i*-1;destY=d/this.stageHeight*e*-1;g+=(destX-g)/this.options.image_pan_smoothness;c+=(destY-c)/this.options.image_pan_smoothness;e>0&&this.setStyle(a,{top:Math.max(e*-1,Math.min(0,c))});i>0&&this.setStyle(a,{left:Math.max(i*-1,Math.min(0,g))})}});this.forget(this.get("stage"),
"mousemove");this.listen(this.get("stage"),"mousemove",k);this.addTimer("pan",m,30,true)}},removePan:function(){this.forget(this.get("stage"),"mousemove");this.clearTimer("pan")},parseCarousel:function(){var a=0,b=0,d=[0];this.loop(this.thumbnails,function(g,c){if(g.ready){a+=g.outerWidth||this.width(g.elem,true);d[c+1]=a;b=Math.max(b,this.height(g.elem))}});this.toggleClass(this.get("thumbnails-container"),"galleria-carousel",a>this.stageWidth);this.setStyle(this.get("thumbnails-list"),{overflow:"hidden",
position:"relative"});this.setStyle(this.get("thumbnails"),{width:a,height:b,position:"relative",overflow:"hidden"});this.carousel||this.initCarousel();this.carousel.max=a;this.carousel.hooks=d;this.carousel.width=this.width(this.get("thumbnails-list"));this.carousel.setClasses()},initCarousel:function(){var a=this.carousel={right:this.get("thumb-nav-right"),left:this.get("thumb-nav-left"),update:this.proxy(function(){this.parseCarousel()}),width:0,current:0,set:function(b){for(b=Math.max(b,0);a.hooks[b-
1]+a.width>a.max&&b>=0;)b--;a.current=b;a.animate()},hooks:[],getLast:function(b){b=b||a.current;return b-1},follow:function(b){if(b==0||b==a.hooks.length-2)a.set(b);else{for(var d=a.current;a.hooks[d]-a.hooks[a.current]<a.width&&d<=a.hooks.length;)d++;if(b-1<a.current)a.set(b-1);else b+2>d&&a.set(b-d+a.current+2)}},max:0,setClasses:this.proxy(function(){this.toggleClass(a.left,"disabled",!a.current);this.toggleClass(a.right,"disabled",a.hooks[a.current]+a.width>a.max)}),animate:this.proxy(function(){a.setClasses();
this.animate(this.get("thumbnails"),{to:{left:a.hooks[a.current]*-1},duration:this.options.carousel_speed,easing:"galleria",queue:false})})};this.listen(a.right,"click",this.proxy(function(){if(this.options.carousel_steps=="auto")for(var b=a.current;b<a.hooks.length;b++){if(a.hooks[b]-a.hooks[a.current]>a.width){a.set(b-2);break}}else a.set(a.current+this.options.carousel_steps)}));this.listen(a.left,"click",this.proxy(function(){if(this.options.carousel_steps=="auto")for(var b=a.current;b>=0;b--)if(a.hooks[a.current]-
a.hooks[b]>a.width){a.set(b+2);break}else{if(b==0){a.set(0);break}}else a.set(a.current-this.options.carousel_steps)}))},addElement:function(){this.loop(arguments,function(a){this.dom[a]=this.create("div","galleria-"+a)});return this},getDimensions:function(a){return{w:a.width,h:a.height,cw:this.stageWidth,ch:this.stageHeight,top:(this.stageHeight-a.height)/2,left:(this.stageWidth-a.width)/2}},attachKeyboard:function(a){this.keyboard.attach(a);return this},detachKeyboard:function(){this.keyboard.detach();
return this},build:function(){this.append({"info-text":["info-title","info-description","info-author"],info:["info-text"],"image-nav":["image-nav-right","image-nav-left"],stage:["images","loader","counter","image-nav"],"thumbnails-list":["thumbnails"],"thumbnails-container":["thumb-nav-left","thumbnails-list","thumb-nav-right"],container:["stage","thumbnails-container","info"]});this.current=this.create("span","current");this.current.innerHTML="-";this.get("counter").innerHTML=' / <span class="total">'+
this.data.length+"</span>";this.prependChild("counter",this.current)},appendChild:function(a,b){try{this.get(a).appendChild(this.get(b))}catch(d){}},prependChild:function(a,b){b=this.get(b)||b;try{this.get(a).insertBefore(b,this.get(a).firstChild)}catch(d){}},remove:function(){this.jQuery(Array.prototype.slice.call(arguments).join(",")).remove()},append:function(a){for(var b in a)if(a[b].constructor==Array)for(var d=0;a[b][d];d++)this.appendChild(b,a[b][d]);else this.appendChild(b,a[b]);return this},
rescale:function(a,b,d){var g=this.options;d=this.proxy(d);if(typeof a=="function"){d=this.proxy(a);a=undefined}var c=this.proxy(function(){this.stageWidth=a||this.width(this.get("stage"));this.stageHeight=b||this.height(this.get("stage"));this.controls.getActive().scale({width:this.stageWidth,height:this.stageHeight,crop:g.image_crop,max:g.max_scale_ratio,min:g.min_scale_ratio,margin:g.image_margin,position:g.image_position});this.carousel&&this.carousel.update();this.trigger(f.RESCALE);d()});f.WEBKIT&&
!a&&!b?this.addTimer("scale",c,5):c.call(this)},show:function(a,b,d){if(!(!this.options.queue&&this.queue.stalled)){b=typeof b!="undefined"?!!b:a<this.active;d=d||false;a=Math.max(0,Math.min(parseInt(a),this.data.length-1));if(!d&&f.History)f.History.value(a.toString());else{this.active=a;this.push([a,b],this.queue);this.queue.stalled||this.showImage();return this}}},showImage:function(){var a=this.options,b=this.queue[0],d=b[0],g=!!b[1];a.carousel&&this.carousel&&a.carousel_follow&&this.carousel.follow(d);
b=this.getData(d).image;var c=this.controls.getActive(),i=this.controls.getNext(),e=i.isCached(b),h=this.proxy(function(){this.queue.stalled=false;this.toggleQuality(i.image,a.image_quality);this.setStyle(c.elem,{zIndex:0});this.setStyle(i.elem,{zIndex:1});this.trigger({type:f.IMAGE,index:d,imageTarget:i.image,thumbTarget:this.thumbnails[d].image});a.image_pan&&this.addPan(i.image);this.controls.swap();this.moveOut(c.image);if(this.getData(d).link){this.setStyle(i.image,{cursor:"pointer"});this.listen(i.image,
"click",this.proxy(function(){if(a.popup_links)l.open(this.getData(d).link,"_blank");else l.location.href=this.getData(d).link}))}Array.prototype.shift.call(this.queue);this.queue.length&&this.showImage();this.playCheck()});if(typeof a.preload=="number"&&a.preload>0){var j,k=this.getNext();try{for(var m=a.preload;m>0;m--){j=new q;j.add(this.getData(k).image);k=this.getNext(k)}}catch(o){}}this.trigger({type:f.LOADSTART,cached:e,index:d,imageTarget:i.image,thumbTarget:this.thumbnails[d].image});jQuery(this.thumbnails[d].elem).addClass("active").siblings(".active").removeClass("active");
i.load(b,this.proxy(function(){i.scale({width:this.stageWidth,height:this.stageHeight,crop:a.image_crop,max:a.max_scale_ratio,min:a.min_scale_ratio,margin:a.image_margin,position:a.image_position,complete:this.proxy(function(){c.image&&this.toggleQuality(c.image,false);this.toggleQuality(i.image,false);this.trigger({type:f.LOADFINISH,cached:e,index:d,imageTarget:i.image,thumbTarget:this.thumbnails[d].image});this.queue.stalled=true;var n=f.transitions[a.transition]||a.transition;this.removePan();
this.setInfo(d);this.setCounter(d);typeof n=="function"?n.call(this,{prev:c.image,next:i.image,rewind:g,speed:a.transition_speed||400},h):h()})})}))},getNext:function(a){a=typeof a=="number"?a:this.active;return a==this.data.length-1?0:a+1},getPrev:function(a){a=typeof a=="number"?a:this.active;return a===0?this.data.length-1:a-1},next:function(){this.data.length>1&&this.show(this.getNext(),false);return this},prev:function(){this.data.length>1&&this.show(this.getPrev(),true);return this},get:function(a){return a in
this.dom?this.dom[a]:null},getData:function(a){return this.data[a]||this.data[this.active]},getIndex:function(){return typeof this.active==="number"?this.active:0},play:function(a){this.trigger(f.PLAY);this.playing=true;this.playtime=a||this.playtime;this.playCheck();return this},pause:function(){this.trigger(f.PAUSE);this.playing=false;return this},playCheck:function(){var a=0,b=(new Date).getTime();if(this.playing){this.clearTimer("play");var d=this.proxy(function(){a=(new Date).getTime()-b;if(a>=
this.playtime&&this.playing){this.clearTimer("play");this.next()}else if(this.playing){this.trigger({type:f.PROGRESS,percent:Math.ceil(a/this.playtime*100),seconds:Math.floor(a/1E3),milliseconds:a});this.addTimer("play",d,20)}});this.addTimer("play",d,20)}},setActive:function(a){this.active=a;return this},setCounter:function(a){a=a||this.active;this.current.innerHTML=a+1;return this},setInfo:function(a){var b=this.getData(a||this.active);this.loop(["title","description","author"],function(d){var g=
this.get("info-"+d);this[b[d]&&b[d].length?"reveal":"hide"](g);if(b[d])g.innerHTML=b[d]});return this},hasInfo:function(a){a=this.getData(a);for(var b="title description author".split(" "),d=0;b[d];d++)if(a[b[d]]&&a[b[d]].length)return true;return false},getDataObject:function(a){var b={image:"",thumb:"",title:"",description:"",author:"",link:""};return a?this.mix(b,a):b},jQuery:function(a){var b=[];this.loop(a.split(","),this.proxy(function(g){g=g.replace(/^\s\s*/,"").replace(/\s\s*$/,"");this.get(g)&&
b.push(g)}));var d=jQuery(this.get(b.shift()));this.loop(b,this.proxy(function(g){d=d.add(this.get(g))}));return d},$:function(a){return this.jQuery(a)},toggleQuality:function(a,b){if(!f.IE7||typeof a=="undefined"||!a)return this;if(typeof b==="undefined")b=a.style.msInterpolationMode=="nearest-neighbor";a.style.msInterpolationMode=b?"bicubic":"nearest-neighbor";return this},unload:function(){},load:function(){var a=0,b=this.options;if(b.data_type=="auto"&&typeof b.data_source=="object"&&!(b.data_source instanceof
jQuery)&&!b.data_source.tagName||b.data_type=="json"||b.data_source.constructor==Array){this.data=b.data_source;this.trigger(f.DATA)}else{var d=jQuery(b.data_source).find(b.data_image_selector),g=this.proxy(function(c){var i,e,h=c.parentNode;if(h&&h.nodeName=="A")if(h.href.match(/\.(png|gif|jpg|jpeg)/i))i=h.href;else e=h.href;return this.mix(this.getDataObject({title:c.title,thumb:c.src,image:i||c.src,description:c.alt,link:e||c.getAttribute("longdesc"),elem:c}),b.data_config(c))});this.loop(d,function(c){a++;
this.push(g(c),this.data);!b.keep_source&&!Galleria.IE&&c.parentNode.removeChild(c);a==d.length&&this.trigger(f.DATA)})}}});f.log=function(){try{console.log.apply(console,Array.prototype.slice.call(arguments))}catch(a){try{opera.postError.apply(opera,arguments)}catch(b){alert(Array.prototype.join.call(arguments," "))}}};p=navigator.userAgent.toLowerCase();var s=l.location.hash.replace(/#\//,"");f.DATA="data";f.READY="ready";f.THUMBNAIL="thumbnail";f.LOADSTART="loadstart";f.LOADFINISH="loadfinish";
f.IMAGE="image";f.THEMELOAD="themeload";f.PLAY="play";f.PAUSE="pause";f.PROGRESS="progress";f.FULLSCREEN_ENTER="fullscreen_enter";f.FULLSCREEN_EXIT="fullscreen_exit";f.IDLE_ENTER="idle_enter";f.IDLE_EXIT="idle_exit";f.RESCALE="rescale";f.LIGHTBOX_OPEN="lightbox_open";f.LIGHTBOX_CLOSE="lightbox_cloe";f.LIGHTBOX_IMAGE="lightbox_image";f.IE8=typeof XDomainRequest!=="undefined";f.IE7=!!(l.XMLHttpRequest&&document.expando);f.IE6=!l.XMLHttpRequest;f.IE=!!(f.IE6||f.IE7);f.WEBKIT=/webkit/.test(p);f.SAFARI=
/safari/.test(p);f.CHROME=/chrome/.test(p);f.QUIRK=f.IE&&document.compatMode&&document.compatMode=="BackCompat";f.MAC=/mac/.test(navigator.platform.toLowerCase());f.OPERA=!!l.opera;f.Picture=q;f.addTheme=function(a){var b={},d=f.prototype;d.loop(["name","author","version","defaults","init"],function(c){a[c]||f.raise(c+" not specified in theme.");if(c!="name"&&c!="init")b[c]=a[c]});b.init=a.init;if(a.css){var g;d.loop(d.getElements("script"),function(c){if(RegExp("galleria."+a.name.toLowerCase()+".js").test(c.src)){g=
c.src.replace(/[^\/]*$/,"")+a.css;d.loadCSS(g,function(){f.theme=b;jQuery(document).trigger(f.THEMELOAD)})}});g||f.raise("No theme CSS loaded")}return b};f.raise=function(a){if(f.debug)throw Error(a);};f.loadTheme=function(a){f.prototype.loadScript(a)};f.galleries=[];f.get=function(a){if(f.galleries[a])return f.galleries[a];else if(typeof a!=="number")return f.galleries;else f.raise("Gallery index not found")};jQuery.easing.galleria=function(a,b,d,g,c){if((b/=c/2)<1)return g/2*b*b*b*b+d;return-g/
2*((b-=2)*b*b*b-2)+d};f.transitions={add:function(a,b){if(a!=arguments.callee.name)this[a]=b},fade:function(a,b){jQuery(a.next).show().css("opacity",0).animate({opacity:1},a.speed,b);a.prev&&jQuery(a.prev).css("opacity",1).animate({opacity:0},a.speed)},flash:function(a,b){jQuery(a.next).css("opacity",0);a.prev?jQuery(a.prev).animate({opacity:0},a.speed/2,function(){jQuery(a.next).animate({opacity:1},a.speed,b)}):jQuery(a.next).animate({opacity:1},a.speed,b)},pulse:function(a,b){a.prev&&jQuery(a.prev).css("opacity",
0);jQuery(a.next).css("opacity",0).animate({opacity:1},a.speed,b)},slide:function(a,b){var d=jQuery(a.next).parent(),g=this.$("images"),c=this.stageWidth;d.css({left:c*(a.rewind?-1:1)});g.animate({left:c*(a.rewind?1:-1)},{duration:a.speed,queue:false,easing:"galleria",complete:function(){g.css("left",0);d.css("left",0);b()}})},fadeslide:function(a,b){if(a.prev)jQuery(a.prev).css({opacity:1,left:0}).animate({opacity:0,left:50*(a.rewind?1:-1)},{duration:a.speed,queue:false,easing:"swing"});jQuery(a.next).css({left:50*
(a.rewind?-1:1),opacity:0}).animate({opacity:1,left:0},{duration:a.speed,complete:b,queue:false,easing:"swing"})}};f.addTransition=function(){f.transitions.add.apply(this,arguments)};jQuery.fn.galleria=function(a){a=a||{};return this.each(function(){a.keep_source||jQuery(this).children().hide();a=f.prototype.mix(a,{target:this});var b=f.prototype.height(this)||f.prototype.getStyle(this,"height",true);if(!a.height&&b)a=f.prototype.mix({height:b},a);f.debug=!!a.debug;var d=new f(a);Galleria.galleries.push(d);
f.theme?d.init():jQuery(document).bind(f.THEMELOAD,function(){d.init()})})}})();


/*!
 * Galleria Flickr Plugin v 1.1
 * http://galleria.aino.se
 *
 * Copyright 2010, Aino
 * Licensed under the MIT license.
 */

(function() {
   
var G = window.Galleria; 
if (typeof G == 'undefined') {
    return;
}

var F = G.Flickr = function(api_key) {
    if (!api_key) {
        G.raise('No API key found');
    }
	this.callback = function(){};
	this.api_key = api_key;
	this.options = {
		max: 40,
		size: 'big',
		sort: 'interestingness-desc',
		description: false
	}
}

F.prototype = {
	search: function(str) {
		this._set(arguments);
		return this._find({
			text: str
		});
	},
	getTags: function(str) {
		this._set(arguments);
		return this._find({
			tags: str
		});
	},
	getUser: function(username) {
		var args = arguments;
		return this._call({
			method: 'flickr.urls.lookupUser',
			url: 'flickr.com/photos/'+username
		}, function(data) {
			this._set(args);
			this._find({
				user_id: data.user.id,
				method: 'flickr.people.getPublicPhotos'
			});
		});
	},
	getSet: function(photoset_id) {
		this._set(arguments);
		return this._find({
			photoset_id: photoset_id,
			method: 'flickr.photosets.getPhotos'
		});
	},
	getGallery: function(gallery_id) {
		this._set(arguments);
		return this._find({
			gallery_id: gallery_id,
			method: 'flickr.galleries.getPhotos'
		});
	},
	setOptions: function(options) {
		jQuery.extend(this.options, options);
		return this;
	},
	_set: function(args) {
		args = Array.prototype.slice.call(args);
		this.callback = args[2] || args[1];
		if (typeof args[1] == 'object') {
			this.setOptions(args[1]);
		}
		return this;
	},
	_call: function(params, callback) {
		var url = 'http://api.flickr.com/services/rest/?';
		var scope = this;
		params = jQuery.extend({
			format : 'json',
			jsoncallback : '?',
			api_key: this.api_key
		}, params);
		jQuery.each(params, function(key, value) {
			url += '&'+ key + '=' +value;
		});
		jQuery.getJSON(url, function(data) {
			if (data.stat == 'ok') {
				callback.call(scope, data);
			} else {
				G.raise(data.code.toString() + ' ' + data.stat + ': ' + data.message);
			}
		});
		return scope;
	},
	_find: function(params) {
		params = jQuery.extend({
			method: 'flickr.photos.search',
		    extras: 'url_t, url_m, url_o, url_s, url_l, description',
		    sort: this.options.sort
		}, params);
		
		return this._call(params, function(data) {
			var obj = { length: 0 };
			var photos = data.photos ? data.photos.photo : data.photoset.photo;
			var len = Math.min(this.options.max, photos.length);
			var loaded = 0;
		    
			for (var i=0; i<len; i++) {
    		    var photo = photos[i],
    		        img = photo.url_m;
    		    switch(this.options.size) {
    		        case 'small':
    		            img = photo.url_s;
    		            break;
    		        case ( 'big' || 'large' ):
    		            if (photo.url_l) {
    		                img = photo.url_l;
    		            } else if (parseInt(photo.width_o) > 1280) {
    		                img = 'http://farm'+photo['farm']+'.static.flickr.com/'+photo['server']+
    		                      '/'+photo['id']+'_' + photo['secret'] + '_b.jpg';
                            
    		            } else if(photo.url_o) {
    		                img = photo.url_o;
    		            }
    		            break;
    		        case 'original':
    		            if(photo.url_o) {
    		                img = photo.url_o;
    		            }
    		            break;    
    		    }
                var item = {
    				thumb: photos[i].url_t,
    				image: img,
    				title: photos[i].title,
    				description: this.options.description && photos[i].description ? photos[i].description._content : ''
    			};
    			Array.prototype.push.call(obj, item);
			}
			this.callback.call(this, obj);
		});
	}
}


// Static
F.getFeed = function(type, params) {
	
}

})();


jQuery(document).ready(function($) {
	
	var flickr = new Galleria.Flickr(stacks.stacks_in_18_page1.flickr_api);		
	flickr.setOptions({	max:stacks.stacks_in_18_page1.num_images, size:stacks.stacks_in_18_page1.image_size_value,  description:(stacks.stacks_in_18_page1.flickr_description=='true') });
	if (stacks.stacks_in_18_page1.flickr_set!='') {	
		flickr.getSet(stacks.stacks_in_18_page1.flickr_set, function(data) {
			jQuery('#gallery').galleria({
				autoplay: parseInt(stacks.stacks_in_18_page1.autoplay_value),
				image_crop: (stacks.stacks_in_18_page1.image_crop_value=='true'),
				image_pan: (stacks.stacks_in_18_page1.image_pan_value=='true'),
				transition: stacks.stacks_in_18_page1.transition_value,
				transition_speed: parseInt(stacks.stacks_in_18_page1.transition_speed_value),
				show_info: (stacks.stacks_in_18_page1.show_info_value=='true'),
				show_counter: (stacks.stacks_in_18_page1.show_counter_value=='true'),
				data_source: data,
				data_config: function(img) {           
					return  {
						title: $(img).parent().children("strong").html(),
						description: $(img).parent().children("span").html()
					};
				}
			});
		});
	}
	
	else if (stacks.stacks_in_18_page1.flickr_search!='') {	
		flickr.search(stacks.stacks_in_18_page1.flickr_search, function(data) {
			jQuery('#gallery').galleria({
				autoplay: parseInt(stacks.stacks_in_18_page1.autoplay_value),
				image_crop: (stacks.stacks_in_18_page1.image_crop_value=='true'),
				image_pan: (stacks.stacks_in_18_page1.image_pan_value=='true'),
				transition: stacks.stacks_in_18_page1.transition_value,
				transition_speed: parseInt(stacks.stacks_in_18_page1.transition_speed_value),
				show_info: (stacks.stacks_in_18_page1.show_info_value=='true'),
				show_counter: (stacks.stacks_in_18_page1.show_counter_value=='true'),
				data_source: data,
				data_config: function(img) {           
					return  {
						title: $(img).parent().children("strong").html(),
						description: $(img).parent().children("span").html()
					};
				}
			});
		});
	}
	
	else if (stacks.stacks_in_18_page1.flickr_tags!='') {	
		flickr.getTags(stacks.stacks_in_18_page1.flickr_tags, function(data) {
			jQuery('#gallery').galleria({
				autoplay: parseInt(stacks.stacks_in_18_page1.autoplay_value),
				image_crop: (stacks.stacks_in_18_page1.image_crop_value=='true'),
				image_pan: (stacks.stacks_in_18_page1.image_pan_value=='true'),
				transition: stacks.stacks_in_18_page1.transition_value,
				transition_speed: parseInt(stacks.stacks_in_18_page1.transition_speed_value),
				show_info: (stacks.stacks_in_18_page1.show_info_value=='true'),
				show_counter: (stacks.stacks_in_18_page1.show_counter_value=='true'),
				data_source: data,
				data_config: function(img) {           
					return  {
						title: $(img).parent().children("strong").html(),
						description: $(img).parent().children("span").html()
					};
				}
			});
		});
	}
	
	else if (stacks.stacks_in_18_page1.flickr_gallery!='') {	
		flickr.getGallery(stacks.stacks_in_18_page1.flickr_gallery, function(data) {
			jQuery('#gallery').galleria({
				autoplay: parseInt(stacks.stacks_in_18_page1.autoplay_value),
				image_crop: (stacks.stacks_in_18_page1.image_crop_value=='true'),
				image_pan: (stacks.stacks_in_18_page1.image_pan_value=='true'),
				transition: stacks.stacks_in_18_page1.transition_value,
				transition_speed: parseInt(stacks.stacks_in_18_page1.transition_speed_value),
				show_info: (stacks.stacks_in_18_page1.show_info_value=='true'),
				show_counter: (stacks.stacks_in_18_page1.show_counter_value=='true'),
				data_source: data,
				data_config: function(img) {           
					return  {
						title: $(img).parent().children("strong").html(),
						description: $(img).parent().children("span").html()
					};
				}
			});
		});
	}
	
	else if (stacks.stacks_in_18_page1.flickr_user!='') {	
		flickr.getUser(stacks.stacks_in_18_page1.flickr_user, function(data) {
			jQuery('#gallery').galleria({
				autoplay: parseInt(stacks.stacks_in_18_page1.autoplay_value),
				image_crop: (stacks.stacks_in_18_page1.image_crop_value=='true'),
				image_pan: (stacks.stacks_in_18_page1.image_pan_value=='true'),
				transition: stacks.stacks_in_18_page1.transition_value,
				transition_speed: parseInt(stacks.stacks_in_18_page1.transition_speed_value),
				show_info: (stacks.stacks_in_18_page1.show_info_value=='true'),
				show_counter: (stacks.stacks_in_18_page1.show_counter_value=='true'),
				data_source: data,
				data_config: function(img) {           
					return  {
						title: $(img).parent().children("strong").html(),
						description: $(img).parent().children("span").html()
					};
				}
			});
		});
	}
	else {
		jQuery('body').append('<div id="flickrError">Please Enter a Value in the HUD for the Flickr Images to Fetch!<br /><button>OK</button></div>');
		
		jQuery('#flickrError').css({
			'display': 'none',
			'position': 'absolute',
			'top': '50%',
			'margin-top': '-150px',
			'left': '50%',
			'margin-left': '-200px',
			'width': '400px',
			'height': '300px',
			'color': '#fff',
			'padding': '20px',
			'font-size' :'1.5em',
			'background-color': '#000',
			'opacity': 0.9,
			'line-height':'2em',
			'z-index':5000
		});
		jQuery('#flickrError button').css({
			'color': '#999',
			'padding': '6px 20px',
			'background-color': '#333'
		});
		jQuery('#flickrError').show(800);
		jQuery('#flickrError button').click(function() {
  			jQuery('#flickrError').hide(400);
	  	});
	}
	

});

	return stack;
})(stacks.stacks_in_18_page1);



