//Ajutement de la hauteur des div content et sidebar
function setTall(sIDCss, sClickOpenCss) {
      if (document.getElementById) {
			if (sIDCss == '') {
				sIDCss = 'sidebar';
			}
			var iHeightClickOpenCss = document.getElementById(sClickOpenCss).offsetHeight;
            var divs = new Array(document.getElementById(sIDCss), document.getElementById('mainContent'));
            var maxHeight = 0;
            for (var i = 0; i < divs.length; i++) {
//alert(divs[i].id + ' : ' + divs[i].offsetHeight);
                  if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight + iHeightClickOpenCss;
			}
//alert(sIDCss + ' : ' + maxHeight + ' : ' + iHeightClickOpenCss);
            for (var i = 0; i < divs.length; i++) {
                  divs[i].style.height = maxHeight + 'px';
                  if (divs[i].offsetHeight > maxHeight) {
                        divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight-5)) + 'px';
                  }
            }
      }
}

// JavaScript Document
<!--
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];}
}
//-->


function AfficherMenuGauche(iSection, sNiveau, sPathName) {
	var sOut = '';
	var sUrl = '';
	var strClassMenu = '';
	var strPathName = location.pathname;
	var sUrlTarget = '';
//alert('iSection : ' + iSection + '\nsNiveau : ' + sNiveau);
//alert(strPathName);

	for (var i = 0; i < aryMenu.length; i++) {
		i = parseInt(i);
		var sTmpUrl = aryMenu[i][1];
		var sTitleUrl = aryMenu[i][0];
		//alert(strPathName);
		if (sTmpUrl != sPathName) {
// [FS] 2008-12-03 - Modifier la section car avant nous avions des chiffres (101/) et now nous avons du alphanumrique
//			if (iSection == sTmpUrl.substring(0, 3)) {
			if (sTmpUrl.indexOf(iSection + '/') >= 0) {
				// [FS] 2008-06-04, si on a deux répertoire commun pour deux adresse, ça permet d'identifier le bon bouton à afficher
				if (strPathName.indexOf(sTmpUrl) != -1) {
					sOut += AfficherImage(sNiveau + 'images/menu/' + aryMenu[i][3], 'image' + i, sTitleUrl);
				} else {
					sUrl = aryMenu[i][1];
					if (sUrl.indexOf('http://') == -1) {
						sUrl = sNiveau + sUrl
					}
					sOut += '<a href="' + sUrl + '" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'image' + i + '\',\'\',\'' + sNiveau + 'images/menu/' + aryMenu[i][3] + '\',1)" title="' + sTitleUrl + '"><img src="' + sNiveau + 'images/menu/' + aryMenu[i][2] + '" name="image' + i + '" border="0" style="margin-bottom: 20px"></a>';				
				}
			} else {
				sUrl = aryMenu[i][1];
				if (sUrl.indexOf('http://') == -1) {
					sUrl = sNiveau + sUrl
					sUrlTarget = '';
				} else {
					sUrlTarget = 'target="_blank"';
				}
				sOut += '<a href="' + sUrl + '" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'image' + i + '\',\'\',\'' + sNiveau + 'images/menu/' + aryMenu[i][3] + '\',1)" title="' + sTitleUrl + '"';
				// [fs] 2008-06-04, mettre un TARGET _BLANK sur les adresses ayant http://
				if (sUrlTarget != '') {
					sOut = sOut + sUrlTarget;
				}
				sOut = sOut + '><img src="' + sNiveau + 'images/menu/' + aryMenu[i][2] + '" name="image' + i + '" border="0" style="margin-bottom: 20px"></a>';
			}
		} else {
			sOut += AfficherImage(sNiveau + 'images/menu/' + aryMenu[i][3], 'image' + i, sTitleUrl);
		}
	}
//	sOut += '<img src="' + sNiveau + 'images/menu/bt_11.gif" name="image' + i + 1 + '" border="0">';

	sOut += '<div id="concours">Gagnez une paire de billets<br>';	
    sOut += '<input name="courriel" type="text" id="courriel" style="width: 176px; height:25px; margin: 5px 0 5px 0; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px; color: #000;" value="Inscrivez votre courriel" onClick="clearField(\'click\');" onmouseout="clearField();"><br>';
	sOut += '<input name="Envoyer" type="button" style="font-size: 11px;" value="Envoyer" onClick="SendMailList();">';	
    sOut += '</div>';
	return sOut;
}
//sFileImage = sNiveau + 'images/menu/' + aryMenu[i][3];
//sNameImage = 'image' + i;

function AfficherImage(sFileImage, sNameImage, sTitleImage) {
	var sOut = '';

	if ((sFileImage != '') && (sNameImage != '')) {
		sOut += '<img src="' + sFileImage + '" name="' + sNameImage + '" border="0" style="margin-bottom: 20px"';
		if (sTitleImage != '') {
			sOut += ' alt="' + sTitleImage + '" title="' + sTitleImage + '"';
		}
		sOut += '>';
	}
	return sOut;
}

//aryMenu[][0]=""; aryMenu[][1]=""; aryMenu[][2]=""; aryMenu[][3]="";

aryMenu = new Array();
aryMenu[0] = new Array(3); 
aryMenu[1] = new Array(3); 
aryMenu[2] = new Array(3); 
aryMenu[3] = new Array(3); 
aryMenu[4] = new Array(3); 
aryMenu[5] = new Array(3); 

aryMenu[0][0]="ACCUEIL"; aryMenu[0][1]="menu.htm"; aryMenu[0][2]="bt_accueil.gif"; aryMenu[0][3]="bt_accueil_ov.gif";
aryMenu[1][0]="HISTORIQUE"; aryMenu[1][1]="historique/default.htm"; aryMenu[1][2]="bt_historique.gif"; aryMenu[1][3]="bt_historique_ov.gif";
aryMenu[2][0]="PROGRAMMATION"; aryMenu[2][1]="programmation/default.htm"; aryMenu[2][2]="bt_programmation.gif"; aryMenu[2][3]="bt_programmation_ov.gif";
aryMenu[3][0]="LOCATION / PLAN DE LA SALLE"; aryMenu[3][1]="location/default.htm"; aryMenu[3][2]="bt_location.gif"; aryMenu[3][3]="bt_location_ov.gif";
aryMenu[4][0]="PHOTOS"; aryMenu[4][1]="photos/default.htm"; aryMenu[4][2]="bt_photos.gif"; aryMenu[4][3]="bt_photos_oV.gif";
aryMenu[5][0]="NOUS JOINDRE"; aryMenu[5][1]="joindre/default.htm"; aryMenu[5][2]="bt_joindre.gif"; aryMenu[5][3]="bt_joindre_ov.gif";
/*
function AfficherImage(sFileImage, sNameImage, sTitleImage) {
	var sOut = '';

	if ((sFileImage != '') && (sNameImage != '')) {
		sOut += '<img src="' + sFileImage + '" name="' + sNameImage + '" border="0"';
		if (sTitleImage != '') {
			sOut += ' alt="' + sTitleImage + '" title="' + sTitleImage + '"';
		}
		sOut += '>';
	}
	return sOut;
}
*/

function getpath(){
	var pathname = window.location.pathname;
	var pathlen = pathname.split("/");
	var serverpath = "";
	var hostname = document.location.hostname;
	var faccorrectionniveau = 0;
	if (hostname == '192.168.100.231') {
		faccorrectionniveau = 2;
	}
	var sNiveau = '';
	
//alert(pathlen.length + ' : ' + faccorrectionniveau + ' : ' + pathname + ' = ' +  new String(faccorrectionniveau + 2));
//alert(hostname + ' (' + faccorrectionniveau + ') : ' + pathname+"-------"+pathlen.length);
//	alert("pathlen.length " + pathlen.length + " Path: " +window.location.pathname + " faccorrectionniveau : " + faccorrectionniveau);
	for(i = (faccorrectionniveau + 2); i < ((pathlen.length)); i++) {
		sNiveau +='../';
	}
	
	return sNiveau;
	
}