$(document).ready(
	function() {
		$("#topMenu img").each(
			function() {
				if ($(this).attr("src").indexOf("_over") == -1) {
					var preloader = new Image();
					preloader.src = $(this).attr("src").slice(0, $(this).attr("src").indexOf(".jpg")) + "_over.jpg";
				}
			}
		);
		$("#topMenu img").hover(
			function() {
				if (!($(this).parent().parent().hasClass("topMenuSelected"))) {
					$(this).attr("src", $(this).attr("src").slice(0, $(this).attr("src").indexOf(".jpg")) + "_over.jpg");
					$(this).parent().parent().addClass("topMenuHover");
				}
			},
			function() {
				if (!($(this).parent().parent().hasClass("topMenuSelected"))) {
					$(this).attr("src", $(this).attr("src").slice(0, $(this).attr("src").indexOf("_over.jpg")) + ".jpg");
					$(this).parent().parent().removeClass("topMenuHover");
				}
			}
		);
		$(".menuItem img").each (
			function() {
				if ($(this).attr("src").indexOf("_over") == -1) {
					var preloader = new Image();
					preloader.src = $(this).attr("src").slice(0, $(this).attr("src").indexOf(".gif")) + "_over.gif";
				}
			}
		);
		$(".menuItem img").hover(
			function() {
				if (!($(this).parent().parent().hasClass("menuItemSelected"))) {
					$(this).attr("src", $(this).attr("src").slice(0, $(this).attr("src").indexOf(".gif")) + "_over.gif");
				}
			},
			function() {
				if (!($(this).parent().parent().hasClass("menuItemSelected"))) {
					$(this).attr("src", $(this).attr("src").slice(0, $(this).attr("src").indexOf("_over.gif")) + ".gif");
				}
			}
		);
		
		if (window.location.href.indexOf("/invitations/") == -1) {
			$("#location").click(
				function() {
					if ($(this).attr("value") == "City, State or Zip") {
						$(this).attr("value", "");	
					}
				}
			);
		}
		
		$("#locationSearch").click(
			function() {
				if ($(this).attr("value") == "City, State or Zip") {
					$(this).attr("value", "");	
				}
			}
		);
	}
);