﻿function enableForm() {
    var elemCurrent;
    elemCurrent = document.getElementById('cse-search-box');
    if (elemCurrent) {
        elemCurrent.disabled = false;
    }
}
window.onLoad = enableForm();

function SearchSite() {
    document.location.href = 'http://www.onecity.org/search_results.aspx?cx=003032856756879126797%3Am1osinvjyiu&cof=FORID%3A11%3BNB%3A1&ie=UTF-8&q=' + document.getElementById('searchtext').value + '&sa=Search';  //#906
}

function validateDropDown(objField, strName, strDefault) {
    // Last mods 20100220 - tbankes@libertastechnologies.com
    if (objField.options[objField.selectedIndex].text == strDefault) {
        alert('Please select a value for ' + strName + '.');
        objField.focus();
        return (false);
    }
    if (objField.options[objField.selectedIndex].text == '') {
        alert('Please select a value for ' + strName + '.');
        objField.focus();
        return (false);
    }
    return (true);
}

function validateNumber(objField) {
    // Last mods 20100220 - tbankes@libertastechnologies.com
    var numYE = Number(objField.value);
    if (isNaN(numYE)) {
        alert('Please enter a numeric value for years of experience.');
        objField.focus();
        return (false);
    }
    return (true);
}

function validateBasicText(objField, strName) {
    // Last mods 20100220 - tbankes@libertastechnologies.com
    if (objField.value == '') {
        alert('Please enter a value for ' + strName + '.');
        objField.focus();
        return (false);
    }
    return (true);
}

function validateRadioButton(rad, strName) {
    // Last mods 20100220 - tbankes@libertastechnologies.com
    for (var i = 0; i < rad.length; i++) {
        //alert('rad[i].checked='+rad[i].checked);
        if (rad[i].checked == true) {
            return (true);
        }
    }
    alert('Please select a value for ' + strName + '.');
    rad[0].focus();
     return (false);
}

function validateDate(objField, strField) {
    // Last mods 20100220 - tbankes@libertastechnologies.com
    var strDate = objField.value;
    if (strDate != '') {
        if (isNaN(Date.parse(strDate))) {
            alert('Please enter a valid date in the format 09/28/2005 for the ' + strField + '.');
            objField.focus();
            return false;
        }
        //Check digit count for each value

        return (true);
    }
    return (true);
}

var win = null;
function NewWindow(mypage, myname, w, h, scroll) {
    // Last mods 20100224 - tbankes@libertastechnologies.com
    LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
    TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
    settings =
'height=' + h + ',width=' + w + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable'
    win = window.open(mypage, myname, settings)
    if (win.window.focus) { win.window.focus(); }
}

function printDocument() {
    // Last mods 20100224 - tbankes@libertastechnologies.com
    if (window.print) {
        window.print();
    } else {
        var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
        document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6, 2); //Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
    }
}

function printReceipt(strID) {
    // Last mods 20100224 - tbankes@libertastechnologies.com
    NewWindow('printreceipt.aspx?id=' + strID, '', '800', '600', 'yes')
}
function printTicketReceipt(strID) {
    // Last mods 20100305 - tbankes@libertastechnologies.com
    NewWindow('printticketreceipt.aspx?id=' + strID, '', '800', '600', 'yes')
}