function openGallery(cale){
	var latime   = 800;
	var inaltime = 620;
	var stanga = (window.screen.width  - latime)/2;
	var sus    = (window.screen.height - inaltime)/2;
	var f = window.open(cale,"imovilpictureGallery","left=" + stanga + ",top=" + sus + ",width=" + latime + ",height=" + inaltime + ",resizable=1");
	f.focus();
}

var xmlhttp;
var globalURL = "";

function getPicture(url,currentImg){
	for(var i=0; i<document.images.length; i++){
		if(document.images[i].className == "poza_mica_selectat") document.images[i].className = "poza_mica";
	}
	document.getElementById(currentImg).className = "poza_mica_selectat";
	globalURL = url;
	getIt();
}

function getIt(){
	// Mozila, etc.
	if(window.XMLHttpRequest){
		xmlhttp = new XMLHttpRequest();
		document.getElementById('pic_large_ct').style.display = "none";
		document.getElementById('progressBar').style.display = "";
		xmlhttp.onreadystatechange = showPicture;
		xmlhttp.open("GET",globalURL,true);
		xmlhttp.send(null);
	}
	// IE
	else if(window.ActiveXObject){
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		if(xmlhttp){
			document.getElementById('pic_large_ct').style.display = "none";
			document.getElementById('progressBar').style.display = "";
			xmlhttp.onreadystatechange = showPicture;
			xmlhttp.open("GET",globalURL,true);
			xmlhttp.send();
		}
	}
}

function showPicture(){
	if(xmlhttp.readyState == 4){
		if(xmlhttp.status == 200 || xmlhttp.status == 304){
			document.getElementById('pic_large').src = globalURL;
			document.getElementById('progressBar').style.display = "none";
			document.getElementById('pic_large_ct').style.display = "";
		}else{
			document.getElementById('pic_large_ct').innerHTML = "Picture not found!";
			document.getElementById('progressBar').style.display = "none";
			document.getElementById('pic_large_ct').style.display = "";
		}
	}
}

