﻿// Menu image rollovers using jQuery v1.4.4 on 1/10/2011$(document).ready(function() {	// all menu images require id='m-3', etc. starting with 'm-0'	// user defined	var skip		= 2, // Use '2' for 1 image between each menu item, 12, 14, 16, etc.		path		= '/graphics_slices/soup2nuts_', //path incl. filename prefix		start		= 15, // starting menu image id number		sticky		= '-sticky', // suffix for sticky item		over		= '-over',  // suffix for hover item		type		= '.gif', // .jpg, .gif, .png, etc.	// end user defined		section		= $('input#section').attr('value'), // this is value of hidden field id='section'		tab_sticky	= new Array(),		tab_over	= new Array(),		j;			$('img[id|="m"]').each(function (i) {		imgid = ((i*skip) + start); if (imgid < 10){imgid="0"+imgid};		if (section == i){			$(this).attr({ src: path+imgid+sticky+type });			$(this).click(function (e) { e.preventDefault(); }).css("cursor","default"); // kills link cuz you're already there		} else {			tab_sticky[i]	=	path+imgid+type;			tab_over[i]		=	path+imgid+over+type;		};		// preloads all hidden menu images on page load		(new Image()).src	=	path+imgid+over+type; 		(new Image()).src	=	path+imgid+sticky+type;	});		$('img[id|="m"]').hover(enter, leave);	function enter(event) { // mouseenter		j = $(this).attr('id').replace(/m-/, "");		if (section != j){$(this).attr("src",tab_over[j]);};	};	function leave(event) { // mouseout		j = $(this).attr('id').replace(/m-/, "");		if (section != j){$(this).attr("src",tab_sticky[j]);};	};	$('img[id|="m"]').click(leave); // drop tab on click - fixes issue with tab stuck up on "back" button	// custom function for email rollover image	(new Image()).src	=	"/graphics_slices/soup2nuts_10-over.gif";		$('#emaillink').hover(		function () { // enter			$(this).attr('src','/graphics_slices/soup2nuts_10-over.gif');		}, 		function () { //leave			$(this).attr('src','/graphics_slices/soup2nuts_10.gif');		}	);});
