﻿//************************************************************************************* 
// File     :   mf_clearlogin.js
// Requires :   mf_domLibrary_0.1.js, prototype.js
// Author   :   Kyle Weems (ksw)
// Origin   :   mindfly.com
// Created  :   June 30, 2008
// Modified :   July 01, 2008
// Purpose  :   Clear the contents of a login box if it's the default value of "username".
//*************************************************************************************

function observeLogin()
{

    var login = $$('.txtLogin');
    if(login.length > 0)
    {
        var i;
        for(i=0;i<login.length;i++)
        {
            login[i].observe('focus',function(event){clearLogin(this);});
            login[i].observe('blur',function(event){fillLogin(this);});
        }
    }
} // end of function observeLogin()


function clearLogin(element)
{
    if(element.value =='username')
    {
        element.value = '';
    }

} // end of function clearLogin()


function fillLogin(element)
{
    if(element.value =='')
    {
        element.value = 'username';
    }
} // end of function fillLogin()

addLoadEvent(observeLogin);