function show_full_image(path, desc){
	create_elements();
	show_loader();
	load_image(path, desc);
}

function create_elements(){
	var back = document.createElement("div");	
	back.setAttribute("id", "gallery_back");
	
	var img_container = document.createElement("div");	
	img_container.setAttribute("id", "gallery_img_container");
	
	var img_loader = document.createElement("div");	
	img_loader.setAttribute("id", "gallery_loader_box");
	
	var full_image = document.createElement("img");	
	full_image.setAttribute("id", "gallery_full_image");
	full_image.onclick = close_full_image;
	
	var description = document.createElement("div");	
	description.setAttribute("id", "gallery_description");
	
	document.body.appendChild(back);
	document.body.appendChild(img_container);
	img_container.appendChild(full_image);
	img_container.appendChild(img_loader);
	img_container.appendChild(description);
}

function show_loader(){
	document.getElementById("gallery_loader_box").innerHTML = "<img src='bilder/layout/loader.gif' />";
}

function load_image(path, desc){
	var img_path = path;
	var image = new Image();

	image.onload = function() {
		document.getElementById("gallery_loader_box").style.display = "none";
		show_image(path);
		show_desc(desc);
	}

	image.src = img_path;	
}

function show_image(path){
	document.getElementById("gallery_full_image").src = path;
	document.getElementById("gallery_full_image").style.display = "inline";
}

function show_desc(desc){
	document.getElementById("gallery_description").innerHTML = desc;
}

function close_full_image(){
	document.body.removeChild(document.getElementById("gallery_back"));
	document.body.removeChild(document.getElementById("gallery_img_container"));
}