$(document).ready(function(){
	
		// remove link background images since we're re-doing the hover interaction below 
		// (doing it this way retains the CSS default hover states for non-javascript-enabled browsers)
		// we also want to only remove the image on non-selected nav items, so this is a bit more complicated
		$(".room_menu").children("li").each(function() {
			var current = "room_menu current-" + ($(this).attr("class"));
			var parentClass = $(".room_menu").attr("class");
			if (parentClass != current) {
				$(this).children("a").css({backgroundImage:"none"});
			}
		});	


		// create events for each nav item
		attachNavEvents(".room_menu", "charme");
		attachNavEvents(".room_menu", "smart");
		attachNavEvents(".room_menu", "relax");
		attachNavEvents(".room_menu", "light");
	

		function attachNavEvents(parent, myClass) {
			$(parent + " ." + myClass).mouseover(function() {
				var classe_ul=$(".room_menu").attr("class");
				
					$(this).append('<div class="room_menu-' + myClass + '"></div>');
					$("div.room_menu-" + myClass).css({display:"none"}).fadeIn(200);
				
			}).mouseout(function() {
				$("div.room_menu-" + myClass).fadeOut(200, function() {
					$(this).remove();
				});
			}).mousedown(function() {
				$("div.room_menu-" + myClass).attr("class", "room_menu-" + myClass + "-click");
			}).mouseup(function() {
				$("div.room_menu-" + myClass + "-click").attr("class", "room_menu-" + myClass);
			});
			
		}



	});

