function show_full_pic(path, desc){
	create_elements();
	set_style();
	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 full_image = document.createElement("img");	
	full_image.setAttribute("id", "gallery_full_image");
	
	document.body.appendChild(back);
	document.body.appendChild(img_container);
	document.body.appendChild(full_image);
}

function set_style(){
	// back
	$('gallery_back').setStyle({
		position: 'fixed',
		top: '0px',
		left: '0px',
		width: '100%',
		height: '100%',
		opacity: '0.5',
		background: 'black',
		zIndex: '100'
	});
	
	$('gallery_back').onclick = function(){
		close_full_image();
	}
	
	// img container
	$('gallery_img_container').setStyle({
		position: 'fixed',
		top: '50px',
		left: '50%',
		marginLeft: '-50px',
		width: '100px',
		height: '60px',
		background: 'white',
		zIndex: '1001',
		textAlign: 'center',
		paddingTop: '40px'
	});
	
	// full pic
	$('gallery_full_image').setStyle({
		position: 'absolute',
		top: '50px',
		left: '50%',
		background: 'white',
		zIndex: '1001',
		display: 'none',
		padding: '5px',
		cursor: 'pointer'
	});
	
	$('gallery_full_image').onclick = function(){
		close_full_image();
	}
	
	// special ie6
	if(navigator.appVersion.indexOf("MSIE 6") != '-1'){
		$('gallery_back').setStyle({
			position: 'absolute'
		});
		
		$('gallery_img_container').setStyle({
			position: 'absolute'
		});
	}
}

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

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

	image.onload = function() {
		$("gallery_img_container").hide();
		$("gallery_full_image").src = path;
		$("gallery_full_image").setStyle({
			marginLeft: '-'+(image.width+4)/2+'px'
		});
		$("gallery_full_image").show();
	}

	image.src = img_path;	
}

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


