//------------------------------//
//    Change logging console    //
//------------------------------//

// expand selected change to show details

function show_change_details(change_key)
{
	if(ajax_in_use == 1) return;
	ajax_in_use = 1; 
	ajax_prev = $('#'+change_key).html();
	
	// show 'wait' div instead
	
	var width = $('#' + change_key).width();
	var height = $('#' + change_key).height();
	var wt = "<div class='wt' style='width:" + width + "px;height:" + height + "px;'></div>";
	$('#' + change_key).html(wt);
	
	// use ajax to retrieve change details
	
	$.get(
		ajax_call_file,

		{
			action: 'read' ,
			edit_key: change_key ,
			sp: 'show_change'
		}, 
		
		function(data){
			if(data.response == 'success') {
	
				var change_text = data.content;
				$('#'+change_key).html(change_text);
				
				var hide_link = data.hidelink;
				$('#link_' + change_key).html("<a class='tmlinkg' href='javascript:hide_change_details(\"" + change_key + "\");'>Hide changes</a>&nbsp;");
				
			} else {
			
				alert("Something went wrong!");
			}
			ajax_in_use = 0; 
		},
		'json'
	);
	//
}

// hide site change details

function hide_change_details(change_key)
{
	$('#'+change_key+'_control').html("<a class='top_controls' href='javascript:show_change_details(\"" + change_key + "\");'>Show changes</a>");
	$('#'+change_key).html("");
}



