﻿jQuery(document).ready(function () {
    // init the swap function for every ".inputswap" element
    // the swap function is used to set the text box value as blank when user click on it, 
    // and set back the default value in case user did not enter anything in the textbox.
    swap_val = [];
    jQuery(".oofe-input-swap").each(function (i) {
        var thisInput = jQuery(this);

        // take title first as swapVal
        var currentSwapVal = thisInput.attr('title');
        if (!currentSwapVal) {
            // take input.val as swapVal
            currentSwapVal = thisInput.val();
        }

        swap_val[i] = currentSwapVal;

        jQuery(this).focusin(function () {
            if (jQuery(this).val() == swap_val[i]) {
                jQuery(this).val("");
            }
        }).focusout(function () {
            if (jQuery.trim(jQuery(this).val()) == "") {
                jQuery(this).val(swap_val[i]);
            }
        });
    });
});

