var showContainer = ""; // variable for optional show-hide lists
var showHover = ""; // variable for optional show-hide lists
var showOn = ""; // variable for optional show-hide lists

$(document).ready(function(){
	$(".jumpMenu").superfish().supposition().find(">li:has(ul)")
		.mouseover(function(){
			$("ul", this).bgiframe({width:100});
		})
		.find("a")
			.focus(function(){
				$("ul", $(".jumpMenu>li:has(ul)")).bgiframe({width:100});
			});
});

// Drop-down menus
$(document).ready(function(){
	$('#mainNav').superfish({
	speed : 1,
	onShow : function() { 
	  $(this).parents('li').siblings('li').addClass('navDim') 
	},
	onHide : function() { 
	  $(this).parents('li').siblings('li').removeClass('navDim') 
	}
  }).find('>li:has(ul)')
	.mouseover(function(){
		$('ul', this).bgiframe({width:'auto',top:'0px',left:'0px'});
	})
	.find("a")
		.focus(function(){
			$('ul', $(".jumpMenu>li:has(ul)")).bgiframe({width:'auto',top:'0px',left:'0px'});
		});
});
  
// Additional calls to hover styles for "navDim" on non-active tabs 
$(document).ready(function(){
  $("#mainNav li.hasMenu").hover(function() {
  $(this).siblings("li").addClass("navDim");
  }, function() {
  $(this).siblings("li").removeClass("navDim");
  });
  $("#mainNav li.noMenu").hover(function() {
  $(this).addClass("noMenuHover");
  $(this).siblings("li").addClass("navDim");
  }, function() {
  $(this).removeClass("noMenuHover");
  $(this).siblings("li").removeClass("navDim");
  });
});

$(document).ready(function(){
  $("#mainNav a.noClick").click(function() {
    $(this).parent("li").siblings("li").addClass("navDim");
    return false;
  });
});

// Hover behavior for survey submit button
$(document).ready(function(){
  $("#sidebar .survey #surveySubmit").hover(function() {
  $(this).addClass("surveyHover");
  }, function() {
  $(this).removeClass("surveyHover");
  });
});

// login form button hover behavior
$(document).ready(function(){
  $("#dealerSubmit").hover(function() {
    $(this).addClass("submitOver");
  }, function() {
    $(this).removeClass("submitOver");
  });
});

// dealer locator form button hover behavior
$(document).ready(function(){
  $("#formLocSubmit").hover(function() {
    $(this).addClass("formLocSubmitOver");
  }, function() {
    $(this).removeClass("formLocSubmitOver");
  });
});


// image rollovers for graphic subheads and left nav column headings
  $(document).ready(function() {
		
		// Preload all rollovers
		$(".overviewItem h2 img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.gif$/ig,"_on.gif");
			$("<img>").attr("src", rollON);
		});
		
		// Subhead rollovers (if links)
		$(".overviewItem h2 a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_on/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.gif$/ig,"_on.gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$(".overviewItem h2 a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		
		// Nav heading rollovers (if links)
		$("#navList h2 a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_on/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.gif$/ig,"_on.gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$("#navList h2 a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		
		// "intro" module siteLink hovers
		$(".intro p.siteLink a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_on/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.gif$/ig,"_on.gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$(".intro p.siteLink a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
	
	});
	
// Sidebar highlight rollovers
$(document).ready(function() {
	
	// Preload all rollovers
	$("#sidebar a img.highlight").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.jpg$/ig,"_on.jpg");
		$("<img>").attr("src", rollON);
	});
	
	// Subhead rollovers (if links)
	$("#sidebar a img.highlight").mouseover(function(){
		imgsrc = $(this).attr("src");
		matches = imgsrc.match(/_on/);
		
		// don't do the rollover if state is already ON
		if (!matches) {
		imgsrcON = imgsrc.replace(/.jpg$/ig,"_on.jpg"); // strip off extension
		$(this).attr("src", imgsrcON);
		}
		
	});
	$("#sidebar a img.highlight").mouseout(function(){
		$(this).attr("src", imgsrc);
	});
});
	
// sidebar heading arrow rollovers
	$(document).ready(function() {
	$(".literature h2 a").mouseover(function(){
		imgsrc = $(this).children("img.linkArrow").attr("src");
		matches = imgsrc.match(/_on/);
		
		// don't do the rollover if state is already ON
		if (!matches) {
		imgsrcON = imgsrc.replace(/.gif$/ig,"_on.gif"); // strip off extension
		$(this).children("img.linkArrow").attr("src", imgsrcON);
		}
		
	});
	$(".literature h2 a").mouseout(function(){
		$(this).children("img.linkArrow").attr("src", imgsrc);
	});
	});

// sidebar heading arrow rollovers
		$(document).ready(function() {
		$("a.hoverLink").mouseover(function(){
			imgsrc = $(this).children("img.linkArrow").attr("src");
			matches = imgsrc.match(/_on/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.gif$/ig,"_on.gif"); // strip off extension
			$(this).children("img.linkArrow").attr("src", imgsrcON);
			}
			
		});
		$("a.hoverLink").mouseout(function(){
			$(this).children("img.linkArrow").attr("src", imgsrc);
		});
		});	

// Accordion show-hide for definition lists 
$(document).ready(function() {
  $('dl.' + showContainer + ' dt a').hover(function() {
    $(this).parent().addClass(showHover);
  }, function() {
    $(this).parent().removeClass(showHover);
    });
  $('dl.' + showContainer + ' dt a').click(function() {
    if ($(this).parent().siblings('dt').hasClass(showOn)) $(this).parent().siblings('dt').removeClass(showOn);
    if ($(this).parent().hasClass(showOn)) {
    $(this).parent().removeClass(showOn).next('dd:visible').hide();
    return false;
    }
    else {
    $(this).parent().addClass(showOn).next('dd:hidden').slideDown('fast').siblings('dd:visible').hide();
    return false;
    }
});
});

