/**
 * Fonction pour creation de l'objet XMLRequest AJAX
 */
function createRequestObject() {
    
    var xhr;
    
    try {
    	xhr = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (err) {
    	try {
    		xhr = new ActiveXObject("Microsoft.XMLHTTP");
    	} catch(err) {
    		xhr = false;
    	}
    }
    
    if(!xhr && typeof XMLHttpRequest != 'undefined') {
    	xhr = new XMLHttpRequest();
    }
    
    return xhr;
}

var http = createRequestObject();


// Ajax pour liste personne qui partagent une chambre
function request_detail_prestation(idDiv,key,nomAction,langue) {

	// Loading
	document.getElementById(idDiv).innerHTML = '<div align="center"><img src="/images/ajax-loader.gif"  alt="" border="0" /></div>';
	
	// Ouverture de la requete GET
	 http.open('get', 'detail_prestation_ajax.php?action='+ nomAction +'&key=' + key + '&langue=' + langue);
	 
	 // Recupération du retour de la fonction
	 http.onreadystatechange = function() {
         if(http.readyState == 4){
         	
	        var response = http.responseText;
	        var html = new String();
	        
	        // Récupération du code HTML (echo)
	        html = response;
			  
	       document.getElementById(idDiv).innerHTML = html;
	    }
    }
	http.send(null);
}

function popup_images_prestataire(typeprest,code){
	var page;
	page = 'image_prestataire.php?TYPREST=' + typeprest + '&CODE=' + code;
	var win = window.open (page,'', config='height=80, width=250, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
    if(win.focus){win.focus();} 
}

function popup_images_prestation(typeprest,code,codeprest){
	var page;
	page = 'image_prestation.php?TYPREST=' + typeprest + '&CODE=' + code + '&CODEPREST=' + codeprest;
	var win = window.open (page,'', config='height=80, width=250, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
    if(win.focus){win.focus();} 
}

function popup_plan_situation(typeprest,code,lot){
	var page;
	page = 'plan_de_situation.php?typeprest=' + typeprest + '&presta=' + code + '&lot=' + lot;
	var win = window.open (page,'', config='height=200, width=300, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
    if(win.focus){win.focus();} 
}

function popup_cgv(typeprest,code,lot,numpave){
	var page;
	page = 'popup_cgv.php?typePrest=' + typeprest + '&codePrest=' + code + '&codePrestation=' + lot + '&pave=' + numpave;
	var win = window.open (page,'', config='height=200, width=300, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
    if(win.focus){win.focus();} 
}