﻿
window.onload = function() { ('searchResultsText'); }

function getSearchText(input) {

    var inputControl = document.getElementById(input);
    if (inputControl != null) 
    {

        inputControl.value = getQuerystring("q", "");
        //var inputBox = document.getElementById(input);
        //inputBox.value = searchText;
        //inputBox.value = "found";
        
    }
    
}
function getQuerystring(key, default_) {
    if (default_ == null) default_ = "";
    key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
    var qs = regex.exec(window.location.href);
    if (qs == null)
        return default_;
    else
        return qs[1];
}
function search(input) {
    var queryValue = document.getElementById(input).value;

    location.href = "/Pages/SearchResults.aspx?cx=010514226075048418806%3Azq966omm_y8&cof=FORID%3A10&ie=UTF-8&q=" + queryValue + "&sa=Search";

}
function KeyDownHandler(btn) {
    // process only the Enter key

    var button = document.getElementById(btn);
    if (event.keyCode == 13) {
        // cancel the default submit
        event.returnValue = false;
        event.cancel = true;
        // submit the form by programmatically clicking the specified button
        var buttonName = button.name;
        
        button.click();
    }
//    else {alert('blew by');
//    }

}
