﻿

/* Pour la popup Imprimer -> remplacer les liens vers autres pages par rien*/
 function replaceOnclick(cont){
        var indexStart=cont.indexOf('onclick=\'');
        if(indexStart!=-1){
            var temp=cont.substring(indexStart+9, cont.length);
             var endStart=temp.indexOf('\'');
             if(endStart!=-1){
                temp=cont.substring(indexStart+9, endStart+indexStart+9);
                var tmp1=cont.substring(0, indexStart+9);
                var tmp2=cont.substring(endStart+indexStart+9, cont.length);
                if(replaceOnclick(tmp2)!=tmp2){
                  cont=tmp1+replaceOnclick(tmp2);
                 }
                else  cont=tmp1+tmp2;
             }
        }
        return cont;
 }



/* Pour la popup Imprimer -> remplacer les liens vers autres pages par rien*/
 function replaceHref(cont){
        var indexStart=cont.indexOf('href="');
        if(indexStart!=-1){
            var temp=cont.substring(indexStart+6, cont.length);
             var endStart=temp.indexOf('"');
             if(endStart!=-1){
                temp=cont.substring(indexStart, endStart+indexStart+1);
                var tmp1=cont.substring(0, indexStart);
                var tmp2=cont.substring(endStart+indexStart, cont.length);
                if(replaceHref(tmp2)!=tmp2){
                  cont=tmp1+replaceHref(tmp2);
                 }
                else  cont=tmp1+tmp2;
             }
        }
        return cont;
 }


/*Ouverture de fenetre*/
function opennewwindow(url,nameWindow,options){

 window.open(url, nameWindow, options);
	  
}




function MM_findObjPrint(n, d) { 
	var p,i,x;
	if(!d)
	{
		d=window.opener.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_findObjPrint(n,d.layers[i].document);
	}
	if(!x && d.getElementById){
		x=d.getElementById(n);
	}
	return x;
}


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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

///Fonction qui permet de savoir si on affiche ou non des actualités
function displayActualite(tab, tabParution, tabFinParution)
{
	var	Now = new Date();
	var	dateNow = new Date(Now.getFullYear() + "/" + (Now.getMonth()+2) + "/"+ Now.getDate());
	for(var i=0; i<tab.length; i++)
	{
	    if((tabParution[i] != "") && (tabFinParution[i] != ""))
	    {
		    var dateParution = new Date(tabParution[i].substring(6), tabParution[i].substring(3, 5), tabParution[i].substring(0, 2));
		    var dateFinParution = new Date(tabFinParution[i].substring(6), tabFinParution[i].substring(3, 5), tabFinParution[i].substring(0, 2));
		    
		    //alert("dateNow = " + dateNow + "\r\ndateParution = " + dateParution + "\r\ndateFinParution = " + dateFinParution);
		    
		    if(dateNow > dateFinParution)
		    { 
			    document.getElementById(tab[i]).style.display='none';
		    }
		    
		    if(dateNow < dateParution)
		    { 
			    document.getElementById(tab[i]).style.display='none';
		    }
      }
      else
      {
          if(tabParution[i] != "")
          {
              var dateParution = new Date(tabParution[i].substring(6), tabParution[i].substring(3, 5), tabParution[i].substring(0, 2));
              if(dateNow < dateParution)
              {
		        		document.getElementById(tab[i]).style.display='none';
              }
          }
          else
          {
              if(tabFinParution[i] != "")
              {
                  var dateFinParution = new Date(tabFinParution[i].substring(6), tabFinParution[i].substring(3, 5), tabFinParution[i].substring(0, 2));
                  if(dateNow > dateFinParution)
                  {
                      document.getElementById(tab[i]).style.display='none';
                  }
              }
          }
      }
	}
}

/* changment d'image pour le composant hébergement*/
function swapImageHebergement(p_image, p_id,p_id_new_img,nbPhoto,alt){
  
	document.getElementById(p_id).src =  p_image ;
	document.getElementById(p_id).alt =  alt ;
	for(i=0;i<nbPhoto;i++)
	{
		document.getElementById('hpimage'+i).className="case_image_layer";
		document.getElementById('imgVignette'+i).style.height='45px';
		document.getElementById('imgVignette'+i).style.width='60px';
	}
	document.getElementById('imgVignette'+p_id_new_img).style.width='52px';
	document.getElementById('imgVignette'+p_id_new_img).style.height='37px';
	document.getElementById('hpimage'+p_id_new_img).className="case_image_layer_selected";
}

function swapImage(p_image, p_id,p_id_new_img,nbPhoto){
  
	document.getElementById(p_id).src =  p_image ;
	for(i=0;i<nbPhoto;i++)
	{
		document.getElementById('ctl00_hpVignette'+i).className="case_image_layer";
		document.getElementById('imgVignette'+i).style.height='45px';
		document.getElementById('imgVignette'+i).style.width='60px';
	}
	document.getElementById('imgVignette'+p_id_new_img).style.width='52px';
	document.getElementById('imgVignette'+p_id_new_img).style.height='37px';
	document.getElementById('ctl00_hpVignette'+p_id_new_img).className="case_image_layer_selected";
}
// Global object to hold drag information.

function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

var dragObj = new Object();
dragObj.zIndex = 0;

function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}
/*******************************diaporama*********************************/
var info = null; 

function ow(img,larg,haut) 
{ 
        titre="Agrandissement"; 
        w=open("",'image','width=400,height=400,toolbar=no,scrollbars=yes,resizable=no'); 
        w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>"); 
        w.document.write("<SCRIPT language=javascript>function checksize() { if (document.images[0].complete) {var valWidth=0;var valHeight=0; if((document.images[0].width+10)>1024){valWidth=1024;}else{valWidth=document.images[0].width+50} if((document.images[0].height+30)>768){valHeight=768;}else{valHeight=document.images[0].height+60} window.resizeTo(valWidth,valHeight); window.focus();} else { setTimeout('checksize()',250) } }</"+"SCRIPT>"); 
        w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
        w.document.write("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
        w.document.write("<TD valign='middle' align='center'><IMG src='"+img+"' border=0 alt=''>"); 
        w.document.write("</TD></TR></TABLE>");
        w.document.write("</BODY></HTML>"); 
        w.document.close();
        return false;
}
var photoDiapo=null;
function ow2(elementDiapo) 
{ 
        titre="Agrandissement"; 
        w=open("",'image','width=400,height=400,toolbar=no,scrollbars=yes,resizable=no'); 
        w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>"); 
        w.document.write("<SCRIPT language=javascript>function checksize() { if (document.images[0].complete) {var valWidth=0;var valHeight=0; if((document.images[0].width+10)>1024){valWidth=1024;}else{valWidth=document.images[0].width+50} if((document.images[0].height+30)>768){valHeight=768;}else{valHeight=document.images[0].height+60} window.resizeTo(valWidth,valHeight); window.focus();} else { setTimeout('checksize()',250) } }</"+"SCRIPT>"); 
        w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
        w.document.write("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
        w.document.write("<TD valign='middle' align='center'><IMG src='"+urlphoto+"' border=0 alt=''>"); 
        w.document.write("</TD></TR></TABLE>");
        w.document.write("</BODY></HTML>"); 
        w.document.close();
}
function ow3(elementDiapo) 
{ 
        titre="Agrandissement"; 
        w=open("",'image','width=400,height=400,toolbar=no,scrollbars=yes,resizable=no'); 
        w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>"); 
        w.document.write("<SCRIPT language=javascript>function checksize() { if (document.images[0].complete) {var valWidth=0;var valHeight=0; if((document.images[0].width+10)>1024){valWidth=1024;}else{valWidth=document.images[0].width+50} if((document.images[0].height+30)>768){valHeight=768;}else{valHeight=document.images[0].height+60} window.resizeTo(valWidth,valHeight); window.focus();} else { setTimeout('checksize()',250) } }</"+"SCRIPT>"); 
        w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
        w.document.write("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
        w.document.write("<TD valign='middle' align='center'><IMG src='"+elementDiapo+"' border=0 alt=''>"); 
        w.document.write("</TD></TR></TABLE>");
        w.document.write("</BODY></HTML>"); 
        w.document.close();
}
 //--- Partie Onglet Hebergement 4 ----------------------------------------------- 

 
 
    /* Rendre un onglet actif au niveau de son style */
    function ongletactif(id_td_onglet,id_lien_onglet){    
        
        ongletinactif('tdInfo','lienInfo');
        ongletinactif('tdContact','lienContact');
        ongletinactif('tdLoisir','lienLoisir');
        ongletinactif('tdTarif','lienTarif');
        ongletinactif('tdEquip','lienEquip');
        
        document.getElementById(id_td_onglet).className="ongletActif";
        
        styleLien(id_lien_onglet);
        document.getElementById(id_lien_onglet).className="ongletActif";     
    }
    
     /* Rendre un onglet inactif au niveau de son style */
    function ongletinactif(id_td_onglet,id_lien_onglet){
    
         document.getElementById(id_td_onglet).className="ongletInactif";
        
        
        styleLien(id_lien_onglet);
        document.getElementById(id_lien_onglet).className="ongletInactif";
        document.getElementById(id_lien_onglet).style.borderStyle="none";
    }
    
    
    
     /* Change les styles des liens*/
       function styleLien(id_lien_onglet){
           
        document.getElementById(id_lien_onglet).style.fontFamily ='Trebuchet MS';
        document.getElementById(id_lien_onglet).style.fontSize ='12px';
        document.getElementById(id_lien_onglet).style.fontWeight ='bold';
        document.getElementById(id_lien_onglet).style.textDecoration ='none';
        document.getElementById(id_lien_onglet).style.paddingTop ='0px';
        document.getElementById(id_lien_onglet).style.paddingRight ='5px';
        document.getElementById(id_lien_onglet).style.paddingBottom ='0px';
        document.getElementById(id_lien_onglet).style.paddingLeft ='5px';   
    }
    
    
    function displayOngletActif(id_td_onglet){
        document.getElementById('info').style.display='none';
        document.getElementById('contact').style.display='none';
        document.getElementById('loisir').style.display='none';
        document.getElementById('tarif').style.display='none';
        document.getElementById('equip').style.display='none';
        
        
        document.getElementById(id_td_onglet).style.display='block';
    }
    
    
    
 
 //--- Partie Onglet Réservation----------------------------------------------- 

 
 
    /* Rendre un onglet actif au niveau de son style */
    function ongletactifRes(id_td_onglet,id_lien_onglet){    
        
        ongletinactif('tdAgenda','lienAgenda');
        ongletinactif('tdReservation','lienReservation');
        ongletinactif('tdReservation','messageEnvoyer');
       
        document.getElementById(id_td_onglet).className="cadreComplet ongletActif";
        
        styleLien(id_lien_onglet);
        document.getElementById(id_lien_onglet).className="ongletActif";     
    }
    
    
    function displayOngletActifRes(id_td_onglet){
        document.getElementById('agenda').style.display='none';
        document.getElementById('reservation').style.display='none';
        document.getElementById('messageEnvoyer').style.display='none';
        
        document.getElementById(id_td_onglet).style.display='block';
    }
    
    function pickDateReservation(dateString,txtDeb,txtFin){
        if(document.getElementById(txtDeb).value==""){
            document.getElementById(txtDeb).value=dateString;
        }
        else if(document.getElementById(txtFin).value==""){
            document.getElementById(txtFin).value=dateString;
        }
    }
     
//--- Partie Popup ----------------------------------------------- 
      
       function openPrint(){
        if(window.opener==null)  window.open("iso_print/popupPrint.html","Imprimer","scrollbars=1,menubar=0,location=0,status=0,toolbar=0,resizable = yes");
        else changePagePrint();
     }
     
     
     


    function changePagePrint(){
            document.styleSheets[0].href="iso_print/iso_misc/iso_style.css";
            document.styleSheets[1].href="iso_print/iso_misc/iso_position.css";
            document.styleSheets[2].href="iso_print/iso_misc/iso_png.css";
            document.styleSheets[3].href="iso_print/iso_misc/iso_template.css";
            var cont = document.getElementById('contenu_print').innerHTML;
            var reg=new RegExp("iso_icons", "g");
           cont= cont.replace(reg,'iso_print/iso_icons');
           var print="<a href='#' onclick='window.print()'><img src='iso_icons/btn_imprimer.png' border='0' alt='' /> Imprimer</a>\n";
            document.getElementById('contenu_print').innerHTML=print+cont;
            document.getElementById('optionsPage').innerHTML="";
           if( document.getElementById('isoDecorMenuConteneur')) document.getElementById('isoDecorMenuConteneur').innerHTML="";
           if( document.getElementById('isoDecorFooterTexte'))  document.getElementById('isoDecorFooterTexte').innerHTML="";
            if( document.getElementById('isoDecorBanHaut'))  document.getElementById('isoDecorBanHaut').innerHTML="";
        }
     
     
     


/* Fonction javascript pour activer un flash*/
function activeFlash(swf, hauteur, largeur, couleur, nom) {
document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\""+hauteur+"\" height=\""+largeur+"\" id=\""+nom+"\" align=\"middle\">\n");
document.write("<param name=\"wmode\" value=\"opaque\" />\n");
document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n");
document.write("<param name=\"movie\" value=\""+swf+"\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\""+couleur+"\" /><embed  wmode=\"opaque\"  src=\""+swf+"\" quality=\"high\" bgcolor=\""+couleur+"\" width=\""+hauteur+"\" height=\""+largeur+"\" name=\""+nom+"\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n");
document.write("</object>\n");
}


/* Fonction pour faire un lien vers une carte mappy*/
function linkCarteMappy(ville, rue, numero) {
ville=htmlToAccent(ville);
rue=htmlToAccent(rue);
 window.open("http://www.mappy.com/direct/Isotools/plan?dep.ville=" + ville + "&dep.rue=" + rue + "&dep.numero=" +numero + "&language=fr","Mappy","width=600,height=500,scrollbars=0,menubar=0,location0,status=0,toolbar=0");
}


/* Fonction pour faire un lien vers un itinéraire mappy*/
function linkItineraireMappy(villedep,villearr) {
 villedep=htmlToAccent(villedep);
villearr=htmlToAccent(villearr);
 window.open("http://www.mappy.com/direct/Isotools/itineraire?params.calcul=0&language=fr&arr.ville="+villearr+"&dep.ville=" + villedep ,"Mappy","width=700,scrollbars=1,menubar=0,location0,status=0,toolbar=0");
}


// Remplace toutes les occurences d'une chaine 
function replaceAll(str, search, repl) { 
  while (str.indexOf(search) != -1) 
    str = str.replace(search, repl); 
  return str; 
} 
  
// Remplace les caractères accentués (+ espace) 
function htmlToAccent(str) { 
  var norm = new Array("é", "è", "ë", "à", "ù", "û", "ô", "î", "ç"); 
  var spec = new Array("e","e", "e", "a", "u", "u", "o", "i", "c"); 
  for (var i = 0; i < spec.length; i++) 
    str = replaceAll(str, norm[i], spec[i]); 
  return str; 
} 


//----------------- Composant Calendrier ---------------------------------//


var ds_i_date = new Date();
ds_c_month = ds_i_date.getMonth() + 1;
ds_c_year = ds_i_date.getFullYear();

function cal_getel(id) {
	return document.getElementById(id);
}


var cal_oe = cal_getel('calclass');
// Container
var cal_ce = cal_getel('conclass');

// Output Buffering
var cal_ob = ''; 
function calendrier_ob_clean() {
	cal_ob = '';
}
function calendrier_ob_flush() {
	cal_oe.innerHTML = cal_ob;
	calendrier_ob_clean();
}
function display(t) {
	cal_ob += t;
}
var nom_mois = [
'Jan', 'Fév', 'Mars', 'Avril', 'Mai', 'Juin',
'Juil', 'Aout', 'Sept', 'Oct', 'Nov', 'Déc'
]; // You can translate it for your language.

var nom_jours = [
'Dim', 'Lun', 'Mar', 'Me', 'Jeu', 'Ven', 'Sam'
]; // You can translate it for your language.

// Calendar template
function display_princ_deb(t) {
	return '<table cellpadding="3" cellspacing="1" class="isoCalendrierTBL">'
	     + '<tr>'
		 + '<td class="isoCalendrierHead" style="cursor: pointer;color:#ffffff;" onclick="calendrier_annee_prec();" title="Année précédente">&lt;&lt;</td>'
		 + '<td class="isoCalendrierHead" style="cursor: pointer;color:#ffffff;" onclick="calendrier_mois_prec();" title="Mois précédent">&lt;</td>'
		 + '<td class="isoCalendrierHead" style="font-size:12px;color:#ffffff;"  colspan="3">'+t.replace(/ /g,'&nbsp;')+'</td>'
		 + '<td class="isoCalendrierHead" style="cursor: pointer;color:#ffffff;" onclick="calendrier_mois_suiv();" title="Mois suivant">&gt;</td>'
		 + '<td class="isoCalendrierHead" style="cursor: pointer;color:#ffffff;" onclick="calendrier_annee_suiv();" title="Année suivante">&gt;&gt;</td>'
		 + '</tr>'
		 + '<tr>';
}

function display_jour_row(t) {
	return '<td class="isoCalendrierSubHead" style="color:#9c00FF;" >' + t + '</td>';
	// Define width in CSS, XHTML 1.0 Strict doesn't have width property for it.
}

function display_nouv_semaine() {
	return '</tr><tr>';
}

function display_cellule_vide(colspan) {
	return '<td colspan="' + colspan + '"></td>'
}

function display_day(d, m, y) {
	return '<td class="isoCalendrierCell" onclick="calendrier_onclick(' + d + ',' + m + ',' + y + ')">' + d + '</td>';
	// Define width the day row.
}

function calendrier_template_main_below() {
	return '</tr>'
	     + '</table>';
}

// This one draws calendar...
function dessiner_calendrier(m, y) {
	// First clean the output buffer.
	calendrier_ob_clean();
	// Here we go, do the header
	display (display_princ_deb(nom_mois[m - 1] + ' ' + y));
	for (i = 0; i < 7; i ++) {
		display (display_jour_row(nom_jours[i]));
	}
	// Make a date object.
	var ds_dc_date = new Date();
	ds_dc_date.setMonth(m - 1);
	ds_dc_date.setFullYear(y);
	ds_dc_date.setDate(1);
	if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
		days = 31;
	} else if (m == 4 || m == 6 || m == 9 || m == 11) {
		days = 30;
	} else {
		days = (y % 4 == 0) ? 29 : 28;
	}
	var first_day = ds_dc_date.getDay();
	var first_loop = 1;
	// Start the first week
	display (display_nouv_semaine());
	// If sunday is not the first day of the month, make a blank cell...
	if (first_day != 0) {
		display (display_cellule_vide(first_day));
	}
	var j = first_day;
	for (i = 0; i < days; i ++) {
		// Today is sunday, make a new week.
		// If this sunday is the first day of the month,
		// we've made a new row for you already.
		if (j == 0 && !first_loop) {
			// New week!!
			display (display_nouv_semaine());
		}
		// Make a row of that day!
		display (display_day(i + 1, m, y));
		// This is not first loop anymore...
		first_loop = 0;
		// What is the next day?
		j ++;
		j %= 7;
	}
	// Do the footer
	display (calendrier_template_main_below());
	calendrier_ob_flush();
}

// A function to show the calendar.
// When user click on the date, it will set the content of t.
function displayCalendrier() {
		
	var ds_sh_date = new Date();
	ds_c_month = ds_sh_date.getMonth() + 1;
	ds_c_year = ds_sh_date.getFullYear();
	// Draw the calendar
	dessiner_calendrier(ds_c_month, ds_c_year);
	cal_ce.style.display = '';
}

// Moves to the next month...
function calendrier_mois_suiv() {
	ds_c_month ++;
	if (ds_c_month > 12) {
		ds_c_month = 1; 
		ds_c_year++;
	}
	// Redraw the calendar.
	dessiner_calendrier(ds_c_month, ds_c_year);
}

// Moves to the previous month...
function calendrier_mois_prec() {
	ds_c_month = ds_c_month - 1; 
	if (ds_c_month < 1) {
		ds_c_month = 12; 
		ds_c_year = ds_c_year - 1; 
	}
	dessiner_calendrier(ds_c_month, ds_c_year);
}

// Moves to the next year...
function calendrier_annee_suiv() {
	ds_c_year++;
	dessiner_calendrier(ds_c_month, ds_c_year);
}

function calendrier_annee_prec() {
	ds_c_year = ds_c_year - 1; 
	dessiner_calendrier(ds_c_month, ds_c_year);
}

// When the user clicks the day.
function calendrier_onclick(d, m, y) {
	document.location.href=  "page_result_calendrier.aspx?dc=0&month="+m+"&year="+y+"&day="+d;
}


// Défilement 4 directions multiple
	function Defilant(id, pos_init, pos_min, pos_max, delta, direction) {
	   this.id          = id;
	   this.element     = document.getElementById(id);
	   this.pos_init    = pos_init;
	   this.pos_min     = pos_min;
	   this.pos_max     = pos_max;
	   this.pos_current = pos_init;
	   this.delta       = delta;
	   this.direction   = direction;
	}
       
	Defilant.prototype.defile = function() {
	   if (!this.element) {
	      this.element = document.getElementById(this.id);
	   }
	   if (this.element) {
	      if(this.direction == 'vertical'){
	         if(this.pos_current < (this.pos_min - this.element.offsetHeight) ){
	            this.pos_current = this.pos_init;
	         } else if (this.pos_current > this.pos_max ) {
	            this.pos_current = this.pos_init - this.element.offsetHeight;
	         } else {
	            this.pos_current += this.delta;
	         }
	         this.element.style.top = this.pos_current+"px";
	      } else if(this.direction == 'horizontal') {
	         if(this.pos_current < (this.pos_min - this.element.offsetWidth) ){
	            this.pos_current = this.pos_init;
	         } else if (this.pos_current > this.pos_max ) {
	            this.pos_current = this.pos_init - this.element.offsetWidth;
	         } else {
	            this.pos_current += this.delta;
	         }
	         this.element.style.left = this.pos_current+"px";
	      }
	   }
	}



//********************** InfoBulle ***********************//

function GetIdBulle(id)
{
return document.getElementById(id);
}
var i=false; 
function moveBulle(e) {
  if(i) { 
    if (navigator.appName!="Microsoft Internet Explorer") { 
        GetId("bulle").style.left=e.pageX+"px";
        GetId("bulle").style.top=e.pageY+"px";
    }
    else { 
        if(document.documentElement.clientWidth>0) {
            GetIdBulle("bulle").style.left=20+event.x+document.documentElement.scrollLeft+"px";
            GetIdBulle("bulle").style.top=10+event.y+document.documentElement.scrollTop+"px";
        }
        else {
            GetIdBulle("bulle").style.left=20+event.x+document.body.scrollLeft+"px";
            GetIdBulle("bulle").style.top=10+event.y+document.body.scrollTop+"px";
        }
    }
  }
}

function montreBulle() {
  if(i==false) {
  GetIdBulle("bulle").style.visibility="visible"; 
  i=true;
  }
}
function cacheBulle() {
if(i==true) {
GetIdBulle("bulle").style.visibility="hidden"; // Si la bulle etais visible on la cache
i=false;
}
}

/*Redirection vers page résultat pour moteur recherche dans raccourci */
function redirectSearch(pageRecherche,txtSearch){
   var search= document.getElementById(txtSearch).value;
    if(search!="Rechercher...") document.location.href=pageRecherche+"?searchRacc="+search;   
}

/*Redirection vers page résultat pour moteur recherche dans raccourci */
/*Evenement sur le textbox de recherche*/
function searchRacc(e,txt,pageRecherche){
   if (document.all)
    {
        if(window.event)    {    e = window.event;    }
    }

    if(e.which || e.keyCode || e.charCode){
      if ((e.which == 13) || (e.keyCode == 13) ) {
              var search= txt.value;
              if(search!="Rechercher..."){
                 document.location.href=pageRecherche+"?searchRacc="+search;
              }
        }
    }   
}


//Pour certain menu verticaux, déroulant javascript
function expandMenu(idUL){
    if(document.getElementById(idUL)){
         if(document.getElementById(idUL).style.display=='none')
            document.getElementById(idUL).style.display='block';
         else   document.getElementById(idUL).style.display='none'; 
    }
}