/* toggleMDM
-----------------------------------------------------------------------------*/
function toggleMDM(id){
    jQuery("#mdm .active").removeClass("active");
    jQuery("#mdm_btn_"+id).addClass("active");
    jQuery("#mdm .mdm-box:visible").fadeOut(function(){
        jQuery("#mdm_box_"+id).fadeIn();
    });
    jQuery("#mdm_details_btn").attr("href","mdm-popup.php?id="+id);
}
/* setRadio
-----------------------------------------------------------------------------*/
function setRadio(label, container){
	var labels = document.getElementById(container).getElementsByTagName('label');
	for (i=0; i<labels.length; i++){
        if (labels[i].className.indexOf('radio-label') != -1){
		    labels[i].className = "radio-label";
		}
    }
    if (label.className.indexOf('radio-label') != -1){
	    label.className = "radio-label-checked";
    }
}
/* setCheckbox
-----------------------------------------------------------------------------*/
function setCheckbox(label){
    if (label.className.indexOf('checkbox-label-checked') != -1){
	    label.className = "checkbox-label";
    } else {
	    label.className = "checkbox-label-checked";
    }
}
/* autoHeight
-----------------------------------------------------------------------------*/
function autoHeight(){
    var divh = document.getElementById('footer').offsetHeight;
    var refDiv = (divh +"px");
    document.getElementById('wrap-footer').style.height = refDiv;
    document.getElementById('push').style.height = refDiv;
    document.getElementById('fwrap1').style.height = refDiv;
    document.getElementById('fwrap2').style.height = refDiv;
    document.getElementById('fwrap3').style.height = refDiv;
    document.getElementById('container').style.marginBottom = (0-divh)+"px";

    var minDivh = document.getElementById('container').offsetHeight;
    document.getElementById('mh1').style.height = minDivh+"px";
    document.getElementById('mh2').style.height = minDivh+"px";
    document.getElementById('mh3').style.height = minDivh+"px";
};
/* newWindow
-----------------------------------------------------------------------------*/
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=no';
    win = window.open(mypage,myname,settings);
    if (parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
/* changeToMail
-----------------------------------------------------------------------------*/
var mails = new Array();
mails[0] = "cecilegal"+"@"+"live"+"."+"fr";
mails[1] = "";

function changeToMail(id,i,title){
    if (!title) title = "Envoyer un e-mail";
    if (document.getElementById(id)) {
        document.getElementById(id).innerHTML = "<a href='" + "mai" + "lto:" + mails[i] + "' title='" + title + "'>" + mails[i] + "</a>";
    }
}
/* highlightTable
-----------------------------------------------------------------------------*/
function highlightTable(e, highlight, selectable){
    $(e + ' tbody tr:nth-child(2n)').addClass('odd');
    if (highlight){
        $(e + ' tbody tr').hover(
            function(){$(this).addClass('over');},
            function(){$(this).removeClass('over');}
        );
    }
    if (selectable){
        $(e + ' tbody tr').click(function(){
            $(e + ' tr').removeClass('sel');
            $(this).addClass('sel');
        });
    }
}
