/* Jacks in the product into the search/listings */

function stamp(){
 	var d = new Date();
 	var time = d.getTime();
 	return time;
}

function fetch_section( sid )
{
	
	var destination = $("div.description",$("div.e" + sid));
	var nametag = $("div.name",$("div.e"+sid));
	var par = $("div.e"+sid);
	
	$(".showing").each(function(i){
			$(this).removeClass("showing");
			$("div.description",$(this)).css("display","none");
	});
	
	if ( ! $(par).is(".showing") )
	{
		if ( $(nametag).is(".fetched") )
		{
			$(destination).css("display","");
			$(par).addClass("showing");
		}
		else
		{
			if ( ! $(nametag).is(".fetching") )
			{
				$(nametag).addClass("fetching");
				
				$.post("product_inner.php",{ product: sid, time: $.stamp() }, function(data){
					$(destination).html(data);
					$(nametag).addClass("fetched");
					$(destination).css("display","");
					$(par).addClass("showing");
					$(nametag).removeClass("fetching");
					doBinds(sid);
					/*bind_togglers(par,sid);*/
				});
			}
		}
	}
	else
	{
		$(destination).css("display","none");
		$(par).removeClass("showing");
	}
}
