$().ready(function() {
	$(".IEMPCat").click(function() {
		var divIEMPCat = $(this).attr('id');
		var IEMPCatID = divIEMPCat.replace(/divIEMPCat/,"");
		ShowHideIEMPList(IEMPCatID);
	});

	$(".offerPlanHolder").click(function() {
		var divIEMP = $(this).attr('id');
		var lIEMP = divIEMP.replace(/divIEMP/,"").replace(/m/,",");
		$.AjaxCFC({
			url: "/org/red5/ajax/entity.cfc",
			method: "addToCart",
			blockMessage: "Please wait while we add to your cart....",
			data: {"lIEMP":lIEMP},
			success: function(r) {
				$("#divAddToCartResponse").html("");
				$("#divAddToCartResponse").append(r.html);
				//$("#divAddToCart").jqm();
				$("#cartQty").html(r.CARTITEMS);
				Shadowbox.open({
					player:'html',
					content:$("#divAddToCart").html(),
			        height:     256,
			        width:      485
				});
			}
		});
	});
	
	$(".termsPopup").click(function(){
		Shadowbox.open({
			player:'html',
			content:$($(this).attr('href')).html(),
			width:		485,
			height:		428
		});
		return false;
	});
	$("#iempCatCollapse").click(function(){
		$(".categoryIEMPs").html("");
		$(".IEMPCat").removeClass("selected");
		heightFixEntity();
		return false;	
	});
	
	
});
function ShowHideIEMPList(IEMPCatID) {
	var IEMPContent = document.getElementById("divIEMPList"+IEMPCatID).innerHTML;
	$.AjaxCFC({
		url: "/org/red5/ajax/entity.cfc",
		method: "getEntityIEMP",
		blockUI: false,
		blockMessage: "Processing....",
		data: {"EntityIEMPCatID":IEMPCatID},
		success: function(html) {
			$("#divIEMPList"+IEMPCatID).html("");
			$("#divIEMPCat" + IEMPCatID).removeClass("selected");
			if (IEMPContent == '') {
				$("#divIEMPList" + IEMPCatID).append(html);
				$("#divIEMPCat" + IEMPCatID).addClass("selected");
			}
			heightFixEntity();
		}
	});
}

