function add_new_response(name, text)
{	
	$("<li><div>"+name+"</div><div>"+text+"</div></li>").prependTo("#res");	
}

function show_album(id)
{	
	var album = $("#album_"+id);
	
	if(album.attr("not_loaded") == null)
	{
		load_album(id, album);
	}	
	else
	{		
		album.slideToggle("slow");		
	}
}

function show_response (id)
{
	var response = $("#response_"+id);
	
	if(response.attr("not_loaded") == null)
	{
		load_response(id, response);
	}	
	else
	{		
		response.slideToggle("slow");		
	}	
}

function load_response(id, response)
{		
	$("<img style='margin-left:15px;' src='./img/loadingAnimation.gif' width='208' height='13'/>").prependTo(response);
	response.show();
	
	$.post(
	'/ajax2.html',
	{
	action: 'get_response',
	id: id
	},
		function(msg)
		{			
		    response.empty();
		    response.hide();
			response.append(msg);
			response.attr("not_loaded", true);
			response.slideToggle("slow");
	  	}
	);	
}


function load_album(id, album)
{		
	$("<img style='margin-left:15px;' src='./img/loadingAnimation.gif' width='208' height='13'/>").prependTo(album);
	album.show();
	$.post(
	'/ajax2.html',
	{
	action: 'get_photos',
	id: id
	},
		function(msg)
		{			
		    album.empty();
		    album.hide();
			album.append(msg);
			album.attr("not_loaded", true);
			tb_reinit();		
			album.slideToggle("slow");
	  	}
	);	
}

