﻿
// Fuction called at the time of mouse out / lostfocus from the textbox to set/reset the value inside the control.
function InitInput(txtInput, defaultValue) {
    if (txtInput.value == defaultValue) {
        txtInput.value = '';
    }
    return false;
}

// Function called when textbox gets the focus to set/reset the value inside the control.
function RestoreInput(txtInput, defaultValue) {
    if (txtInput.value == '' || (Trim(txtInput.value) == "")) {
        txtInput.value = defaultValue;
    }
    return false;
}

// Returns blank value if the InputString passed is empty or null else the InputString value is returned
function Trim(InputString) {
    var m = InputString.match(/^\s*(\S+(\s+\S+)*)\s*$/);
    return (m == null) ? "" : m[1];
}