var menutimers=new Array();
var publicsite=true;
var rel='images/navig/';
var gardoc='';
var gard='';
var gardy='';
posimask=0;
var loaded=0;
var limit=0;
var loaded=0;
var xmenu=1;
var htab=0;
var hdiv=0;
var gardcal='';
var indice=0;
var bkmrk=null;
var tblieux=new Array('6','3','5');
function validcherche()
{var ch=document.getElementById('CHERCHE').value;
 if (ch.length<3) {
    alert('Le mot recherché doit avoir au minimum 3 caractères');
    return false;
    } else {return true;};
};
function showhide(elid,sh)
{   el=document.getElementById(elid)?document.getElementById(elid):null;
if (el!=null) {
menuleft=document.getElementById('formutyp')?document.getElementById('formutyp'):null;
if (sh) {el.style.visibility='visible';
  if(menuleft!=null) {menuleft.style.visibility='hidden';};
    }
else {el.style.visibility='hidden';
 if(menuleft!=null && elid.indexOf('smenu')==-1) {menuleft.style.visibility='visible';};
       };
};
}

function disp(id,dc) {
if(dc==1) {
         eld=document.getElementById('divdoc'+id);
         im=document.getElementById('fl'+id);
         if(eld.style.display!='block') {
         eld.style.display='block';
         im.src='images/flechvisit0.png';
         im.alt='Cliquer pour fermer';

         } else {
         eld.style.display='none';
         im.src='images/flechvisit1.png';
         im.alt='Cliquer pour voir les détails';

};
 } else {
             eld=document.getElementById('divdoc'+id);
             if(eld.style.display!='block') {
             eld.style.display='block';
             if(gardoc!='') {
             document.getElementById('divdoc'+gardoc).style.display='none';
             };
             gardoc=id;
             } else {
             eld.style.display='none';
             };
 };
};

function affcalmod(elid,z,jour)
{
elt=document.getElementById(elid);
if(elt) {
if(elt.style.display=="block") {
elt.style.display="none";
elt.style.visibility="hidden";
elt.style.width="1px";
elt.style.height="1px";
} else {

if(gardcal!='') {
elm=document.getElementById(gardcal);
elm.style.display="none";
elm.style.visibility="hidden";
elm.style.width="1px";
elm.style.height="1px";
};
inidiv(elid,'pos'+z,12,0);

for(i=0;i<elt.childNodes.length-1;i++) {
if(elt.childNodes[i].tagName=='A') {
tx=elt.childNodes[i].getAttribute('href');
elt.childNodes[i].setAttribute('href',tx.replace('§§dat§§','&date_agenda='+jour));
};};
elt.style.display="block";
elt.style.visibility="visible";
elt.style.width="180px";
elt.style.height="120px";
gardcal=elid;
};
};
};

function getAbsPos(elt,which,par) {
 iPos = 0;
 if (par) {
 while (elt != null ) {
  iPos += parseInt(elt["offset" + which]);
  elt = elt.offsetParent ? elt.offsetParent : null;
 } ; } else if(elt!=null) {
 iPos= parseInt(elt["offset" + which]);
 };
 // if (is.iemac) { if (which=='Left' || which=='Top'){iPos-=parseInt(document.body.currentStyle['margin'+which]);};};
  return iPos;
}
function getElementStyle(elem, IEStyleProp, CSSStyleProp) {
    if (elem.currentStyle) {
     if (isNaN(elem.currentStyle[IEStyleProp]))
       {
      return getAbsPos(elem,IEStyleProp,false);

      } else {
       return  elem.currentStyle[IEStyleProp];
       };
    } else if (window.getComputedStyle) {
        var compStyle = window.getComputedStyle(elem, "");
        return compStyle.getPropertyValue(CSSStyleProp);
    }
    return '';
}


function correctPNG() 
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   { var imgs=document.getElementsByTagName("img");
      for(var i=0; i<imgs.length; i++)
      {
         var img =imgs[i];
         var imgName = img.src.toUpperCase();
		 cl=img.parentElement.className?img.parentElement.className:null;
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG" && cl=='drawimg')
         {
            w=parseInt(img.offsetWidth);
            h=parseInt(img.offsetHeight);
			var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:block;width:"+w+"px;height:"+h+"px" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" +  imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}

if (!Array.prototype.indexOf) {
	Array.prototype.indexOf = function(val, fromIndex) {
		if (typeof(fromIndex) != 'number') fromIndex = 0;
		for (var index = fromIndex,len = this.length; index < len; index++)
			if (this[index] == val) return index;
		return -1;
	}
}

/*function initmenu()
{var menubox=document.getElementById('menubox')?document.getElementById('menubox'):null;
menubox=menubox.getChildren();
menubox.each(function(el,i) {el.addEvent('click',function() {affichbox(this,af);});
});};
function affichbox(el,af)
{
var box=el.href;box=box.substr(1);
if(af) {disp='block';cl='main';} else {disp='none';cl='';};
$(box).setStyle('display',disp);this.className=cl;var prt=el.getParent();
if(af) {el.injectInside(prt);} else {el.inject}
};*/
function makecorners()
{
 if(!window.NiftyChk)
    return;
RoundedTop("div.roundbox","","transparent",'#7ABDE4',"",'small'); 
RoundedBottom("div.roundbox","","transparent",'#ffffff','');
//RoundedTop("div.roundbox","","transparent",'#7ABDE4',"",'small'); 
RoundedBottom("div.roundbox2","","transparent",'#ffffff',''); 
RoundedBottom("div.roundbox3","","transparent",'#ffffff','');  
//RoundedTop("div.roundbox","","transparent",'#7ABDE4',"",'small'); 
RoundedBottom("div.roundboxcal","","transparent",'#ffffff','');
RoundedTop("div.roundbox1","","transparent",'#7ABDE4',"",'small'); 
RoundedBottom("div.roundbox1","","transparent",'#ffffff','');


};

function repost()
{
if (loaded==1) {
document.getElementById(id);
     initmenu(rel);
 };

};

window.onresize= function() {

    if (loaded==1) {

 //  tim=setTimeout("initmenu('"+rel+"')",300);
 };
        };
window.onload = function() {

            if (document.getElementById) {
      	  correctPNG();var img=document.getElement('div[class=panorama]');if(img) {img=img.getElement('img');
      	  var h=img.getCoordinates();
      	  if(h.width<h.height) {
			  h.width=Math.floor(h.width/3);h.height=Math.floor(h.height/3);
			img.setStyles({'width':h.width+'px','height':h.height+'px'});
			img.parentNode.setStyle('margin','0 12px 12px 0');
			document.getElement('div[class=infoplus]').setStyles({'float':'left','display':'inline','clear':'right','padding':'12px 12px 8px 0'});document.getElement('div[class=notes]').setStyles({'float':'left','display':'inline','clear':'right'});$('diapo20').setStyles({'z-index':'200','clear':'both'});
			};
      	  };
      	  TB_init();
		var myTabs = new mootabs('contentot'); 
       	//	makecorners();
       if(window.googlemap) {loadgooglemap(37.423021,-122.083739);window.onunload=GUnload();};
                if (window.formulaire) {init_editor('');} else {calendrier=document.getElementById('visuelcal');  if(calendrier!=null) {init_calendrier();};}; };
        }
