jQuery(document).ready(function() {
	/*.hover(function(){},function(){
			jQuery(this).children('ul').slideUp(500,function(){
				jQuery(this).parent().removeClass("open");
			});
		})*/
		jQuery("#column-one ul li ul").parent('li').addClass('drop').children('a').click(function() {
			if(jQuery(this).parent('li').hasClass('open')){
				
			}else{
				jQuery('#column-one ul li.drop.open').children('ul').slideUp(500,function(){jQuery(this).parent('li').removeClass('open');});
				jQuery(this).parent('li').children('ul').slideDown(500,function(){
					jQuery(this).parent().addClass("open");
				});
				return false;
			}
		//jQuery("#column-one ul li").removeClass("open").removeClass("selected");
		//jQuery(this).parent('li').toggleClass("open");
		//return false;
	}
	/*,function(){	
		jQuery(this).children('ul').slideUp(500,function(){
			jQuery(this).parent().removeClass("open");
		});
	}*/);
	jQuery("#column-one ul li.selected").addClass('open');
	if( $('#column-one ul li.selected') ) {
		$('#column-one ul li.selected').mouseout(function(e) {
			if($('>  a',$(this)).text() =='Home') {
				$(this).addClass('open');
			} else {
				$(this).addClass('open drop');
			}
		});
	}
	var warm = jQuery("#warm-weather").html();
	if ( warm ) {
		if ( warm == 'y' ) {
			jQuery("#warm-weather").html('<p class="warm-weather"><strong>Warm Weather Warning</strong>Please Note, this product can melt. Our chocolates contain the freshest ingredients and no preservatives. If the temperature we are shipping to or from is 70 degrees F. or more, Next Day Air shipping is recommended to guarantee your products against melting.</p>');
		}
	}
	var pagingHeader = jQuery(".header");
	var paging = pagingHeader.children();
	if ( paging.html() ) {
		if ( paging.html().length == 0 ) {
			paging.parent().hide();	
			jQuery(".footer").hide();
		}
	} else {
		jQuery(".header").hide();
		jQuery(".footer").hide();
	}
	jQuery("#warning-cell .productitemcell").addClass('this').each(function(i) {
		var warmAgain = jQuery(this).html();
		if ( warmAgain ) {
			if ( warmAgain != 'y' ) {
				jQuery(this).remove();
			}
		} else {
			jQuery(this).remove();
		}
	});
	jQuery("#warning-cell .productitemcell").hover(function() { 
		var offset = jQuery(this).position();
		jQuery("#warm-weather-warning").css({'top' : offset.top+30, 'left' : offset.left-30}).fadeIn();
	}, function() {
		jQuery("#warm-weather-warning").fadeOut();
	});
	jQuery("#giftBox").attr("checked",false);
	jQuery("#giftBox").click(function() {
		jQuery("#gift-note").toggle();
	});
});
