$(document).ready(function(){

	$("#category_closets").mouseover(function () {
		$("#products").hide();
		$("#closets").slideDown(300);
		$("#category_closets").css({'background-color':'#374673'});
	});
	$("#home_office").mouseover(function () {
		$("#category_closets").css({'background-image':'','background-color':'#273561'});
		$("#closets").slideUp(150);
	});
	$("#contentBody").mouseover(function () {
		$("#category_closets").css({'background-image':'','background-color':'#273561'});
		$("#closets").slideUp(150);
	});
	$("#logo").mouseover(function () {
		$("#category_closets").css({'background-image':'','background-color':'#273561'});
		$("#closets").slideUp(150);
	});
	$(".sub_nav").mouseover(function () {
		$("#category_closets").css({'background-image':'','background-color':'#273561'});
		$("#closets").slideUp(150);
	});

	$("#category_products").mouseover(function () {
		$("#closets").hide();
		$("#products").slideDown(300);
		$("#category_products").css({'background-color':'#374673'});
	});
	$("#garages").mouseover(function () {
		$("#category_products").css({'background-image':'','background-color':'#273561'});
		$("#products").slideUp(150);
	});
	$("#contentBody").mouseover(function () {
		$("#category_products").css({'background-image':'','background-color':'#273561'});
		$("#products").slideUp(150);
	});
	$("#last").mouseover(function () {
		$("#category_products").css({'background-image':'','background-color':'#273561'});
		$("#products").slideUp(150);
	});
	$(".sub_nav").mouseover(function () {
		$("#category_products").css({'background-image':'','background-color':'#273561'});
		$("#products").slideUp(150);
	});

	// $("#reqEstimate #send").click(function() {
		// $.post("home/ajax", function(data){
		  // $("#formResult").fadeIn();
		  // $("#formResult").html(data);
		// });
	// });
	
	$("#formRequest").submit(function(){

		var str = $(this).serialize();

		$.ajax({
			type: "POST",
			url: "contact_us/ajax",
			data: str,
			success: function(msg){
			
				$("#requestResult").ajaxComplete(function(event, request, settings){

					if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
					{
						result = 'Thank you for your interest in Everything Closets, <br />a representative will contact you shortly.';
						$("#requestResult").html(result);
						$("#requestResult").slideDown();
						$("#contactForm").slideUp();
					}
					else
					{
						result = msg;
						$("#requestResult").html(result);
						$("#requestResult").slideDown();

					}
					
				});
			}
		});

	return false;

	});	
	$("#reqEstimate").submit(function(){

		var str = $(this).serialize();

		$.ajax({
			type: "POST",
			url: "home/ajax",
			data: str,
			success: function(msg){
			
				$("#formResult").ajaxComplete(function(event, request, settings){

					if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
					{
						$("#formResultError").hide();
						$(".showroomHours").fadeTo("fast", 1);
						result = '<div class="notification_ok">Your request has been sent and <br />we will contact you shortly. <br /><span>Thank you!</span></div>';
						$("#formResult").html(result);
						$("#resultContainer").css({zIndex:"10"});
						$("#formResultError").hide();
						$("#resultContainer").show();
						$("#formResult").show();
					}
					else
					{
						result = msg;
						$("#formResultError").html(result);
						$("#formResultError").css({
							display:"none",
							position:"absolute",
							left:"548px",
							backgroundImage:"url()",
							backgroundColor:"#091A4D",
							height:"auto",
							width:"388px",
							top:"550px",
							zIndex:"80"
						});
						$(".showroomHours").fadeTo("slow", 0.33);
						$("#formResultError").show();
						$("#formResultError").animate({ 
							top:"564px"
						  }, 400 );
						
					}
					
				});
			}
		});

	return false;

	});
	
    $(function() {
        $('#wood_samples a').lightBox();
    });

});

/*
	function showDetail(image) {
		var detailBox = document.getElementById('detailBox');
		if (detailBox == null) {
			var div = document.createElement('div');
			var img = document.createElement('img');
			div.style.float="left";
			div.style.position="absolute";
			div.setAttribute('id', 'detailBox');
			img.setAttribute('src', image);
			div.appendChild(img);
			document.getElementById('wrapper').appendChild(div);
		} else {
			ev = event || window.event;
			alert(ev.pageX);
			}
	}*/
	