


$(document).ready( function() {
	
	$('#nav_level_1 a').mouseover( function() {
		$('#nav_level_1 a').css('color', '#fff');
		$(this).css('color', '#fce100');
		showLevel2($(this).attr('id'));
		checkCreateRollOffDiv();
	});

	
	$('.delayed_hide').hide();
});

function rollImgHi (img) {
	img.attr('src', img.attr('src').replace("_flat", "_hi"));
}
function rollImgFlat (img) {
	img.attr('src', img.attr('src').replace("_hi", "_flat"));
}


function checkCreateRollOffDiv() {
	if ( $('#hpRolloffDiv').length <= 0) {
		$('#rolleroff_container').append('<div id="hpRolloffDiv" style="height: '+($(window).height()-150)+'px; width: '+($('#main_content').width())+'px; position: absolute; top: 0px; left: 0px;"></div>');
		$('#hpRolloffDiv, #imgholderx img').mouseover(function() {
			hideLevel2();
			$('#nav_level_1 a').css('color', '#fff');
			$('#hpRolloffDiv').remove();
		});
	}
}
function showLevel2 (objid) {
	hideLevel2();
	$('#'+ objid).css('color', '#fce100');
	if ($('#' + objid + '_roll').length > 0) {
		$('#nav_level_2').show();
		$('#nav_level_2').html($('#' + objid + '_roll').html() + '<div id="nav_level_3"></div>')
		$('#subnav').show();
		$('#nav_level_2').fadeIn('slow');
		$('#nav_level_2 a').mouseover( function() {
			showLevel3($(this).attr('id'));		
		});
	}
}
function hideLevel2() {
	hideLevel4();
	hideLevel3();
	$('#subnav').hide();
	$('#nav_level_2').html('')	
	$('#nav_level_2').hide();
	
}
function showLevel3	(objid) {
	hideLevel3();
	$('#'+ objid).css('color', '#fce100');
	if ($('#' + objid + '_roll').length > 0) {
		$('#nav_level_3').html($('#' + objid + '_roll').html() + '<div id="nav_level_4"></div>')
		$('#subnav').css({height: '50px'})
		$('#nav_level_3').show();
		$('#nav_level_3 a').mouseover( function() {
			showLevel4($(this).attr('id'));		
		});
	}
}
function hideLevel3() {
	hideLevel4();
	$('#subnav').css({height: '28px'})
	$('#nav_level_3').html('')	
	$('#nav_level_3').hide();
	$('#nav_level_2 a').css('color', '#999');
}
function showLevel4	(objid) {
	hideLevel4();
	$('#'+ objid).css('color', '#fce100');
	if ($('#' + objid + '_roll').length > 0) {
		$('#nav_level_4').html($('#' + objid + '_roll').html())
		$('#subnav').css({height: '144px'})
		$('#nav_level_4').show();
	}
}
function hideLevel4() {
	$('#subnav').css({height: '50px'})
	$('#nav_level_4').html('')
	$('#nav_level_4').hide();	
	$('#nav_level_3 a').css('color', '#fff');
}








