    function urlEncode( s )
    {
        return encodeURIComponent( s ).replace( /\%20/g, '+' ).replace( /!/g, '%21' ).replace( /'/g, '%27' ).replace( /\(/g, '%28' ).replace( /\)/g, '%29' ).replace( /\*/g, '%2A' ).replace( /\~/g, '%7E' );
    }
   
    function SearchBoxValidate() {
        if ($("#txtSearch").val() != "")
            if ($("#txtSearch").val() != "undefined")
            {
                //alert($("#txtSearch").val());
                window.location = "/SiteSearchResults.aspx?search=" + urlEncode($("#txtSearch").val());
            }
    }
    $(document).ready(function(){
        $("#txtSearch").keypress(function(e) {
            if (e.keyCode == 13) {
                //alert('enter' + $("#txtSearch").val());
                SearchBoxValidate();
            }
        });
    });
