﻿
function enableControl(control, defaultText) {

    if (control.value == defaultText) {
        control.className = control.className.replace('disabledInput', 'enabledInput');
        control.value = '';
    } 
}

function checkControl(control, defaultText) {
    if (control.value.length < 1) {
        disableControl(control,  defaultText);
    } 
}

function disableControl(control, text) {
    control.className = control.className.replace('enabledInput', 'disabledInput');
    control.value = text;
}

function enableDropdown(control) {
    if (control.value == "pre") {
        control.className = control.className.replace('enabledInput', 'disabledInput');
    } else if (!isNaN(control.value)) {
    control.className = control.className.replace('disabledInput', 'enabledInput');
    }
}

function checkDropdown(control) {
    if (control.value == "pre") {
        control.className = control.className.replace('enabledInput', 'disabledInput');
    } else if (!isNaN(control.value)) {
        control.className = control.className.replace('disabledInput', 'enabledInput');
    }
    control.blur();
}


function getSelText() {
    var txt = '';
    if (window.getSelection) {
        txt = window.getSelection();
    }
    else if (document.getSelection) {
        txt = document.getSelection();
    }
    else if (document.selection) {
        txt = document.selection.createRange().text;
    }
    return txt;
}

