$(document).ready(function() {

		// changes field focus for all inputs. Uses the field's value for text.
		$('input, textarea').focus(function() {
			value=$(this).val();
			$(this).attr("value","");
		});
		$('input, textarea').blur(function() {
			if($(this).val()=="") {
				$(this).val(value);
			}
		});

	// Menu page accordion
	if($("#menu_list").length > 0) {
		$("#menu_list dt").click(function() {
			
			var sel = $(this);
			
			// add class to the element
			// to indicate current selector
			sel.addClass("active current");
			
			// loop through all dd elements to slide them up
			// except the current one in case we simply want to slide it up
			sel.parent().children("dd").each(function() {
				if($(this).is(":visible") && !$(this).prev("dt").hasClass("current")) {
					if($(this).prev("dt").hasClass("active")) {
						$(this).prev("dt").removeClass("active");
					}
					$(this).slideUp(300);					
				}
			});
			
			// toggle slide and remove class from the current selector
			sel.next().slideToggle(300, function() {
				if(!$(this).is(":visible")) {
					$(this).prev("dt").removeClass("active");
				}
				sel.removeClass("current");				
			});
			
			return false;
			
		});
	}

});

// image rollovers
function rollover(img_name, img_src) {
   document[img_name].src = img_src;
}

