﻿/*
Built on jquery 1.5.2
Author: Jeff J. Crist
*/
(function($) {
    $(function() {
        $.UrlParams = function() {
            var urlParams = {};
            var e,
            a = /\+/g,  // Regex for replacing addition symbol with a space
            r = /([^&=]+)=?([^&]*)/g,
            d = function(s) { return decodeURIComponent(s.replace(a, " ")); },
            q = window.location.search.substring(1);

            while (e = r.exec(q))
                urlParams[d(e[1])] = d(e[2]);

            return urlParams;
        };

        $.SubmitOnEnter = function(p) {
            p = $.extend({
                inputField: '#input',
                targetButton: '#submit'
            }, p);

            $(p.inputField).keypress(function(e) {
                if (e.which == 13) {
                    e.preventDefault();
                    $(p.targetButton).click();
                }
            });

        };

    });
})(jQuery);
