//show and hide on homepage

$(document).ready(function() {

    //hide all the divs with class teaser-content 
    //$("#home-teaser-wrap div.teaser-content").hide();

    var hoverConfig = {
        sensitivity: 7,
        interval: 100,
        over: teaserHoverOver,
        timeout: 250,
        out: teaserHoverOut
    }

    //when you click on a div with the class of home-teaser show the content
    $("#home-teaser-wrap .teaser-content").hide();
    $("#home-teaser-wrap li.teaser, ").hoverIntent(hoverConfig);
    $("#home-teaser-wrap .teaser-small").css("width", "166px");

});


function teaserHoverOver() {
	
	$(this)
		.children("div.teaser-content")
			.show(300)
			.end()
		.children("div.teaser-grey")
			.removeClass("teaser-grey")
			.end()
		.siblings("li.teaser")
			.children("div.home-teaser")
				.addClass("teaser-grey");
	
};

function teaserHoverOut() {
	
	$(this)
		.children("div.teaser-content")
			.hide(300);

	$("#home-teaser-wrap")
		.animate({width:"100%"
            }, 310, function() {
		    if ($(this).find("div.teaser-content:visible").length == 0) {
		        $(this)
					.find("div.teaser-grey")
						.removeClass("teaser-grey");
		    };
		});
	
};