// Set the initial height
var sliderHeight = "220px";

$(document).ready(function(){
	// Show the slider content
	$('.slider').show();
	
	$('.slider').each(function () {
		var current = $(this);
		current.attr("box_h", current.height());
	});
	
	$(".slider").css("height", sliderHeight);
});

// Set the initial slider state
var slider_state = "close";

function sliderAction(id)
{
	if (slider_state == "close")
	{
		sliderOpen(id);
		slider_state = "open"
		$(".slider_menu_"+id).html('<a href="#" onclick="return sliderAction('+ id +');">Close</a>');
	}
	else if (slider_state == "open")
	{
		sliderClose(id);
		slider_state = "close";
		$(".slider_menu_"+id).html('<a href="#" onclick="return sliderAction('+ id +');">Read more...</a>');
	}
	
	return false;
}

function sliderOpen(id)
{
	var open_height = $("#slider_"+id).attr("box_h") + "px";
	$("#slider_"+id).animate({"height": open_height}, {duration: "slow" });
}

function sliderClose(id)
{
	$("#slider_"+id).animate({"height": sliderHeight}, {duration: "slow" });
}
