


// MENU DEROULANT HEADER

sfHover = function() {
	var sfEls = document.getElementById("liensPerso").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*sfHover = function() {
	var sfEls = document.getElementById("simpleS").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}*/
if (window.attachEvent) window.attachEvent("onload", sfHover);


// FONCTION AFFICHER MASQUER DIV actu.detail
function ShowHideLayer(boxID) {
	/* Obtain reference for the selected boxID layer and its button */
	var box = document.getElementById("box"+boxID);
	var pagination = document.getElementById("pagination");

	/* If the selected box is currently invisible, show it */
	if (box.style.display == "none" || box.style.display=="" ) {
		box.style.display = "inline";
	}
	else{
		box.style.display = "none";
	}
	if(pagination != null)
		{
		if (pagination.style.display == "block" || pagination.style.display=="" )
			{
			pagination.style.display = "none";
			}
			/* otherwise hide it */
		else
			{
			pagination.style.display = "block";
			}
		}

	}

// FONCTION AFFICHER MASQUER DIV PLAN DU SITE
function ShowHideLayerPlan(boxID) {
	/* Obtain reference for the selected boxID layer and its button */
	var box = document.getElementById("box"+boxID);
	var pagination = document.getElementById("pagination");
	/* If the selected box is currently invisible, show it */
	if (box.style.display == "none" || box.style.display=="" ) {
	}
	if (pagination.style.display == "none" || pagination.style.display=="" ) {
	}
	/* otherwise hide it */
	else {
		box.style.display = "none";
		pagination.style.display = "none";
	}
}

// HAUTEUR COLONNES

function fixColumns(boxID){
	var h1 = document.getElementById("actus");
	var h2 = document.getElementById("box"+boxID);

	if(h1.offsetHeight && h2.offsetHeight){
		maxheight=Math.max((h1.offsetHeight),(h2.offsetHeight));
	}
	if(navigator.userAgent.indexOf("Firefox") != -1){
		h1.style.height = (maxheight + 15 )+'px';
		h2.style.height = (maxheight + 10 )+'px';
		}
	else{
		//Detect IE7
		version=0
		if (navigator.appVersion.indexOf("MSIE")!=-1){
		temp=navigator.appVersion.split("MSIE")
		version=parseFloat(temp[1])
		}

		if (version>=6.5)
			{
			h1.style.height = (maxheight + 15)+'px';
			h2.style.height = (maxheight + 15)+'px';
			}
		else
			{
			h1.style.height = (maxheight - 10)+'px';
			h2.style.height = (maxheight - 10)+'px';
			}
	}

}

function unfixColumns(boxID){
	var h1 = document.getElementById("actus");
	var h2 = document.getElementById("box"+boxID);

	if(h1.offsetHeight && h2.offsetHeight){
		maxheight=Math.max((h1.offsetHeight),(h2.offsetHeight));
	}
	if(navigator.userAgent.indexOf("Firefox") != -1){
		h1.style.height = 'auto';
		h2.style.height = 'auto';
		}
	else{
		h1.style.height = 'auto';
		h2.style.height = 'auto';
	}

}

function fixColumnsProduits(boxID){
	var h1 = document.getElementById("fiche");
	var h2 = document.getElementById("box"+boxID);

	if(h1.offsetHeight && h2.offsetHeight){
		maxheight=Math.max(h1.offsetHeight,h2.offsetHeight)+'px';
	}
	h1.style.height = maxheight;
	h2.style.height = maxheight;
}


   function selectReplacement(obj) {
      obj.className += ' replaced';
      var ul = document.createElement('ul');
      ul.className = 'selectReplacement';
	  ul.idName = 'boite';
      var opts = obj.options;
      for (var i=0; i<opts.length; i++) {
        var selectedOpt;
        if (opts[i].selected) {
          selectedOpt = i;
          break;
        } else {
          selectedOpt = 0;
        }
      }
      for (var i=0; i<opts.length; i++) {
        var li = document.createElement('li');
        var txt = document.createTextNode(opts[i].text);
        li.appendChild(txt);
        li.selIndex = opts[i].index;
        li.selectID = obj.id;
        li.onmouseover = function() {
          selectMe(this);
        }
        if (i == selectedOpt) {
          li.className = 'selected';
          li.onclick = function() {
            this.parentNode.className += ' selectOpen';
            this.onmouseover = function() {
              selectMe(this);
            }
          }
        }
        if (window.attachEvent) {
          li.onmouseover = function() {
            this.className += ' hover';
          }
          li.onmouseout = function() {
            this.className =
              this.className.replace(new RegExp(" hover\\b"), '');
          }
        }
        ul.appendChild(li);
      }
      obj.parentNode.insertBefore(ul,obj);
    }
    function selectMe(obj) {
      var lis = obj.parentNode.getElementsByTagName('li');
      for (var i=0; i<lis.length; i++) {
        if (lis[i] != obj) {
          lis[i].className='';
          lis[i].onclick = function() {
            selectMe(this);
          }
        } else {
          setVal(obj.selectID, obj.selIndex);
          obj.className='selected';
          obj.parentNode.className =
            obj.parentNode.className.replace(new RegExp(" selectOpen\\b"), '');
          obj.onclick = function() {
            obj.parentNode.className += ' selectOpen';
            this.onclick = function() {
              selectMe(this);
            }
          }
        }
      }
    }
    function setVal(objID, selIndex) {
      var obj = document.getElementById(objID);
      obj.selectedIndex = selIndex;
    }
    function setForm() {
      var s = document.getElementsByTagName('select');
      for (var i=0; i<s.length; i++) {
        selectReplacement(s[i]);
      }
    }
    window.onload = function() {
      (document.all && !window.print) ? null : setForm();
    }

// FONCTIONS SITE FULL SIZE

function ShowHidePresse() {
	/* Obtain reference for the selected boxID layer and its button */
	var presse = document.getElementById("presse");
	var btnPresse = document.getElementById("btnPresse");

	/* If the selected box is currently invisible, show it */
	if(presse.style.display == "none" || presse.style.display=="") {
		presse.style.display = "block";
 		btnPresse.src = "/extension/smiledesignlagardere/design/lagardere/images/css/presse/collapsePresse.png";
	}
	/* otherwise hide it */
	else {
		presse.style.display = "none";
		btnPresse.src = "/extension/smiledesignlagardere/design/lagardere/images/css/presse/expandPresse.png";
	}
}

function ShowHideTelevision() {
	/* Obtain reference for the selected boxID layer and its button */
	var television = document.getElementById("television");
	var btnTelevision = document.getElementById("btnTelevision");

	/* If the selected box is currently invisible, show it */
	if(television.style.display == "none" || television.style.display=="") {
		television.style.display = "block";
 		btnTelevision.src = "/extension/smiledesignlagardere/design/lagardere/images/css/television/collapseTelevision.png";
	}
	/* otherwise hide it */
	else {
		television.style.display = "none";
		btnTelevision.src = "/extension/smiledesignlagardere/design/lagardere/images/css/television/expandTelevision.png";
	}
}

function ShowHideInternet() {
	/* Obtain reference for the selected boxID layer and its button */
	var internet = document.getElementById("internet");
	var btnInternet = document.getElementById("btnInternet");

	/* If the selected box is currently invisible, show it */
	if(internet.style.display == "none" || internet.style.display=="") {
		internet.style.display = "block";
 		btnInternet.src = "/extension/smiledesignlagardere/design/lagardere/images/css/internet/collapseInternet.png";
	}
	/* otherwise hide it */
	else {
		internet.style.display = "none";
		btnInternet.src = "/extension/smiledesignlagardere/design/lagardere/images/css/internet/expandInternet.png";
	}
}

function ShowHideMobile() {
	/* Obtain reference for the selected boxID layer and its button */
	var mobile = document.getElementById("mobile");
	var btnMobile = document.getElementById("btnMobile");

	/* If the selected box is currently invisible, show it */
	if(mobile.style.display == "none" || mobile.style.display=="") {
		mobile.style.display = "block";
 		btnMobile.src = "/extension/smiledesignlagardere/design/lagardere/images/css/mobile/collapseMobile.png";
	}
	/* otherwise hide it */
	else {
		mobile.style.display = "none";
		btnMobile.src = "/extension/smiledesignlagardere/design/lagardere/images/css/mobile/expandMobile.png";
	}
}

function ShowHideRadio() {
	/* Obtain reference for the selected boxID layer and its button */
	var radio = document.getElementById("radio");
	var btnRadio = document.getElementById("btnRadio");

	/* If the selected box is currently invisible, show it */
	if(radio.style.display == "none" || radio.style.display=="") {
		radio.style.display = "block";
 		btnRadio.src = "/extension/smiledesignlagardere/design/lagardere/images/css/radio/collapseRadio.png";
	}
	/* otherwise hide it */
	else {
		radio.style.display = "none";
		btnRadio.src = "/extension/smiledesignlagardere/design/lagardere/images/css/radio/expandRadio.png";
	}
}

function ShowHidePlurimedia() {
	/* Obtain reference for the selected boxID layer and its button */
	var radio = document.getElementById("plurimedia");
	var btnRadio = document.getElementById("btnRadio");

	/* If the selected box is currently invisible, show it */
	if(radio.style.display == "none" || radio.style.display=="") {
		radio.style.display = "block";
 		btnRadio.src = "/extension/smiledesignlagardere/design/lagardere/images/css/plurimedia/collapsePlurimedia.png";
	}
	/* otherwise hide it */
	else {
		radio.style.display = "none";
		btnRadio.src = "/extension/smiledesignlagardere/design/lagardere/images/css/plurimedia/expandPlurimedia.png";
	}
}

function hauteurFullSite(){
	var c1 = document.getElementById("contenu");
	var c2 = document.getElementById("box100");
	var c3 = document.getElementById("box75");
	if (c1 && c2){
		if(c1.offsetHeight && c2.offsetHeight){
			maxheight=Math.max(c1.offsetHeight,c2.offsetHeight)+'px';
		}else{
			if(c1.offsetHeight){
				maxheight=c1.offsetHeight+'px';
			}else{ 
				if(c2.offsetHeight){
					maxheight=c2.offsetHeight+'px';
				}
			}
		}
		c1.style.height = maxheight;
		c2.style.height = maxheight;
		//c3.style.height = maxheight-10;
	}
	else if(c1 && c3){
		if(c1.offsetHeight && c3.offsetHeight){
			maxheighttmp = Math.max(c1.offsetHeight,c3.offsetHeight) - 20;
			maxheighttmp2 = Math.max(c1.offsetHeight,c3.offsetHeight) + 10;
			maxheight= maxheighttmp+'px';
			maxheight2= maxheighttmp2+'px';
		}
		c1.style.height = maxheight2;
		c3.style.height = maxheight;
	}
}

function hauteurFullSitePlan(){
	var c1 = document.getElementById("contenu");
	var c2 = document.getElementById("box100");
	var c3 = document.getElementById("box75");

	if (c1 && c2){
		if(c1.offsetHeight && c2.offsetHeight){
			maxheight=Math.max(c1.offsetHeight,c2.offsetHeight)+'px';
		}
		c1.style.height = maxheight;
		c2.style.height = maxheight;
	}
}