﻿function addEvent(obj, evType, fn, useCapture)
{
    if (obj.addEventListener)
    {
        obj.addEventListener(evType, fn, useCapture);
        return true;
    }
    else if (obj.attachEvent)
    {
        var r = obj.attachEvent("on" + evType, fn);
        return r;
    }
    else
        return false;
}

var vL = "Utilisateur";
var vP = "Mot de passe";
var oL, oP, oPX;

function body_onLoad()
{
    oL = document.getElementById("ctl00_txtLogin");
    oP = document.getElementById("ctl00_txtPass");
    oPX = document.getElementById("txtXPass");

    if (oL == null || oP == null || oPX == null)
        return;

    if (addEvent(oL, "focus", txtLogin_onFocus, false) && addEvent(oL, "blur", txtLogin_onBlur, false))
        txtLogin_onBlur();

    if (addEvent(oPX, "focus", txtXPass_onFocus, false) && addEvent(oP, "blur", txtPass_onBlur, false))
    {
        txtPass_onBlur();
        oPX.value = vP;
    }
}

function txtXPass_onFocus()
{
    oPX.style.display = "none";
    oP.style.display = "inline";
    oP.focus();
}

function txtPass_onBlur()
{
    if ("" == oP.value)
    {
        oPX.style.display = "inline";
        oP.style.display = "none";
    }
}


function txtLogin_onFocus()
{
    oL.className = "youwrite";
    if (vL == oL.value)
        oL.value = "";
}

function txtLogin_onBlur()
{
    if ("" == oL.value || oL.value == vL)
    {
        oL.className = "writehere";
        oL.value = vL;
    }
}