/*REQUIRES jQUERY */
$(function(){
    
    function processSearch(inputID) {
        var inputVal = $('#'+inputID).val();
        var searchPage = '/Search.aspx';
        var cseAPIcx = '011120253064383584234:bfhcnkdv8nc';
        var cseAPIcof = "FORID:11";//add ";NB:1" to end of string to remove branding.
        var cseAPIie = "UTF-8";
        window.location = searchPage+'?cx='+cseAPIcx+'&cof='+cseAPIcof+'&ie='+cseAPIie+'&q=' + inputVal;
    }
    
    $('#head_submitGoogleSearchCSE').click(function(){processSearch('head_googleSearchCSE');});//remember to use .net modified id's
    $('#cseSearchFormSubmit').click(function(){processSearch('cseSearchFormInput');});//for use on the searchPage

});