// JavaScript Document

function selectList ( lang, name, id, init )
{
	if ( $("message_content") )
	{
		$("message_content").innerHTML = '<div style="padding-left:15px;">讀取中...</div>';
		setClass ( selected_id, false );
		new Ajax.Updater ( "message_content", "../codeFiles/updateList.php?lang=" + lang + "&name=" + name + "&id=" + id );
		selected_id = id;
		setClass ( selected_id, true );
		if ( !init ) setNavigation ( "/" + id );
	}
}

function setClass ( id, is_select )
{
	$("list_area_left_" + selected_id).className 		= (is_select) ? "list_area_left_select" : "list_area_left";
	$("list_area_right_" + selected_id).className 		= (is_select) ? "list_area_right_select" : "list_area_right";
	$("list_area_left_top_" + selected_id).className 	= (is_select) ? "list_area_left_top_select" : "list_area_left_top";
	$("row_" + selected_id).className 					= (is_select) ? "row_select" : "row";
	$("row_text_" + selected_id).className 				= (is_select) ? "row_text_select" : "row_text";
	$("row_date_" + selected_id).className 				= (is_select) ? "row_date_select" : "row_date";
}

var selected="";
function swapImage ( id, filename, color )
{
	var s = document.getElementById(selected);
	if(s)s.className = "image_thumb";
	var d = document.getElementById(id);
	if(d)d.className = "image_thumb_select";
	selected = id;
	new Ajax.Updater ( "enlarge", "../codeFiles/updateImage.php?file="+filename+"&color="+color );
}