String.prototype.hasString = function(b) {
    if (typeof b == "object") {
        for (var a = 0, c = b.length; a < c; a++) if (!this.hasString(b[a])) return false;
        return true

    } else if (this.indexOf(b) != -1) return true

};	
String.prototype.breakWord = function(b, a) {
    a || (a = "<wbr/>");
    return this.replace(RegExp("(\\w{" + (b ? b: 0) + "})(\\w)", "g"), 
    function(c, e, f) {
        return e + a + f

    })

};
UI = window.UI || {
	domain:function(){
		var a = document.getElementsByTagName("script"),
        b = "",
        c = 0,
        d = a.length,
        e = /callback.js/i;
        for (; c < d; c++) if (e.test(a[c].src)) {
            b = !document.querySelector ? a[c].getAttribute("src", 4) : a[c].src;
            break
        }
        return b.split("?")
	},
	log:function(b){
		UI.log.query=UI.log.console || UI.parseUrl();
		if(UI.log.query["console"])
			console.log(b);
	},
    ajax: function(b) {
        // b.type == "get" && UI.get(b.url, b.data, b.success);
        if(b.type=="get")
        	return UI.get(b.url, b.data, b.success);
        var a = UI.xmlHttp();
        a.onreadystatechange = function() {
            if (a.readyState == 4 && a.status == 200) try {
                b.success(a.responseText)
            } catch(f) {}
            else if(a.readyState == 4 && a.status != 200) try {
            	b.fail(a.responseText)
            } catch(f) {}
            else return a

        };
        a.open("POST", b.url, true);
        a.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        if (UI.isObject(b.data)) {
            var c = [];
            for (var e in b.data) c.push(e + "=" + encodeURIComponent(b.data[e]));
            b.data = c.join("&")

        }
        a.send(b.data);
        return a

    },
    get: function(b, a, c) {
        var e = UI.xmlHttp(),
        f = b.hasString("?") ? "&": "?";
        e.onreadystatechange = function() {
            if (e.readyState == 4 && e.status == 200) try {
                c(e.responseText)

            } catch(h) {alert(h);} else return e

        };
        if (a != undefined) if (UI.isObject(a)) {
            var i = [];
            for (var g in a) i.push(g + "=" + encodeURIComponent(a[g]));
            b += f + i.join("&")

        } else b += f + a;
        e.open("GET", b, true);
        e.send(null);
        return e

    },
    xmlHttp: function() {
        var b;
        if (window.ActiveXObject) b = new ActiveXObject("Microsoft.XMLHTTP");
        else if (window.XMLHttpRequest) b = new XMLHttpRequest;
        return b

    },
    getScript: function(b, a, c, f) {
        var e = UI.DC("script");
        if (a) if (UI.B.ie) e.onreadystatechange = function() {
            if (e.readyState == "loaded" || e.readyState == "complete") a()

        };
        else e.onload = a;
        c && UI.A(e, "charset", c);
        UI.A(e, "type", "text/javascript");
        UI.A(e, "src", b);
        if(f){
        	UI.GT(f.contentDocument, "head")[0].appendChild(e)
        }
        else
        UI.GT(document, "head")[0].appendChild(e)

    },
    getCss: function(b, a, e) {
        var c = UI.DC("link");
        if (a) c.onload = a;
        UI.A(c, "rel", "stylesheet");
        UI.A(c, "type", "text/css");
        UI.A(c, "href", b);
        if(e){
        	UI.GT(e.contentDocument, "head")[0].appendChild(c);
        }else
        	UI.GT(document, "head")[0].appendChild(c)
    },
    evalScript: function(b) {
        var a = this.regExp.script; (b = b.match(new RegExp(a, "img"))) && UI.each(b, 
        function(c) {
            eval(c.match(new RegExp(a, "im"))[1])

        })

    },
    regExp: {
        script: "<script[^>]*>([\\S\\s]*?)<\/script>"

    },
    encode: function(b) {
        return escape(UI.utfEncode(b))

    },
    decode: function(b) {
        return UI.utfDecode(unescape(b))

    },
    utfEncode: function(b) {
        b = b.replace(/\r\n/g, "\n");
        for (var a = "", c = 0; c < b.length; c++) {
            var e = b.charCodeAt(c);
            if (e < 128) a += String.fromCharCode(e);
            else {
                if (e > 127 && e < 2048) a += String.fromCharCode(e >> 6 | 192);
                else {
                    a += String.fromCharCode(e >> 12 | 224);
                    a += String.fromCharCode(e >> 6 & 63 | 128)

                }
                a += String.fromCharCode(e & 63 | 128)

            }

        }
        return a

    },
    utfDecode: function(b) {
        for (var a = "", c = 0, e = c1 = c2 = 0; c < b.length;) {
            e = b.charCodeAt(c);
            if (e < 128) {
                a += String.fromCharCode(e);
                c++

            } else if (e > 191 && e < 224) {
                c2 = b.charCodeAt(c + 1);
                a += String.fromCharCode((e & 31) << 6 | c2 & 63);
                c += 2

            } else {
                c2 = b.charCodeAt(c + 1);
                c3 = b.charCodeAt(c + 2);
                a += String.fromCharCode((e & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
                c += 3

            }

        }
        return a

    },
    parseUrl: function(b, a) {
        var c = b ? b: document.location.href;
        b = {};
        a = a || "?";
        if (!c.hasString(a)) return b;
        a = c.split(a)[1].split("&");
        for (c = 0; c < a.length; c++) {
            var e = a[c].replace(/#.*$/g, "").split("=");
            e[1] || (e[1] = "");
            b[e[0]] = UI.B.ie ? e[1] : UI.decode(e[1])

        }
        return b

    },
    cookie: function(b, a, c) {
        if (a == undefined) {
            b = b + "=";
            a = document.cookie.split(";");
            for (c = 0; c < a.length; c++) {
                for (var e = a[c]; e.charAt(0) == " ";) e = e.substring(1, e.length);
                if (e.indexOf(b) == 0) return decodeURIComponent(e.substring(b.length, e.length))

            }
            return null

        } else {
            e = "";
            if (c) {
                e = new Date;
                e.setTime(e.getTime() + c * 24 * 60 * 60 * 1E3);
                e = "; expires=" + e.toGMTString()

            }
            document.cookie = b + "=" + a + e + "; path=/"

        }

    },
    drag: function(b, a, c) {
        var e = document;
        c = c != undefined ? c: true;
        UI.EA(b, "mousedown", 
        function(f) {
            a.start && a.start(f);
            if (c) if (b.setCapture) b.setCapture();
            else window.captureEvents && window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
            if (a.drag) e.onmousemove = a.drag;
            e.onmouseup = function() {
                if (c) if (b.releaseCapture) b.releaseCapture();
                else window.captureEvents && window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
                a.stop && a.stop(f);
                e.onmousemove = null;
                e.onmouseup = null;
                a.call && a.call(f)

            }

        })

    },
    animate: function(b, a, c, e, f, i) {
        f = f || 0.4;
        var g = a.hasString("scroll"),
        h,
        k = setInterval(function() {
            var j = g ? b[a] : UI.C(b, a),
            l,
            m,
            o = a == "opacity";
            if (o) {
                j *= 100;
                c *= 100;
                if (c > 100) c = 100

            } else g || (j = j == "auto" ? 0: Number(j.slice(0, -2)));
            if (Math.abs(c - j) <= 3 || g && h == j || UI.B.ie9) {
                j = c;
                clearInterval(k)

            }
            m = (c - j) * f;
            if (!o) if (m > 0 && m < 1) m = 1;
            else if (m < 0 && m > -1) m = -1;
            l = h = j + m;
            if (!o && (m < 0 && c - l > 0 || m > 0 && l - c > 0)) l = c;
            if (g) b[a] = parseInt(l);
            else UI.C(b, a, !o ? l + "px": l / 100 + "");
            if (j == c) if (UI.isString(e)) eval(e);
            else e && e()

        },
        i || 40);
        return k

    },
    getX: function(b) {
        return b.offsetParent ? b.offsetLeft + UI.getX(b.offsetParent) : b.offsetLeft

    },
    getY: function(b) {
        return b.offsetParent ? b.offsetTop + UI.getY(b.offsetParent) : b.offsetTop

    },
    within: function(b, a) {
        var c = UI.getX(a) - UI.scrollX(),
        e = UI.width(a) + c,
        f = UI.getY(a) - UI.scrollY();
        a = UI.height(a) + f;
        var i = {};
        if (b[0] > c && b[0] < e && b[1] > f && b[1] < a) {
            if (b[0] - c < (e - c) / 2) i.left = true;
            if (b[1] - f < (a - f) / 2) i.top = true;
            return i

        }

    },
    frameX: function(b) {
        return b.frameElement ? UI.getX(b.frameElement) + UI.frameX(b.parent) : 0

    },
    frameY: function(b) {
        return b.frameElement ? UI.getY(b.frameElement) + UI.frameY(b.parent) : 0

    },
    width: function(b) {
        return parseInt(b.offsetWidth)

    },
    height: function(b) {
        return parseInt(b.offsetHeight)

    },
    pageWidth: function() {
        return document.body.scrollWidth || document.documentElement.scrollWidth

    },
    pageHeight: function() {
        return document.body.scrollHeight || document.documentElement.scrollHeight

    },
    windowWidth: function() {
        var b = document.documentElement;
        return self.innerWidth || b && b.clientWidth || document.body.clientWidth

    },
    windowHeight: function() {
        var b = document.documentElement;
        return self.innerHeight || b && b.clientHeight || document.body.clientHeight

    },
    scrollX: function(b) {
        var a = document.documentElement;
        if (b) {
            var c = b.parentNode,
            e = b.scrollLeft || 0;
            if (b == a) e = UI.scrollX();
            return c ? e + UI.scrollX(c) : e

        }
        return self.pageXOffset || a && a.scrollLeft || document.body.scrollLeft

    },
    scrollY: function(b) {
        var a = document.documentElement;
        if (b) {
            var c = b.parentNode,
            e = b.scrollTop || 0;
            if (b == a) e = UI.scrollY();
            return c ? e + UI.scrollY(c) : e

        }
        return self.pageYOffset || a && a.scrollTop || document.body.scrollTop

    },
    scrollTo: function(b, a, c) {
        if (b == document.documentElement || b == document.body) return window.scrollTo(a, c)

    },
    hide: function(b) {
        if (UI.isString(b)) b = this.G(b);
        if (b) {
            var a = this.C(b, "display");
            if (a != "none") b.__curDisplay = a;
            b.style.display = "none"

        }

    },
    show: function(b) {
        if (UI.isString(b)) b = this.G(b);
        if (b) b.style.display = b.__curDisplay || ""
    },
    toggle: function(b) {
        if (UI.isString(b)) b = this.G(b);
        this.C(b, "display") == "none" ? this.show(b) : this.hide(b)

    },
    hasClass: function(b, a) {
        if (!b.className) return false;
        return b.className != b.className.replace(new RegExp("\\b" + a + "\\b"), "")

    },
    addClass: function(b, a) {
        if (b.className) if (this.hasClass(b, a)) return false;
        else b.className += " " + a;
        else b.className = a

    },
    removeClass: function(b, a) {
    	if(UI.isArray(b)){
	    	UI.each(b,function(e){
    		if (e) e.className = e.className.replace(new RegExp("\\b" + a + "\\b"), "")
    	});
    	}else{
        	if (b) b.className = b.className.replace(new RegExp("\\b" + a + "\\b"), "")
        }

    },
    toggleClass: function(b, a) {
        this.hasClass(b, a) ? this.removeClass(b, a) : this.addClass(b, a)

    },
    next: function(b) {
        b = b.nextSibling;
        if (b == null) return false;
        return UI.isElement(b) ? b: this.next(b)

    },
    prev: function(b) {
        b = b.previousSibling;
        if (b == null) return false;
        return UI.isElement(b) ? b: this.prev(b)

    },
    remove: function(b) {
        b && b.parentNode && b.parentNode.removeChild(b)

    },
    append: function(b, a) {
        a.appendChild(b)

    },
    prepend: function(b, a) {
        var c = a.firstChild;
        c ? UI.before(b, c) : UI.append(b, a)

    },
    after: function(b, a) {
        var c = a.parentNode;
        c.lastChild == b ? c.appendChild(b) : c.insertBefore(b, a.nextSibling)

    },
    before: function(b, a) {
        a.parentNode.insertBefore(b, a)

    },
    replace: function(b, a) {
        a.parentNode.replaceChild(b, a)

    },
    tmpl: function() {
        var b = {};
        return function a(c, e) {
            c = !/\W/.test(c) ? (b[c] = b[c] || a(UI.G(c).innerHTML)) : UI.tmplString(c);
            return e ? c(e) : c

        }

    } (),
    tmplString: function(b) {
        return new Function("obj", "var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('" + b.replace(/[\r\t\n]/g, " ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g, "$1\r").replace(/\t=(.*?)%>/g, "',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'") + "');}return p.join('');")

    },
    html: function(b) {
        var a = UI.DC("div"),
        c = [];
        a.innerHTML = b;
        UI.each(a.childNodes, 
        function(e) {
            c.push(e)

        });
        return c

    },
    css: function(b) {
        var a = UI.DC("style");
        UI.A(a, "type", "text/css");
        if (a.styleSheet) a.styleSheet.cssText = b;
        else {
            b = document.createTextNode(b);
            UI.append(b, a)

        }
        UI.append(a, UI.GT(document, "head")[0])

    },
    text: function b(a) {
        var c = [];
        a = a.childNodes;
        for (var e = 0, f = a.length; e < f; e++) c.push(a[e].nodeType != 1 ? a[e].nodeValue: b(a[e]));
        return c.join("")

    },
    parent: function(b, a) {
        if (UI.isArray(b)) {
            var c = [];
            UI.each(b, 
            function(e) {
                if (a && UI.hasClass(e.parentNode, a) || !a) c.push(e.parentNode)

            });
            return c

        }
        return b.parentNode

    },
    parents: function(b, a) {
        if (a) {
            var c = [];
            b = UI.parents(b);
            UI.each(b, 
            function(e) {
                UI.hasClass(e, a) && c.push(e)

            });
            return c

        }
        b = b.parentNode;
        return b.nodeName == "HTML" ? [b] : [b].concat(UI.parents(b))

    },
    children: function(b, a) {
        var c = [];
        if (a) a = a.split("|");
        // 新加了一个判断
        if(b!=null){
        UI.each(b.childNodes, 
        function(e) {
            var f = false;
            if (a) for (var i = 0, g = a.length; i < g; i++) if (UI.hasClass(e, a[i])) {
                f = true;
                break

            }
            if (UI.isElement(e) && (!a || f)) c.push(e)

        });
        }
        return c

    },
    A: function(b, a, c) {
        if (c == undefined) return b.getAttribute(a);
        else c == "" ? b.removeAttribute(a) : b.setAttribute(a, c)

    },
    C: function(b, a, c) {
        if (c == undefined) if (window.getComputedStyle) {
            a = a.replace(/([A-Z])/g, "-$1");
            a = a.toLowerCase();
            return window.getComputedStyle(b, null).getPropertyValue(a)

        } else {
            if (b.currentStyle) {
                if (a == "opacity") return b.style.filter.indexOf("opacity=") >= 0 ? parseFloat(b.style.filter.match(/opacity=([^)]*)/)[1]) / 100: "1";
                return b.currentStyle[a]

            }

        } else if (a == "opacity" && UI.B.ie) b.style.filter = (b.filter || "").replace(/alpha\([^)]*\)/, "") + "alpha(opacity=" + c * 100 + ")";
        else b.style[a] = c

    },
    DC: function(b) {
        return document.createElement(b)

    },
    E: function(b) {
        if (b && b.clone) return b;
        b = window.event || b;
        return {
            clone: true,
            stop: function() {
                if (b && b.stopPropagation) b.stopPropagation();
                else b.cancelBubble = true

            },
            prevent: function() {
                if (b && b.preventDefault) b.preventDefault();
                else b.returnValue = false

            },
            target: b.target || b.srcElement,
            x: b.clientX || b.pageX,
            y: b.clientY || b.pageY,
            button: b.button,
            key: b.keyCode,
            shift: b.shiftKey,
            alt: b.altKey,
            ctrl: b.ctrlKey,
            type: b.type,
            wheel: b.wheelDelta / 120 || -b.detail / 3

        }

    },
    EA: function(b, a, c, e) {
        if (UI.isString(b)) {
            var f = c;
            c = function() {
                eval(f)

            }

        }
        if (b.addEventListener) {
            if (a == "mousewheel") a = "DOMMouseScroll";
            b.addEventListener(a, c, e);
            return true

        } else return b.attachEvent ? b.attachEvent("on" + a, c) : false

    },
    ER: function(b, a, c) {
        if (b.removeEventListener) {
            b.removeEventListener(a, c, false);
            return true

        } else return b.detachEvent ? b.detachEvent("on" + a, c) : false

    },
    G: function(b) {
        return document.getElementById(b)

    },
    GT: function(b, a) {
        return b.getElementsByTagName(a)

    },
    GC: function() {
        function b(l, m) {
            if (!m) {
                m = l;
                l = document

            }
            l = l || document;
            if (!/^[\w\-_#]+$/.test(m) && l.querySelectorAll) return a(l.querySelectorAll(m));
            if (m.indexOf(",") > -1) {
                m = m.split(/,/g);
                for (var o = [], n = 0, p = m.length; n < p; ++n) o = o.concat(b(l, m[n]));
                return j(o)

            }
            m = m.match(f);
            var q = m.pop();
            o = (q.match(g) || k)[1];
            n = !o && (q.match(i) || k)[1];
            p = q.split(".").slice(2);
            q = !o && (q.match(h) || k)[1];
            if (n && !q && l.getElementsByClassName) q = a(l.getElementsByClassName(n));
            else {
                q = !o && a(l.getElementsByTagName(q || "*"));
                if (n) q = e(q, "className", RegExp("(^|\\s)" + n + "(\\s|$)"), p);
                if (o) return (l = l.getElementById(o)) ? [l] : []

            }
            return m[0] && q[0] ? c(m, q) : q

        }
        function a(l) {
            try {
                return Array.prototype.slice.call(l)

            } catch(m) {
                for (var o = [], n = 0, p = l.length; n < p; ++n) o[n] = l[n];
                return o

            }

        }
        function c(l, m, o) {
            var n = l.pop();
            if (n === ">") return c(l, m, true);
            var p = [],
            q = -1,
            s = (n.match(g) || k)[1],
            v = !s && (n.match(i) || k)[1];
            n = !s && (n.match(h) || k)[1];
            var y = -1,
            w,
            z,
            r;
            for (n = n && n.toLowerCase(); w = m[++y];) {
                z = w.parentNode;
                do {
                    r = (r = (r = !n || n === "*" || n === z.nodeName.toLowerCase()) && (!s || z.id === s)) && (!v || RegExp("(^|\\s)" + v + "(\\s|$)").test(z.className));
                    if (o || r) break

                }
                while (z = z.parentNode);
                if (r) p[++q] = w

            }
            return l[0] && p[0] ? c(l, p) : p

        }
        function e(l, m, o, n) {
            var p = -1,
            q,
            s = -1,
            v = [];
            for (n = n || ""; q = l[++p];) if (o.test(q[m]) && q[m].hasString(n)) v[++s] = q;
            return v

        }
        var f = /(?:[\w\-\\.#]+)+(?:\[\w+?=([\'"])?(?:\\\1|.)+?\1\])?|\*|>/ig,
        i = /^(?:[\w\-_]+)?\.([\w\-_]+)/,
        g = /^(?:[\w\-_]+)?#([\w\-_]+)/,
        h = /^([\w\*\-_]+)/,
        k = [null, null],
        j = function() {
            var l = +new Date,
            m = function() {
                var o = 1;
                return function(n) {
                    var p = n[l],
                    q = o++;
                    if (!p) {
                        n[l] = q;
                        return true

                    }
                    return false

                }

            } ();
            return function(o) {
                for (var n = o.length, p = [], q = -1, s = 0, v; s < n; ++s) {
                    v = o[s];
                    if (m(v)) p[++q] = v

                }
                l += 1;
                return p

            }

        } ();
        return b

    } (),
    isDate: function(b) {
        return this.getType(b) == "Date"

    },
    cloneDate: function(b) {
        if (!b) return b;
        d = new Date;
        d.setTime(b.getTime());
        return d

    },
    formatDate: function(b, a) {
        var c = a.replace(/\W/g, ",").split(","),
        e = ["yyyy", "MM", "dd", "hh", "mm", "ss", "ww"];
        b = {
            y: b.getFullYear(),
            M: b.getMonth() + 1,
            d: b.getDate(),
            h: b.getHours(),
            m: b.getMinutes(),
            s: b.getSeconds(),
            w: b.getDay()

        };
        for (var f = 0, i = c.length; f < i; f++) for (var g = c[f], h = 0; h < 7; h++) {
            var k = e[h].slice( - 1);
            if (g.hasString(k)) {
                if (k == "w" && b[k] == 0) b[k] = 7;
                a = g.hasString(e[h]) ? a.replace(RegExp(e[h], "g"), this.addZero(b[k])) : a.replace(RegExp(e[h].slice(e[h].length / 2), "g"), b[k])

            }

        }
        return a

    },
    parseDate: function(b, a) {
        a || (a = "yyyy-MM-dd");
        a = a.replace(/\W/g, ",").split(",");
        b = b.replace(/\D/g, ",").split(",");
        var c = 2E3,
        e = 0,
        f = 1,
        i = 0,
        g = 0,
        h = 0;
        UI.each(a, 
        function(k, j) {
            if (b[j] != "" && !isNaN(b[j])) {
                if (k.hasString("y")) c = Number(b[j]);
                if (k.hasString("M")) e = Number(b[j]) - 1;
                if (k.hasString("d")) f = Number(b[j]);
                if (k.hasString("h")) i = Number(b[j]);
                if (k.hasString("m")) g = Number(b[j]);
                if (k.hasString("s")) h = Number(b[j]);
                if (k.hasString("w")) h = Number(b[j])

            }

        });
        return new Date(c, e, f, i, g, h)

    },
    isObject: function(b) {
        return typeof b == "object"

    },
    isElement: function(b) {
        return b && b.nodeType == 1

    },
    isUndefined: function(b) {
        return typeof b == "undefined"

    },
    isFunction: function(b) {
        return this.getType(b) == "Function"

    },
    isNumber: function(b) {
        return this.getType(b) == "Number"

    },
    isString: function(b) {
        return this.getType(b) == "String"

    },
    isArray: function(b) {
        return this.getType(b) == "Array"

    },
    getType: function(b) {
        return Object.prototype.toString.call(b).slice(8, -1)

    },
    addZero: function(b, a) {
        a || (a = 2);
        return Array(Math.abs(("" + b).length - (a + 1))).join(0) + b

    },
    trim: function(b) {
        return b.replace(/^\s+|\s+$/g, "")

    },
    random: function(b, a) {
        if (b == undefined) b = 0;
        if (a == undefined) a = 9;
        return Math.floor(Math.random() * (a - b + 1) + b)

    },
    has: function(b, a) {
        for (var c = 0, e = b.length; c < e; c++) if (b[c] == a) return true;
        return false

    },
    each: function(b, a) {
        if (UI.isUndefined(b[0])) for (var c in b) UI.isFunction(b[c]) || a(c, b[c]);
        else {
            c = 0;
            for (var e = b.length; c < e; c++) UI.isFunction(b[c]) || a(b[c], c)

        }

    },
    merge: function(b, a) {
        var c = [];
        if (a) {
            UI.each(a, 
            function(e) {
                UI.has(b, e) || c.push(e)

            });
            return b.concat(c)

        } else {
            UI.each(b, 
            function(e) {
                UI.has(c, e) || c.push(e)

            });
            return c

        }

    },
    ready: function(b) {
        if (UI.ready.done) return b();
        if (UI.isReady.done) UI.readyDo.push(b);
        else {
            UI.readyDo = [b];
            UI.isReady()

        }

    },
    readyDo: [],
    isReady: function() {
        if (!UI.isReady.done) {
            UI.isReady.done = true;
            if (document.addEventListener) document.addEventListener("DOMContentLoaded", 
            function() {
                document.removeEventListener("DOMContentLoaded", arguments.callee, false);
                UI.onReady()

            },
            false);
            else if (document.attachEvent) {
                var b = top != self;
                if (b) document.attachEvent("onreadystatechange", 
                function() {
                    if (document.readyState === "complete") {
                        document.detachEvent("onreadystatechange", arguments.callee);
                        UI.onReady()

                    }

                });
                else document.documentElement.doScroll && !b && 
                function() {
                    if (!UI.ready.done) {
                        try {
                            document.documentElement.doScroll("left")

                        } catch(a) {
                            setTimeout(arguments.callee, 0);
                            return

                        }
                        UI.onReady()

                    }

                } ()

            }
            UI.EA(window, "load", UI.onReady)

        }

    },
    onReady: function() {
        if (!UI.ready.done) {
            UI.ready.done = true;
            for (var b = 0, a = UI.readyDo.length; b < a; b++) try {
                UI.readyDo[b]()

            } catch(c) {}
            UI.readyDo = null

        }

    },
    B: function() {
        var b = {},
        a = navigator.userAgent;
        b.win = a.hasString("Windows") || a.hasString("Win32");
        b.ie6 = a.hasString("MSIE 6") && !a.hasString("MSIE 7") && !a.hasString("MSIE 8");
        b.ie8 = a.hasString("MSIE 8");
        b.ie9 = a.hasString("MSIE 9");
        b.ie = a.hasString("MSIE");
        b.safari = a.hasString("WebKit");
        b.ipad = a.hasString("iPad");
        b.firefox = a.hasString("Firefox");
        return b

    } ()

};
UI.B.ie && document.execCommand("BackgroundImageCache", false, true);
$gt = UI.G;
$$gt = UI.GC;
resDomain = UI.domain()[0].replace("callback.js","");
MI = {
	focus: function(b) {
	    var a = b.value.length;
	    b.focus();
	    MI.selectTxt(b, a, a, a)
	},
	selectTxt: function(b, a, c) {
        if (document.createRange) b.setSelectionRange(a, c);
        else {
            b = b.createTextRange();
            b.collapse(1);
            b.moveStart("character", a);
            b.moveEnd("character", c - a);
            b.select()
        }
    }
};
MI.Dialog = function(a) {
    a = a || {};
    var b = this;
    b._body = UI.html(a.tmpl || '<div class="D">' + (UI.B.ie6 ? '<iframe src="javascript:false;" class="cover_select"></iframe>': "") + '<div class="bg"></div><div class="CR"><table border="0" cellspacing="0" cellpadding="0" class="tbSendMsg"><tr><td class="tl"></td><td class="tm"></td><td class="tr"></td></tr><tr><td class="lm"></td><td><div class="DWrap"><div class="DTitle"></div><a title="关闭" class="DClose close" href="#">关闭</a><div class="DLoad"></div><div class="DCont"></div></div></div></td><td class="rm"></td></tr><tr><td class="bl"></td><td class="bm"></td><td class="br"></td></tr></table></div></div>')[0];
    b._bg = b.$(".bg");
    b._cover = b.$(".cover_select");
    b._wrap = b.$(".CR");
    b._title = b.$(".DTitle");
    b._close = b.$(".DClose");
    b._cont = b.$(".DCont");
    b._load = b.$(".DLoad");
    b.resizeBg = function() {
        if (b.display) {
            if (UI.B.ie) b._bg.style.cssText += ";width:100%;";
            b.delay = setTimeout(function() {
                var g = UI.pageHeight(),
                d = UI.windowHeight();
                b._bg.style.cssText += ";margin-left:0;width:" + UI.pageWidth() + "px;height:" + (g < d ? d: g) + "px;";
                if (UI.B.ie6) b._cover.style.cssText = b._bg.style.cssText
            },
            0)
        }
    };
    var c = b._wrap;
    b._title.onmousedown = b._title.ontouchstart = function(g) {
        g = UI.E(g);
        var d = g.x - parseInt(c.style.marginLeft),
        f = g.y - parseInt(c.style.marginTop),
        e = UI.windowWidth(),
        h = UI.windowHeight();
        g.prevent();
        document.onmousemove = document.ontouchmove = function(i) {
            i = UI.E(i);
            if (!UI.B.ie && (i.x < 0 || i.y < 0 || i.x > e || i.y > h)) return false;
            c.style.marginTop = i.y - f + "px";
            c.style.marginLeft = i.x - d + "px";
            return false
        };
        document.onmouseup = document.ontouchend = function() {
            document.onmousemove = document.ontouchmove = null;
            document.onmouseup = document.ontouchend = null
        };
        return false
    };
    UI.EA(window, "resize", b.resizeBg);
    b._close.onclick = function() {
        b.hide();
        return false
    }
};
MI.Dialog.prototype = {
    width: 462,
    close: 1,
    show: function(a) {
        var b = this,
        c;
        if (!b._append) {
            document.body.appendChild(b._body);
            b._append = 1
        }
        b.close = a.close != undefined ? a.close: b.close;
        b.ico = a.ico;
        b.close ? UI.show(b._close) : UI.hide(b._close);
        b._title.innerHTML = a.title || "";
        UI.C(b._title, "height", a.title ? "": "0");
        if (a.html) for (var g = 0, d = b._cont.childNodes.length; g < d; g++) {
            var f = b._cont.childNodes[g];
            if (f.nodeType == 1) {
                UI.hide(f);
                UI.append(f, document.body)
            }
        }
        if (UI.isString(a.html)) b._cont.innerHTML = a.html;
        else if (UI.isObject(a.html)) {
            UI.append(a.html, b._cont);
            UI.show(a.html)
        }
        if (a.width) b.width = a.width;
        if (a.height) b.height = a.height;
        UI.C(b._wrap, "width", b.width + "px");
        UI.C(b._wrap, "opacity", 0);
        UI.show(b._body);
        b.height && UI.C(b._cont, "height", b.height + "px");
        c = "width:" + b.width + "px;margin:" + (UI.scrollY() - UI.height(b._wrap) / 2) + "px 0 0 -" + b.width / 2 + "px;";
        if (a.left != undefined) c += "left:" + a.left + "px;margin-left:0;";
        if (a.top != undefined) c += "top:" + a.top + "px;margin-top:0;";
        // 出现两次问题
        /**
		 * setTimeout(function() { b.resizeBg(); b._wrap.style.cssText = c },
		 * 0);
		 */
        b._wrap.style.cssText = c;
        if (a.html) {
            a.start && a.start();
            b.end = a.end ? a.end: null;
            this.call && this.call()
        }
        b.display = 1;
        UI.B.firefox || UI.C(UI.B.ie ? document.documentElement: document.body, "overflowX", "hidden")
    },
    hide: function() {
        UI.hide(this._body);
        this.hideLoad();
        this.end && this.end();
        this.display = 0;
        UI.B.firefox || UI.C(UI.B.ie ? document.documentElement: document.body, "overflowX", "auto")
    },
    showLoad: function(a, b, c, g, d) {
        a = a || this._cont;
        var f = "";
        g = g || UI.width(a);
        d = d || UI.height(a);
        if (UI.isNumber(b)) f += "top:" + b + "px;";
        if (UI.isNumber(c)) f += "left:" + c + "px;";
        this._load.style.cssText = "width:" + g + "px;height:" + d + "px;" + f
    },
    hideLoad: function() {
        UI.hide(this._load)
    },
    showTip: function(a) {
        var b = this,
        c = b.close;
        a.close = 0;
        a.html = '<div class="popBox"><span class="ico_tsW"><span class="' + (a.ico ? a.ico: "ico_ts") + '"></span></span><h2>' + a.html + "</h2><p></p></div>";
        a.end = a.end || b.end;
        b.show({
            width: 9999
        });
        b.show(a);
        b.show({
            width: UI.width(b._cont) + 40
        });
        setTimeout(function() {
            b.hide();
            b.close = c
        },
        a.delay ? a.delay: 1E3)
    },
    alert: function(a, b) {
        var c = this,
        g;
        c.show({
            width: 9999
        });
        c.show({
            html: '<div class="popBox"><span class="ico_tsW"><span class="ico_te"></span></span><h3>' + a + '</h3><p><input type="button" value="知道了" onclick="MI.dialog.hide()"></p></div>',
            end: b
        });
        setTimeout(function() {
            c.show({
                width: UI.width(c._cont) + 40
            }); (g = $$gt(c._cont, "input")[0]) && g.focus()
        },
        0)
    },
    $: function(a) {
        return $$gt(this._body, a)[0]
    }
};
MI.Validate = function(b) {
    function i(d) {
        var n,
        c,
        g,
        k,
        o = 0,
        e = 0,
        l = {};
        if (UI.isString(d)) {
            d = d;
            e = 1
        } else {
            n = UI.E(d);
            d = UI.A(n.target, "name")
        }
        c = a.data.inputs[d];
        f = c.target;
        g = f.value;
        if (!c.removed) {
            if (c.replace) {
                k = c.replace(g);
                if (g != k) f.value = k
            }
            if (e ? 1: f.blured) if (o = c.rule ? c.rule(f.value) : 0) {
                a.showMessage(c, o);
                e && a.flashMessage(c);
                f.error = 1;
                a.success = 0
            } else if (!c.url || c.url && f.focused) {
                a.hideMessage(c);
                f.error = 0
            }
            l[d] = g;
            if (!e && !o && c.url && f.blured && n.type == "blur" && UI.trim(g)) UI.get(UI.isFunction(c.url) ? c.url() : c.url, l, 
            function(m) {
                m = MI.json(m);
                if (m.result == 0) a.hideMessage(c);
                else {
                    a.showMessage(c, m.msg);
                    a.success = 0
                }
            })
        }
    }
    this.data = b;
    this.check = b.check;
    this.isAjax = b.isAjax == undefined ? 1: b.isAjax;
    this._body = $gt(b.id);
    var a = this,
    q,
    r = 0,
    j,
    f;
    if (UI.isFunction(b.messages)) q = 1;
    for (var p in a.data.inputs) {
        j = a.data.inputs[p];
        f = j.target = $gt(p);
        if (q) j.message = b.messages(b.inputs[p].target);
        else {
            j.message = b.messages[r];
            r++
        }
        if(j.message)UI.A(j.message, "rel", j.message.innerHTML || "");
        j.ico = UI.html('<b class="pass" style="display:none"></b>')[0];
        UI.after(j.ico, j.target);
        f.onfocus = function() {
            this.ico = 0;
            this.focused = 1
        };
        f.onblur = function() {
            this.ico = this.blured = 1;
            this.focused = 0
        };
        UI.EA(f, "blur", i);
        UI.EA(f, "keyup", i)
    }
    UI.EA(a._body, "submit", 
    function(d) {
        function n() {
            if (!a.xhr) a.xhr = UI.getScript(UI.A(a._body, "action")+c)
        }
        d = UI.E(d);
        var c = "?rd="+Math.random();
        a.success = 1;
        a.isAjax && d.prevent();
        if (! (a.check && a.check())) {
            for (var g in a.data.inputs) i(g);
            if (a.success && a.isAjax) {
                for (g in a.data.inputs) {
                    d = $gt(g);
                    if (d.type == "radio") {
                        d = $$gt(d.parentNode.parentNode, "input[type=radio]");
                        for (var k = 0, o = d.length; k < o; k++) if (d[k].checked) {
                            //c[g] = d[k].value;
                            c+="&"+g+"="+d[k].value;
                            break
                        }
                    } else c+="&"+g+"="+$gt(g).value //c[g] = $gt(g).value
                }
                n()
            } else a.success || d.prevent()
        }
    })
};
MI.Validate.prototype = {
    xhr: null,
    showMessage: function(b, i, a) {
        i || (i = UI.A(b.message, "rel"));
        b.message.innerHTML = i;
        UI.addClass(b.message, a ? "success": "error"); ! b.noIco && a ? UI.show(b.ico) : UI.hide(b.ico)
    },
    hideMessage: function(b) {
		try{
    	b.message.innerHTML = UI.A(b.message, "rel") || "";
        UI.removeClass(b.message, "error");
        UI.removeClass(b.message, "success"); ! b.noIco && b.target.ico && UI.show(b.ico)
        }catch(e){}
    },
    clearMessage: function() {
        var b = this;
        for (var i in b.data.inputs) b.hideMessage(b.data.inputs[i])
    },
    flashMessage: function(b) {
        clearInterval(b.delay);
        UI.C(b.message, "opacity", 0);
        b.delay = UI.animate(b.message, "opacity", 1)
    }
};
function proxyResult(data){
	if(data.result==0 || data.result==200){
		if(MI.validate){
			MI.dialog.hide();
			MI.validate.xhr=null;
			MI.validate.data.success && MI.validate.data.success(data);
		}
		else
			MI.CallBack._success && MI.CallBack._success(data);
	}else if(data.result==1 || data.result==201){
		if(MI.validate){
			MI.validate.xhr=null;
			MI.validate.data.fail && MI.validate.data.fail(data);
		}
		else
			MI.CallBack._fail && MI.CallBack._fail(data);
	}
	else if(data.result==-1){
		MI.CallBack.add();
	}
}
MI.CallBack = {
	_body : null,
	_success :null,
	_fail : null,
	init : function(a, c ,e){
		UI.getCss(resDomain+"login.css");
		var b = this;
		b._success=c;
		b._fail=e;
	},
	add : function() {
		var b = this;
		if (!b._body) {
			b._body = UI.html('<div style="border:0px;"id="login"class="main"><div class="loginBox"><table cellspacing="0"cellpadding="0"border="0"><tbody><tr><td><div style="display:none;"id="qlogin"></div><div id="web_login"><form id="loginform" style="margin:0px;"method="post"action="http://t.home.news.cn/userLogin.action"name="loginform"autocomplete="off"id="loginform"><ul id="g_list"><li id="g_u"><span style="float:left;"><u id="label_uin">用户名：</u></span><input type="text"maxlength="20"tabindex="1"value=""name="gMblogUser.loginName"id="gMblogUser.loginName"class="inputstyle"/><div rel=""></div></li><li id="wb_tips"></li><li id="g_p"><span style="float:left;"><u id="label_pwd">密码：</u></span><input type="password"maxlength="20"value=""tabindex="2"name="gMblogUser.passWord"id="gMblogUser.passWord"class="inputstyle"/><div rel=""></div><input type="hidden" id="turnto" name="turnto" value="proxy"/><label></label></li><li><span style="float:left;">&nbsp;</span><label for="remember" title="为了确保您的信息安全，不建议在网吧等公共环境勾选此项"><input type="checkbox" checked="checked" style="vertical-align: middle;" id="remember" name="remember" value="1" tabindex="4" id="low_login_enable"><u id="label_remember_pwd">下次自动登录</u></label></li></ul><div class="login_button"><input type="submit"id="login_button"class="btn"value="登录"tabindex="5"></div></form></div><div class="lineright"id="switch"><a onclick=""></a></div></td></tr></tbody></table></div><div class="Quick"><table cellspacing="0"cellpadding="0"border="0"class="quick_tab"><tbody><tr><td class="quick_t">还没有开通微博？<br><a title="注册新华微博" href="http://my.home.news.cn/profile/passport.do?targeturl=http://t.home.news.cn" target="_top" class="btn_reg"></a></td></tr></tbody></table>')[0];
			setTimeout(function() {
				MI.validate=new MI.Validate( {
					id : "loginform",
					inputs : {
						"gMblogUser.loginName" : {
							rule : function(e) {
								if(!e)
									return "用户名不能为空。";
							}
						},
						"gMblogUser.passWord" : {
							rule : function(e) {
								if(!e)
									return "密码不能为空。";
							}
						},
						"remember" : {
							rule : function(e){
								var t=$gt("remember");
								if(t.checked){
									t.value="true";
								}else{
									t.value="false";
								}
							},
							noIco : true
						},
						turnto : {
							noIco : true
						}
					},
					messages : function(e) {
						return UI.next(e)
					},
					success : function(e) {
						b._success && b._success(e);
					},
					fail : function(e) {
						b._fail && b._fail(e);
					}
				})
			}, 100);
			var b = this;
			MI.dialog.show( {
				title : "微博登录",
				width : 620,
				height : 210,
				html : b._body,
				start : function() {
					if(!$gt("gMblogUser.loginName").value){
						MI.focus($gt("gMblogUser.loginName"));
					}
					else if($gt("gMblogUser.passWord").value){
						$gt("gMblogUser.passWord").value="";
						MI.focus($gt("gMblogUser.passWord"));
					}
				}
			});
		}
	}
};
MI.dialog=new MI.Dialog;
