
var obj = null;
var obj2 = null;



function checkHover() {
	if (obj) {
	 	obj.children('.menu').hide();
		obj.children('.menu').css("display", "none");		
	} 
}

function checkHover2() {
	if (obj2) {
	 	obj2.children('.menu').hide();
		obj2.children('.menu').css("display", "none");		
	} 
}


$(document).ready(function() {
	obj = null;
	
	$('.sidenav li').hover(function() {
		$(this).addClass("hover");									
	}, function() {
		$(this).removeClass("hover");									
	});
		
    $('.navlink').hover(function() {
		if (obj && obj != $(this)) {
            obj.children('.menu').hide();
            obj = null;
        } 		 	
        $(this).children('.menu').css("left", $(this).offset().left).css("top", $(this).offset().top + $(this).height() + 12).show();
     }, function() {
         obj = $(this);
         setTimeout("checkHover()",400);
     });
	
	 $('.navlink>.menu>.menuitem').hover(function() {
		if (obj2 && obj2 != $(this)) {
            obj2.children('.menu').hide();
            obj2 = null;
        }
     	$(this).children('.menu').css("left", $(this).width() + 17).css("top", $(this).position().top - 1).show();
     }, function() {
         obj2 = $(this);
         setTimeout("checkHover2()", 400);
     });
	 
	 
	 $('.upcomingHome').hover(function() {
		if($('.upcomingHomeList').css("display") == 'none'){
			$('.upcomingHomeList').css("display", "block");
		}else{
			$('.upcomingHomeList').css("display", "none");
		}
     });
	 
	 $('.upcomingFlower').hover(function() {
		if($('.upcomingFlowerList').css("display") == 'none'){
			$('.upcomingFlowerList').css("display", "block");
		}else{
			$('.upcomingFlowerList').css("display", "none");
		}
     });
	 
	 
});



/*
function viewPic(picName) {
	 var picwin = window.open("/viewpic.cfm?picName=" + picName, "picwin", "width=650,height=500,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
	 picwin.document.close();
	 picwin.focus();
}

var obj = null;
var obj2 = null;

function checkHover() {
	if (obj) {
	 	obj.children('.menu').hide();
		obj.children('.menu').css("display", "none");		
	} 
}

function checkHover2() {
	if (obj2) {
	 	obj2.children('.menu').hide();
		obj2.children('.menu').css("display", "none");		
	} 
}

var indexFlowerImgs = ["index-img-flower-1.jpg","index-img-flower-2.jpg","index-img-flower-3.jpg","index-img-flower-4.jpg","index-img-flower-5.jpg","index-img-flower-6.jpg","index-img-flower-7.jpg"];
var indexHomeImgs = ["index-img-home-1.jpg","index-img-home-2.jpg","index-img-home-3.jpg","index-img-home-4.jpg","index-img-home-5.jpg"];

var interiorflowerImgs = ["interior-img-flower-1.jpg","interior-img-flower-2.jpg","interior-img-flower-3.jpg","interior-img-flower-4.jpg","interior-img-flower-5.jpg"];
var interiorhomeImgs = ["interior-img-home-1.jpg","interior-img-home-2.jpg","interior-img-home-3.jpg","interior-img-home-4.jpg","interior-img-home-5.jpg","interior-img-home-6.jpg"];
var interiormainImgs = ["interior-img-generic-1.jpg","interior-img-generic-2.jpg","interior-img-generic-3.jpg"];

function rotateImage(obj, arr, duration, delay) {
	arr.push(arr.shift());
	$(obj).children("img:first").after("<img src=''>");
	$(obj).children("img:last").hide().attr("src", "/template/sleek/images/" + arr[0]).load(function() {
		$(this).fadeIn(duration);
		$(this).prev().fadeOut(duration, function() { $(this).remove(); });
	});
	
	setTimeout(function() { rotateImage(obj, arr, duration, delay) }, delay);			
}


$(document).ready(function() {
	obj = null;
	
	// make div bkg clickable for menuitems
	$('.menuitem').click(function() { 
		location.href = $(this).children('a:first').attr('href'); // navigate to the first A tag's href attribute
		return false; // don't bubble up for nested menuitems
	});
	
	$('.upcomingShowList li').click(function() {
		location.href = $(this).children('a:first').attr('href'); // navigate to the first A tag's href attribute
		return false; // don't bubble up for nested menuitems
	});
	
	$('.frmNewsLetter fieldset');	
	
	var labelValue = $(".frmNewsLetter input[type='text']:first").siblings("label").html();
	// Set the input value equal to label text
	$(".frmNewsLetter input[type='text']:first").val(labelValue);
	
	$(".frmNewsLetter").submit(function() {
		if($('.frmNewsLetter #emailaddress').val() == 'Enter Email')
			$('.frmNewsLetter #emailaddress').val('');
	});
	
	// Attach event listeners to the input
	$(".frmNewsLetter input[type='text']:first").bind("focus blur", function(e){
		var eLabelVal = $(this).siblings("label").html();
		var eInputVal = $(this).val();
		
		// Empty input value if it equals it's label
		if (eLabelVal == eInputVal) {
			$(this).val("");
		// Reset the input value if it's empty
		} else if ($(this).val() == "") {
		  $(this).val(eLabelVal);
		}
	});
	
	$('.sidenav li').hover(function() {
		$(this).addClass("hover");									
	}, function() {
		$(this).removeClass("hover");									
	});
		
    $('.navlink').hover(function() {
		if (obj && obj != $(this)) {
            obj.children('.menu').hide();
            obj = null;
        } 		 	
        $(this).children('.menu').css("left", $(this).offset().left).css("top", $(this).offset().top + $(this).height() + 12).show();
     }, function() {
         obj = $(this);
         setTimeout("checkHover()",400);
     });
	
	 $('.navlink>.menu>.menuitem').hover(function() {
		if (obj2 && obj2 != $(this)) {
            obj2.children('.menu').hide();
            obj2 = null;
        }
     	$(this).children('.menu').css("left", $(this).width() + 17).css("top", $(this).position().top - 1).show();
     }, function() {
         obj2 = $(this);
         setTimeout("checkHover2()", 400);
     });
	 
	 
	 $('.upcomingHomeLabel').hover(function() {
		if (obj && obj != $(this)) {
            obj.children('.menu').hide();
            obj = null;
        } 		 	
        $(this).children('.menu').css("left", $(this).offset().left - 87).css("top", $(this).offset().top + $(this).height() + 15).show();
     }, function() {
         obj = $(this);
         setTimeout("checkHover()",400);
	 });
	 
	 
	 $('.upcomingFlowerLabel').hover(function() {
		if (obj && obj != $(this)) {
            obj.children('.menu').hide();
            obj = null;
        } 		 	
        $(this).children('.menu').css("left", $(this).offset().left).css("top", $(this).offset().top + $(this).height() + 15).show();
     }, function() {
         obj = $(this);
         setTimeout("checkHover()",400);
	 });
	 	 
	 setTimeout(function() { rotateImage($('#homeRotator'), indexHomeImgs, 700, 5000) }, 5000); 
	 setTimeout(function() { rotateImage($('#flowerRotator'), indexFlowerImgs, 700, 5000) }, 2500); 
	 setTimeout(function() { rotateImage($('#interiorRotator'), eval("interior" + cat + "Imgs"), 700, 8000) }, 2500);
});*/