﻿//对<a>进行处理，达到将页面在指定窗口打开的功能。


var cookiesDomain = window.location.host;
var ChatPath = 'http://' + cookiesDomain + '/Chat';

var chat = {};

chat.SW = {
    __Prefix: "CHAT_SW_",
    GetName: function(id) {
        return this.__Prefix + id;
    },
    Check: function(a, wHeight, wWidth) {//a，要进行处理的a元素。wHeight、wWidth如果需要控制窗口大小，请指定。
        if (!a.target) {
            a.target = Math.random();
        }
        var name = this.GetName(a.target);
        if (j.getcookie(name) != "opened") {
            j.setcookie(name, "opened", null, "/", cookiesDomain);
            if (wHeight && wWidth) {
                if (a.target) {
                    window.open(a.href, name, 'height=' + wHeight + ', width=' + wWidth + ', top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
                    return false;
                }
            }
        }
        return true;
    }
};
chat.T = {
    GetHiddenValue: function(_result, _name) {
        if (_result == null || typeof (_result) != "string")
            return "";
        if (_name == null || typeof (_name) != "string")
            return "";
        if (_result.length > _name.length + 8) {
            if (_result.indexOf("<!--" + _name + ":") != -1) {
                var startIndex = _result.indexOf("<!--" + _name + ":") + _name.length + 5;
                return _result.substring(startIndex, _result.indexOf("-->", startIndex));
            }

        }
        return "";
    }
}


