hld_documentReady("addLinksExpansion");
var buttonExpanderLike = "[id*='linksExpander-']";

function addLinksExpansion()
{
	$(buttonExpanderLike).unbind();
	$(buttonExpanderLike).click(function() 
	 {
		var thisId = splitValue(this.id, "-", [1]);	
		var image = $("#linksExpanderImage-"+thisId).attr("src");	

		if(image.indexOf('HideLinks') > -1) {
			contractLinks(thisId);
		}else {
			expandLinks(thisId);
		}
		return false;
	 });
}

function expandLinks(thisId) {
	var html = "<img id='linksExpanderImage-" + thisId + "' src='" + resources + "/images/btn_HideLinks.jpg' class='searchIcon'/>hide related links";
	$("#expandableArea-"+thisId).slideDown('slow');
	$("#linksExpander-"+thisId).html(html);
}


function contractLinks(thisId) {
	var html = "<img id='linksExpanderImage-" + thisId + "' src='" + resources + "/images/btn_ViewLinks.jpg' class='searchIcon'/>view all related links";

	$("#expandableArea-"+thisId).slideUp("slow");
	$("#linksExpander-"+thisId).html(html);
}


function splitValue(value, token, index) {
		var arr = value.split(token);
		return arr[index];
}
