
// '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_60_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_60_page0 = {};

// A closure is defined and assined to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for refering
// to this object from elsewhere.
stacks.stacks_in_60_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;
	

//-- Mask Stack v1.0.5 by Joe Workman --//
$(document).ready(function() {    
	// Set Border
	var bg_border_style = $('#stacks_in_60_page0').css('border-bottom-style');
	if (bg_border_style) { 
		var bg_border_color = $('#stacks_in_60_page0').css('border-bottom-color');
		var bg_border_top = $('#stacks_in_60_page0').css('border-top-width');
		var bg_border_right = $('#stacks_in_60_page0').css('border-right-width');
		var bg_border_bottom = $('#stacks_in_60_page0').css('border-bottom-width');
		var bg_border_left = $('#stacks_in_60_page0').css('border-left-width');
		$('#stacks_in_60_page0').css({'border-width':0});	
		$('#stacks_in_60_page0 .boxgrid').css({'border-style':bg_border_style,
								 'border-color':bg_border_color,
								 'border-top-width':bg_border_top,
								 'border-right-width':bg_border_right,
								 'border-bottom-width':bg_border_bottom,	
								 'border-left-width':bg_border_left
		});	
	}
	//Set Backgrounds
	var back_bg_color = $('#stacks_in_60_page0 .back .stacks_in').css('background-color');
	if (back_bg_color) { 
		$('#stacks_in_60_page0 .back .stacks_in').css({'background-color': 'transparent'});	
		$('#stacks_in_60_page0 .back').css({'background-color': back_bg_color });	
	}
	var cover_bg_color = $('#stacks_in_60_page0 .cover .stacks_in').css('background-color');
	if (cover_bg_color) { 
		$('#stacks_in_60_page0 .cover .stacks_in').css({'background-color': 'transparent'});	
		$('#stacks_in_60_page0 .cover').css({'background-color': cover_bg_color });	
	}
	
	// Make Everything the same height
	var back_height = $('#stacks_in_60_page0 .boxgrid .back').height();
	var cover_height = $('#stacks_in_60_page0 .boxgrid .cover').height();
    var box_height = back_height;
    if ('auto' == 'auto') {        
    	if (back_height > cover_height) {
    		$('#stacks_in_60_page0 .boxgrid .cover').height(back_height);
    		$('#stacks_in_60_page0 .boxgrid').height(back_height);
    	}
    	else {
    	    box_height = cover_height;
    		$('#stacks_in_60_page0 .boxgrid .back').height(cover_height);
    		$('#stacks_in_60_page0 .boxgrid').height(cover_height);
    	}
    }
	// Make Everything the same width
    var box_width;
	var back_width = $('#stacks_in_60_page0 .boxgrid .back').width();
	var cover_width = $('#stacks_in_60_page0 .boxgrid .cover').width();
	if (back_width > cover_width) {
	    box_width = back_width;
		$('#stacks_in_60_page0 .boxgrid .cover').width(back_width);
		$('#stacks_in_60_page0 .boxgrid').width(back_width);
	}
	else {
	    box_width = cover_width;
		$('#stacks_in_60_page0 .boxgrid .back').width(cover_width);
		$('#stacks_in_60_page0 .boxgrid').width(cover_width);
	}
		
   	//Vertical Sliding
	$('#stacks_in_60_page0 .boxgrid.slidedown').hover(function(){
	    console.log('Height: '+ box_height);
		$('.cover', this).stop().animate({top: box_height},{queue:false,duration:300});
	}, function() {
		$('.cover', this).stop().animate({top:0},{queue:false,duration:300});
	});
	$('#stacks_in_60_page0 .boxgrid.slideup').hover(function(){
		$('.cover', this).stop().animate({top: (box_height*-1)},{queue:false,duration:300});
	}, function() {
		$('.cover', this).stop().animate({top:0},{queue:false,duration:300});
	});
	//Horizontal Sliding
	$('#stacks_in_60_page0 .boxgrid.slideright').hover(function(){
		$('.cover', this).stop().animate({left:box_width},{queue:false,duration:300});
	}, function() {
		$('.cover', this).stop().animate({left:0},{queue:false,duration:300});
	});
	$('#stacks_in_60_page0 .boxgrid.slideleft').hover(function(){
		$('.cover', this).stop().animate({left:(box_width*-1)},{queue:false,duration:300});
	}, function() {
		$('.cover', this).stop().animate({left:0},{queue:false,duration:300});
	});
	//Diagnal Sliding
	$('#stacks_in_60_page0 .boxgrid.slidediag-rb').hover(function(){
		$('.cover', this).stop().animate({top: box_height, left:box_width},{queue:false,duration:300});
	}, function() {
		$('.cover', this).stop().animate({top:0, left:0},{queue:false,duration:300});
	});
	$('#stacks_in_60_page0 .boxgrid.slidediag-rt').hover(function(){
		$('.cover', this).stop().animate({top: (box_height*-1), left:box_width},{queue:false,duration:300});
	}, function() {
		$('.cover', this).stop().animate({top:0, left:0},{queue:false,duration:300});
	});
	$('#stacks_in_60_page0 .boxgrid.slidediag-lb').hover(function(){
		$('.cover', this).stop().animate({top: box_height, left:(box_width*-1)},{queue:false,duration:300});
	}, function() {
		$('.cover', this).stop().animate({top:0, left:0},{queue:false,duration:300});
	});
	$('#stacks_in_60_page0 .boxgrid.slidediag-lt').hover(function(){
		$('.cover', this).stop().animate({top: (box_height*-1), left:(box_width*-1)},{queue:false,duration:300 });
	}, function() {
		$('.cover', this).stop().animate({top:0, left:0},{queue:false,duration:300});
	});
	//Partial Sliding (Only show some of background)
	$('#stacks_in_60_page0 .boxgrid.peekdown').hover(function(){
		$('.cover', this).stop().animate({top:'90'},{queue:false,duration:300});
	}, function() {
		$('.cover', this).stop().animate({top:0},{queue:false,duration:300});
	});
	$('#stacks_in_60_page0 .boxgrid.peekup').hover(function(){
		$('.cover', this).stop().animate({top:'-90'},{queue:false,duration:300});
	}, function() {
		$('.cover', this).stop().animate({top:0},{queue:false,duration:300});
	});
	//Fadeout Effect
	$('#stacks_in_60_page0 .boxgrid.fadeout').hover(function(){
		if($.browser.msie){
			$(".cover", this).css("display","none");
		}
		else{
			$(".cover", this).stop().animate({opacity:'0'},{queue:false,duration:300,complete:function(){$(this).hide()} });
		}
	}, function() {
		if($.browser.msie){
			$(".cover", this).css("display","inline");
		}
		else{
			$(".cover", this).show().stop().animate({opacity:'0.1'},{queue:false,duration:300});			
		}
	});
});
//-- End Mask Stack --//

	return stack;
})(stacks.stacks_in_60_page0);



