//************************************************************************************* 
// File     :   mf_clear_value.js
// Requires :   prototype.js
// Author   :   Kyle Weems (ksw)
// Origin   :   mindfly.com
// Created  :   August 2, 2007
// Modified :   August 6, 2007
// Purpose  :   Adds and removes a default value from an input box.          
//*************************************************************************************


// Clear the value property of the element with the id tag elemID.
function clearValue(elemID)
{
    $(elemID).value = '';
} // end of function clearValue()

// Clear the value property of the element with the id tag elemID if the value is filled with defaultText.
function clearValueIfNotDefault(elemID, defaultText)
{
    if($(elemID).value == defaultText)
    {
        $(elemID).value = '';
    }
} // end of function clearValueIfNotDefault()

// Insert the information in fillText into the element with the id tag elemID.
function fillValue(elemID, fillText)
{
    $(elemID).value = fillText;
} // end of function fillValue()

// Insert the information in fillText into the element with the id tag elemID if it is empty.
function fillValueIfEmpty(elemID, fillText)
{
    if($(elemID).value == "")
    {
        $(elemID).value = fillText;
    }
} // End of function fillValueIfEmpty()

// Clear the value properties of the elements with the class elemClass.
function clearValueByClass(elemClass)
{
    var elemList = document.getElementsByClassName(elemClass);
    if(elemList.length)
    {
        for(i=0;i < elemList.length; i++)
        {
            elemList[i].value = '';
        }
    }
} // end of function clearValeByClass()

// Insert the information in fillText into the elements with the class elemClass.
function fillValueByClass(elemClass, fillText)
{
    var elemList = document.getElementsByClassName(elemClass);
    if(elemList.length)
    {
        for(i=0;i < elemList.length; i++)
        {
            elemList[i].value = fillText;
        }
    }
} // end of function fillValueByClass()

// Insert the information in fillText into the elements with the class elemClass if they're empty.
function fillValueIfEmptyByClass(elemClass, fillText)
{
    var elemList = document.getElementsByClassName(elemClass);
    if(elemList.length)
    {
        for(i=0;i < elemList.length; i++)
        {
            if(elemList[i].value == "")
            {
                elemList[i].value = fillText;
            }
        }
    }
} // end of function fillValueIfEmptyByClass()

// Clear the value properties of the elements with the class elemClass if their values are filled with defaultText.
function clearValueIfNotDefaultByClass(elemClass, defaultText)
{
    var elemList = document.getElementsByClassName(elemClass);
    if(elemList.length)
    {
        for(i=0;i < elemList.length; i++)
        {
            if(elemList[i].value == defaultText)
            {
                elemList[i].value = '';
            }
        }
    }
} // end of function clearValueIfNotDefaultByClass()
