$(function(){
	
	// listenButton
	$("img.listen").click(function() {
		// hidden watchListBox
		$("div#watchListBox").css("display", "none");
		// reset listenButton,watchButton
		resetButtons();
		// set thisButton Active
		$(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"));
		//
		var listLocationX = Math.round($(this).offset().left);
		var listLocationY = Math.round($(this).offset().top);
		currentList = "div#listenListBox";
		// visible listenListBox
		$("div#listenListBox").css("display", "block");
		$("table#listenTable").html(listen_ids[$(this).attr("id")]);
		//
		setListPosition(listLocationX, listLocationY);
	});
	
	// watchButton
	$("img.watch").click(function() {
		// hidden listenListBox
		$("div#listenListBox").css("display", "none");
		// reset listenButton,watchButton
		resetButtons();
		// set thisButton Active
		$(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"));
		//
		var listLocationX = Math.round($(this).offset().left);
		var listLocationY = Math.round($(this).offset().top);
		listLocationX -= 55;
		currentList = "div#watchListBox";
		// visible watchListBox
		$("div#watchListBox").css("display", "block");
		$("table#watchTable").html(listen_ids[$(this).attr("id")]);
		//
		setListPosition(listLocationX, listLocationY);
	});
	
	// workListCloseButton
	$("p.closeBtn").click(function() {
		$("div#listenListBox").css("display", "none");
		$("div#watchListBox").css("display", "none");
		try { $("img.listen").attr("src",$("img.listen").attr("src").replace(/^(.+)_on(\.[a-z]+)$/, "$1$2")); } catch(e){}
		try { $("img.watch").attr("src",$("img.watch").attr("src").replace(/^(.+)_on(\.[a-z]+)$/, "$1$2")); } catch(e){}
	});
	
})


