// Utils JScript File

// Renvoie true si le navigateur est IE, false sinon
function isMSIE() {
    return (navigator.userAgent.toLowerCase().indexOf("msie") >= 0);
}

// Redirige vers une url
function redirectToUrl(newUrl) {
    try {
        window.location = newUrl;
    }
    catch (ex) {}
}

function removeFromString(myString, myStrToRemove) {
    pos = myString.indexOf(myStrToRemove);
    if (pos >= 0) {
        return myString.substr(0, pos) + myString.substr(pos + myStrToRemove.length, myString.length - pos - myStrToRemove.length);
    }
    else {
        return myString;
    }
}

// Return the current timestamp into a string (year month day hours min sec)
function getTimeStamp() {
    var currentTime = new Date();
    var month = currentTime.getMonth();
    var day = currentTime.getDate();
    var year = currentTime.getFullYear();
    var hours = currentTime.getHours();
    var minutes = currentTime.getMinutes();
    var seconds = currentTime.getSeconds();
    return (year + month + day + hours + minutes + seconds);
}

function min(nbrA, nbrB) {
    if (nbrA <= nbrB) {
        return nbrA;
    }
    if (nbrB < nbrA) {
        return nbrB;
    }
    return null;
}

function max(nbrA, nbrB) {
    if (nbrA >= nbrB) {
        return nbrA;
    }
    if (nbrB > nbrA) {
        return nbrB;
    }
    return null;
}
