function gotoLink(prmId) {
	window.open(prmId,"_blank","menubar=yes,toolbar=yes,resizable=yes,status=yes,dependent=yes,location=yes,scrollbars=yes") ;
}

function EcrireCookie(nom, valeur) {
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+
	((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
	((path==null) ? "" : ("; path="+path))+
	((domain==null) ? "" : ("; domain="+domain))+
	((secure==true) ? "; secure" : "");
}


function LireCookie (name) {
	 if ( document.cookie) { // Le cookie est-il valide ?
			  index = document.cookie.indexOf( name);
			  if ( index != -1) {
					   nDeb = (document.cookie.indexOf( "=", index) + 1);
					   nFin = document.cookie.indexOf( ";", index);
					   if (nFin == -1) {nFin = document.cookie.length;}
					   return unescape(document.cookie.substring(nDeb, nFin));
			  }
	 }
	 return null;
}


function saveCommsProduit(id) {
	
	commentaire = document.commsForm.comms.value ;
	
	var expire = new Date();
	var dixMinutes = expire.getTime() + (10*60*1000);
	expire.setTime(dixMinutes);

	EcrireCookie("comm_" + id,commentaire,expire,"/") ;

}

function showMap(id_produit) {
	ajax = new Ajax(true) ;
	ajax.appendData('id_produit',id_produit) ;
	ajax.sendAndLoad("/ajax/map.php", "POST", showMapHandler) ;
}

function showMapHandler(conn) {
	eval(conn.responseText) ;	
}

function hideMap() {
	document.getElementById('ggMap').style.display = "none" ;
	GUnload() ;
}

function mapGetTitle(id_produit) {
	ajax = new Ajax(true) ;
	ajax.appendData('id_produit',id_produit) ;
	ajax.sendAndLoad("/ajax/getHotelName.php", "POST", mapRefreshTitle) ;
}

function mapRefreshTitle(conn) {
	document.getElementById('mapTarget').firstChild.nodeValue = conn.responseText ;
}

function mapGetHotelInfos(id_produit) {
	ajax = new Ajax(true) ;
	ajax.appendData('id_produit',id_produit) ;
	ajax.sendAndLoad("/ajax/getHotelInfo.php", "POST", mapRefreshInfos) ;
}


function mapGetTHotelInfos(id_produit) {
	ajax = new Ajax(true) ;
	ajax.appendData('id_produit',id_produit) ;
	ajax.sendAndLoad("/ajax/getTHotelInfo.php", "POST", mapRefreshInfos) ;
}


function mapRefreshInfos(conn) {
	eval(conn.responseText) ;
}

function mapGetMonumentTitle(id_monument) {
	ajax = new Ajax(true) ;
	ajax.appendData('id_monument',id_monument) ;
	ajax.sendAndLoad("/ajax/getMonumentName.php", "POST", mapRefreshTitle) ;
}

function mapGetMonumentInfos(id_monument) {
	ajax = new Ajax(true) ;
	ajax.appendData('id_monument',id_monument) ;
	ajax.sendAndLoad("/ajax/getMonumentInfo.php", "POST", mapRefreshInfos) ;
}

function townAutoComplete(idProduit) {
	ajax = new Ajax(true) ;
	ajax.sendAndLoad("/ajax/hotelGetTown.php?id=" + idProduit,"GET",townAutoCompleteHandler) ;
}

function townAutoCompleteHandler(conn) {
	document.getElementById("lieuMEH").value = conn.responseText ;
}

//Ajouter aux favoris
function ajouterFavoris(titre) {
	if (String(titre) == "undefined") titre = document.title ;
	if (navigator.appName.indexOf("Explorer") > -1) { window.external.AddFavorite(location.href,unescape(titre)) ; }
	else { window.sidebar.addPanel(unescape(titre),location.href,"") ; }
}

function getScrollingPosition()
{
 var position = new Array(2) ;

 if (typeof window.pageYOffset != 'undefined')
 {
   position[0] = window.pageXOffset ;
   position[1] = window.pageYOffset ;
 }

 else if (typeof document.documentElement.scrollTop
     != 'undefined' && document.documentElement.scrollTop > 0)
 {
   
   position[0] = document.documentElement.scrollLeft ;
   position[1] = document.documentElement.scrollTop ;
 }

 else if (typeof document.body.scrollTop != 'undefined')
 {
 
   position[0] = document.body.scrollLeft ;
   position[1] = document.body.scrollTop ;

 }

 return position;
}

