// =================================================
// redirection vers une fiche hotel
// =================================================
function fiche_hotel(idhotel, rewriting)
{
    url = "hotel_"+idhotel+"_"+rewriting+".asp";
    window.location.href="/hotel/fr/" + url
}
function fiche_hotel_tab(idhotel, rewriting, tab)
{
    url = "hotel_"+idhotel+"_"+rewriting+".asp"+tab;
    window.location.href="/hotel/fr/" + url
}
function fiche_hotel_tab2(idhotel, rewriting, tab)
{
    url = "hotel_"+idhotel+"_"+rewriting+".asp"+tab;
    window.open("/hotel/fr/" + url);
}


// =================================================
// redirection vers la page "laissez un avis"
// =================================================
function fiche_hotel_avis( idhotel, rewriting)
{
    url = "hotel_"+idhotel+"_"+rewriting+".asp#tab_avis";
    window.location.href="/hotel/fr/" + url
}

// =================================================
// redirection vers la page "laissez un avis" dans nouvelle fenetre
// =================================================
function fiche_hotel_avis_n( idhotel, rewriting)
{
    url = "hotel_"+idhotel+"_"+rewriting+".asp#tab_avis";
    window.open('/hotel/fr/' + url);
}


//======================================
// reload de page sur la pagination
//======================================
function ReloadPagination(Valeur)
{
    Url = lien_base_clair + params.replace("&pagination="+pagination,"&pagination="+Valeur);
    document.location.href = Url;
}


// =================================================
// Soumission du formulaire
// =================================================
function VerifForm(form)
{
	if(document.forms['form_hotels'].elements['destination'].value == "")
    {
        alert("Veuillez Choisir une ville.");
		return false;
    }
    if(nnghts <= "0" || nnghts > "30"){
        alert("La date de départ de l'hotel doit être supérieur à la date d'arrivée dans la limite de 30 jours.\n Veuillez reformuler votre demande.");
        return false;
    }
}


function affiliation(id){
	url = id + "bas/affiliation.asp"
	window.location=(url);
}

function regleaffichage(id){
	url = id + "bas/affichagelt.asp"
	window.open(url,'','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=660,height=520,left=0,top=0');
}

//======================================
// redirige depuis les filtres
//======================================
function FiltreService()
{
	var url = "";
	
	if (arguments.length == 0) {
		window.location.href=lien_base + ".asp";
	} else {
		for (var i=0; i <arguments.length; i++) {
			url = url + "/" + arguments[i];
		}
		window.location.href= lien_base + url;
	}
}

//======================================
// Fonction pour gerer le reload de 
// la page sur le tri
//======================================
function ReloadTri(Valeur)
{
	url=lien_base_clair + params.replace("&typetri="+typetri,"&typetri="+Valeur);
	window.location.href=url;
}

function recherchehotel() {
	if (document.forms['form_rechhotels'].elements['destinationrecherche'].value == "") {
		alert("Veuillez saisir une ville ou un pays.");
	} else {
		document.forms['form_rechhotels'].submit(); 
	}
}
function checkrecherchehotel() {
	if (document.forms['form_rechhotels'].elements['destinationrecherche'].value == "") {
		alert("Veuillez saisir une ville ou un pays.");
		document.forms['form_rechhotels'].elements['destinationrecherche'].focus();
		return false;
	} 
	return true;
}

//======================================
// pagination
//======================================
function Pagination( numpage )
{
    url= lien_base_clair + params.replace("&numpage="+num_page_affiche, "&numpage="+numpage);
    window.location.href=url
}

// Open d'urls particulières
function openPublicite(id)
{
    window.open('/externe/framepub.asp?id=' + id);
}

// ============================================
// supprime le nom du pay entre parenthese
// apres un autocomplete sur les villes
// ============================================
function SupprimerNomPaysApresAC() {
	var regExp = /\s*\(.*\)*\s*$/;
	var text = $('destination').value;
	var char = ""+text.charAt(0);
	text = char.toUpperCase() + text.substring(1);

    return text.replace(regExp, "");	
}

// ============================================
// analyse la saisie du nom de destination
// dans le moteur
// ============================================
function CheckDestination() {
	setTimeout('CheckDestination2()',100);
}
function CheckDestination2() {
	var div = $('rech2valid');
	
	document.form_rechhotels2.destinationrecherche.value = SupprimerNomPaysApresAC();
	div.getElementsByTagName("a")[0].innerHTML = 'Voir les Hôtels de ' + SupprimerNomPaysApresAC();
	
	div.style.display = 'block';
}

// fonction de redirection vesr les partenaires
function hotelresultats( partenaire_id, idlog, hotel_selection_id, date_arrivee, date_depart, nombre_chambre, type_chambre, czone)
{
	URL = "../moteur/go_part_moteur.asp?partenaire_id=" + partenaire_id + "&hotel_selection_id=" + hotel_selection_id + "&idlog=" + idlog + "&date_arrivee=" + date_arrivee + "&date_depart=" + date_depart + "&nombre_chambre=" + nombre_chambre + "&type_chambre=" + type_chambre + "&czone=" + czone
	LOC = "toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=890,height=570,left=20,top=20";
	window.open(URL,"",LOC);
}
// ouverture d'une page resultat recherchehotel chez partenaire
function hotelrecherche( resultat_id, idlog, affilie_id, czone)
{
	URL = "../moteur/go_part_moteur.asp?resultat_id=" + resultat_id + "&idlog=" + idlog + "&affilie_id=" + affilie_id + "&czone=" + czone
	LOC = "toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=890,height=570,left=20,top=20";
	window.open(URL,"",LOC);
}

// ouverture d'une page resultat recherchehotel chez partenaire
function GoPartenaireFiche(hotel_id, partenaire_id, type)
{
	URL = "/hotel/moteur/go_part_fiche.asp?hotel_id=" + hotel_id + "&part_id=" + partenaire_id + "&type=" + type
	LOC = "toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=890,height=570,left=20,top=20";
	window.open(URL,"",LOC);
}



