// JavaScript Document

var image_path = "";

var living_dropdown_image = "http://s7d5.scene7.com/is/image/thomasville/144411_101002S_07?ckill=1&op_sharpen=1&hei=115&wid=123&align=0,0";
var living_dropdown_description = "Living Room Furniture";
var bedroom_dropdown_image = "http://s7d5.scene7.com/is/image/thomasville/45211_435445S_DS_08?ckill=1&op_sharpen=1&hei=115&wid=123&align=0,0";
var bedroom_dropdown_description = "Bedroom Furniture";
var dining_dropdown_image = "http://s7d5.scene7.com/is/image/thomasville/44421_771S_DS08?ckill=1&op_sharpen=1&hei=115&wid=123&align=0,0";
var dining_dropdown_description = "Dining Room Furniture";
var office_dropdown_image = "http://s7d5.scene7.com/is/image/thomasville/50941_630S_DS_08?ckill=1&op_sharpen=1&hei=115&wid=123&align=0,0";
var office_dropdown_description = "Home Office Furniture";
var accessories_dropdown_image = "http://s7d5.scene7.com/is/image/thomasville/60102_1032S_07?ckill=1&op_sharpen=1&hei=115&wid=123&align=0,0";
var accessories_dropdown_description = "Home Furniture Accessories";
var entertainment_dropdown_image = "http://s7d5.scene7.com/is/image/thomasville/53741985935823S_DS_08?ckill=1&op_sharpen=1&hei=115&wid=123&align=0,0";
var entertainment_dropdown_description = "Home Entertainment Furniture";
var design_dropdown_image = "/images/nav/mercer.jpg";
var design_dropdown_description = "Design Your Own";

$(document).ready(function() 
{
	$("#living_nav").mouseover(function(){
		$("#living_dropdown").show();
		$("#living_dropdown .first img").attr("src", image_path + living_dropdown_image);
		$("#living_dropdown .first p").html(living_dropdown_description);
	});
	$("#living_nav").mouseout(function(){
		$("#living_dropdown").hide();
	});
	$("#living_dropdown").hover(
		function(){$("#living_dropdown").show();}, 
		function(){$("#living_dropdown").hide();}
	);

	$("#dining_nav").mouseover(function(){
		$("#dining_dropdown").show();
		$("#dining_dropdown .first img").attr("src", image_path + dining_dropdown_image);
		$("#dining_dropdown .first p").html(dining_dropdown_description);							
	});
	$("#dining_nav").mouseout(function(){
		$("#dining_dropdown").hide();									
	});
	$("#dining_dropdown").hover(
		function(){$("#dining_dropdown").show();}, 
		function(){$("#dining_dropdown").hide();}
	);
	
	$("#bedroom_nav").mouseover(function(){
		$("#bedroom_dropdown").show();
		$("#bedroom_dropdown .first img").attr("src", image_path + bedroom_dropdown_image);
		$("#bedroom_dropdown .first p").html(bedroom_dropdown_description);								
	});
	$("#bedroom_nav").mouseout(function(){
		$("#bedroom_dropdown").hide();									
	});
	$("#bedroom_dropdown").hover(
		function(){$("#bedroom_dropdown").show();}, 
		function(){$("#bedroom_dropdown").hide();}
	);
	
	$("#office_nav").mouseover(function(){
		$("#office_dropdown").show();
		$("#office_dropdown .first img").attr("src", image_path + office_dropdown_image);
		$("#office_dropdown .first p").html(office_dropdown_description);									
	});
	$("#office_nav").mouseout(function(){
		$("#office_dropdown").hide();									
	});
	$("#office_dropdown").hover(
		function(){$("#office_dropdown").show();}, 
		function(){$("#office_dropdown").hide();}
	);
	
	$("#entertainment_nav").mouseover(function(){
		$("#entertainment_dropdown").show();
		$("#entertainment_dropdown .first img").attr("src", image_path + entertainment_dropdown_image);
		$("#entertainment_dropdown .first p").html(entertainment_dropdown_description);									
	});
	$("#entertainment_nav").mouseout(function(){
		$("#entertainment_dropdown").hide();									
	});
	$("#entertainment_dropdown").hover(
		function(){$("#entertainment_dropdown").show();}, 
		function(){$("#entertainment_dropdown").hide();}
	);
	
	$("#design_nav").mouseover(function(){
		$("#design_dropdown").show();
		$("#design_dropdown .first img").attr("src", image_path + design_dropdown_image);
		$("#design_dropdown .first p").html(design_dropdown_description);									
	});
	$("#design_nav").mouseout(function(){
		$("#design_dropdown").hide();									
	});
	$("#design_dropdown").hover(
		function(){$("#design_dropdown").show();}, 
		function(){$("#design_dropdown").hide();}
	);
	
	$("#accessories_nav").mouseover(function(){
		$("#accessories_dropdown").show();
		$("#accessories_dropdown .first img").attr("src", image_path + accessories_dropdown_image);
		$("#accessories_dropdown .first p").html(accessories_dropdown_description);								
	});
	$("#accessories_nav").mouseout(function(){
		$("#accessories_dropdown").hide();									
	});
	$("#accessories_dropdown").hover(
		function(){$("#accessories_dropdown").show();}, 
		function(){$("#accessories_dropdown").hide();}
	);
	
	$(".dropdown li ul li a").each(function(){
		$(this).hover(
			function(){
				$(".dropdown:block .first p").html($(this).attr("title"));
				$(".dropdown:block .first img").attr("src", image_path + $(this).attr("rel"));
			},
			function(event){
				if(!$(event.relatedTarget).is("a")){
					var dropdown = $(this).closest(".dropdown");
					$(dropdown).find(".first img").attr("src", image_path + eval($(dropdown).attr("id") + "_image"));
					$(dropdown).find(".first p").html(eval($(dropdown).attr("id") + "_description"));
				}
			}
		);
	});
	
	$(".dropdown").each(function(){
		$(this).width(($(this).children().size()-2)*200+360);
	});
	
});