function imagezoom(w,h,url) {
w+=18;
h+=15;
   var Fensteroptionen = "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0";
   var popupWindow = window.open(url, 'Imagezoom', Fensteroptionen + ',width=' + w + ',height=' + h);
   var focus = popupWindow.focus();
}

function enleverFlash()
{
	// Je récupère le flash et je le masque !
	document.getElementById("flash").style.display = "none";
	document.getElementById("flash2").style.display = "block";
	document.getElementById("flash3").style.display = "block";
	
}

function ValideHeb() {
	for (i=0; i<document.search.Param1.length;i++){
	if (document.search.Param1[i].checked)
	{var1=document.search.Param1[i].value}
	}
	for (j=0; j<document.search.Param2.length;j++){
	if (document.search.Param2[j].checked)
	{var2=document.search.Param2[j].value}
	}
	//var adresse = '/hebergement/recherche?type=' + var1 + '&lieu=' + var2;
	var adresse = '/hebergement/recherche/(type)/' + var1 + '/(lieu)/' + var2;
	self.location.href=adresse;
}

function ValideRes() {
	for (j=0; j<document.search.Param2.length;j++){
	if (document.search.Param2[j].checked)
	{var2=document.search.Param2[j].value}
	}
	var adresse = '/restaurants/recherche/(lieu)/' + var2;
	self.location.href=adresse;
}

function ValidePat() {
	for (j=0; j<document.search.Param2.length;j++){
	if (document.search.Param2[j].checked)
	{var2=document.search.Param2[j].value}
	}
	
	var adresse = '/pays_de_laon/recherche/(type)/' + var2;
	self.location.href=adresse;
}

function ValideLoi() {
	for (i=0; i<document.search.Param1.length;i++){
	if (document.search.Param1[i].checked)
	{var1=document.search.Param1[i].value}
	}
	for (j=0; j<document.search.Param2.length;j++){
	if (document.search.Param2[j].checked)
	{var2=document.search.Param2[j].value}
	}
	var adresse = '/loisirs/recherche/(type)/' + var1 + '/(lieu)/' + var2;
	self.location.href=adresse;
}

function ValideVis() {
	for (i=0; i<document.search.Param1.length;i++){
	if (document.search.Param1[i].checked)
	{var1=document.search.Param1[i].value}
	}
	for (j=0; j<document.search.Param2.length;j++){
	if (document.search.Param2[j].checked)
	{var2=document.search.Param2[j].value}
	}
	var adresse = '/visites/recherche/(type)/' + var1 + '/(lieu)/' + var2;
	self.location.href=adresse;
}

function changeLocation2(Combo) {
	var URL=document.getElementById(Combo).value;
	if(URL!="") {
		if(document.location.href.indexOf(URL)<0) {
			window.location = '/' + URL;
		}
	}
	else {
		switch (Combo) {
			case 'type':
				URL="";
				break;
				case 'type2':
				URL="";
				break;
				case 'type3':
				URL="";
				break;
			case 'marque':
				URL=document.getElementById("type").value;
				break;
			case 'modele':
				URL=document.getElementById("marque").value;
				break;
		}
		window.location = '/formulaire_pass_sejour?type=' + URL;
	}
}

function changeLocation3(Combo){
	var URL = document.getElementById(Combo).value;
	alert("1");
	var liv =    document.getElementById("loop"); 
    liv.innerHTML = "{def $listing=fetch('tourinsoft', 'sejour1', hash('code'," + URL + " ))} ";
	//window.location = '/formulaire_pass_sejour?type=' + URL;
	return URL;
	
}


// GoogleMaps
/*
function load($xpos, $ypos) {
    if (GBrowserIsCompatible()) {
		//création de la map:
        var map = new GMap2(document.getElementById("map"));
		
		//control :
		map.addControl(new GLargeMapControl());
		map.addControl(new GOverviewMapControl());
		map.addControl(new GOverviewMapControl())
		map.enableDoubleClickZoom();
		map.enableContinuousZoom();
		GEvent.addDomListener(document.getElementById("map"), "DOMMouseScroll", wheelZoom); // Firefox
		GEvent.addDomListener(document.getElementById("map"), "mousewheel",     wheelZoom); // IE
		
		//centrage carte:
        map.setCenter(new GLatLng($xpos, $ypos), 10);
		
		//marker:
		var point = new GLatLng(parseFloat($xpos), parseFloat($ypos));
		map.addOverlay(createMarker(point, 0));
	}
}
	
function wheelZoom(a) {
  if (a.detail) // Firefox
  {
    if (a.detail < 0)
    { map.zoomIn(); }
    else if (a.detail > 0)
    { map.zoomOut(); }
  }

  else if (a.wheelDelta) // IE
  {
    if (a.wheelDelta > 0)
    { map.zoomIn(); }
    else if (a.wheelDelta < 0)
    { map.zoomOut(); }
  }
}

function createMarker(point, tabbed) {
  var marker = new GMarker(point);
  return marker;
}*/




// to layout image and text, 2-row table, image centered in top cell
// these go in var tip in doTooltip function
// startStr goes before image, midStr goes between image and text
var startStr = '<table ><tr><td align="center" width="100%"><img src="';
var midStr = '" border="0" width="500"></td></tr><tr><td valign="top">';
var endStr = '</td></tr></table>';

////////////////////////////////////////////////////////////
//  initTip	- initialization for tooltip.
//		Global variables for tooltip. 
//		Set styles
//		Set up mousemove capture if tipFollowMouse set true.
////////////////////////////////////////////////////////////
var tooltip, tipcss;
function initTip() {
	if (nodyn) return;
	tooltip = (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
	tipcss = tooltip.style;
	if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites
		//tipcss.width = tipWidth+"px";
		tipcss.width = "510px";
		tipcss.fontFamily = tipFontFamily;
		tipcss.fontSize = tipFontSize;
		tipcss.color = tipFontColor;
		tipcss.backgroundColor = tipBgColor;
		tipcss.borderColor = tipBorderColor;
		tipcss.borderWidth = tipBorderWidth+"px";
		tipcss.padding = tipPadding+"px";
		tipcss.borderStyle = tipBorderStyle;
	}
	if (tooltip&&tipFollowMouse) {
		document.onmousemove = trackMouse;
	}
}

window.onload = initTip;

/////////////////////////////////////////////////
//  doTooltip function
//			Assembles content for tooltip and writes 
//			it to tipDiv
/////////////////////////////////////////////////
var t1,t2;	// for setTimeouts
var tipOn = false;	// check if over tooltip link
function doTooltip(evt,num,id, img) {


    //var children = document.getElementById(id).src;
	var children = img;
    //alert(children);


	if (!tooltip) return;
	if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
	tipOn = true;
	// set colors if included in messages array
	if (messages[num][2])	var curBgColor = messages[num][2];
	else curBgColor = tipBgColor;
	if (messages[num][3])	var curFontColor = messages[num][3];
	else curFontColor = tipFontColor;
	if (ie4||ie5||ns5) {
		var tip = startStr + children + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + messages[num][1] + '</span>' + endStr;
		tipcss.backgroundColor = curBgColor;
	 	tooltip.innerHTML = tip;
	}
	if (!tipFollowMouse) positionTip(evt);
	else t1=setTimeout("tipcss.visibility='visible'",100);
}

var mouseX, mouseY;
function trackMouse(evt) {
	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
	mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	if (tipOn) positionTip(evt);
}

/////////////////////////////////////////////////////////////
//  positionTip function
//		If tipFollowMouse set false, so trackMouse function
//		not being used, get position of mouseover event.
//		Calculations use mouseover event position, 
//		offset amounts and tooltip width to position
//		tooltip within window.
/////////////////////////////////////////////////////////////
function positionTip(evt) {
	if (!tipFollowMouse) {
		mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
		mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	}
	// tooltip width and height
	var tpWd = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	// document area in view (subtract scrollbar width for ns)
	var winWd = (ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
	var winHt = (ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
	// check mouse position against tip and window dimensions
	// and position the tooltip 
	if ((mouseX+offX+tpWd)>winWd) 
		tipcss.left = mouseX-(tpWd+offX)+"px";
	else tipcss.left = mouseX+offX+"px";
	if ((mouseY+offY+tpHt)>winHt) 
		tipcss.top = winHt-(tpHt+offY)+"px";
	else tipcss.top = mouseY+offY+"px";
	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}

function hideTip() {
	if (!tooltip) return;
	t2=setTimeout("tipcss.visibility='hidden'",100);
	tipOn = false;
}

document.write('<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:100"></div>')



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/*
window.onload=montre;
function montre(id) {
document.getElementById('smenu'+id).style.display='block';
var d = document.getElementById(id);
	for (var i = 1; i<=9999; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}
*/
