/* 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] = "nina"+"."+"6904@"+"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>";
    }
}
/* addLoadEvent
-----------------------------------------------------------------------------*/
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}
/* highlightTable
-----------------------------------------------------------------------------*/
function highlightTable(t, highlightRows, highlightColumns, selectable){
    $(t + ' tr:odd').addClass('odd');
    $(t + ' tr:even').addClass('even');
    if (highlightRows){
        $(t + ' tbody tr').mouseover(function(){
            $(this).addClass('over');
        }).mouseout(function(){
            $(this).removeClass('over');
        });
    }
    if (highlightColumns){
        $(t + ' td,' + t + ' th').mouseover(function(){
            var column = $(this).parent().children().index($(this)) + 1;
            $(t + ' tr :nth-child(' + column + ')').addClass('sel2');
        }).mouseout(function(){
            var column = $(this).parent().children().index($(this)) + 1;
            $(t + ' tr :nth-child(' + column + ')').removeClass('sel2');
        });
    }
    if (selectable){
        $(t + ' tbody tr').click(function(){
            $(t + ' tr').removeClass('sel');
            $(this).addClass('sel');
        });
    }
}
