var _ua = navigator.userAgent.toLowerCase();
var $IE = /msie/.test(_ua);
var $opera = /opera/.test(_ua);
var $moz = /gecko/.test(_ua);
var $IE5 = /msie 5 /.test(_ua);
var $IE55 = /msie 5.5/.test(_ua);
var $IE6 = /msie 6/.test(_ua);
var $IE7 = /msie 7/.test(_ua);
var $Safari = /safari/.test(_ua);
var $winVista = /windows nt 6.0/.test(_ua);
var $winXP = /windows nt 5.1/.test(_ua);
var $win2000 = /windows nt 5.0/.test(_ua);
var $win2003 = /windows nt 5.2/.test(_ua);

Array.prototype.toInt = function(i) {
    return this.join("").toInt(i)
};
Array.prototype.isEmpty = function() {
    return this.length > 0 ? false: true
};
Array.prototype.hashBy = function(id) {
    var o = {};
    $foreach(this, 
    function(e) {
        o[e[id]] = e
    });
    return o
};
Array.prototype.up = function(index, num) {
    num = num > index ? index: num;
    return this.slice(0, index - num).concat(this[index], this.slice(index - num, index), this.slice(index + 1))
};
Array.prototype.down = function(index, num) {
    num = num > this.length - index ? this.length - index: num;
    return this.slice(0, index).concat(this.slice(index + 1, index + num + 1), this[index], this.slice(index + num + 1))
};
Array.prototype.findit = function(v) {
    var k = -1;
    $foreach(this, 
    function(value, index) {
        if (v == value) {
            k = index
        }
    });
    return k
};
Array.prototype.insert = function(index, value) {
    return this.slice(0, index).concat(value, this.slice(index))
};
Array.prototype.copy = function() {
    return this.slice(0)
};
String.prototype.a2u = function() {
    return this.replace(/\\u[\da-fA-F]{4}/gi, 
    function(a) {
        a = a.substr(2).toInt(16);
        return String.fromCharCode(a)
    })
};
String.prototype.expand = function() {
    var r = this.replace(/([\u00ff-\ufffe])/gi, "\uffff$1");
    return r
};
String.prototype.byteLength = function() {
    var aMatch = this.match(/[^\x00-\x80]/g);
    return (this.length + (!aMatch ? 0: aMatch.length))
};
String.prototype.collapse = function() {
    return this.replace(/\uffff/gi, "")
};
String.prototype.shorten = function(len, suffix) {
    if (suffix != "" && this.expand().length > len) {
        suffix = suffix || "..."
    } else {
        suffix = ""
    }
    return this.expand().substr(0, len).collapse() + suffix
};
String.prototype.trim = function() {
    return this.trimTail().trimHead()
};
String.prototype.trimHead = function() {
    return this.replace(/^(\u3000|\s|\t)*/gi, "")
};
String.prototype.trimTail = function() {
    return this.replace(/(\u3000|\s|\t)*$/gi, "")
};
String.prototype.j2o = function() {
    try {
        var o = window.eval("(" + this + ")");
        return o
    } catch(e) {
        return null
    }
};
String.prototype.toInt = function(i) {
    return parseInt(this, i)
};
String.prototype.toArray = function(n) {
    n = n || 1;
    if (n == 1) {
        return this.split("")
    }
    var reg = new RegExp(".{1," + n + "}", "gim");
    return this.match(reg)
};
String.prototype.leftB = function(len) {
    var s = this.replace(/\*/g, " ").replace(/[^\x00-\xff]/g, "**");
    return this.slice(0, s.slice(0, len).replace(/\*\*/g, " ").replace(/\*/g, "").length)
};
String.prototype.HTMLescape = function() {
    var d = document;
    var div = d.createElement('div');
    var txt = d.createTextNode(this);
    div.appendChild(txt);
    return div.innerHTML.replace(/\s/g, "&nbsp;")
};





function $showDialog(str, op,func) {
    var dialogCfg = {
        ad: false,
        title: op.title || "???",
        drag: true,
        shadow: op.shadow || 1,
        css: "Dialog",
        content: str,
        middle: true,
        width: op.width || 300,
        height: op.height || 300
    };

    if (typeof window.htmlDialog == "undefined") {
        var dialog = new window.ui.dialog(dialogCfg, func||{});
        window.htmlDialog = dialog

    } else {
        dialog = window.htmlDialog

    }
    dialog.setContent(str);
    dialog.setTitle(op.title);
    dialog.setSize(op.width, op.height);
    dialog.show();
    return dialog

}
function $openWin(url, width, height, title, scrolling,func) {
    //this.dialog.hidden();
    var sContent = '<iframe id="openIframe" style="width:' + width + 'px;height:' + height + 'px;" frameborder="0" scrolling="' + (scrolling == undefined || !scrolling ? "no": "yes") + '"></iframe>';
    var dialog = $showDialog(sContent, {
        title: title,
        width: width,
        height: height,
        shadow: 2
    },func);
    if(url.indexOf("#")>0){
    	url=url.substr(0,url.indexOf("#"));
    }
    if(url.indexOf("?")>0){
    	url=url+"&windowType=1";
    }else{
    	url=url+"?windowType=1";
    }
	document.getElementById("openIframe").src = url;
    return dialog;

}
function $E(id) {
    return typeof(id) == 'string' ? document.getElementById(id) : id

}
function $C(tagName) {
    return document.createElement(tagName)

}
function $getXY(el) {
    if ((el.parentNode == null || el.offsetParent == null || $getStyle(el, "display") == "none") && el != document.body) {
        return false

    }
    var parentNode = null;
    var pos = [];
    var box;
    var doc = el.ownerDocument;
    box = el.getBoundingClientRect();
    var scrollPos = $getScrollPos(el.ownerDocument);
    return [box.left + scrollPos[1], box.top + scrollPos[0]];
    parentNode = el.parentNode;
    while (parentNode.tagName && !/^body|html$/i.test(parentNode.tagName)) {
        if ($getStyle(parentNode, "display").search(/^inline|table-row.*$/i)) {
            pos[0] -= parentNode.scrollLeft;
            pos[1] -= parentNode.scrollTop

        }
        parentNode = parentNode.parentNode

    }
    return pos

}
if ($moz) {
    $getXY = function(el) {
        if ((el.parentNode == null || el.offsetParent == null || $getStyle(el, "display") == "none") && el != document.body) {
            return false

        }
        var parentNode = null;
        var pos = [];
        var box;
        var doc = el.ownerDocument;
        pos = [el.offsetLeft, el.offsetTop];
        parentNode = el.offsetParent;
        var hasAbs = $getStyle(el, "position") == "absolute";
        if (parentNode != el) {
            while (parentNode) {
                pos[0] += parentNode.offsetLeft;
                pos[1] += parentNode.offsetTop;
                if ($Safari && !hasAbs && $getStyle(parentNode, "position") == "absolute") {
                    hasAbs = true

                }
                parentNode = parentNode.offsetParent

            }

        }
        if ($Safari && hasAbs) {
            pos[0] -= el.ownerDocument.body.offsetLeft;
            pos[1] -= el.ownerDocument.body.offsetTop

        }
        parentNode = el.parentNode;
        while (parentNode.tagName && !/^body|html$/i.test(parentNode.tagName)) {
            if ($getStyle(parentNode, "display").search(/^inline|table-row.*$/i)) {
                pos[0] -= parentNode.scrollLeft;
                pos[1] -= parentNode.scrollTop

            }
            parentNode = parentNode.parentNode

        }
        return pos

    }

}

function $getStyle(el, property) {
    switch (property) {
        case "opacity":
        var val = 100;
        try {
            val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity

        } catch(e) {
            try {
                val = el.filters('alpha').opacity

            } catch(e) {}

        }
        return val;
        case "float":
        property = "styleFloat";
        default:
        var value = el.currentStyle ? el.currentStyle[property] : null;
        return (el.style[property] || value)

    }

};
if ($moz) {
    $getStyle = function(el, property) {
        if (property == "float") {
            property = "cssFloat"

        }
        try {
            var computed = document.defaultView.getComputedStyle(el, "")

        } catch(e) {

            }
        return el.style[property] || computed ? computed[property] : null

    }

}

function $setStyle(el, property, val) {

    switch (property) {
        case "opacity":
        el.style.filter = "alpha(opacity=" + (val * 100) + ")";
        if (!el.currentStyle || !el.currentStyle.hasLayout) {
            el.style.zoom = 1

        }
        break;
        case "float":
        property = "styleFloat";
        default:
        el.style[property] = val;

    }

}
if ($moz) {
    $setStyle = function(el, property, val) {
        if (property == "float") {
            property = "cssFloat"

        }
        el.style[property] = val

    }

}



function $loadCSS(cssFileUrl) {
    var css = $C('link');
    css.rel = 'stylesheet';
    css.type = 'text/css';
    css.href = cssFileUrl;
    document.getElementsByTagName('head')[0].appendChild(css)

}

function $include(jsfile, handle, _charset) {
    var ja = new Array();
    var jsHash = {};
    if (typeof jsfile == 'string')
    ja.push(jsfile);
    else
    ja = jsfile.slice(0);
    var ua = navigator.userAgent.toLowerCase();
    var isIE = /msie/.test(ua);
    var isOpera = /opera/.test(ua);
    var isMoz = /firefox/.test(ua);
    for (var i = 0; i < ja.length; i++) {
        jsHash['j' + i] = false;
        jsHash['count_' + i] = 0;
        var js = $C('script');
        js.type = 'text/javascript';
        if (_charset != null && _charset == "gb2312") {
            js.charset = _charset

        }
        js.src = ja[i];
        js.id = 'j' + i;
        if (isIE)
        js.onreadystatechange = function() {
            if (this.readyState.toLowerCase() == 'complete' || this.readyState.toLowerCase() == 'loaded') {
                jsHash[this.id] = true

            }

        };
        if (isMoz)
        js.onload = function() {
            jsHash[this.id] = true

        };
        if (isOpera)
        jsHash['j' + i] = true;
        document.body.appendChild(js)

    }
    var loadTimer = setInterval(function() {
        for (var i = 0; i < ja.length; i++) {

            if (jsHash['count_' + i] < 3) {
                if (jsHash['j' + i] == false) {
                    jsHash['count_' + i]++;
                    return

                }

            } else {
                continue

            }

        }
        clearInterval(loadTimer);
        eval(handle)()

    },
    100)

}

//??????????????
function $getPageSize() {
    var _rootEl = (document.compatMode == "CSS1Compat" ? document.documentElement: document.body);
    var xScroll,
    yScroll;
    if (window.innerHeight && window.scrollMaxY) {
        xScroll = _rootEl.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY

    } else if (_rootEl.scrollHeight > _rootEl.offsetHeight) {
        xScroll = _rootEl.scrollWidth;
        yScroll = _rootEl.scrollHeight

    } else {
        xScroll = _rootEl.offsetWidth;
        yScroll = _rootEl.offsetHeight

    }
    var windowWidth,
    windowHeight;
    if (self.innerHeight) {
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight

    } else if (_rootEl && _rootEl.clientHeight) {
        windowWidth = _rootEl.clientWidth;
        windowHeight = _rootEl.clientHeight

    } else if (_rootEl) {
        windowWidth = _rootEl.clientWidth;
        windowHeight = _rootEl.clientHeight

    }
    if (yScroll < windowHeight) {
        pageHeight = windowHeight

    } else {
        pageHeight = _rootEl.scrollHeight

    }
    if (xScroll < windowWidth) {
        pageWidth = windowWidth

    } else {
        pageWidth = xScroll

    }
    return [pageWidth, pageHeight, windowWidth, windowHeight]

}

//?????????
function $getScrollPos(oDocument) {
    oDocument = oDocument || document;
    return [Math.max(oDocument.documentElement.scrollTop, oDocument.body.scrollTop), Math.max(oDocument.documentElement.scrollLeft, oDocument.body.scrollLeft), Math.max(oDocument.documentElement.scrollWidth, oDocument.body.scrollWidth), Math.max(oDocument.documentElement.scrollHeight, oDocument.body.scrollHeight)]

}

function $winSize(_target) {
    var windowWidth,
    windowHeight;
    if (_target)
    target = _target.document;
    else
    target = document;
    if (self.innerHeight) {
        if (_target)
        target = _target.self;
        else
        target = self;
        windowWidth = target.innerWidth;
        windowHeight = target.innerHeight

    } else if (target.documentElement && target.documentElement.clientHeight) {
        windowWidth = target.documentElement.clientWidth;
        windowHeight = target.documentElement.clientHeight

    } else if (target.body) {
        windowWidth = target.body.clientWidth;
        windowHeight = target.body.clientHeight

    }
    return {
        width: parseInt(windowWidth),
        height: parseInt(windowHeight)
    }

};

function $addEvent2(elm, func, evType, useCapture) {
    var elm = $E(elm);
    if (typeof useCapture == 'undefined') useCapture = false;
    if (typeof evType == 'undefined') evType = 'click';
    if (elm.addEventListener) {
        elm.addEventListener(evType, func, useCapture);
        return true

    } else if (elm.attachEvent) {
        var r = elm.attachEvent('on' + evType, func);
        return true

    } else {
        elm['on' + evType] = func

    }

};
//??Event??
function $getEvent() {
    return window.event
};
if (!$IE) {
    $getEvent = function() {
        var o = arguments.callee.caller;
        var e;
        var n = 0;
        while (o != null && n < 40) {
            e = o.arguments[0];
            if (e && (e.constructor == Event || e.constructor == MouseEvent)) {
                return e

            }
            n++;
            o = o.caller

        }
        return e

    }

}

function $removeEvent2(oElement, fHandler, sName) {
    var elm = $E(oElement);
    if ("function" != typeof fHandler) return;
    if (oElement.addEventListener) {
        oElement.removeEventListener(sName, fHandler, false)

    } else if (oElement.attachEvent) {
        oElement.detachEvent("on" + sName, fHandler)

    }
    fHandler[sName] = null

}

//??Event????
function $stopEvent() {
    var ev = $getEvent();
    ev.cancelBubble = true;
    ev.returnValue = false

};
if ($moz) {
    $stopEvent = function() {
        var ev = $getEvent();
        ev.preventDefault();
        ev.stopPropagation()

    }

}



 (function() {
    if (window.ui == null) {
        window.ui = {}
    }
    var dialog = function(oInitCFG, oInitFUNC) {
        var _self = this;
        var _dialogRndID = window.parseInt(Math.random() * 10000);
        var _dialogCFG = {
            title: "???",
            drag: true,
            zindex: 1024,
            shadow: 1,
            css: "Dialog",
            content: "",
            middle: true,
            width: 300,
            height: 300,
            close: true,
            closed: true
        };
        var _dialogFUNC = {
            onDragStart: function() {},
            onDrag: function() {},
            onDragEnd: function() {},
            onContentUpdate: function() {},
            onPosUpdate: function() {},
            onShow: function() {},
            onHidden: function() {}

        };
        for (var key in _dialogCFG) {
            if (oInitCFG[key] != null) {
                _dialogCFG[key] = oInitCFG[key]
            }

        }
        for (key in _dialogFUNC) {
            if (oInitFUNC[key] != null) {
                _dialogFUNC[key] = oInitFUNC[key]

            }

        }
        
        var _dialogNodes = {
            parent: null,
            shadow: null,
            window: null,
            title: null,
            content: null,
            move: null,
            drag: null,
            titleContent: null,
            leftContent: null,
            rightContent: null
        };
        var _dialogInfo = {
            titleHeight: 0,
            leftborderWidth: 0,
            rightborderWidth: 0
        };
        var shadowClass = "";
        var windowClass = "";
        var fixShadowTimer;
        var fixShadowTimeBoolean = false;
        shadowClass += _dialogCFG.shadow == 1 ? "": (_dialogCFG.shadow == 0 ? " hidden": " disabled");
        windowClass += _dialogCFG.drag == true ? " movable": " ";
        
        var adStr = '<iframe scrolling="no" frameborder="0" src="" style="background:;height: 26px; width: 100%;" id="adframe"></iframe>';
        var _dialogUI = '<div class="dialog" id="Dialog_parent_' + _dialogRndID + '"><div class="shadow' + shadowClass + '" id="Dialog_shadow_' + _dialogRndID + '"><iframe class="base"></iframe><div class="base"></div></div><!--?????--><div class="open-wrap base window focus' + windowClass + '" id="Dialog_window_' + _dialogRndID + '"><div class="base dialogwrapper"><!--??--><div class="open-top" id="Dialog_titleContent_' + _dialogRndID + '"><div class="r">&nbsp;</div><div class="l">&nbsp;</div><div class="c"><span class="" id="Dialog_title_' + _dialogRndID + '">' + _dialogCFG.title + '</span></div><a id="Dialog_close_' + _dialogRndID + '" style="cursor:pointer" class="close">&nbsp;</a></div><!--??--><div class="middle open-info"><div class="base left" id="Dialog_leftContent_' + _dialogRndID + '"></div><span class="center" id="Dialog_content_' + _dialogRndID + '">' + _dialogCFG.content + '</span><div class="base right" id="Dialog_rightContent_' + _dialogRndID + '"></div></div><div class="open-bottom"><div class="r">&nbsp;</div><div class="l">&nbsp;</div><div class="c">&nbsp;</div></div><!--????--><a class="base baselink move" href="javascript:;" id="Dialog_move_' + _dialogRndID + '"></a><!--???????--></div></div><div class="base mceeventblocker" id="Dialog_dragshadow_' + _dialogRndID + '"><div class="base placeholder" id="Dialog_drag_' + _dialogRndID + '"></div></div></div>';
        
        function _init() {
            $addHTML(document.body, _dialogUI);
            _dialogNodes = {
                parent: $E("Dialog_parent_" + _dialogRndID),
                shadow: $E("Dialog_shadow_" + _dialogRndID),
                window: $E("Dialog_window_" + _dialogRndID),
                title: $E("Dialog_title_" + _dialogRndID),
                content: $E("Dialog_content_" + _dialogRndID),
                move: $E("Dialog_move_" + _dialogRndID),
                dragshadow: $E("Dialog_dragshadow_" + _dialogRndID),
                drag: $E("Dialog_drag_" + _dialogRndID),
                close: $E("Dialog_close_" + _dialogRndID),
                titleContent: $E("Dialog_titleContent_" + _dialogRndID),
                leftContent: $E("Dialog_leftContent_" + _dialogRndID),
                rightContent: $E("Dialog_rightContent_" + _dialogRndID)
            };
            _dialogInfo.titleHeight = parseInt($getStyle(_dialogNodes.titleContent, "height"), 10);
            _dialogInfo.titleHeight =isNaN( _dialogInfo.titleHeight)?0:_dialogInfo.titleHeight;
           
            _dialogInfo.leftWidth = parseInt($getStyle(_dialogNodes.leftContent, "width"), 10);
            _dialogInfo.leftWidth =isNaN( _dialogInfo.leftWidth)?0:_dialogInfo.leftWidth;
            
            _dialogInfo.rightWidth = parseInt($getStyle(_dialogNodes.rightContent, "width"), 10);
            _dialogInfo.rightWidth =isNaN( _dialogInfo.rightWidth)?0:_dialogInfo.rightWidth;
            _dialogInfo.rightWidth = 42;
            $setStyle(_dialogNodes.parent, "zIndex", _dialogCFG.zindex);
            $setStyle(_dialogNodes.close, "display", (_dialogCFG.close == true ? "": "none")); (function() {
                var mousePOS = {};
                var nodePOS = new Array();
                var tempPOS = {};
                var screenInfo = {};
                var setCapture = function(el) {
                    el.setCapture()
                };
                if ($moz) setCapture = function() {};
                var releaseCapture = function(el) {
                    el.releaseCapture()
                };
                if ($moz) releaseCapture = function() {};
                var eMousedown = function(el) {
                    mousePOS = {
                        x: el.clientX,
                        y: el.clientY
                    };
                    nodePOS = $getXY(_dialogNodes.window);
                    screenInfo = {
                        left: $getScrollPos()[1],
                        top: $getScrollPos()[0],
                        width: $getPageSize()[0] - _dialogNodes.window.offsetWidth,
                        height: $getPageSize()[1] - _dialogNodes.window.offsetHeight
                    };
                    $setStyle(_dialogNodes.dragshadow, "display", "block");
                    $setStyle(_dialogNodes.drag, "left", nodePOS[0] + "px");
                    $setStyle(_dialogNodes.drag, "top", nodePOS[1] + "px");
                    $setStyle(_dialogNodes.drag, "width", _dialogNodes.window.offsetWidth + "px");
                    $setStyle(_dialogNodes.drag, "height", _dialogNodes.window.offsetHeight + "px");
                    setCapture(_dialogNodes.drag);
                    $addEvent2(document, eMousemove, "mousemove");
                    $addEvent2(document, eMouseup, "mouseup");
                    _dialogFUNC.onDragStart();
                    $stopEvent()
                };
                var eMousemove = function(el) {
                    tempPOS = {
                        x: nodePOS[0] + (el.clientX - mousePOS.x),
                        y: nodePOS[1] + (el.clientY - mousePOS.y)
                    };
                    if (tempPOS.x < screenInfo.left) {
                        tempPOS.x = screenInfo.left
                    } else if (tempPOS.x > screenInfo.width) {
                        tempPOS.x = screenInfo.width
                    }
                    if (tempPOS.y < screenInfo.top) {
                        tempPOS.y = screenInfo.top
                    } else if (tempPOS.y > screenInfo.height) {
                        tempPOS.y = screenInfo.height
                    }
                    $setStyle(_dialogNodes.drag, "left", tempPOS.x + "px");
                    $setStyle(_dialogNodes.drag, "top", tempPOS.y + "px");
                    _dialogFUNC.onDrag()
                };
                var eMouseup = function() {
                    nodePOS = $getXY(_dialogNodes.drag);
                    $setStyle(_dialogNodes.window, "left", nodePOS[0] + "px");
                    $setStyle(_dialogNodes.window, "top", nodePOS[1] + "px");
                    $setStyle(_dialogNodes.dragshadow, "display", "none");
                    $removeEvent2(document, eMousemove, "mousemove");
                    $removeEvent2(document, eMouseup, "mouseup");
                    _dialogFUNC.onDragEnd();
                    releaseCapture(_dialogNodes.drag)
                };
                $addEvent2(_dialogNodes.move, eMousedown, "mousedown")
            })();
            $addEvent2(_dialogNodes.close, _self.hidden, "click");
            $addEvent2(window, _self.setShadow, "resize");
            _self.setSize(_dialogCFG.width, _dialogCFG.height);
        }
        function _viewShadow() {
            $setStyle(_dialogNodes.shadow, "top", ($getScrollPos()[0]) + "px")
        }
        this.setSize = function(nWidth, nHeight) {
            $setStyle(_dialogNodes.window, "width", (nWidth + _dialogInfo.leftWidth + _dialogInfo.rightWidth) + "px");
            if ($IE6) {
                nHeight += nHeight % 2
            }
            $setStyle(_dialogNodes.window, "height", (nHeight + _dialogInfo.titleHeight + 31) + "px")
        };
        this.setShadow = function() {
            var frameView = $getStyle(_dialogNodes.dragshadow, "display");
            $setStyle(_dialogNodes.shadow, "display", "none");
            $setStyle(_dialogNodes.dragshadow, "display", "none");
            var pageSize = $getPageSize();
            var shdowHeight = pageSize[3];
            var maxViewSize = 1000;
            if (pageSize[1] > maxViewSize) {
                fixShadowTimeBoolean = true
            } else {
                fixShadowTimeBoolean = false
            }
            $setStyle(_dialogNodes.shadow, "display", "block");
            $setStyle(_dialogNodes.dragshadow, "display", frameView);
            if (pageSize[1] > pageSize[3] && $moz) {
                $setStyle(_dialogNodes.shadow, "width", (pageSize[0] - 18) + "px");
                $setStyle(_dialogNodes.dragshadow, "width", (pageSize[0] - 18) + "px");
                if (pageSize[1] > maxViewSize) {
                    $setStyle(_dialogNodes.shadow, "height", shdowHeight + "px")
                } else {
                    $setStyle(_dialogNodes.shadow, "height", pageSize[1] + "px")
                }
                $setStyle(_dialogNodes.dragshadow, "height", pageSize[1] + "px")
            } else {
                if ($IE6) {
                    if (pageSize[1] > pageSize[3]) {
                        $setStyle(_dialogNodes.shadow, "width", pageSize[0] + "px");
                        $setStyle(_dialogNodes.dragshadow, "width", pageSize[0] + "px");
                        if (pageSize[1] > maxViewSize) {
                            $setStyle(_dialogNodes.shadow, "height", shdowHeight + "px")
                        } else {
                            $setStyle(_dialogNodes.shadow, "height", pageSize[1] + "px")
                        }
                        $setStyle(_dialogNodes.dragshadow, "height", pageSize[1] + "px")
                    } else {
                        $setStyle(_dialogNodes.shadow, "width", pageSize[0] - 22 + "px");
                        $setStyle(_dialogNodes.dragshadow, "width", pageSize[0] - 22 + "px");
                        if (pageSize[1] > maxViewSize) {
                            $setStyle(_dialogNodes.shadow, "height", shdowHeight + "px")
                        } else {
                            $setStyle(_dialogNodes.shadow, "height", pageSize[3] + "px")
                        }
                        $setStyle(_dialogNodes.dragshadow, "height", pageSize[3] + "px")
                    }
                } else {
                    $setStyle(_dialogNodes.shadow, "width", pageSize[0] + "px");
                    $setStyle(_dialogNodes.dragshadow, "width", pageSize[0] + "px");
                    if (pageSize[1] > maxViewSize) {
                        $setStyle(_dialogNodes.shadow, "height", shdowHeight + "px")
                    } else {
                        $setStyle(_dialogNodes.shadow, "height", pageSize[1] + "px")
                    }
                    $setStyle(_dialogNodes.dragshadow, "height", pageSize[1] + "px")
                }
            }
        };
        this.setTitle = function(sHTML) {
            _dialogNodes.title.innerHTML = sHTML
        };
        this.setContent = function(sHTML) {
            _dialogNodes.content.innerHTML = sHTML;
            _dialogFUNC.onContentUpdate()
        };
        this.setIframe = function(oCFG) {
            _dialogNodes.content.style.backgroundImage = "url(/images/blog/loading.gif)";
            var sURL = oCFG.url ? oCFG.url: "";
            sURL = sURL.split("//").length < 2 ? ("http://" + window.location.host + "/" + sURL) : sURL;
            var nWidth = oCFG.width ? oCFG.width: 300;
            var nHeight = oCFG.height ? oCFG.height: 300;
            var bHost = sURL.split("//")[1].split("/")[0] == window.location.host;
            var self = this;
            setTimeout(function() {
                self.setContent("<iframe id='DataIframe_" + _dialogRndID + "' frameborder='0' scrolling='no' style='width: " + nWidth + "px; height: " + nHeight + "px; " + (bHost ? "display: none;": "") + "' src='" + sURL + "'></iframe>");
                $addEvent2($E("DataIframe_" + _dialogRndID), 
                function() {
                    $E("DataIframe_" + _dialogRndID).style.display = "";
                    _dialogNodes.content.style.backgroundImage = "url()"
                },
                "load")
            },
            1)
        };
        this.setPosition = function(nLeft, nTop) {
            if (nLeft != null) {
                $setStyle(_dialogNodes.window, "left", nLeft + "px")
            }
            if (nTop != null) {
                $setStyle(_dialogNodes.window, "top", nTop + "px")
            }
            _dialogFUNC.onPosUpdate()
        };
        this.getDialogNodes = function() {
            return _dialogNodes
        };
        this.setSkin = function(sCSS) {
            _dialogCFG.css = sCSS;
            _dialogNodes.parent.className = sCSS
        };

        this.setMiddle = function() {
            var pageSize = $getPageSize();
            var dialogTop = (pageSize[3] - _dialogNodes.window.offsetHeight) / 2 + $getScrollPos()[0];
            _dialogInfo.left = (pageSize[2] - _dialogNodes.window.offsetWidth) / 2;
            _dialogInfo.top = dialogTop < 0 ? 0: dialogTop;
            if(_dialogCFG.height>700){
            	_self.setPosition(_dialogInfo.left, _dialogInfo.top+200);
            }else{
            	_self.setPosition(_dialogInfo.left, _dialogInfo.top+80);
            }
            _dialogFUNC.onPosUpdate()
        };
        this.setCloseBtn = function(oView) {
            $setStyle(_dialogNodes.close, "display", (oView == true ? "": "none"))
        };
        this.getCloseBtn = function() {
            return _dialogNodes.close
        };
        this.show = function() {
            $setStyle(_dialogNodes.parent, "display", "block");
            $setStyle(_dialogNodes.parent, "visibility", "visible");
            this.setShadow();
            this.setMiddle();
            if (fixShadowTimeBoolean == true) {
                clearInterval(fixShadowTimer);
                fixShadowTimer = setInterval(_viewShadow, 100)
            }
            _dialogFUNC.onShow()
        };
        this.hidden = function() {
            if (_dialogCFG.closed == false) return;
            $setStyle(_dialogNodes.parent, "visibility", "hidden");
            $setStyle(_dialogNodes.parent, "display", "none");
            if (fixShadowTimeBoolean == true) {
                clearInterval(fixShadowTimer)
            }
            _dialogFUNC.onHidden()
        };
        this.setCloseEvent = function(bClose) {
            _dialogCFG.closed = bClose
        };
        _init()
    };
    window.ui.dialog = dialog
})();

//????????
function $removeNode(node) {
    node = $E(node) || node;
    node.parentNode.removeChild(node)

};
//?????HTML(??????)")
function $addHTML(oParentNode, sHTML) {
    oParentNode.insertAdjacentHTML("BeforeEnd", sHTML)

}
if ($moz) {
    $addHTML = function(oParentNode, sHTML) {
        var oRange = oParentNode.ownerDocument.createRange();
        oRange.setStartBefore(oParentNode);
        var oFrag = oRange.createContextualFragment(sHTML);
        oParentNode.appendChild(oFrag)

    }

}

//?????HTML???? IE ?? insertAdjacentHTML
function $insertHTML(el, html, where) {
    El = $E(el) || document.body;
    where = where.toLowerCase() || "beforeend";
    if (el.insertAdjacentHTML) {
        switch (where) {
            case "beforebegin":
            el.insertAdjacentHTML('BeforeBegin', html);
            return el.previousSibling;
            case "afterbegin":
            el.insertAdjacentHTML('AfterBegin', html);
            return el.firstChild;
            case "beforeend":
            el.insertAdjacentHTML('BeforeEnd', html);
            return el.lastChild;
            case "afterend":
            el.insertAdjacentHTML('AfterEnd', html);
            return el.nextSibling

        }
        throw 'Illegal insertion point -> "' + where + '"'

    }
    var range = el.ownerDocument.createRange();
    var frag;
    switch (where) {
        case "beforebegin":
        range.setStartBefore(el);
        frag = range.createContextualFragment(html);
        el.parentNode.insertBefore(frag, el);
        return el.previousSibling;
        case "afterbegin":
        if (el.firstChild) {
            range.setStartBefore(el.firstChild);
            frag = range.createContextualFragment(html);
            el.insertBefore(frag, el.firstChild);
            return el.firstChild

        } else {
            el.innerHTML = html;
            return el.firstChild

        }
        break;
        case "beforeend":
        if (el.lastChild) {
            range.setStartAfter(el.lastChild);
            frag = range.createContextualFragment(html);
            el.appendChild(frag);
            return el.lastChild

        } else {
            el.innerHTML = html;
            return el.lastChild

        }
        break;
        case "afterend":
        range.setStartAfter(el);
        frag = range.createContextualFragment(html);
        el.parentNode.insertBefore(frag, el.nextSibling);
        return el.nextSibling

    }
    throw 'Illegal insertion point -> "' + where + '"'

};


function $byId(id) {
    return document.getElementById(id)

};

function $getElementsByClass(el, tg, clz) {
    El = el || document;
    var rs = [];
    clz = " " + clz + " ";
    var cldr = el.getElementsByTagName(tg),
    len = cldr.length;
    for (var i = 0; i < len; ++i) {
        var o = cldr[i];
        if (o.nodeType == 1) {
            var ecl = " " + o.className + " ";
            if (ecl.indexOf(clz) != -1) {
                rs[rs.length] = o

            }

        }

    }
    return rs

};
//??ClassName????
$byClz = $getElementsByClass;

function $getChildrenByClass(el, clz) {
    var rs = [];
    clz = " " + clz + " ";
    var cldr = el.childNodes,
    len = cldr.length;
    for (var i = 0; i < len; ++i) {
        var o = cldr[i];
        if (o.nodeType == 1) {
            var ecl = " " + o.className + " ";
            if (ecl.indexOf(clz) != -1) {
                rs[rs.length] = o

            }

        }

    }
    return rs

};

function $getElementByClassAttr(el, clz) {
    var clazz,
    attr,
    value;
    clz.replace(/(\w+)\[(\w+)\=(\w+)\]/g, 
    function(a0, b1, b2, b3) {
        clazz = b1;
        attr = b2;
        value = b3
    });
    var Elements = $getChildrenByClass(el, clazz);
    var len = Elements.length;
    for (var i = 0; i < len; i++) {
        if (Elements[i][attr] == value) {
            return Elements[i]

        }

    }
    return null

};

function $childById(el, id) {
    if (el === null) {
        return null

    }
    var cld = el.childNodes;
    for (var i = 0; i < cld.length; ++i) {
        var o = cld[i];
        if (o.nodeType == 1 && o.id == id) {
            return o

        }

    }

};

function $descByIds(el, ids) {
    if (el === null) {
        el = document

    }
    if (typeof el == "string") {
        ids = el;
        el = document

    }
    if (typeof ids == "string") {
        ids = ids.split("#");
        if (ids[0] === "") {
            ids.shift()

        }

    }
    if (el.nodeType == 9 && ids[0].indexOf(">") == -1) {
        el = el.getElementById(ids[0]);
        ids.shift()

    }
    if (el === null) {
        return null

    }
    for (var si = 0; si < ids.length; ++si) {
        var id = ids[si];
        if (id.indexOf(">") >= 0) {
            var tn = id.split(">");
            var cld = el.getElementsByTagName(tn[0] || "*"),
            len = cld.length;
            id = tn[1]

        } else {
            var cld = el.childNodes;
            var len = cld.length

        }
        for (var i = 0; i < len; ++i) {
            var e = cld[i];
            if (e.nodeType == 1 && e.id == id) {
                el = e;
                break

            }

        }
        if (i == len) {
            return null

        }

    }
    return el

};

function $removeClassName(obj, _className) {
    obj = $E(obj);
    MoveObject.className = (" " + MoveObject.className + " ").replace(" " + _className + " ", "")

};

function $execInNodes(nodeType, fun1) {
    var eles = document.getElementsByTagName(nodeType);
    for (var i = 0; i < eles.length; i++) {
        fun1(eles[i])

    }

};

function $createElementByClass(type, className) {
    var ele = $C(type);
    ele.className = className;
    return ele

};

function $swapClassName(ele1, ele2, type) {
    var tem = ele1[type];
    ele1[type] = ele2[type];
    ele2[type] = tem

};

function $getLeft(element) {
    var left = 0;
    var el = $E(element);
    if (el.offsetParent) {
        while (el.offsetParent) {
            left += el.offsetLeft;
            el = el.offsetParent

        }

    } else if (el.x) {
        left += el.x

    }
    return left

};

function $getTop(element) {
    var top = 0;
    var el = $E(element);
    if (el.offsetParent) {
        while (el.offsetParent) {
            top += el.offsetTop;
            el = el.offsetParent

        }

    } else if (el.y) {
        top += el.y

    }
    return top

};

function $up(element, className) {
    var el = $E(element);
    while (el.parentNode) {
        if (el.className.indexOf(className) != -1) {
            return el

        }
        el = el.parentNode

    }

};

function $insertAfter(newElement, targetElement) {
    var parent = targetElement.parentNode;
    if (parent.lastChild == targetElement) {
        parent.appendChild(newElement)

    } else {
        parent.insertBefore(newElement, targetElement.nextSibling)

    }

};

function $opacity(elm, value) {
    elm = $E(elm);
    elm.style.filter = 'alpha(opacity=' + value + ')';
    elm.style.opacity = value / 100

};


function $getWin(iframeElement) {
    iframeElement = $E(iframeElement);
    if (iframeElement.contentWindow) {
        return iframeElement.contentWindow

    } else {
        var ifm = $descByIds(iframeElement, "#iframe");
        if (ifm) {
            return ifm.contentWindow

        } else {
            return null

        }

    }

};

Ajax = {
    createRequest: function() {
        var request = null;
        try {
            request = new XMLHttpRequest()
        } catch(trymicrosoft) {
            try {
                request = new ActiveXObject("Msxml2.XMLHTTP")
            } catch(othermicrosoft) {
                try {
                    request = ActiveXObject("Microsoft.XMLHTTP")
                } catch(failed) {}
            }
        }
        if (request == null) {

        } else {
            return request
        }
    },
    request: function(url, option) {
        option = option || {};
        option.onComplete = option.onComplete? option.onComplete: function() {};
        option.onException = option.onException?option.onException: function() {};
        option.returnType = option.returnType?option.returnType: "txt";
        option.method = option.method ?option.method : "get";
        option.data = option.data?option.data: {};
        this.loadData(url, option)
    },
    loadData: function(url, option) {
        var request = this.createRequest(),
        tmpArr = [];
        var _url = url;
        if (option.POST) {
            for (var postkey in option.POST) {
            	
                var postvalue = option.POST[postkey];
               
                if (postvalue != null) {
                	 
                    tmpArr.push(postkey + '=' + encodeDoubleByte(postvalue))
                }
            }
            
        }
        var sParameter = tmpArr.join("&") || "";
        if (option.GET) {
            for (var key in option.GET) {
                _url.setParam(key, encodeDoubleByte(option.GET[key]))
            }
        }
        request.onreadystatechange = function() {
            if (request.readyState == 4) {
                var response;
                var type = option.returnType;
                try {
                    switch (type) {
                    case "txt":
                        response = request.responseText;
                        break;
                    case "xml":
                        if (Core.Base.detect.$IE) {
                            response = request.responseXML
                        } else {
                            var Dparser = new DOMParser();
                            response = Dparser.parseFromString(request.responseText, "text/xml")
                        }
                        break;
                    case "json":
                        response = eval("(" + request.responseText + ")");
                        break
                    }
                    option.onComplete(response)
                } catch(e) {
                    option.onException(e.message, _url);
                    return false
                }
            }
        };
		
        try {
            if (option.POST) {
                request.open("POST", _url, true);
                request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                request.send(sParameter)
            } else {
                request.open("GET", _url, true);
                request.send(null)
            }
        } catch(e) {
            option.onException(e.message, _url);
            return false
        }
    }
};
function encodeDoubleByte(str) {
    if (typeof str != "string") {
        return str
    }
    return escape(str)
};

function createCheckBox(n,v,c,g){
		var checkBoxArray = document.getElementsByName(n);
		var l=checkBoxArray.length;
		document.write("<input type='checkbox' class='none' name='"+n+"' value='"+v+"' id='"+n+"_"+l+"'/><span id='"+n+"_"+l+"_s' class='"+(c?"on-checkbox":"un-checkbox")+" fl' onclick='checkClick(this,"+g+")'>&nbsp;</span>");
		if(c){
		document.getElementById(n+"_"+l).checked=true;
		
	}
}
function checkClick(o,g){
	
	 $stopEvent()
	var sid=o.id.split("_");
	if(g){
		var cArray = document.getElementsByName(sid[0]);
		for(var i=0;i<cArray.length;++i){
			cArray[i].checked="";
			document.getElementById(cArray[i].id+"_s").className="un-checkbox";
		}
	}
	if(o.className=="un-checkbox"){
		//alert(document.getElementById(sid[0]+"_"+sid[1]).checked)
		document.getElementById(sid[0]+"_"+sid[1]).checked=true;
		o.className="on-checkbox"
	}else{
		document.getElementById(sid[0]+"_"+sid[1]).checked="";
		o.className="un-checkbox"
	}

}
function createRadio(n,v,c){
		var checkBoxArray = document.getElementsByName(n);
		var l=checkBoxArray.length;
		document.write("<input type='radio' class='none' name='"+n+"' value='"+v+"' id='"+n+"_"+l+"'/><span id='"+n+"_"+l+"_s' class='"+(c?"on-radio fl":"un-radio fl")+"' onclick='radioClick(this)'>&nbsp;</span>");
		if(c){
		document.getElementById(n+"_"+l).checked=true;
		
	}
}
function radioClick(o){
	
	 $stopEvent()
	var sid=o.id.split("_");

		var cArray = document.getElementsByName(sid[0]);
		for(var i=0;i<cArray.length;++i){
			cArray[i].checked="";
			document.getElementById(cArray[i].id+"_s").className="un-radio fl";
		}


	document.getElementById(sid[0]+"_"+sid[1]).checked=true;
	o.className="on-radio fl"


}

(function(){windowDialog={
alert:function(content,op){
	op=op||{};
	var myop={};
	myop.title=op.title;
	myop.icon=op.icon||"01";
	myop.width=op.width;
	myop.height=op.height;
	myop.user_btn=[];
	var o={};
	o.label=op.textOk;
	o.func=op.funcOk;
	o.focus=true;
	o.css="";
	myop.user_btn.push(o);
	this.msgbox(content,myop)
},
confirm:function(e,op){
	op=op||{};
	var myop={};
	myop.title=op.title;
	myop.icon=op.icon||"04";
	myop.width=op.width;
	myop.height=op.height;
	myop.user_btn=[];
	var o={};
	o.label=op.textOk;
	o.func=op.funcOk;
	o.focus=(op.defaultBtn!=0)?true:false;
	o.css="";
	myop.user_btn.push(o);
	o={};
	o.label=op.textCancel;
	o.func=op.funcCancel;
	o.focus=(op.defaultBtn==0)?true:false;
	o.css="";
	myop.user_btn.push(o);
	var content=e;
	this.msgbox(content,myop)
},
msgbox:function(content,op){
	var c=content||"";
	op=op||{};
	var t=op.title||"提示！";
	var i=op.icon||"";
	var iconUrl=(i.length>2&&i!="")?i:"http://page1.aigou.com/images/"+i+".gif";
	iconUrl=(iconUrl=="http://page1.aigou.com/images/blog/icon/.gif")?"":iconUrl;
	var w=op.width?op.width:300;
	var h=op.height;
	var btn="";
	var _btn=op.user_btn||[{label:"确定",func:function(){},focus:true,css:"but_all but_2"}],len=_btn.length;
	var close_btn=op.close==null?true:op.close;
	var defaultBtn;
	for(var j=0;j<len;j++){
		e=_btn[j];
		var lab=e.label;
		var func=e.func;
		if(typeof defaultBtn!="number"&&e.focus==true){
			defaultBtn=j
		}
		if(lab==null){
			switch(j){
			case 0:
				lab=lab||"确定";
				break;
			case 1:
				lab=lab||"取消";
				break;
			default:
				lab=lab||"应用";
				break
			}
		}
		var defaultBtnCss=Math.round(lab.expand().length/2);
		var Css="";
		if(len == 1){
			Css="btn-qr mll5"
		}else{
			if(j+1<len){
				Css="btn-qr"
			}else{
				Css="btn-qx mll5"
			}
		}
		Css='class="'+Css+'"';
		btn=btn+'&nbsp;&nbsp;&nbsp;&nbsp;<input id="dialogBtn_'+j+'" type="button" '+Css+' />&nbsp;&nbsp;&nbsp;&nbsp;'
	}
	defaultBtn=defaultBtn||0;
	content='<table class="windowdialogcontent" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 32px 0pt 0pt 42px;"><img src="'+iconUrl+'" class="dialogicon" alt="" /></td><td class="msg'+((i=="")?" center":"")+'" valign="top" '+((i=="")?"":"style='width:215px;'")+'><div id="mydialogContent"class="mydialogcontent'+((i=="")?" textIndent":"")+'">'+c+'</div></td></tr><tr><td id="dialogBtnArea" colspan="2" class="msg windialogbutton">'+btn+'</td></tr></table>';
	
	this.init(content,t,w,h,defaultBtn,_btn,close_btn)
}
,setSize:function(w,h){
	windowDialog.dialog.setSize(w,h)
},
initBtn:function(btns){
	var len=btns.length;
	for(var i=0;i<len;i++){
		$addEvent2($E("dialogBtn_"+i),btns[i].func||function(){},"click");
		$addEvent2($E("dialogBtn_"+i),windowDialog.dialog.hidden,"click")
	}
},
init:function(e,t,w,h,d,btns,close_btn){
	var wDialog=windowDialog;
	if(this.isInit==false){
		var dialogCfg={ad:true,title:t||"提示！",drag:true,zindex:3000,shadow:2,css:"Dialog",content:"",middle:true,width:w||300,height:h};
		var func={};
		var dialog=new window.ui.dialog(dialogCfg,func);
		wDialog.dialog=dialog;
		wDialog.isInit=true
	}
	wDialog.dialog.setTitle('<b style="font-size:12px;">'+t+'</b>');
	wDialog.dialog.setContent(e);
	wDialog.dialog.setCloseBtn(close_btn);
	windowDialog.initBtn(btns);
	wDialog.dialog.show();
	$E('dialogBtn_'+d).focus();
	var hh=parseInt($E("mydialogContent").scrollHeight),hh2=parseInt($E("dialogBtnArea").scrollHeight);
	
	$E("mydialogContent").style.height=hh+"px";
	if(w==300){
		wDialog.dialog.setSize(300,(hh>30?hh:30)+hh2+35)
	}else{
		wDialog.dialog.setSize(w,(hh>30?hh:30)+hh2+35)
	}
	
	wDialog.dialog.setMiddle()
},
isInit:false,
dialog:null}})();


function getAjaxVote(dOrB,id,voteId,spanId,str,uid,vcode,vkey){
	var url = '/saveVoteLog_'+voteId+'_'+id+'_'+dOrB+'.html?s='+new Date().getTime()+'&code='+(vcode||"")+'&key='+(vkey||"");
	Ajax.request(url,{onComplete:function(req){
			if(req.length<15){
				if(req=='old'){
					if(str!=null && str!=""){
						windowDialog.alert(str);
					}else{
						windowDialog.alert('已经投过票!');
					}
				}else if(req=='nologin'){
					windowDialog.alert('请登陆后投票!');
				}else if(req=='expired'){
					windowDialog.alert('该投票已经结束!');
				}else if(req=='novalidate'){
					$openWin('/getVoteValidateCodeWindow_'+voteId+'_'+id+'_'+dOrB+'.html?changeNumSpanId='+spanId,340,165,'投票验证');
				}else if(req=='validatefaile'){
					windowDialog.alert('请输入正确的验证码!');
				}else if(req=='notstart'){
					windowDialog.alert('该投票还未开始!');
				}else{
					if(req!=0){
						$E(spanId).innerHTML=req;
					}
				}
			}
		},method:"get",onException:function(){}});
}
function refreshVoteValidateCode(){
	var url = "/getVoteValidateCode.html";
	var op = {
		method : "POST",
		POST : {
			
		},
		returnType : "txt",
		onComplete : function(key){
			if(key){
				$byId("key").value = key;
				$byId("validateCodeImg").src = 'http://zhidao.aigou.com/validate/image/'+key+'.gif';
			}
		}
	};
	Ajax.request(url,op);
}
function strLength(str){
	var strlength = 0;
	for(var i=0;i<str.length;i++){ 
		var intcode=str.charCodeAt(i);
		if(intcode>=0 && intcode<=255){
			strlength+=1;
		}else{
			strlength+=2;
		}
	}
	return strlength;
}
function isStr(str){
	var reg = /^(\w|[\u4E00-\u9FA5])*$/;
	if(str.match(reg)){
		return true;
	}else{
		return false;
	}	
}
function isMath(str){
	if(!isNaN(str)){ 
	    return true;
	}else{
		return false;
	}
}

function checktxt(str){   
	  var pattern = /^[a-zA-Z0-9_]+$/;
	  if(pattern.test(str)){
	  	 return true;
	  }else{   
	  	 return false;
	  }   
}

var Speed = 10;
//速度(毫秒)
var Space = 5;
//每次移动(px)
var PageWidth = 69;
//横向整体移位
var PageHeight = 105;
//纵向整体移位
var MoveLock = false;
var MoveTimeObj;
var Comp = 0;
var MoveObject;
var MoveObjectType=0;
function ISL_GoUp(mObj,lObj) {
    //左翻开始
    if (MoveLock) return;
    MoveLock = true;
    MoveObject=$E(mObj);
	var DogListLength=0;
    var dogList=$E(lObj).childNodes;
    var lastLi
	for (var i = 0; i < dogList.length; i++) {
	    if (dogList[i].tagName == "LI"){
	        ++DogListLength;
	        lastLi=dogList[i];
	    }
	}
	lastLi.style.marginRight="0px";
	DogListLength=DogListLength*PageWidth-5;
	$E(lObj).style.width=DogListLength+"px";
	ISL_ScrUp();
    MoveTimeObj = setInterval('ISL_ScrUp();', Speed);
}
function ISL_StopUp() {
    //左翻停止
    clearInterval(MoveTimeObj);
    
    if (MoveObject.scrollLeft % PageWidth  != 0) {
        Comp = 0 - (MoveObject.scrollLeft % PageWidth);
        CompScr();

    } else {
        MoveLock = false;

    }

}
function ISL_ScrUp() {
    //左翻动作
    MoveObject.scrollLeft -= Space;

}
function ISL_GoDown(mObj,lObj) {
    //右翻
    clearInterval(MoveTimeObj);
    if (MoveLock) return;
    MoveLock = true;
    MoveObject=$E(mObj)
	var DogListLength=0;
    var dogList=$E(lObj).childNodes;
    var lastLi
	for (var i = 0; i < dogList.length; i++) {
	    if (dogList[i].tagName == "LI"){
	        ++DogListLength;
	        lastLi=dogList[i];
	    }
	}
	lastLi.style.marginRight="0px";
	DogListLength=DogListLength*PageWidth-5;
	$E(lObj).style.width=DogListLength+"px";
    ISL_ScrDown();
    MoveTimeObj = setInterval('ISL_ScrDown()', Speed);

}
function ISL_StopDown() {
    //右翻停止
    clearInterval(MoveTimeObj);
    if (MoveObject.scrollLeft % PageWidth  != 0) {
        Comp = PageWidth - MoveObject.scrollLeft % PageWidth ;
        CompScr();

    } else {
        MoveLock = false;

    }

}
function ISL_ScrDown() {
    //右翻动作
    MoveObject.scrollLeft += Space;
}
function CompScr() {
    var num;
    if (Comp == 0) {
        MoveLock = false;
        return;
    }
    if (Comp < 0) {
        //左翻
        if (Comp < -Space) {
            Comp += Space;
            num = Space;

        } else {
            num = -Comp;
            Comp = 0;

        }
        MoveObject.scrollLeft -= num;
        setTimeout('CompScr()', Speed);

    } else {
        //右翻
        if (Comp > Space) {
            Comp -= Space;
            num = Space;

        } else {
            num = Comp;
            Comp = 0;

        }
        MoveObject.scrollLeft += num;
        setTimeout('CompScr()', Speed);

    }

}
// -------------
function GetObjTop(objName) {
    var top=$E(objName).style.top;
    if(top==""||top=="px")
    	return 0;
    return top.substring(0,top.length-2).toInt();
}

function ISL_vGoUp(mObj,lObj) {
    //上翻开始
    if (MoveLock) return;
    MoveLock = true;
    MoveObject=$E(mObj)
	var DogListLength=0;
    var dogList=$E(lObj).childNodes;
    var lastLi;
	for (var i = 0; i < dogList.length; i++) {
	    if (dogList[i].tagName == "LI"){
	        ++DogListLength;
	        lastLi=dogList[i];
	    }
	}
	lastLi.style.marginBottom="0px";
	DogListLength=DogListLength*PageHeight-8;
	$E(lObj).style.height=DogListLength+"px";
	ISL_ScrUp(lObj);
	MoveTimeObj = setInterval('ISL_vScrUp();', Speed);
	
}
function ISL_vStopUp() {
    //上翻停止
    clearInterval(MoveTimeObj);
    
    if (MoveObject.scrollTop % PageHeight  != 0) {
        Comp = 0 - (MoveObject.scrollTop % PageHeight);
        vCompScr();

    } else {
        MoveLock = false;
    }

}
function ISL_vScrUp() {
    //上翻动作
    MoveObject.scrollTop -= Space;

}
function ISL_vGoDown(mObj,lObj) {
    //下翻
    clearInterval(MoveTimeObj);
    if (MoveLock) return;
    MoveLock = true;
    MoveObject=$E(mObj)
	var DogListLength=0;
    var dogList=$E(lObj).childNodes;
    var lastLi
	for (var i = 0; i < dogList.length; i++) {
	    if (dogList[i].tagName == "LI"){
	        ++DogListLength;
	        lastLi=dogList[i];
	    }
	}
	lastLi.style.marginBottom="0px";
	DogListLength=DogListLength*PageHeight-8;
	$E(lObj).style.height=DogListLength+"px";
    ISL_vScrDown();
    MoveTimeObj = setInterval('ISL_vScrDown()', Speed);

}
function ISL_vStopDown() {
    //下翻停止
    clearInterval(MoveTimeObj);
    if (MoveObject.scrollTop % PageHeight  != 0) {
        Comp = PageHeight - MoveObject.scrollTop % PageHeight ;
        vCompScr();

    } else {
        MoveLock = false;

    }

}
function ISL_vScrDown() {
    //下翻动作
    MoveObject.scrollTop += Space;
}
function vCompScr() {
    var num;
    if (Comp == 0) {
        MoveLock = false;
        return;
    }
    if (Comp < 0) {
        //上翻
        if (Comp < -Space) {
            Comp += Space;
            num = Space;

        } else {
            num = -Comp;
            Comp = 0;

        }
        MoveObject.scrollTop -= num;
        setTimeout('vCompScr()', Speed);

    } else {
        //下翻
        if (Comp > Space) {
            Comp -= Space;
            num = Space;

        } else {
            num = Comp;
            Comp = 0;

        }
        MoveObject.scrollTop += num;
        setTimeout('vCompScr()', Speed);

    }

}

/**
 * 初始化焦点狗狗位置
 */
function initDogFocus(mObj,index,totalCount){
  var moveobj = $byId(mObj);
  if(!index || index<1 || !moveobj){
    return;
  }
  var maxMoveCount = totalCount-4;
  if(maxMoveCount<0){
    return;
  }
  if(index <= maxMoveCount){
    moveobj.scrollTop += 105*(index-1);
  }else{
	moveobj.scrollTop += (105*(maxMoveCount));
  }
}
// -------------
var onloadWangWangReady=false;
function getWangWangText(){
	if(onloadWangWangReady)
		return;
	onloadWangWangReady=true;
	if(document.getElementById("mywangwang").innerHTML != ""){
		return;
	}
	var url = '/my/ajax/getUserWangwang.html?s='+new Date().getTime();
	Ajax.request(url,{onComplete:function(req){
			document.getElementById("mywangwang").innerHTML = req;
		},method:"get",onException:function(){}});
}

function headRecordAjax(){
	var recordContents = document.getElementById("headRecordContents").value;
	var re = true;
	if(recordContents==null || recordContents==''){
		windowDialog.alert("内容不能为空！");
		re = false;
	}
	if(strLength(recordContents)>300){
		windowDialog.alert("内容不能超过300个字符！");
		re = false;
	}
	if(re){
		var url = "/my/ajax/saveRecordAjax.html";
		var op = {
				method: "post",
				POST:{"record.contents":recordContents,
					  "s":+new Date().getTime()},
				onComplete: function(req){
					document.getElementById("headRecordContents").value = "";
					onloadWangWangReady = false;
				}
			  };
		Ajax.request(url,op);
	}else{
		return false;
	}
}

function checkLogin(url,id){
	if(!id || id>0 || id.length>2){
		return;
	}
	
	var done=url;
	var v_html=
		'<form name="quicklogonform" action="http://blog.aigou.com/login/login.html" method="post">'
		+'<div class="open-wrap">'
		+'<h4 class="fs14">快速登录爱狗网</h4>'
		+'<div class="open-sp mt15 mb15">&nbsp;</div>'
		
		+'<div class="login">'
		+'<p><label for="user">用户名：</label><input type="text" id="userName" name="userName" class="login-input" /></p>'
		+'<p class="mt10"><label for="password">密&nbsp;&nbsp;&nbsp;&nbsp;码：</label><input type="password" id="password" name="password" class="login-input" /></p>'
		+'</div>'
		
		+'<div class="open-sp mt15 mb15">&nbsp;</div>'
		+'<div class="tr"><input type="submit" class="btn-dl" title="登录" value=" " /><input type="button" class="btn-zc ml15" title="注册"  onclick="window.location.href=\'http://blog.aigou.com/login/register.html\'" /></div>'
				
		+'<input type="hidden" name="done" value="'+done+'" />'
		+'<input type="hidden" name="parent" value="login" />'
		+'</form>'
		+'</div>';
	
	var op={title:"快速登录",width:380,height:270,shadow:2};
	$showDialog(v_html,op);
	
}

function addExplorerBookmark(title,url){
	url = url || window.location.href+"";
	if(window.sidebar){
		window.sidebar.addPanel(title,url,"");
	}else if(document.all){
		window.external.AddFavorite(url,title);
	}else if(window.opener && window.print()){
		return true;
	}
}
/*通用搜索 回车事件*/
var isIE = navigator.userAgent.indexOf("MSIE")>0;
function searchKeyDown(obj){
	obj.onkeydown = function(e){
    	if(isIE){ 
			if(getSearchKeyCode(event) == 13&&$E('headSearchInput').value!='全站搜索'&&$E('headSearchInput').value!=''){
				window.location.href='http://search.aigou.com/index.html?title='+escape($E('headSearchInput').value);
    		}
    	}else{
    		if(getSearchKeyCode(e) == 13&&$E('headSearchInput').value!='全站搜索'&&$E('headSearchInput').value!=''){
     			window.location.href='http://search.aigou.com/index.html?title='+escape($E('headSearchInput').value);
			}
    	}
	}
}
function getSearchKeyCode(e){
	var keynum = "";
	if(isIE){ // window.event IE
		keynum = e.keyCode;
	}else{ // Netscape/Firefox/Opera
		keynum = e.which;
	}
	return keynum;
}