<!--

function fenetreCent(url,nom,largeur,hauteur,options) {
	var haut=(screen.height-hauteur)/2;
	var Gauche=(screen.width-largeur)/2;
	fencent=window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
	if( self.focus ) fencent.focus();
}

function openWin(url,hauteur,largeur)
{	
	window.open(url,'nom','toolsbar=no,height='+hauteur+',width='+largeur);
}

function openWinvideo(url,hauteur,largeur)
{	
	window.open(url,'video','toolsbar=no,height='+hauteur+',width='+largeur);
}

function openWin2(url,hauteur,largeur)
{	
	window.open(url,'nom2','toolsbar=no,scrollbars=1,height='+hauteur+',width='+largeur);
}




function popup_planning_prestation(typeprest,prestataire,prestation,langue) {
	var page;
	page = 'popup_planning.php?typeprest=' + typeprest + '&prestataire=' + prestataire + '&prestation=' + prestation + '&langue=' + langue;
	var win = window.open (page,'', config='height=450, width=1000, toolbar=no, menubar=yes, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
    if(win.focus){win.focus();} 
}

function rollOver(ImgNme)
{
 obj=document.images[ImgNme];
 obj.src=(obj.src.lastIndexOf('_on')!=-1)? obj.src.replace(/_on/gi,"_off"):obj.src.replace(/_off/gi,"_on");
}


function PSR_imprimer () { 
    var PSR_f1 = null; 
    var PSR_content=document.getElementById('PSR_print').parentNode.innerHTML; 
    var PSR_title=document.getElementsByTagName('title')[0].innerText; 
    if (PSR_f1) {if(!PSR_f1.closed) PSR_f1.close();} 
    PSR_f1 = window.open ('',"PSR_f1", "height=500,width=600,menubar=yes,scrollbars=yes,resizable=yes,,left=10,top=10"); ; 
    PSR_f1.document.open(); 
    PSR_f1.document.write("<html><head><title>" + PSR_title + "</title><link rel='STYLESHEET' type='text/css' href='style.css'></head><body bgcolor='#ffffff'><div align=center><img src='images/logo_aayc.gif'></div><br>"+PSR_content+"</body></html>"); 
    PSR_f1.document.close(); 

    PSR_f1.focus(); 
PSR_f1.print();
} 


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_plan_google(latitude,longitude){
	var page;
	page = 'google_maps.php?latitude=' + latitude + '&longitude=' + longitude;
	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 check_affiche_tarif(cle,guide) {
	
	horaires = document.getElementById('horaires_' + guide).value;
	guidage = document.getElementById('guidage_' + guide).value;
	langue_guide = document.getElementById('langue_guide_' + guide).value;
	
	if(horaires == '') { return false;}
	if(guidage == '') { return false;}
	if(langue_guide == '') { return false;}
	
	document.location.href = 'index.php?modele=reserver_visites&action_resa=recherche&action_spec=fiche2&k=' + cle + '&derouler=' + guide +'&horaires=' + horaires + '&guidage=' + guidage + '&langue_guide=' + langue_guide + '#' + guide;
	
	return false;
	
}

function affiche_nb_resultats_ajax() {
	
	if(document.getElementById('ajax_ville')) {
		ville = document.getElementById('ajax_ville').value;
	} else {
		ville = '';
	}

	pers = document.getElementById('divPers').value;
	champCrit = document.getElementsByName('criteres[]');
	datedeb = document.getElementById('datedeb_ID').value;
	
	criteres = '';
	var passage = 0;
	// Boucle de recup des criteres
	for(i = 0; i < champCrit.length; i++) {		
		if(champCrit[i].type == "checkbox") {
			if(champCrit[i].checked == true) {
				if(passage > 0) { criteres = criteres + '&';}	
				criteres = criteres + 'criteres[]=' +champCrit[i].value;
				passage++;
			}
			
		} else {
			if(champCrit[i].value != '') {
			  if(passage > 0) { criteres = criteres + '&';}	
			  criteres = criteres + 'criteres[]=' + champCrit[i].value;
			  passage++;
			}
			
		}
		
	}
	
	if(datedeb != 'JJ/MM/AAAA' && pers != '') {
		// Loading
		document.getElementById('nb-res-ajax').innerHTML = '<img src="/images/loading_ajax.gif"  alt="" border="0" />';
		//alert('ajax.php?action_ajax=nb-resultats-ajax&filtre_prestataires=' + ville + '&personnes[ENFANTS]=0&personnes[ADULTES]='+ pers + '&datedeb='+ datedeb + '&duree=1&action_resa=recherche-ajax&' + criteres);
		// Ouverture de la requete GET
		http.open('get', 'ajax.php?action_ajax=nb-resultats-ajax&filtre_prestataires=' + ville + '&personnes[ENFANTS]=0&personnes[ADULTES]='+ pers + '&datedeb='+ datedeb + '&duree=1&action_resa=recherche-ajax&' + criteres);
		// 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('nb-res-ajax').innerHTML = html;
		    }
	    }
		http.send(null);
		
	}
	
}

function choisir_date_contre_propo(date_s,prestation) {
	document.getElementById('datedeb_ID').value = date_s;
	affiche_nb_resultats_ajax_guide_prestation(prestation);
}

function affiche_nb_resultats_ajax_guide_prestation(prestation) {
	
	datedeb = document.getElementById('datedeb_ID').value;
	
	if(datedeb != 'JJ/MM/AAAA') {
		// Loading
		document.getElementById('nb-res-ajax-guide').innerHTML = '<img src="/images/loading_ajax.gif"  alt="" border="0" />';
		// Ouverture de la requete GET
		http.open('get', 'ajax.php?action_ajax=nb-resultats-ajax-guides-prestation&prestation=' + prestation + '&datedeb='+ datedeb);
		// 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('nb-res-ajax-guide').innerHTML = html;
		    }
	    }
		http.send(null);
		
	}
	
}

/**
 * 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();
	
//-->
