var Img
var ImgWidth
var ImgHeight

Img = new Image();

var timer
clearTimeout(timer);
timer = null;
w = 300
h = 300

function photo(PathImg, jazyk) {
	if(!document.getElementById('photodetail')) document.body.innerHTML += '<div id="photodetail"></div><div id="photodetail_in"></div>'
	var photo_in = document.getElementById('photodetail_in')
	photo_in.style.width = w;
	photo_in.style.height = h;

	document.getElementById('photodetail').style.height=page.offsetHeight+800;
	document.getElementById('photodetail_in').style.left=(screen.availWidth/2)-150;
	
	if (jazyk == 1){
		photo_in.innerHTML = '<br /><a href="javascript:photoclose()"><img src="'+ PathImg +'" alt="zavřít/skrýt obrázek" onload="ImgSize(this)" /><br /><img class="close" src="img/closelabel_small.jpg" alt="zavřít/skrýt obrázek" /></a>'
	} else {
		photo_in.innerHTML = '<br /><a href="javascript:photoclose()"><img src="'+ PathImg +'" alt="close obrázek" onload="ImgSize(this)" /><br /><img class="close" src="/data/xsl/photodetail/closelabel-en.gif" alt="close obrázek" /></a>'
	}
	document.getElementById('photodetail').style.display = 'block';	
	document.getElementById('photodetail_in').style.display = 'block';	
	window.scrollTo(0, 0)
	
	document.getElementById('goodsselect').style.display = 'none';
	
}
function photoclose() {
	document.getElementById('photodetail').style.display = 'none';
	document.getElementById('photodetail_in').style.display = 'none';
	document.getElementById('goodsselect').style.display = 'block';
}

function ImgSize(image) {
	var photo_in = document.getElementById('photodetail_in')

	Img.src = image.src;
	
	photo_in.style.width = Img.width + 50
	photo_in.style.height = Img.height + 50

//	ResizeWidth()
//	ResizeHeight()
	
//	image.style.display = 'block';
	image.style.visibility = 'visible';
	Img = new Image();
	
//	ShowImg(photo_in)


// spocitani sirky okna a divu s obraze
document.getElementById('photodetail_in').style.left=(screen.availWidth/2)-(photodetail_in.offsetWidth/2);

}
/*
function ResizeWidth() {
	var photo_in = document.getElementById('photodetail_in')
	
	if(w < ImgWidth + 50) {
		w = w + 200
		if(w > ImgWidth + 50) {w = ImgWidth + 50}
		photo_in.style.width = w
		timer = setTimeout('ResizeWidth()',0);
		//ResizeWidth()
	} else {
		ShowImg(photo_in)
	}
}

function ResizeHeight() {
	var photo_in = document.getElementById('photodetail_in')
	
	if(h < ImgHeight + 50) {
		h = h + 200
		if(h > ImgHeight + 50) {h = ImgHeight + 50}
		photo_in.style.height = h 
		timer = setTimeout('ResizeHeight()',0);
		//ResizeHeight()
	} else {
		ShowImg(photo_in)
	}
}
*/
/*
function ShowImg(photo_in) {
	if(photo_in.style.width.replace('px', '') == ImgWidth+50 && photo_in.style.height.replace('px', '') == ImgHeight+50) {
		document.getElementById('photodetail_in').innerHTML = document.getElementById('photodetail_help').innerHTML
	}
}
*/
