function launchDept(o) { if (o.selectedIndex > 0) { window.location = "http://" + window.location.host + o.options[o.selectedIndex].value; } }

function linkconfirm()
{
    return confirm('You are about to leave the Butte County web site.')
    //return confirm('By clicking ok, you will leave the Butte County web site and enter a web site not created, operated or maintained by Butte County. Butte County is not endorsing any products or services that may appear on this website. Click cancel to return to the Butte County web site.')
}

function SetSearchAction(searchStr)
{
    if (searchStr != "Search Butte County" && searchStr != "")
    {
        var out = " "; // replace this
        var add = "+"; // with this
        var temp = "" + searchStr; // temporary holder

        while (temp.indexOf(out)>-1)
        {
            pos = temp.indexOf(out);
            temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
        }

        document.forms[0].action = "/County%20Intranet/Search.aspx?q=" + temp;
    }
    else
    {
        document.forms[0].action = "/County%20Intranet/Search.aspx"
    }
}

function SetSearchActionBC(searchStr)
{
    if (searchStr != "Search Butte County" && searchStr != "")
    {
        var out = " "; // replace this
        var add = "+"; // with this
        var temp = "" + searchStr; // temporary holder

        while (temp.indexOf(out)>-1)
        {
            pos = temp.indexOf(out);
            temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
        }

        document.forms[0].action = "/public internet/Search.aspx?q=" + temp;
    }
    else
    {
        document.forms[0].action = "/public internet/Search.aspx"
    }
}

var QtSubmittedForm = false;
var QsLastSearchData = "";

function AllowSearch() {
    var s_thisSearchData = document.forms[0].SearchData.value;

    if (QtSubmittedForm == true && s_thisSearchData == QsLastSearchData) {
        return false;
    }
    else {
        QtSubmittedForm = true;
        QsLastSearchData = s_thisSearchData;
        return true;
    }
}

function SubmitSearch() {
    if (AllowSearch()) {
        document.forms[0].action = "http://library.buttecounty.net/TLCScripts/interpac.dll?Search";
        document.forms[0].submit;
    }
}

function DataChange() {
    QtSubmittedForm = false;
}
