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

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

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

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/* Flex EZ Menu Stack by RWExtras v1.1.0 */
/* Copyright (C) 2011 by Mauricio Sabene http://rwextras.com */
var $this = '';
var $buttons = 0;
var $bg_rounded = '';
var $bg_square = '';
var $select_a = '';
var $menuWidth = 0;
jQuery(document).ready(function() {
	$bg_rounded = 'bgspriter'+ '1' + '.png';
	$bg_square = 'bgsprites'+ '1' + '.png';
	$select_a = jQuery('.menu_stacks_in_5_page151 a');
	$this = jQuery('.menu_stacks_in_5_page151 span');
	$buttons = $this.size();
	$this.each(function(){
		if(jQuery('a',this).size() == 0){jQuery(this).html('<a href="#">Add link...</a>')}
		if(!jQuery(this).hasClass('current')){
		if(jQuery(this).hasClass('yes')){jQuery(this).removeClass('yes').addClass('current')}
		}
	});
	$select_a.css({'background-image':'url(files/flex_sprites/'+ $bg_square+')','background-repeat':'no-repeat'});
	if ('vertical' === 'horizontal') {
		if ('fixw'==='varw') {
			$select_a.css({'width':'auto','padding':'0 20px'});
			$menuWidth = 1;
			}
		if ('bgspriter' === 'bgspriter') {
			jQuery($this).eq(0).removeClass('b_middle').addClass('b_left');
			jQuery($this).eq($buttons-1).removeClass('b_middle').addClass('b_right');
			$select_a.css({'background-image':'url(files/flex_sprites/'+ $bg_rounded +')','background-repeat':'no-repeat'});
		}
		for (var i=0; i < $buttons; i++) {
		$menuWidth += jQuery('.menu_stacks_in_5_page151 a').eq(i).outerWidth(true);
		}
		jQuery('.menu_stacks_in_5_page151').css('width', $menuWidth + 'px');
	} else {
		$select_a.css({'margin-left':'0','width': '230px'});
		jQuery('.menu_stacks_in_5_page151').css({'width':'230px'});		
	}
	$this.removeClass('no');
});

	return stack;
})(stacks.stacks_in_5_page151);



