﻿jQuery.extend({
    gup: function(param) {
        var param = param.replace(/[[]/, "[").replace(/[]]/, "]");
        var regexS = "[?&]" + param + "=([^&#]*)";
        var regex = new RegExp(regexS);
        var results = regex.exec(window.location.href);
        if (results) {
            return results[1];
        }
    },
    gpn: function() {
        var params = new Array();
        var regex = /[?&]([^=]+)=/g;
        while ((results = regex.exec(window.location.href)) != null)
            params.push(results[1]);
        return params;
    },
    gpnv: function() {
        var oString = new Array();
        var values = new Array();
        values = $.fn.gpn();
        for (var i = 0; i < values.length; i++) {
            oString[i] = new Array(i);
            oString[i, i] = [values[i], $.fn.gup(values[i])];
        }
        return oString;
    }
});

function Get_Cookie(check_name) {
    var a_all_cookies = document.cookie.split(';');
    var a_temp_cookie = '';
    var cookie_name = '';
    var cookie_value = '';
    var b_cookie_found = false;

    for (i = 0; i < a_all_cookies.length; i++) {
        a_temp_cookie = a_all_cookies[i].split('=');
        cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
        if (cookie_name == check_name) {
            b_cookie_found = true;
            if (a_temp_cookie.length > 1) {
                cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, ''));
            }
            return cookie_value;
            break;
        }
        a_temp_cookie = null;
        cookie_name = '';
    }
    if (!b_cookie_found) {
        return null;
    }
}