var RateSummaryContainers = new Array();
function loadRateSummary(targetID,year,rate,maturity)
{
	targetIDElem = '#'+targetID;
    if(RateSummaryContainers[targetID] == undefined)
    {
		$(targetIDElem).html("<td colspan=4>Loading ...</td>");
		var myUrl = "/_utilities/tablesummary_ajax_backend.html";
		var params = {rate_code: rate, maturity_code: maturity, selectedYear: year, summaryAction: 'showDetail'};
		//$(targetIDElem).html("<td colspan=4>"+myUrl+"?rate_code="+rate+"&maturity_code="+maturity+"&selectedYear="+year+"&summaryAction=showDetail");
		$(targetIDElem).load(myUrl,params,function(response, status, xhr) {
			if (status == "error") {
				var msg = "Sorry but there was an error: ";
				//alert(msg + xhr.status + " " + xhr.statusText);
				$(targetIDElem).html(response);
			}
			SummaryLoadSuccessfull(targetID);
		});
		/*
		$.ajax({url: myUrl,
			data: params,
			dataType: "html",
			cache: false,
			success: function (htmlContent){
				$(targetIDElem).html(htmlContent);
			},
			error: function(XMLHttpRequest, textStatus, errorThrown){
				var msg = "Sorry but there was an error: ";
				alert(msg + errorThrown + " " + textStatus +XMLHttpRequest.responseText);
			},
			complete: function(XMLHttpRequest, textStatus){
				$(targetIDElem).html(XMLHttpRequest.responseText);
			}
		});
		*/
    }
    else
    {
		if(RateSummaryContainers[targetID].visible)
		{
			$(targetIDElem).fadeOut();
			RateSummaryContainers[targetID].visible = false;
		}
		else
		{
			$(targetIDElem).fadeIn();
			RateSummaryContainers[targetID].visible = true;
		}
    }
}

function SummaryLoadSuccessfull(targetID){
    RateSummaryContainers[targetID] = {loaded:true,visible:true};
};
