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

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

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

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

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

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


$(document).ready(function() {



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

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

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

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

if (cooky == "lzcookyset"){

}

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


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

$(tempClone).fadeIn(4000).appendTo(".doosuperoverlay").css(position)
.delay(3000)
.fadeOut(3000);
  // showstack once
var dooremoveoverlaytimer = 3000 + 3000 + 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 + 4000 + 3000 + 3000;
setTimeout(function(){ $("#stacks_in_56_page0").remove(); }, doodelaylz + 1000);
}

});


	return stack;
})(stacks.stacks_in_56_page0);


// Javascript for stacks_in_19_page0
// ---------------------------------------------------------------------

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

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

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

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




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

// COOKIE FUNCTIONS
function setCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires ;
}

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

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



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

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



// CUSTOM STACK SCRIPT

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


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

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


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

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

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

if("center" == "center"){
var stacks_in_19_page0negleftmargin = 519 / 2;
var stacks_in_19_page0negtopmargin = $(".stacks_in_19_page0wrapper").height() / 2;

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

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

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

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



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

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



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




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

 
 });

} // end cookie check


deleteCookie('stacks_in_19_page0roar');


});





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


// Javascript for stacks_in_356_page0
// ---------------------------------------------------------------------

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

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

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
// imagelist Stack by http://www.doobox.co.uk
// Copyright@2010 Mr JG Simpson, trading as Doobox.
// all rights reserved.



$(document).ready(function() {


if("no" == "yes"){
var thefirstsource = $( "#stacks_in_356_page0:first-child img" ).attr("src");
$( "#stacks_in_356_page0 .listIcon .centered_image" ).each(function(){
$(this).html('<img width="128" height="128" src="' + thefirstsource + '" />');
});
}

else{

$("#stacks_in_356_page0 .listIcon").each(function(){
if(!$(this).find("img").attr("src")){
$(this).html('<img width="128" height="128" src="files/imagelistimages/tick.png" />');
}
});

}

$( "#stacks_in_356_page0 li" ).css("list-style-type", "none");
});

	return stack;
})(stacks.stacks_in_356_page0);


// Javascript for stacks_in_9_page0
// ---------------------------------------------------------------------

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

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

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
// imagelist Stack by http://www.doobox.co.uk
// Copyright@2010 Mr JG Simpson, trading as Doobox.
// all rights reserved.



$(document).ready(function() {


if("yes" == "yes"){
var thefirstsource = $( "#stacks_in_9_page0:first-child img" ).attr("src");
$( "#stacks_in_9_page0 .listIcon .centered_image" ).each(function(){
$(this).html('<img width="128" height="128" src="' + thefirstsource + '" />');
});
}

else{

$("#stacks_in_9_page0 .listIcon").each(function(){
if(!$(this).find("img").attr("src")){
$(this).html('<img width="128" height="128" src="files/imagelistimages/tick.png" />');
}
});

}

$( "#stacks_in_9_page0 li" ).css("list-style-type", "none");
});

	return stack;
})(stacks.stacks_in_9_page0);


// Javascript for stacks_in_209_page0
// ---------------------------------------------------------------------

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

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

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
(function($){	
	$.extend({
		rwtultimate1:{
			transitions:{
				fade:{
					duration:3000,
					delay:0,
					css:{opacity:0},
					columns:1,
					rows:1,
					order:'normal',
					easing:'linear',
					slide:'current'
				}
			}
		}
	});
	$.fn.rwtultimate1 = function(opts) {
		var defaults = {
				delay: 5000,
				type:'fade',
				onend:null,
				onstart:null
			};
		var settings = $.extend({}, defaults, opts);
		if(settings['transitions']){
			$.extend($.rwtultimate1.transitions,settings.transitions);
		}
		this.each(function() {
			var $this=$(this);
			$this.attr('sv_cur',0);
			$this.attr('sv_ani',0);
			$this.attr('sv_timer',setTimeout(function(){startSwitch($this);}, settings.delay));
			$this.children('li').each(function(index){
				if(index==0){
					$(this).css({zIndex:2,position:'absolute'});
				}
				else{
					$(this).css({zIndex:0,position:'absolute'});
				}
			});	
			$(settings.prev).click(function(){
				if($this.attr('sv_ani')==0){
					var cur=$this.attr('sv_cur');
					var next=cur-1;
					if(next<0){
						next=$this.children('li').length-1;
					}	
					clearTimeout($this.attr('sv_timer'));
					startSwitch($this,next);
				}
			});
			$(settings.next).click(function(){
				if($this.attr('sv_ani')==0){
					clearTimeout($this.attr('sv_timer'));
					startSwitch($this);		
				}
			});
			$('li',$(settings.controls)).each(function(index){
				$(this).click(function(){
					if($this.attr('sv_ani')==0){
						clearTimeout($this.attr('sv_timer'));
						startSwitch($this,index);
					}
				});				
			});
			$this.hover(
				function(){
					if($this.attr('sv_ani')==0){
						clearTimeout($this.attr('sv_timer'));
					}
				},
				function(){
					if($this.attr('sv_ani')==0){
						$this.attr('sv_timer',setTimeout(function(){startSwitch($this);}, settings.delay));
					}					
				});
		});		
		var startSwitch=function($this,index){
			if($this.attr('sv_ani')==0 && $this.attr('sv_cur')!=index){
				$this.attr('sv_ani',1);
				clearTimeout($this.attr('sv_timer'));
				var cur =$this.attr('sv_cur');
				if(!isNaN(index)){
					var n = index;
				}	
				else if(cur<$this.children('li').length-1){
					var n= parseInt(cur)+1;
				}	
				else{
					var n= 0;
				}	
				doSwitch($this,n);
			}
		}
		var getTransData = function($this){
			var type;
			if($.isArray(settings.type)){
				if(isNaN($this.attr('sv_type'))){$this.attr('sv_type',0)};	
				type = settings.type[parseInt($this.attr('sv_type'))];
				if(parseInt($this.attr('sv_type'))+1>=settings.type.length){
					$this.attr('sv_type',0);
				}
				else{
					$this.attr('sv_type',parseInt($this.attr('sv_type'))+1);
				}
			}
			else{
				type=settings.type
			}			
			if(!$.rwtultimate1.transitions[type]){
				return $.rwtultimate1.transitions.fade;
			}
			else{
				return $.extend({}, $.rwtultimate1.transitions.fade, $.rwtultimate1.transitions[type]);
			}
		}		
		var cloneSlide=function($this,trans,n){
			var divs = []
				cols=trans.columns,
				rows=trans.rows;	
			
			if(trans.slide=='next'){
				var slide = $($this.children('li')[n]);
			}
			else{
				var slide = $($this.children('li')[$this.attr('sv_cur')]);
			}
			var w=($this.width()/cols);
			var h=($this.height()/rows);
			var nLi=$('<li/>')
					.css({
						width:$this.width(),
						height:$this.height(),
						overflow:'hidden',
						position:'relative',
						top:0,
						display:'block',
						zIndex:3
					});		
			for(var j=0;j<rows;j++){//rows
				for(var i=0;i<cols;i++){//columns
					divs[((j*cols)+i)]=$('<div/>')
											.css({
												width:w+1,
												height:h+1,
												overflow:'hidden',
												position:'absolute',
												left:(w*i),
												top:(h*j)
											});
					if(trans.slide=='next'){
						var css={};
						css['width']=divs[((j*cols)+i)].css('width');
						css['height']=divs[((j*cols)+i)].css('height');
						css['opacity']=1;
						css['top']=divs[((j*cols)+i)].css('top');
						css['left']=divs[((j*cols)+i)].css('left');
					
						divs[((j*cols)+i)].data('sv_cssdata',css)									
									.animate(trans.css,0);
						divs[((j*cols)+i)].data('sv_divwidth',divs[((j*cols)+i)].css('width'));
						divs[((j*cols)+i)].css({width:0});
					
					}
					var div = $('<div/>')
								.html(slide.html())
								.css({
									marginTop:-(h*j),
									marginLeft:-(w*i),
									width:w,
									height:h
								});
					divs[((j*cols)+i)].append(div);	
					nLi.append(divs[((j*cols)+i)]);
				}
			}
			return [nLi,divs];
		}
		var doTransition=function($this,divs,nLi,n,trans){
			var j=0,
				count = divs.length;
				del = trans.delay;
				tt 	= trans.duration;
			if(trans.order=='reverse'){
				divs.reverse();
			}
			for(var i = 0; i<count; i++){
										if(trans.easing==undefined || !jQuery.easing[trans.easing]){trans.easing='swing'}
										if(j<count-1){
											if(trans.order=='random'){
												j++;
												var div = divs[Math.floor(Math.random()*divs.length)];
												divs = jQuery.grep(divs, function(value) {
															return value != div;
												});
												div.delay((del*i), "rwtultimate1")
													.queue("rwtultimate1", function(next) {
														
														if(trans.slide=='next'){
															var ncss=$(this).data('sv_cssdata');
														}
														else{var ncss=trans.css;}
														
														if(trans.slide=='next'){
															$(this).css({width:$(this).data('sv_divwidth')});
														}
														$(this).animate(ncss,tt,trans.easing);
														next();
													})
													.dequeue("rwtultimate1");
											}
											else{											
												divs[j++].delay((del*i), "rwtultimate1")
													.queue("rwtultimate1", function(next) {
														if(trans.slide=='next'){
															var ncss=$(this).data('sv_cssdata');
														}
														else{var ncss=trans.css;}
														if(trans.slide=='next'){
															$(this).css({width:$(this).data('sv_divwidth')});
														}
														$(this).animate(ncss,tt,trans.easing);
														next();
													})
													.dequeue("rwtultimate1");
											}
										}
										else{											
											var div = (trans.order=='random')?divs[0]:divs[j++];
											clearInterval($this.attr('sv_timer'));
											div.delay((del*i), "rwtultimate1")
													.queue("rwtultimate1", function(next) {
														if(trans.slide=='next'){
															var ncss=$(this).data('sv_cssdata');
														}
														else{var ncss=trans.css;}
														if(trans.slide=='next'){
															$(this).css({width:$(this).data('sv_divwidth')});
														}
														$(this).animate(ncss,tt,trans.easing,function(){
																		nLi.remove();
																		$($this.children('li')[n]).css({zIndex:2});
																		$($this.children('li')[$this.attr('sv_cur')]).css({zIndex:0});
																		if(settings.onend){settings.onend(cur,n)}
																		$this.attr('sv_cur',n);
																		$this.attr('sv_timer',setTimeout(function(){startSwitch($this);}, settings.delay));
																		$this.attr('sv_ani',0);	
																	});
														next();
													})
													.dequeue("rwtultimate1");
										}
				}
		}
		var doSwitch=function($this,n){
			if(settings.onstart){settings.onstart(cur,n);}				
			var trans=getTransData($this);
			var data = cloneSlide($this,trans,n);
			$this.append(data[0]);
			$('li',$(settings.controls)).removeClass('active');
			$($('li',$(settings.controls))[n]).addClass('active');
			if(trans.slide!='next'){
				$($this.children('li')[n]).css({zIndex:2});
				$($this.children('li')[$this.attr('sv_cur')]).css({zIndex:0});
			}
			doTransition($this,data[1],data[0],n,trans);
		}
		return this;
	}	
})(jQuery);

jQuery.extend(jQuery.rwtultimate1.transitions,
{			
	
	blockdrop:{
			duration:1000,
			delay:80,
			css:{top:'+=200',opacity:0.0},
			columns:1,
			rows:1,
			order:'reverse',
			easing:'easeInOutBack',
			slide:'current'
	}
	
});

$(window).load(function(){	
	
	var options = {
			
				type:['blockdrop'],
				controls:'#stacks_in_209_page0 .controls',
				next:'#stacks_in_209_page0 .next',
				prev:'#stacks_in_209_page0 .prev'
			};
	$('#stacks_in_209_page0 .container').rwtultimate1(options);

	
});
	return stack;
})(stacks.stacks_in_209_page0);



