﻿/// <reference path="jquery-1.3.2.js"

/* Accepts a jQuery object, and an args JSON object.
 * 
 * jqObject - A single jQuery object that contains the DOM object or objects that need to have
 *            default text. Ex.: $('.textbox'). Can accept multiple objects.
 *
 * args - Settings for the form.
 *
 *        Variables: defaultText, defaultColor, userColor.
 *        
 */

function StyleInputs(selector, args) {

    var jqObject = $(selector);

    for (var i = 0; i < jqObject.length; i++) {
        var element = jqObject.eq(i);

        element.value = args.defaultText;

        element.focus(function() {
            this.style.color = args.userColor;
            if (this.value == args.defaultText) {
                this.value = "";
            }
        });

        element.blur(function() {

            if (this.value == "") {
                this.style.color = args.defaultColor;
                this.value = args.defaultText;
            }
        });
    }
}
