var n = 0;

function popupImage (photo, w, h){
	window.open ('inc/tools/pop_photo.php?photo=' + photo, 'IMG', 'toolbar=0,menubar=0,location=0,scrollbars=0,width=' + (w + 20) + ',height=' + (h + 40));
}

function popupImage_remot (photo, w, h){
	window.open ('pop_photo.php?photo=' + photo, 'IMG', 'toolbar=0,menubar=0,location=0,scrollbars=0,width=' + (w + 20) + ',height=' + (h + 40));
}

function getImages (from, type, id, nbphotos){
	var xhr_object = null; 

	// Firefox
	if (window.XMLHttpRequest){
		xhr_object = new XMLHttpRequest(); 
	} else 
	// Explorer
	if (window.ActiveXObject){
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	} 
	// XMLHttpRequest non supporté
	else {
		alert("Votre navigateur ne supporte pas cette fonction !");
	} 

	xhr_object.open("POST", "inc/tools/galleries.php", true); 
	
	
	
	xhr_object.onreadystatechange = function () {
		if (xhr_object.readyState == 1){
			document.getElementById('gallerie_pages').innerHTML = '<div id="gallerie_pages"><div class="previous"><span><< précédent</span></div><div class="next"><span>suivant >></span></div></div>';
			if (n < from){
				document.getElementById('img_0').style.display = 'none';
				document.getElementById('gallerie_images').innerHTML = document.getElementById('gallerie_images').innerHTML+'<img src="img/layout/loading_gallerie.gif">';
			}else{
				document.getElementById('img_2').style.display = 'none';
				document.getElementById('gallerie_images').innerHTML = '<img src="img/layout/loading_gallerie.gif">'+document.getElementById('gallerie_images').innerHTML;
			}
			
			n = from;
		}else
		if (xhr_object.readyState == 4){
			document.getElementById('gallerie_zone').innerHTML = xhr_object.responseText;
		}
	}

	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
	var data = "from="+from+'&id='+id+'&type='+type+'&nbphotos='+nbphotos;
	xhr_object.send (data);
}
