var $j = jQuery.noConflict();

$j(document).ready(function(){
		
	/* NAVIGATION
	---------------------------------------------------- */
	// -SET 1ST LEVEL ITEMS WIDTH WITH PADDING
		// Number of 1st level menu items
		var n = $j("#navigation > li").length;
		// Width of 1st level menu items without padding
		var initWidth = 0;
		$j("#navigation > li").each(function(){
			initWidth += $j(this).width();
		});
		// Padding calculation
		paddingWidth = Math.round((960 - initWidth) / (2 * n));
		$j("#navigation > li > a").css({padding : '0px '+paddingWidth+'px'});
		// Padding correction for last 1st level menu item
		var paddingRightWidth = paddingWidth - ((initWidth + (2 * n * paddingWidth)) - 960);
		$j("#navigation > li:last > a").css({paddingRight : paddingRightWidth+'px'});
	// -2ND LEVEL CONTROL
		$j("#navigation > li").mouseenter(function(){
			$j(this).children("ul").slideDown();
		});
		$j("#navigation > li").mouseleave(function(){
			$j(this).children("ul").slideUp();
		});
	
	/* -SET #CONTENT HEIGHT ACCORDING TO SIDEBAR
	---------------------------------------------------- */
		if ($j("#sidebar").height() > $j("#content-wrap").height()) {
			$j("#content-wrap").css({
				minHeight: $j("#sidebar").height()
			});
		}
	
	// Location Pages
	$j("dl.offices:last").after('<div class="clear"></div>');
	// Career Page
	$j("#post-1828 object").attr('width','560').attr('height','337');
	$j("#post-1828 embed").attr('width','560').attr('height','337');
	// Form -> Promo Code Tooltip
	$j(".promo-code span:eq(1)").mouseover(function(){
		$j(".promo-code .tooltip").fadeIn();
	}).mouseleave(function(){
		$j(".promo-code .tooltip").fadeOut();
	});
	
});
