﻿    var Version = "Version : 1.0 - Copyright © 2008<br />";
    var modif = new Date(document.lastModified);
    var DateModif = "Dernière modification le " + modif.getDate() + "/" + (modif.getMonth()+1) + "/" + modif.getFullYear();
    DateModif += " à " + modif.getHours() + ":" + modif.getMinutes() 

    var now = new Date();
    var heure = now.getHours();
    var minutes = now.getMinutes();
    var secondes = now.getSeconds();   
    var jour = now.getDate();
    var mois = now.getMonth() + 1;
    var annee = now.getFullYear();
    var lettres = ("" + now.toGMTString() + "")

    // jour de la semaine
    var joursemaine = lettres.substring(0,3);
    var js;
    var mois2;
    if(joursemaine=="Mon"){
    js="Lundi"}
    if(joursemaine=="Tue"){
    js="Mardi"}
    if(joursemaine=="Wed"){
    js="Mercredi"}
    if(joursemaine=="Thu"){
    js="Jeudi"}
    if(joursemaine=="Fri"){
    js="Vendredi"}
    if(joursemaine=="Sat"){
    js="Samedi"}
    if(joursemaine=="Sun"){
    js="Dimanche"}

    // mois
    if(mois=="1"){
    mois2="Janvier";}
    if(mois=="2"){
    mois2="Fevrier";}
    if(mois=="3"){
    mois2="Mars";}
    if(mois=="4"){
    mois2="Avril";}
    if(mois=="5"){
    mois2="Mai";}
    if(mois=="6"){
    mois2="Juin";}
    if(mois=="7"){
    mois2="Juillet";}
    if(mois=="8"){
    mois2="Aout";}
    if(mois=="9"){
    mois2="Septembre";}
    if(mois=="10"){
    mois2="Octobre";}
    if(mois=="11"){
    mois2="Novembre";}
    if(mois=="12"){
    mois2="Decembre";}
    var Cejour = "Nous sommes le "+ js +' '+ jour +' '+ mois2 +' '+annee+', il est '+heure+' h '+minutes+' m '+secondes+' s'

    // variables globales
    var choix_cv = 0;
    var mnum = 0;
    
    // création des boutons de menu en frame1
    function affi_menu(id)
    {
        var mn = document.getElementById(id);
        var i;
        for (i = 0; i < 10; i++)
        {
            var btn = document.createElement('button');
            switch(i)
            {
            case 0:
                btn.appendChild(document.createTextNode("Accueil"));
                btn.onclick = function(){parent.frames["frame2"].location = "accueil.htm"};
                break;
            case 1:
                btn.appendChild(document.createTextNode("CV Patrick"));
                btn.onclick = function(){parent.frames["frame2"].location = "curriculum_p.htm"};
                break;
            case 2:
                btn.appendChild(document.createTextNode('CV Nadine'));
                btn.onclick = function(){parent.frames["frame2"].location = 'curriculum_n.htm'};
                break;
            case 3:
                btn.appendChild(document.createTextNode('Informatique'));
                btn.onclick = function(){parent.frames["frame2"].location = 'logiciel.htm'};
                break;
            case 4:
                btn.appendChild(document.createTextNode('Téléchargement'));
                btn.onclick = function(){parent.frames["frame2"].location = 'telechargement.htm'};
                break;
            case 5:
                btn.appendChild(document.createTextNode('Loisirs'));
                btn.onclick = function(){parent.frames["frame2"].location = 'loisirs.htm'};
                break;
            case 6:
                btn.appendChild(document.createTextNode('Outils'));
                btn.onclick = function(){parent.frames["frame2"].location = 'outils.htm'};
                break;
            case 7:
                btn.appendChild(document.createTextNode('Liens'));
                btn.onclick = function(){parent.frames["frame2"].location = 'liens.htm'};
                break;
            case 8:
                btn.appendChild(document.createTextNode('Nouveautés'));
                btn.onclick = function(){parent.frames["frame2"].location = 'nouveautes.htm'};
                break;
            case 9:
                btn.appendChild(document.createTextNode('Photos'));
                btn.onclick = function(){parent.frames["frame2"].location = 'photos.htm'};
                break;
            }
            btn.style.position = "absolute";
            mn.appendChild(btn);

            btn.position = "static";
            if (i<5)
            {
                btn.style.top="0px"
                btn.style.left=String(i*160)+"px";
            }
            else
            {
                btn.style.top="20px";
                btn.style.left=String((i-5)*160)+"px";
            }
            btn.style.width="160px";
            btn.style.height="20px";
            btn.style.fontFamily="Cataneo BT";
            btn.style.fontSize="10pt";
            mn.appendChild(document.createElement('br'));
        }
        mn.style.height = "38px";
        mn.style.width = String(document.body.offsetWidth-2)+"px";
    }

    function larg_div(div1,div2)
    {
        // aligne (régle largeur et position gauche par rapport à référence div1)
        var v1 = document.getElementById(div1);
        var v2 = document.getElementById(div2);
        // tenir compte du padding : 2 x (8px + 1px bordure)
        v2.style.width = String(v1.offsetWidth-18)+"px";
        v2.style.left = String(v1.offsetLeft)+"px";
    }
    
    function pos_div(div1, div2)
    {
        // positionne contenu par rapport à entête
        var v1 = document.getElementById(div1);
        var v2 = document.getElementById(div2);
        v2.style.top = String(v1.offsetHeight+v1.offsetTop+5)+"px";
    }

    function center_obj(obj, cont)
    {
        // centre un objet par rapport au contenu
        var v1 = document.getElementById(cont);
        var v2 = document.getElementById(obj);
        v2.style.left = String((v1.offsetWidth-v2.offsetWidth)/2)+"px";
        //alert(v1.offsetLeft+", "+v1.offsetWidth+", "+v2.offsetWidth+", "+v2.style.left);
    }

    function hauteur(outer, inner)
    {
        // ajuste la hauteur d'un contenant par rapport au contenu
        var v1 = document.getElementById(outer);
        var v2 = document.getElementById(inner);
        v1.style.height = String(v2.offsetHeight+v2.offsetTop+8)+"px";
        //alert(v2.offsetHeight+", "+v2.offsetTop+", "+v1.style.height);
    }

    // lecture paramètres GET
    function param()
    {
        // séparation paramètres
        param = window.location.search.split(";");
        // suppression "?"
        param1 = param[0].substring(1,param[0].length);
        return param1;
    }
    
    // test email demande CV
    function test_email(nm)
    {
        var v = document.getElementsByName(nm).item(0);
        if (!v.value.length)
            alert("adresse manquante !");
        else
        {
            if (v.value.length < 6 || v.value.indexOf("@", 0) == -1
                || v.value.indexOf(".", 0) == -1)
                alert("adresse incorrecte !");
            else
                // submit
                v.ownerDocument.forms.form1.submit();
        } 
    }
    
    function eMail(id, compte)
    {
	    var lien = document.getElementById(id);
	    var adresse = "";
	    adresse = compte + "@" + "patnad.com";
	    lien.href = "mailto:" + adresse;
	    //lien.firstChild.data = adresse;
    }
    
    function convert(id, num)
    {
        var l1 = document.getElementById(id);
        switch(num)
        {
            case 1:
                l1.v2.value = l1.v1.value * l1.u1.value / l1.u2.value;
                mnum = 1;
                break;
            case 2:
                if (mnum == 3)
                    l1.v1.value = l1.v2.value * l1.u2.value / l1.u1.value;
                else
                    l1.v2.value = l1.v1.value * l1.u1.value / l1.u2.value;
                break;
            case 3:
                l1.v1.value = l1.v2.value * l1.u2.value / l1.u1.value;
                mnum = 3;
                break;
            case 4:
                if (mnum == 3)
                    l1.v1.value = l1.v2.value * l1.u2.value / l1.u1.value;
                else
                    l1.v2.value = l1.v1.value * l1.u1.value / l1.u2.value;
                break;
        }
        // arrondi et decimales
        l1.v1.value = Math.round(l1.v1.value * 1E6) / 1E6;
        l1.v2.value = Math.round(l1.v2.value * 1E6) / 1E6;
        // virgule
        
        
        
        
    }
    
    function conversion(id)
    {
        var f = document.getElementById(id);
        if (f.gr.value == 1)
        {
            f.u1.options[0].value="1000";
            f.u1.options[0].text="km"
            f.u1.options[1].value="1";
            f.u1.options[1].text="m"
            f.u1.options[2].value="0.001";
            f.u1.options[2].text="mm"
            f.u1.length = 3;
        }
        else
        {
            f.u1.options[0].value="1000";
            f.u1.options[0].text="tonne"
            f.u1.options[1].value="1";
            f.u1.options[1].text="kg"
            f.u1.options[2].value="0.001";
            f.u1.options[2].text="mg"
            f.u1.length = 3;
        }
        
        if (f.gr.value == 1)
        {
            f.u2.options[0].value="1609.344";
            f.u2.options[0].text="mile"
            f.u2.options[1].value="1853.24496";
            f.u2.options[1].text="nautic"
            f.u2.options[2].value="0.9144";
            f.u2.options[2].text="yard"
            f.u2.options[3].value="0.3048";
            f.u2.options[3].text="foot"
            f.u2.options[4].value="0.0254";
            f.u2.options[4].text="inch"
            f.u2.length = 5;
        }
        else
        {
            f.u2.options[0].value="907.18474";
            f.u2.options[0].text="ton"
            f.u2.options[1].value="0.45359237";
            f.u2.options[1].text="pound"
            f.u2.options[2].value="0.02834952313";
            f.u2.options[2].text="ounce"
            f.u2.options[3].value="0.0002";
            f.u2.options[3].text="carat"
            f.u2.length = 4;
        }
    }
    
    function cherche(form)
    {
        rech = form.moteur.options[form.moteur.selectedIndex].value;				
        switch(rech)
        {
            case "0":
                var mess="Vous n'avez pas sélectionné de moteur de recherche !"
                alert(mess);
                break;
            case "1":
                window.open('http://www.google.com/search?q='+form.q.value+'&btnG=Recherche+Google&hl=fr&lr=lang_fr','','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
                break;
            case "2":
                window.open('http://www.google.com/search?q='+form.q.value+'&btnG=Recherche+Google&hl=fr&lr=lang_fr','','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
                break;
            case "3":
                window.open( "http://www.google.fr/search?lr=&cr=&q="+form.q.value+"&hl=fr&ie=UTF-8&oe=UTF-8","","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;
            case "4":
                window.open( "http://www.alltheweb.com/search?query="+form.q.value+"&cat=web&charset=utf-8&submit=Web+Search","","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;
            case "5":
                window.open( "http://www.recherche.aol.fr/rech?enc=iso&q="+form.q.value+"&v=0","","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;
            case "6":
                window.open( "http://search-dyn.excite.fr/search.php?key="+form.q.value+"&submit=Recherche+Excite&external=1&language=fr&collection=web","","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;
            case "7":
                window.open( "http://recherche.francite.com/cgi-win/recherche.exe?bd=francite&name="+form.q.value,"","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;
            case "8":
                window.open( "http://www.fr.lycos.de/cgi-bin/pursuit?matchmode=and&lang=fr&mtemp=main.sites&query="+form.q.value+"&cat=lycos&x=19&y=10","","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;
            case "9":
                window.open( "http://search.metacrawler.com/texis/search?brand=metacrawler&q="+form.q.value+"&redirect=&top=1&method=0&rpp=20&hpe=10&region=0&timeout=0&sort=0&theme=classic","","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;
            case "10":
                window.open( "http://search.msn.fr/results.asp?q="+form.q.value+"&origq=&RS=CHECKED&FORM=SMCRT&v=1&cfg=SMCINITIAL&nosp=0","","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;
            case "11":
                window.open( "http://www.sharelook.fr/sldb/SLDB_db.php?keyword="+form.q.value+"&suche_starten=Recherche&seite=700001&template=fr_suchen&next_results=0","","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;	
            case "12":
                window.open( "http://r.voila.fr/se?dblg=fr&ctx=voila&lg=FR&sev=2&ref=ext&db=web&kw="+form.q.value+"&","","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;
            case "13":
                window.open( "http://fr.search.yahoo.com/search/fr?p="+form.q.value+"&y=y","","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;
            case "14":
                window.open( "http://search.yahoo.com/bin/search?p="+form.q.value,"","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;
            case "15":
                window.open( "http://fr.altavista.com/image/results?pg=q&stype=simage&imgset=2&q="+form.q.value+"&avkw=xytx","","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
                break;	
        }
    }

    function innerCalendrier()
    {
        function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11)
        {
            this[0] = m0;
            this[1] = m1;
            this[2] = m2;
            this[3] = m3;
            this[4] = m4;
            this[5] = m5;
            this[6] = m6;
            this[7] = m7;
            this[8] = m8;
            this[9] = m9;
            this[10] = m10;
            this[11] = m11;
        }

        function calendrier()
        {
            var monthNames = "JanFévMarAvrMaiJunJulAoûSepOctNovDéc";
            var today = new Date();
            var thisDay;
            var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
            year = today.getYear();
            if (year <= 200)
                year += 1900;
            thisDay = today.getDate();
            if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
                monthDays[1] = 29;
            nDays = monthDays[today.getMonth()];
            firstDay = today;
            firstDay.setDate(1);
            testMe = firstDay.getDate();
            if (testMe == 2)
                firstDay.setDate(0);
            startDay = firstDay.getDay();
            document.writeln("<CENTER>");
            document.write("<TABLE BORDER='1' BGCOLOR=White>");
            document.write("<TR><TH COLSPAN=7>");
            document.write(monthNames.substring(today.getMonth() * 3, (today.getMonth() + 1) * 3));
            document.write(". ");
            document.write(year);
            document.write("<TR><TH>Lun<TH>Mar<TH>Mer<TH>Jeu<TH>Ven<TH>Sam<TH>Dim");
            document.write("<TR>");
            column = 0;
            for (i = 1; i < startDay; i++)
            {
                document.write("<TD>");
                column++;
            }
            for (i = 1; i <= nDays; i++)
            {
                document.write("<TD>");
                if (i == thisDay)
                    document.write("<FONT COLOR=\"#FF0000\">");
                document.write(i);
                if (i == thisDay)
                    document.write("</FONT>");
                column++;
                if (column == 7)
                {
                    document.write("<TR>");
                    column = 0;
                }
            }
            document.write("</TABLE>");
            document.writeln("</CENTER>");
        }
        // lancement
        calendrier();
    }

