var MivaMerchantDesign={
	init: function(){
		var mivaScreen=document.body.id;
		if(MivaMerchantDesign[mivaScreen]){
			$(document).ready(function(){MivaMerchantDesign[mivaScreen]();}); // If the function exists, run it, otherwise, don't do anything (like Jeff).
		}
		$(document).ready(function(){
		/*--- Top Navigation Controls ---*/
			$('#subnav').advListRotator({
				disableRotationEngine:true,
				effect:'fade'
			});
			$('ul.sub-cats li').hover(function(){
				$(this).addClass('hover');
				// Takes the UL, moves it off screen, finds the width of the longest LI and puts it back in place
				$('ul:first',this).css({display:'block', left:'-9999px'});
				var $list=$('ul:first',this).find('li');
				//var parentWidth=100;
				var maxWidth=0;
				$($list).each(function(){
					var currentWidth=$(this).width();
					if(currentWidth>maxWidth){
						maxWidth=currentWidth;
					}
				}).css({'width':maxWidth+'px'});
				//$($list).each(function(){$(this).css({'width':maxWidth+'px'});});
				$('ul:first',this).css({display:'none', left:'-1px'});
				// Apply the calculated width from above to the UL and show it onHover
				$('ul:first',this).show().addClass('currentUL').css({'width':maxWidth+'px'});
			}, function(){
					$(this).removeClass('hover');
					$('ul:first',this).hide().removeClass('currentUL');
			});
			$('ul.sub-cats li:has(ul)').find('a:first');


		});
		
	}
	
};

MivaMerchantDesign.init();
