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

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

// 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_3335_page17 = (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({
		rwtultimate2:{
			transitions:{
				fade:{
					duration:3000,
					delay:0,
					css:{opacity:0},
					columns:1,
					rows:1,
					order:'normal',
					easing:'linear',
					slide:'current'
				}
			}
		}
	});
	$.fn.rwtultimate2 = function(opts) {
		var defaults = {
				delay: 10000,
				type:'fade',
				onend:null,
				onstart:null
			};
		var settings = $.extend({}, defaults, opts);
		if(settings['transitions']){
			$.extend($.rwtultimate2.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(!$.rwtultimate2.transitions[type]){
				return $.rwtultimate2.transitions.fade;
			}
			else{
				return $.extend({}, $.rwtultimate2.transitions.fade, $.rwtultimate2.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), "rwtultimate2")
													.queue("rwtultimate2", 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("rwtultimate2");
											}
											else{											
												divs[j++].delay((del*i), "rwtultimate2")
													.queue("rwtultimate2", 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("rwtultimate2");
											}
										}
										else{											
											var div = (trans.order=='random')?divs[0]:divs[j++];
											clearInterval($this.attr('sv_timer'));
											div.delay((del*i), "rwtultimate2")
													.queue("rwtultimate2", 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("rwtultimate2");
										}
				}
		}
		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.rwtultimate2.transitions,
{			
	
	blockdrop:{
			duration:1000,
			delay:80,
			css:{top:'+=200',opacity:0.0},
			columns:7,
			rows:3,
			order:'reverse',
			easing:'easeInOutBack',
			slide:'current'
	}
	
});

$(window).load(function(){	
	
	var options = {
			
				type:['blockdrop'],
				controls:'#stacks_in_3335_page17 .controls',
				next:'#stacks_in_3335_page17 .next',
				prev:'#stacks_in_3335_page17 .prev'
			};
	$('#stacks_in_3335_page17 .container').rwtultimate2(options);

	
});
	return stack;
})(stacks.stacks_in_3335_page17);


// Javascript for stacks_in_3347_page17
// ---------------------------------------------------------------------

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

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

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/* SymfoniP.com (c) 2010 - Slidey Note Stack Code V1.0 03-Nov-2010
 * modified and derived from SlideNote - A jQuery Plugin for flexible, customizable sliding notifications.
 * Copyright 2010 Tom McFarlin, http://tommcfarlin.com Released under the MIT License
*/
(function(g){var e=0;g.fn.slideNote=function(h){e+=this.length;var i={where:640,corner:"right",url:null,container:"",closeImage:null,_bIsClosed:false};if(h){i=g.extend(i,h)}return this.each(function(){g(this).addClass("symNote"+i.corner);var k=f(this,i);var j=g.browser.msie===true?window:document;if(g(document).height()<=g(window).height()){k.trigger("slideIn")}g(j).scroll(function(){if(g(this).scrollTop()===0){i.bIsClosed=false}if(g(this).scrollTop()>i.where){if(!k.is(":visible")&&!i.bIsClosed){k.trigger("slideIn")}}else{if(g(this).scrollTop()<i.where&&k.queue("fx")[0]!=="inprogress"){if(k.is(":visible")){k.trigger("slideOut")}}}})})};function f(i,h){g(i).toggle().css(h.corner,-1*g(i).outerWidth()).css({position:"fixed",bottom:0}).bind("slideIn",function(j){c(j,i,h)}).bind("slideOut",function(j){d(j,i,h)});b(i,h);a(i,h);return g(i)}function c(h,k,i){var j=i.corner==="right"?{right:0}:{left:0};g(k).show().animate(j,1000,"swing")}function d(h,k,i){var j=i.corner==="right"?{right:-1*g(k).outerWidth()}:{left:-1*g(k).outerWidth()};g(k).animate(j,1000,"swing",function(){if(e===1){g(k).stop(true).hide()}else{g(k).hide()}});if(i.closeImage!==null&&h.target.id===g(k).attr("id")+"_close"){i.bIsClosed=true}}function b(j,i){if(i.url!==null){if(i.container.length!==0&&i.container.indexOf("#")===-1){i.container="#"+i.container}var h=i.container.length===0?i.url:i.url+" "+i.container;g(j).load(h,function(){if(i.closeImage!==null){a(j,i)}})}}function a(j,i){if(i.closeImage!==null){var h=document.createElement("img");g(h).attr("src",i.closeImage).attr("class","close").attr("alt","close").attr("id",g(j).attr("id")+"_close").hover(function(){g(this).css("cursor","pointer")}).click(function(k){k.stopPropagation();g(this).trigger("slideOut")});g(j).prepend(h)}}})(jQuery);
/* Make the Slidey Note go - SymfoniP.com */
jQuery(document).ready(function($) {
	$('#symSlideyNote_stacks_in_3347_page17').slideNote({where: 50, closeImage: 'files/slideynote/slidenote.close.png', corner: 'right'});
});


	return stack;
})(stacks.stacks_in_3347_page17);



