function onMerchandiseInit()
{
	/* Overlay Popups */
	$jq("div").filter(".merchContainer").hide();
	
	$jq("#merchItems").children("div").children("div").children("h3").children("a").click(function(event){
		merchShow($jq(this),event.pageY);
	});
	$jq("a").filter(".merchClose").click(merchHide);
	$jq("#merchBG").fadeTo(10,0, function(){ $jq("#merchBG").hide() });
	
	/* Toggle Merchandise Content */
}

function merchShow(obj, mousepos)
{	
	$jq("#wrapper").find("select").css("visibility","hidden");
	$jq("#popOverlay").show();
	$jq("#merchBG").show();
	
	$jq(obj).parent().parent().children("div").filter(".merchContainer").show();
	$jq(obj).parent().parent().children("div").children("div").children("div").filter(".merchTitle").show();
	
	
	var popWidth = $jq(obj).parent().parent().children("div").filter(".merchContainer").width();
	var popHeight = $jq(obj).parent().parent().children("div").filter(".merchContainer").height();
	var popLeftPos = ($jq('div#content').width() - popWidth) / 2;

	$jq(obj).parent().parent().children("div").filter(".merchContainer").css("left", popLeftPos);
	$jq(obj).parent().parent().children("div").filter(".merchContainer").css("top", (mousepos + 40) - ($jq(obj).parent().parent().children("div").filter(".merchContainer").height() / 2));
	$jq("#merchBG").css("left", popLeftPos + 4);
	$jq("#merchBG").css("top", (mousepos + 44) - ($jq(obj).parent().parent().children("div").filter(".merchContainer").height() / 2));
	
	
	$jq("#popOverlay").width(overlayWidth);
	$jq("#popOverlay").height(overlayHeight);
	
	$jq("#merchBG").width(popWidth);
	$jq("#merchBG").height(popHeight);
	
	$jq(obj).parent().parent().children("div").filter(".merchContainer").fadeIn("slow");
	
	$jq("#merchBG").fadeTo("slow",0.3);	
	$jq("#popOverlay").fadeTo("slow",0.8);
}

function merchHide()
{
	$jq("#wrapper").find("select").css("visibility","visible");
	$jq("#merchBG").fadeTo(1000,0, function(){ $jq("#merchBG").hide() });
	$jq("#popOverlay").fadeTo(1000,0, function(){ $jq("#popOverlay").hide() });
	$jq(this).parent().parent().parent().fadeOut("slow");
}


$jq(document).ready(onMerchandiseInit);
