function selectTab(id) {
    t=document.getElementById(id);
    t.childNodes[0].childNodes[0].style.color = '#FFFFFF';
    t.childNodes[0].style.backgroundPosition = "0% 0px";
    t.childNodes[0].childNodes[0].style.backgroundPosition = "100% 0px";
}

function init(){
    /* Update copyright notice to have current year */
    copyrightNotice();
    /* Init zoom on link pictures */
    setupZoom();
    /* Test user navigator */
    testNavigator();
    /* Test the current tab */
    testTab();
}

function replyComment(author) {
   var  area = document.getElementById('id_comment');
   if (area) {
      text = area.value;
      area.value = text + '@' + author + ': ';
      area.focus();
   }
}

function testTab(){
    var area = document.location.pathname.split("/")[1];
    switch (area) {
        case "blog":
           selectTab('blog');
           break
        case "galerie":
           selectTab('galerie');
           break
        case "projets":
           selectTab('projets');
           break
        case "bookmarks":
           selectTab('liens');
           break
        default:
           //alert("Lien erroné");
    }
}

function testNavigator(){
    isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
    if (isIE6) {
        var IEwarning = document.createElement("div");
        IEwarning.id = 'IEwarning';
        IEwarning.innerHTML = '<div onclick="document.body.removeChild(document.getElementById(\'IEwarning\'));"><p>Bonjour,</p><p>Vous utilisez actuellement un navigateur qui n\'est pas supporté par ce site web. Ce n\'est pas par faignantise mais plutôt par idéologie. En effet, Internet Explorer 6.0 et ses prédécesseurs sont connus pour ne pas respecter de nombreuses standards du Web.</p><p>Vous pouvez vous procurer gratuitement un navigateur plus respectueux des standards comme <a href="http://www.mozilla-europe.org/fr/firefox/" title="obtenir Firefox">Mozilla Firefox</a> pour visualiser correctement ce site ou <a href="javascript:document.body.removeChild(document.getElementById(\'IEwarning\'));" title="Fermer cet avertissement">continuer votre visite</a> sans tenir compte de ce message (la mise en page risque d\'être fortement dégradée).</p><p><small><a href="http://www.webdevout.net/browser-support" title="En savoir plus sur les lacunes de votre navigateur">En savoir plus sur les lacunes de votre navigateur</a></small></p></div>';
        IEwarning.className = "post_content IEwarning";
        document.body.appendChild(IEwarning);
    }
}

function copyrightNotice(){
    var d = new Date();
    document.getElementById('copyrightYear').innerHTML = d.getFullYear();
}
