// JavaScript Document

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('container').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				//footerElement.style.position = 'absolute';
				//footerElement.style.top = (windowHeight - footerHeight) + 'px';
				document.getElementById('container').style.height = (windowHeight - footerHeight - 0) + 'px';
			}
			else {
				document.getElementById('container').style.height = 'auto';
				//footerElement.style.position = 'static';
			}
		}
	}
}
function setRightColumn(){
    var rightColumn = document.getElementById('right-column');
    var leftColumn = document.getElementById('left-column');
    if (rightColumn.offsetHeight<=leftColumn.offsetHeight) {
        rightColumn.style.height=leftColumn.offsetHeight+'px';
    }
}

function getElementByClass(theClass) {
    var allHTMLTags = new Array();
    var customHTMLTags = new Array();
    var allHTMLTags=document.getElementsByTagName("*");
    var j=0;
    for (i=0; i<allHTMLTags.length; i++) {
        if (allHTMLTags[i].className==theClass) {
            customHTMLTags[j]=allHTMLTags[i];
            j++;
        }
    }
    return customHTMLTags;
}
function fixActivites(){
    var activites_names=getElementByClass('activite-name');
    var activites_images=getElementByClass('activite-image');
    for (i=0;i<activites_names.length;i++){
        if (i>3)
            activites_images[i].style.height=139-activites_names[i].offsetHeight+'px';
        else
            activites_images[i].style.height=117-activites_names[i].offsetHeight+'px';
    }
}

//window.onload = function() {setFooter(); setRightColumn();}
window.onresize = function() {setFooter(); setRightColumn();}
window.onchange = function() {setFooter(); setRightColumn();}

function NewWindow(mypage,myname,w,h,scroll){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
var settings ='height='+h+',';
settings +='width='+w+',';
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars='+scroll+',';
settings +='resizable=yes';
win=window.open(mypage,myname,settings);
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function PopUp2(nId, nWidth, nHeight)
{
    if(typeof WindowPopUp != "undefined")
            WindowPopUp.close();

    WindowPopUp = window.open("popup_image.php?id="+nId, "image", "left="+((screen.width-nWidth)/2)+", top="+((screen.height-nHeight)/2)+", width="+nWidth+", height="+nHeight+", scrollbars=yes");
    WindowPopUp.focus();
    }

function PopUp(strFile, nWidth, nHeight)
{
    if((typeof WindowPopUp != "undefined") && (WindowPopUp != null))
        WindowPopUp.close();

    WindowPopUp = window.open("popup.php?file="+strFile, "popup", "left="+((screen.width-nWidth)/2)+", top="+((screen.height-nHeight)/2)+", width="+nWidth+", height="+nHeight);
    if(WindowPopUp != null)
        WindowPopUp.focus();
}
function PopUp3(strFile, nWidth, nHeight)
{
    if((typeof WindowPopUp != "undefined") && (WindowPopUp != null))
        WindowPopUp.close();

    WindowPopUp = window.open("mdm.php?file="+strFile, "popup", "left="+((screen.width-nWidth)/2)+", top="+((screen.height-nHeight)/2)+", width="+nWidth+", height="+nHeight);
    if(WindowPopUp != null)
        WindowPopUp.focus();
}
function PopUp4(strFile, nWidth, nHeight)
{
    if((typeof WindowPopUp != "undefined") && (WindowPopUp != null))
        WindowPopUp.close();

    WindowPopUp = window.open("plan.php?file="+strFile, "popup", "left="+((screen.width-nWidth)/2)+", top="+((screen.height-nHeight)/2)+", width="+nWidth+", height="+nHeight);
    if(WindowPopUp != null)
        WindowPopUp.focus();
}

//-->
