String.prototype.getQuery = function (name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = this.substr(this.indexOf("\?") + 1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}

String.prototype.getCookie = function (sMainName, sSubName) {
    var re = new RegExp((sSubName ? sMainName + "=(?:.*?&)*?" + sSubName + "=([^&;$]*)" : sMainName + "=([^;$]*)"), "i");
    return re.test(unescape(document.cookie)) ? RegExp["$1"] : "";
}

String.prototype.isNullOrEmpty = function (val) {
    return (val == null || val == "");
}