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

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

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

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

jQuery(document).ready(function($){

	var getThatColor_stacks_in_165_page30 = function(color, ratio, shade) {
	
		var pad = function(num, totalChars) {
		    var pad = '0';
		    num = num + '';
		    while (num.length < totalChars) {
		        num = pad + num;
		    }
		    return num;
		};
		
		// Ratio is between 0 and 1
		var changeColor = function(color, ratio, darker) {
		    // Trim trailing/leading whitespace
		    color = color.replace(/^\s*|\s*$/, '');
		
		    // Expand three-digit hex
		    color = color.replace(
		        /^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i,
		        '#$1$1$2$2$3$3'
		    );
		
		    // Calculate ratio
		    var difference = Math.round(ratio * 256) * (darker ? -1 : 1),
		        // Determine if input is RGB(A)
		        rgb = color.match(new RegExp('^rgba?\\(\\s*' +
		            '(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])' +
		            '\\s*,\\s*' +
		            '(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])' +
		            '\\s*,\\s*' +
		            '(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])' +
		            '(?:\\s*,\\s*' +
		            '(0|1|0?\\.\\d+))?' +
		            '\\s*\\)$'
		        , 'i')),
		        alpha = !!rgb && rgb[4] != null ? rgb[4] : null,
		
		        // Convert hex to decimal
		        decimal = !!rgb? [rgb[1], rgb[2], rgb[3]] : color.replace(
		            /^#?([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i,
		            function() {
		                return parseInt(arguments[1], 16) + ',' +
		                    parseInt(arguments[2], 16) + ',' +
		                    parseInt(arguments[3], 16);
		            }
		        ).split(/,/),
		        returnValue;
		
		    // Return RGB(A)
		    return !!rgb ?
		        'rgb' + (alpha !== null ? 'a' : '') + '(' +
		            Math[darker ? 'max' : 'min'](
		                parseInt(decimal[0], 10) + difference, darker ? 0 : 255
		            ) + ', ' +
		            Math[darker ? 'max' : 'min'](
		                parseInt(decimal[1], 10) + difference, darker ? 0 : 255
		            ) + ', ' +
		            Math[darker ? 'max' : 'min'](
		                parseInt(decimal[2], 10) + difference, darker ? 0 : 255
		            ) +
		            (alpha !== null ? ', ' + alpha : '') +
		            ')' :
		        // Return hex
		        [
		            '#',
		            pad(Math[darker ? 'max' : 'min'](
		                parseInt(decimal[0], 10) + difference, darker ? 0 : 255
		            ).toString(16), 2),
		            pad(Math[darker ? 'max' : 'min'](
		                parseInt(decimal[1], 10) + difference, darker ? 0 : 255
		            ).toString(16), 2),
		            pad(Math[darker ? 'max' : 'min'](
		                parseInt(decimal[2], 10) + difference, darker ? 0 : 255
		            ).toString(16), 2)
		        ].join('');
		};
		if(shade == 'lighter') {
			return changeColor(color, ratio, false);
		} else {
	    	return changeColor(color, ratio, true);
	    }
	};
	
	$("#menu_stacks_in_165_page30").css({'background-color' : '#FFA715'});
	
	if(4 > 0) {
		$("#menu_stacks_in_165_page30").css({'background' : "-moz-linear-gradient(top, "+getThatColor_stacks_in_165_page30('#FFA715', (.05 * 4), 'lighter')+", "+getThatColor_stacks_in_165_page30('#FFA715', (.05 * 4), 'darker')+")"})
		.css({'background' : "-webkit-gradient(linear, 0% 0%, 0% 100%, from("+getThatColor_stacks_in_165_page30('#FFA715', (.05 * 4), 'lighter')+"), to("+getThatColor_stacks_in_165_page30('#FFA715', (.05 * 4), 'darker')+"))"})
		.css({"filter" : "progid:DXImageTransform.Microsoft.gradient( startColorstr='"+getThatColor_stacks_in_165_page30('#FFA715', (.052 * 4), 'lighter')+"', endColorstr='"+getThatColor_stacks_in_165_page30('#FFA715', (.040 * 4), 'darker')+"',GradientType=0 )"});
	}
	
	$(".mm2dd_stacks_in_165_page30").css({'background-color' : '#FFAC00'}).css({'border-color' : getThatColor_stacks_in_165_page30('#FFAC00', .465, 'darker')});
	
	if(3 > 0) {
		$(".mm2dd_stacks_in_165_page30").css({'background' : "-moz-linear-gradient(top, "+getThatColor_stacks_in_165_page30('#FFAC00', (.033 * 3), 'lighter')+", "+getThatColor_stacks_in_165_page30('#FFAC00', (.033 * 3), 'darker')+")"})
		.css({'background' : "-webkit-gradient(linear, 0% 0%, 0% 100%, from("+getThatColor_stacks_in_165_page30('#FFAC00', (.033 * 3), 'lighter')+"), to("+getThatColor_stacks_in_165_page30('#FFAC00', (.033 * 3), 'darker')+"))"})
		.css({"background-color" : '#FFAC00'});
	}
	

	jQuery.fn.setDDcss = function() {
		$(this).css({'background' : "none"});
		$(this).find('.mm_drop').css({'color' : '#284C0B'});
		if(0 > 0) {
			$(this).find('.mm_drop').css({'text-shadow': (.05 + ((0/2)/10))+'em '+(.05 + ((0/2)/10))+'em '+(.05 + ((0/1)/10))+'em '+getThatColor_stacks_in_165_page30('#FFA715', (.8-(0/10)), 'darker')});
		}
		else {
			$(this).find('.mm_drop').css({'text-shadow': 'none'});
		}
	};

	$(".mm2_stacks_in_165_page30").setDDcss();

	$(".mm2_stacks_in_165_page30").hover( function () {
		    $(this).css({'background' : '#FFAC00'}).css({'border-color' : getThatColor_stacks_in_165_page30('#FFAC00', .465, 'darker')});
		    
		    $(this).find('.mm_drop').css({'color': getThatColor_stacks_in_165_page30('#FFAC00', .64, 'darker')}).css({'text-shadow': 'none'});
		    if(3 > 0) {
		    	$(this).css({'background' : "-moz-linear-gradient(top, "+getThatColor_stacks_in_165_page30('#FFAC00', (.04125 * 3), 'lighter')+", "+getThatColor_stacks_in_165_page30('#FFAC00', (.033 * 3), 'lighter')+")"})
		    	.css({'background' : "-webkit-gradient(linear, 0% 0%, 0% 100%, from("+getThatColor_stacks_in_165_page30('#FFAC00', (.04125 * 3), 'lighter')+"), to("+getThatColor_stacks_in_165_page30('#FFAC00', (.033 * 3), 'lighter')+"))"})
		    	.css({"background-color" : '#FFAC00'});
		    }
	    },
        function () {
        	$(this).setDDcss();
        }
    );
});

/*
	# MegaContent (jQuery) #
	
	AUTHOR:	Adam Merrifield <http://adam.merrifield.ca>
			Giuseppe Caruso <http://www.bonsai-studio.net/>
	VERSION: r1.4.2
	DATE: 12-16-10 09:40


*/
jQuery.noConflict();
jQuery(document).ready(function($){
	var megaContent =  (function() {
		// change mcValue to suit your theme
		var mcValue = 12;
		for (i=0;i<=mcValue;i++)
		{
			$('#myMegaContent'+i+' script').remove();
			$('#myMegaContent'+i).appendTo('#megaContainer'+i);
		}
	})();
});


	return stack;
})(stacks.stacks_in_165_page30);



