// JavaScript Document

$(function() {
	var layerTimeout; //// time out variable
	var id_class = /^#(.*)/;   ///// CSS class of main menu item "#FOO" links Submenu <DIV>'s class or id name.   Removes # or . 

	$('.submenu').hide();  //// Hides submenus
		
	$('#top_level a').mouseover(
		function () {
			clearTimeout(layerTimeout);   //// Clears timer function
			$('.submenu').hide(); //// Initially hide submenu on pageload
			$('#top_level a').css('background-color', '#BDB7A5');			
			$(this).css('background-color', '#CAC3B0');  /// bground color of tab when in hover state
			if (id_class.test($(this).attr('id'))) {
				$($(this).attr('id')).slideDown(100).show(); //// jQuery slideDown effect and show for hidden submenu	
				$(this).css('background-color', '#CAC3B0'); /// bground color of tab which is linked to a submenu  #E6DEC8	
				window.top.document.body.rows = '' + ($('#top_level').height() + $($(this).attr('id')).height()) + ',*';
			return false;
			} else
				window.top.document.body.rows = '' + $('#top_level').height() + ',*';
	});
	
	$('#top_level a').mouseout(
		function() {
			var slideLayerUp = function() {
				$('.submenu').slideUp(100).hide(); //// jQuery slideUp effect and show for hidden submenu
				$('#top_level a').css('background-color', '#BDB7A5');////top level menu item CSS Style - bgcolor
			};
			layerTimeout = setTimeout(slideLayerUp, 10000);
	});
	


	


});


//// DEALER LOCATOR POPUP WINDOW
function DealerLocator_popup(url) {
	newwindow=window.open(url,'name','height=800px,width=800px,scrollbars=no');
	if (window.focus) {newwindow.focus()}
	return false;
}

/* TEMPLATE FOR MAIN NAVIGATION MENU*/
//	var layerTimeout;	
//	$(function() {
//		$('img.home-nav, .static-home-box').hover(
//			function() {
//				clearTimeout(layerTimeout);
//				$("div#whiteTransparency").stop().show().fadeTo("slow", 0.6);
//				var myDivId = $(this).attr("id").charAt($(this).attr("id").length - 1);
//				$('.static-home-box').hide();
//				$('#static-home-box' + myDivId).show(); 
//			},
//			function() {
//				var fadeLayerOut = function() {
//					$('.static-home-box').hide();
//					$("div#whiteTransparency").stop().fadeTo("slow", 0.0, function(){$(this).hide()});
//				};
//				layerTimeout = setTimeout(fadeLayerOut, 50);
//			});
//	});