﻿var DB = DB || {};
DB.Debug = -1;
/**
* 框架
* @module base
* @static
*/
/*
注册命名空间
DB.$namespace("com.lijian");
注册包
DB.$package("com.lijian",function(){});
注册类
DB.$class(function(){});
输出日志
DB.out("输出DEBUG-调试信息");
DB.out("输出ERROT-错误信息",1);
DB.out("输出WARN-错误信息",2);
DB.out("输出INFO-提示信息",3);
DB.out("输出DEBUG-调试信息",4);
DB.out("输出Log-日志信息",5);
*/
; (function(object) {
    //private的成员中 _this是绑定当前对象,public的成员 this和_this绑定当前对象    
    var _this = object || window;
    var version = "1.0";
    var topNamespace = _this; //topNamespace是顶级命名空间,所以的命名空间都在他下面。
    var DEBUG = { OFF: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4, ALL: 5 };
    var console = window.console;
    var options = {
        debug: _this.Debug || DEBUG.OFF//管理debug的模式
    };
    //初始化
    function _init() {
        //关闭调试模式,禁用js错误
        if (options.debug == DEBUG.OFF)
            window.onerror = new Function("return true");
    }
    /**
    * 创建一个命名空间，创建的命名空间将会在 顶级 根命名空间下。
    * $namespace('KISSY.app'); // returns KISSY.app
    * $namespace('app.Shop'); // returns KISSY.app.Shop
    * $namespace('TB.app.Shop', true); // returns TB.app.Shop
    */
    function $namespace() {
        var args = arguments, l = args.length,
                o = null, i, j, p,
                global = (args[l - 1] === true && l--);
        for (i = 0; i < l; ++i) {
            p = (args[i]).split('.');
            o = global ? window : topNamespace;
            for (j = (window[p[0]] === o) ? 1 : 0; j < p.length; ++j) {
                o = o[p[j]] = o[p[j]] || {};
            }
        }
        return o;
    }
    /**
    * 创建一个类，创建的类将会在 顶级 根命名空间下。
    * this指向生成的类的prototype对象
    * create();
    * create(function(){
    *   this.method = function(){}
    * }); // returns Class 
    */
    function $class(context) {
        var func = context;
        function klass() {
            this.init && this.init.apply(this, arguments);
            this.initialize && this.initialize.apply(this, arguments);
        }
        if (typeof func === "function") {
            func.call(klass.prototype, topNamespace);
        }
        return klass;
    }
    /**
    * 注册对象
    * eg.
    * $package("RS.App.comment",function(J){
    * 	//这时上下文对象this指向顶级命名空间的RS.App.comment对象,J指向顶级命名空间
    * 	alert("Hello world! _this is " + this);
    * };
    *
    *$package(function(){ 
    *   //这时上下文对象this指向顶级命名空间的RS对象,J指向顶级命名空间
    *});
    *
    * @param {String},{Object} name 要创建的包的名字空间
    * @param {Function} func 要创建的包的包体
    */
    function $package() {
        var name = arguments[0];
        var func = arguments[arguments.length - 1];
        var ns = topNamespace;
        if (typeof func === "function") {
            if (typeof name === "string") {
                ns = $namespace(name);
            } else if (typeof name === "object") {
                ns = name;
            }
            func.call(ns, topNamespace);
        } else {
            throw new Error("Function required");
        }
    }
    function extend(destination, source) {
        for (property in source) {
            destination[property] = source[property];
        }
        return destination;
    }
    //记录异常信息
    function error(ex, space) {
        var msg = "";
        var _s = space || "\n";
        if (!!(window.attachEvent && !window.opera)) {
            msg = "error:" + ex + _s + "错误代码:" + ex.number + _s + "错误信息:" + ex.message + _s + "错误描述:" + ex.description + _s + "错误类型:" + ex.name;
        }
        else {
            msg = "error:" + ex + _s + "错误信息:" + ex.message + _s + "出错的行数:" + ex.lineNumber + _s + "出错的文件名:" + ex.fileName + _s + "错误堆栈信息:" + ex.stack + _s + "错误类型:" + ex.name;
        }
        out(msg, 1);
        return msg;
    }
    function out(msg, type) {
        type = type || 4;
        if (type <= options.debug) {
            if (!!console) {
                //firebug
                switch (type) {
                    case 5: console.log(msg); break;
                    case 4: console.debug(msg); break;
                    case 3: console.info(msg); break;
                    case 2: console.warn(msg); break;
                    case 1: console.error(msg); break;
                }
            } else {
                alert("消息类型[" + type + "]:\n" + msg);
            }
        }
        return msg;
    }
    _init();
    _this.namespace = $namespace; //命名空间
    _this.package = $package; //注册对象
    _this.$namespace = $namespace; //注册命名空间
    _this.$package = $package; //注册对象
    _this.$class = $class; //注册类
    _this.extend = extend;
    _this.version = version; //版本
    _this.error = error; //显示异常信息
    _this.out = out; //日志
    return _this;
} (DB));
/*
缓存
无塞阻
文件加载后立即缓存，不会第二次加载同一个文件
缓存非常厉害,缓存生命周期在当前浏览器关闭之后
DB.load({ src: "base.js" });
DB.load({ src: ['base.js'], asyn: true}); //异步加载
DB.load({ src: ['base.js','app01.js', 'base.css', 'app01.css']},function() { });
RS.loadVersion({ src: ['base.js','base.css', 'app02.js', 'app02.css']},function() { });
*/
; (function(object) {
    var _this = object || window;
    var files = {}; //文件列表 file = {src : "",type : "js" , status :"init"|"loading"|"loaded",queue:[]文件加载之前的函数队列 };
    var queues = {}; //load队列
    var excute = false;
    //初始化Loader对象
    function _init() {
        // 很好，很强大，因为getTime()结果不一样，所以用这种方法可以准确的定位到某一个类有没有执行		
        var root = document.documentElement;
        var script = document.createElement("script");
        id = "script" + (new Date).getTime();
        script.type = "text/javascript";
        try {
            script.appendChild(document.createTextNode("window." + id + "=1;"));
        } catch (e) { }
        root.insertBefore(script, root.firstChild);
        if (window[id]) {
            excute = true;
            delete window[id];
        }
        root.removeChild(script);
    }
    //有问题
    function loadScriptsVersion() {
        var path = document.getElementsByTagName("script");
        var alPath = [];
        for (var i = 0; i < path.length; i++) {
            var a = document.createElement("a");
            a.setAttribute("href", path[i].src);
            alPath.push(a.getAttribute("href"));
        }
        loadVersion(alPath);
    }
    function loadVersion(options) {
        var src = options;
        if (!!options.src) {
            src = options.src;
        }
        src = src.constructor === Array ? src : [src]; //设置文件列表
        for (var i = 0; i < src.length; i++) {
            _mark(src[i], "loaded");
        }
    }
    function load(options, callback) {
        //加载参数
        options = options || {};
        if (!options.src) return;
        options.src = options.src.constructor === Array ? options.src : [options.src]; //设置文件列表
        if (options.src.length < 0) return;
        options.asyn = options.asyn || false; //是否异步加载
        options.name = "queue" + (new Date).getTime();
        if (!!callback) {
            options.asyn = true;
            queues[options.name] = { name: options.name, src: options.src, done: false, callback: callback }; //设置load队列
        }
        //加载文件
        for (var i = 0; i < options.src.length; i++) {
            //标记文件,把文件放到files中
            var src = options.src[i];
            var file = _mark(src);
            if ("loaded" == file.status) {
                //文件已经加载成功
            }
            else if ("loading" == file.status && options.onload != null) {
                //文件已经正在加载中
                file.queue.push(queues[options.name]); //装载该文件的callback队列
            }
            else {
                //文件没有加载  
                file.status = "loading";
                if (file.type == "css") {
                    //加载css
                    loadStyle(file.src);
                    file.status = "loaded";
                }
                else if (file.type == "js") {
                    //同步,无callback,同步加载js(有塞阻)
                    if (!callback && !options.asyn) {
                        loadScript(file.src);
                        file.status = "loaded";
                    }
                    //异步,或者有callback,异步加载js(无塞阻)
                    else {
                        if (!!callback)
                            file.queue.push(queues[options.name]); //装载该文件的callback队列
                        loadFile(file.src, function(tsrc) {
                            var tfile = _getFile(tsrc);
                            tfile.status = "loaded";
                            _callqueue(tfile);
                            tfile.queue.length = 0;
                        });
                    }
                }
            }
        }
        if (!!queues[options.name] && _eachqueue(queues[options.name].src)) {
            queues[options.name].callback();
            delete queues[options.name];
        }
    }
    //异步加载文件
    function loadFile(src, callback) {
        var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
        xhr.onreadystatechange = function() {
            if (4 == xhr.readyState) {
                _globalEval(xhr.responseText);
                callback(src);
            }
        };
        xhr.open("GET", src, true);
        xhr.send("");
    }
    // 直接加载脚本
    function loadScript(src, context) {
        context = context || document;
        var head = context.getElementsByTagName("head")[0] || context.documentElement;
        var script = context.createElement("script");
        script.type = "text/javascript";
        script.src = src;
        head.appendChild(script);
        return script;
    }
    //加载css
    function loadStyle(src, context) {
        context = context || document;
        var head = context.getElementsByTagName("head")[0] || context.documentElement;
        var _link = context.createElement("link");
        var links = context.getElementsByTagName("link", context);
        _link.type = "text/css";
        _link.rel = "stylesheet";
        _link.href = src;
        if (0 < links.length) {
            var _last = links[links.length - 1];
            _last.parentNode.insertBefore(_link, _last.nextSibling);
        } else {
            head.appendChild(_link);
        }
        return _link;
    }
    //判断文件是否加载成功
    function hasLoad(src) {
        var file = _getFile(src);
        if ("undefined" == typeof file) {
            return false;
        } else {
            if ("loaded" == file.status) {
                return true;
            } else {
                return false;
            }
        }
    }
    //获得标记的文件
    function _getFile(src) {
        return files[encodeURIComponent(src.toLowerCase())];
    }
    //标记文件
    function _mark(src, status) {
        src = src.toLowerCase();
        var file = _getFile(src);
        if ("undefined" == typeof (file)) {
            file = {}
            file.src = src;
            file.status = status ? status : "loading"; //文件的加载状态
            file.type = ""; //文件的类型
            file.queue = []; //文件加载前的callback队列
            if (/\.js(\?|$)/.test(src))
                file.type = "js";
            else if (/\.css(\?|$)/.test(src))
                file.type = "css";
            files[encodeURIComponent(src)] = file
        }
        return file;
    }
    function initCache(src) {
        src = src.constructor === Array ? src : [src]; //设置文件列表
        for (var i = 0; i < src.length; i++) {
            _mark(src, true);
        }
    }
    // 将把异步加载的脚本内容插入当前页面来执行
    function _globalEval(data, context) {
        if (data && /\S/.test(data)) {
            context = context || document;
            var head = context.getElementsByTagName("head")[0] || context.documentElement,
			  script = context.createElement("script");
            script.type = "text/javascript";
            if (excute) {
                script.appendChild(context.createTextNode(data));
            } else {
                script.text = data;
            }
            head.insertBefore(script, head.firstChild);
            head.removeChild(script);
            return true;
        }
        return false;
    }
    // 执行文件回调方法数组。一个文件有可能请求多次，绑定了多个的回调方法。
    function _callqueue(file) {
        for (var i = 0; i < file.queue.length; i++) {
            var item = file.queue[i];
            if (_eachqueue(item.src)) {
                item.callback();
                delete queues[item.name];
            }
        }
    }
    //检验队列中的文件是否全部加载完成
    function _eachqueue(src) {
        var flag = true;
        for (var i = 0; i < src.length; i++) {
            if (!hasLoad(src[i])) {
                flag = false;
                break;
            }
        }
        return flag;
    }
    _init();
    _this.load = load;
    _this.loadVersion = loadVersion;
    //把页面上手动嵌入的脚本加入脚本版本库
    _this.loadScriptsVersion = loadScriptsVersion;
} (DB)) 
DB.package("DB.Ui", function() { 
this.initChild= function(wpId) {
	$(wpId+" li").hover(
  function () { 
      if($(this).attr("alt")!=null){
	var arr=$(this).attr("alt").split("|");
	var pid=arr[1]; 
	$(".liparent"+pid).show(500);
	$(this).addClass("over");
      }
  },
  function () {
    $(this).removeClass("over");
  }
 ); 
	
	$(wpId+" li").live("click", function(){ 
        if($(this).attr("alt")!=null){
	var arr=$(this).attr("alt").split("|");
	var pid=arr[1]; 
	$(".liparent"+pid).show(500);
        $(wpId+" li").removeClass("on");
	$(this).addClass("on");
           }
          }); 
	$(wpId+" li").live("dblclick",function(){
        $(this).find(".pset").click();
        }); 

	$(wpId).find(".li_parent").each(function(i) {
              var arr = $(this).attr("alt").split("|");
              var pid = arr[1];
              var ht = $(".liparent" + pid);
              if (ht != null && ht != "") {
                  $(this).after(ht);
              }
			  ht.addClass("li_child1");
			  ht.show();
          });
	$(wpId).find(".li_child1").each(function(i) {
              var arr = $(this).attr("alt").split("|");
              var pid = arr[1];
              var ht = $(".liparent" + pid);
              if (ht != null && ht != "") {
                  $(this).after(ht);
              }
			  ht.addClass("li_child2");
			  ht.show();
          });
	$(wpId).find(".li_child2").each(function(i) {
              var arr = $(this).attr("alt").split("|");
              var pid = arr[1];
              var ht = $(".liparent" + pid);
              if (ht != null && ht != "") {
                  $(this).after(ht);
              }
			  ht.addClass("li_child3");
			  ht.show();
          });
}
this.checkall= function(t,wpId) {
   if($(t).attr("checked")){
   $(wpId).find("input").attr("checked","checked");}else
   {$(wpId).find("input").removeAttr("checked");}
} 
}); 
/*
* artDialog 3.0.4
* Date: 2010-11-11 12:04
* http://code.google.com/p/artdialog/
* (c) 2009-2010 TangBin, http://www.planeArt.cn
*
* This is licensed under the GNU LGPL, version 2.1 or later.
* For details, see: http://creativecommons.org/licenses/LGPL/2.1/
*/

//-------------“art” 微型DOM引擎模块
(function() {
    var $ = function(selector, content) {
        return new $.fn.init(selector, content);
    },
	readyBound = false,
	readyList = [],
	DOMContentLoaded;

    $.fn = $.prototype = {
        init: function(selector, content) {
            if (!selector) return this;
            this[0] = typeof selector === 'string' ?
			$.selector(selector, content) : selector;
            if (typeof selector === 'function') return $().ready(selector);

            return this;
        },

        // dom 就绪
        ready: function(fn) {
            $.bindReady();

            if ($.isReady) {
                fn.call(document, $);
            } else if (readyList) {
                readyList.push(fn);
            };

            return this;
        },

        // 判断样式类是否存在
        hasClass: function(name) {
            var reg = new RegExp('(\\s|^)' + name + '(\\s|$)');
            return this[0].className.match(reg) ? true : false; ;
        },

        // 添加样式类
        addClass: function(name) {
            if (!this.hasClass(name)) this[0].className += ' ' + name;

            return this;
        },

        // 移除样式类
        removeClass: function(name) {
            var elem = this[0];

            if (!name) {
                elem.className = '';
            } else
                if (this.hasClass(name)) {
                elem.className = elem.className.replace(name, ' ');
            };

            return this;
        },

        // 读写样式
        // css(name) 访问第一个匹配元素的样式属性
        // css(properties) 把一个"名/值对"对象设置为所有匹配元素的样式属性
        // css(name, value) 在所有匹配的元素中，设置一个样式属性的值
        css: function(name, value) {
            var elem = this[0];

            if (typeof name === 'string') {
                if (value === undefined) {
                    return elem.currentStyle ?
					elem.currentStyle[name] :
					document.defaultView.getComputedStyle(elem, false)[name];
                } else {
                    elem.style[name] = value;
                };
            } else {
                for (var i in name) elem.style[i] = name[i];
            };

            return this;
        },

        // 向每个匹配的元素内部追加内容
        // @param {String}
        // @return {Object}
        append: function(content) {
            var elem = this[0];

            if (elem.insertAdjacentHTML) {
                elem.insertAdjacentHTML('beforeEnd', content);
            } else {
                var range = elem.ownerDocument.createRange(),
				frag;
                if (elem.lastChild) {
                    range.setStartAfter(elem.lastChild);
                    frag = range.createContextualFragment(content);
                    elem.appendChild(frag);
                } else {
                    elem.innerHTML = content;
                };
            };

            return this;
        },

        // 移除节点
        // remove() 从DOM中删除所有匹配的元素
        // @return {undefined}
        remove: function() {
            try {
                var elem = this[0];

                // 断开js对象对DOM引用，防止IE内存泄漏
                $.each(elem.getElementsByTagName('*'), function(i, val){
			val = null;
		});

                elem.parentNode.removeChild(elem);
                elem = null;
                window.CollectGarbage && CollectGarbage(); // IE私有函数释放内存
            } catch (ex) { }
        },


        // 事件绑定
        // @param {String} 类型
        // @param {Function} 要绑定的事件
        // @return {Object}
        bind: function(type, fn) {
            var elem = this[0];

            if (elem.addEventListener) {
                elem.addEventListener(type, fn, false);
            } else {
                elem['$e' + type + fn] = fn;
                elem[type + fn] = function() { elem['$e' + type + fn](window.event) };
                elem.attachEvent('on' + type, elem[type + fn]);
            };

            return this;
        },

        // 事件代理
        // @param {String} 类型
        // @param {Function} 要绑定的事件. 注意此时this指向触发事件的元素
        // @return {Object}
        live: function(type, fn) {
            this.bind(type, function(event) {
                var et = event.target || event.srcElement;
                fn.call(et, event);

                return this;
            });
        },

        // 移除事件
        // @param {String} 类型
        // @param {Function} 要卸载的事件
        // @return {Object}
        unbind: function(type, fn) {
            var elem = this[0];

            if (elem.removeEventListener) {
                elem.removeEventListener(type, fn, false);
            } else {
                elem.detachEvent('on' + type, elem[type + fn]);
                elem[type + fn] = null;
            };

            return this;
        },

        // offset() 获取相对文档的坐标
        // @return {Object} 返回left、top的数值
        offset: function() {
            var elem = this[0],
			box = elem.getBoundingClientRect(),
			doc = elem.ownerDocument,
			body = doc.body,
			docElem = doc.documentElement,
			clientTop = docElem.clientTop || body.clientTop || 0,
			clientLeft = docElem.clientLeft || body.clientLeft || 0,
			top = box.top + (self.pageYOffset || docElem.scrollTop) - clientTop,
			left = box.left + (self.pageXOffset || docElem.scrollLeft) - clientLeft;

            return {
                left: left,
                top: top
            };
        },
        width: function() {
            return this[0].offsetWidth;
        },
        height: function() {
            return this[0].offsetHeight;
        }
    };

    $.fn.init.prototype = $.fn;

    // 单一元素选择
    // @param {String} id, tag
    // @param {HTMLElement} 上下文，默认document
    // @return {HTMLElement}
    $.selector = function(selector, content) {
        content = content || document;
        if (/^#(\w+)$/.test(selector)) return content.getElementById(RegExp.$1);
        if (/^\w+$/.test(selector)) return content.getElementsByTagName(selector)[0];
    };

    // 遍历
    // @param {Object}
    // @param {Function}
    // @return {undefined}
    $.each = function(obj, fn) {
        var name, i = 0,
		length = obj.length,
		isObj = length === undefined;

        if (isObj) {
            for (name in obj) {
                if (fn.call(obj[name], name, obj[name]) === false) {
                    break;
                };
            };
        } else {
            for (var value = obj[0]; i < length &&
			fn.call(value, i, value) !== false; value = obj[++i]) { };
        };
    };

    // DOM就绪 感谢jQuery
    $.isReady = false;
    $.ready = function() {
        if (!$.isReady) {
            if (!document.body) {
                return setTimeout($.ready, 13);
            };
            $.isReady = true;

            if (readyList) {
                var fn, i = 0;
                while ((fn = readyList[i++])) {
                    fn.call(document, $);
                };
                readyList = null;
            };
        };
    };
    $.bindReady = function() {
        if (readyBound) {
            return;
        };

        readyBound = true;

        if (document.readyState === 'complete') {
            return $.ready();
        };

        if (document.addEventListener) {
            document.addEventListener('DOMContentLoaded', DOMContentLoaded, false);
            window.addEventListener('load', $.ready, false);
        } else if (document.attachEvent) {
            document.attachEvent('onreadystatechange', DOMContentLoaded);
            window.attachEvent('onload', $.ready);
            var toplevel = false;
            try {
                toplevel = window.frameElement == null;
            } catch (e) { };

            if (document.documentElement.doScroll && toplevel) {
                doScrollCheck();
            };
        };
    };
    if (document.addEventListener) {
        DOMContentLoaded = function() {
            document.removeEventListener('DOMContentLoaded', DOMContentLoaded, false);
            $.ready();
        };
    } else if (document.attachEvent) {
        DOMContentLoaded = function() {
            if (document.readyState === 'complete') {
                document.detachEvent('onreadystatechange', DOMContentLoaded);
                $.ready();
            };
        };
    };
    function doScrollCheck() {
        if ($.isReady) {
            return;
        };

        try {
            document.documentElement.doScroll('left');
        } catch (error) {
            setTimeout(doScrollCheck, 1);
            return;
        };
        $.ready();
    };

    // 元素判定
    // @param {Object}
    // @return {Boolean}
    $.isElem = function(obj) {
        return obj && obj.nodeType === 1;
    };

    // 数组判定
    $.isArray = function(obj) {
        return Object.prototype.toString.call(obj) === '[object Array]';
    };

    // 页面编码
    $.charset = function() {
        var d = document;
        return d.characterSet || d.charset;
    } ();

    // 浏览器判定
    $.isIE = ! -[1, ];
    $.isIE6 = $.isIE && !window.XMLHttpRequest;

    // 动态加载外部CSS文件
    // @param {String} CSS路径
    // @param {Function} 回调函数
    // @param {Object} 文档对象，默认为当前文档
    // @return {undefined}
    $.getStyle = function(href, fn, doc) {
        doc = doc || document;

        var link = document.createElement('link');
        link.charset = $.charset;
        link.rel = 'stylesheet';
        link.type = 'text/css';
        link.href = href;
        doc.getElementsByTagName('head')[0].appendChild(link);

        var styles = doc.styleSheets,
		load = function() {
		    for (var i = 0; i < styles.length; i++) {
		        if (link === (styles[i].ownerNode || styles[i].owningElement)) return fn();
		    };
		    setTimeout(arguments.callee, 5);
		};
        fn && load();
    };

    // 向head添加CSS
    // @param {String} CSS内容
    // @param {Object} 文档对象，默认为当前文档
    // @return {undefined}
    var _style = {};
    $.addHeadStyle = function(content, doc) {
        doc = doc || document;

        var style = _style[doc];
        if (!style) {
            style = _style[doc] = doc.createElement('style');
            style.setAttribute('type', 'text/css');
            $('head')[0].appendChild(style);
        };
        style.styleSheet && (style.styleSheet.cssText += content) || style.appendChild(doc.createTextNode(content));
    };

    // 动态加载外部javaScript文件
    // @param {String} 文件路径
    // @param {Function} 回调函数
    // @param {Object} 文档对象，默认为当前文档
    // @return {undefined}
    $.getScript = function(src, fn, doc) {
        doc = doc || document;

        var script = doc.createElement('script');
        script.language = "javascript";
        script.charset = $.charset;
        script.type = 'text/javascript';

        // 读取完后的操作
        script.onload = script.onreadystatechange = function() {
            if (!script.readyState || 'loaded' === script.readyState || 'complete' === script.readyState) {
                fn && fn();
                script.onload = script.onreadystatechange = null;
                script.parentNode.removeChild(script);
            };
        };

        script.src = src;
        // 不插入head是为了保证script标签在DOM中的顺序，以免获取自身scr路径的方法出错
        doc.body.appendChild(script);
    };

    var _path = document.getElementsByTagName('script');
    _path = _path[_path.length - 1].src.replace(/\\/g, '/');

    // 当前外链js所在路径
    $.getPath = _path.lastIndexOf('/') < 0 ? '.' : _path.substring(0, _path.lastIndexOf('/'));

    // 当前外链js地址
    $.getUrl = _path.split('?')[0];

    // 当前外链js地址参数
    $.getArgs = _path.split('?')[1] || '';

    // 阻止事件冒泡
    // @param {Object}
    // @return {undefined}
    $.stopBubble = function(event) {
        event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true;
    };

    // 阻止浏览器默认行为
    // @param {Object}
    // @return {undefined}
    $.stopDefault = function(event) {
        event.preventDefault ? event.preventDefault() : event.returnValue = false;
    };

    (function() {
        var dd, db, dom,
		get = function(win) {
		    dd = win ? win.document.documentElement : document.documentElement;
		    db = win ? win.document.body : document.body;
		    dom = dd || db;
		};

        // 获取页面相关属性
        $.doc = function(win) {
            get(win);

            return {
                width: Math.max(dom.clientWidth, dom.scrollWidth), 	// 页面宽度
                height: Math.max(dom.clientHeight, dom.scrollHeight), // 页面长度
                left: Math.max(dd.scrollLeft, db.scrollLeft), 		// 被滚动条卷去的文档宽度
                top: Math.max(dd.scrollTop, db.scrollTop)				// 被滚动条卷去的文档高度
            };
        };

        // 获取浏览器视口大小
        $.win = function(win) {
            get(win);

            return {
                width: dom.clientWidth,
                height: dom.clientHeight
            };
        };
    })();

    // 微型模板引擎
    // Simple JavaScript Templating
    // Copyright (c) John Resig
    // MIT Licensed
    // http://ejohn.org/
    // @param {String} 可以是模板字符串也可以是装载模板HTML标签的ID
    // @param {Object} 给模板附加数据
    // @return {String} 解析好的模板
    (function() {
        var cache = {};
        $.tmpl = function tmpl(str, data) {
            var fn = !/\W/.test(str) ?
		  cache[str] = cache[str] ||
			tmpl(document.getElementById(str).innerHTML) :
		  new Function("obj",
			"var p=[],print=function(){p.push.apply(p,arguments);};" +
			"with(obj){p.push('" +
			str
			  .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('');");
            return data ? fn(data) : fn;
        };
    })();

    // 微型动画引擎
    // @param {HTMLElement} 元素
    // @param {Number} 开始数值
    // @param {Number} 结束数值
    // @param {Function} 运动中不断执行设置元素状态的函数. “this”指针指向变化的数值
    // @param {Function} 执行完毕后的函数
    // @param {Number} 速度. 默认300
    // @return {undefined}
    $.effect = function(elem, start, end, change, callback, speed) {
        speed = speed || 300;
        var sTime = +new Date(),
		eTime,
		val,
		iTimer = setInterval(function() {
		    eTime = (+new Date() - sTime) / speed;

		    if (eTime >= 1) {
		        change.call(end);
		        callback && callback.call(elem);

		        return clearInterval(iTimer);
		    };

		    val = start + (end - start) * ((-Math.cos(eTime * Math.PI) / 2) + 0.5);
		    change.call(val);
		}, 1);
    };

    if (!window.art) window.art = $;

    //-------------end
})();







//-------------Dialog应用模块
(function($) {

    // 透明渐变动画
    // @param {Number} 结束的透明度
    // @param {Function} 回调函数
    // @param {Number} 速度
    // @return {Object}
    $.fn.opacityFlash = function(end, fn, speed) {
        var elem = this[0],
		start = end === 0 ? 1 : 0,
		change = elem.filters ? function() {
		    elem.filters.alpha.opacity = this * 100;
		} : function() {
		    elem.style.opacity = this;
		};

        $.effect(elem, start, end, change, fn, speed);
        return this;
    };

    // CSS常规动画
    // @param {String} CSS属性名
    // @param {Number} 结束的值
    // @param {Function} 回调函数
    // @param {Number} 速度. 默认300
    // @return {Object}
    $.fn.cssFlash = function(name, end, fn, speed) {
        var elem = this[0],
		start = parseInt(this.css(name)),
		end = parseInt(end),
		change = function() {
		    try {
		        elem.style[name] = this + 'px';
		    } catch (_) {
		    };
		};

        $.effect(elem, start, end, change, fn, speed);
        return this;
    };

    // 清除文本选择
    $.clsSelect = window.getSelection ?
	function() {

	    try {
	        window.getSelection().removeAllRanges()
	    } catch (_) { };
	} :
	function() {
	    try {
	        document.selection.empty();
	    } catch (_) { };
	};

    // 元素可挪动边界算法
    // @param {Boolean} 是否静止定位，默认否
    // @param {Number} 指定其他宽度
    // @param {Number} 指定其他高度
    // @return {Object} 将返回最小、最大的Left与Top的值与居中的Left、Top值
    $.fn.limit = function(fixed, width, height) {
        var minX, minY, maxX, maxY, centerX, centerY;
        var win = $.win(),
		doc = $.doc();
        var winWidth = win.width,
		winHeight = win.height,
		docLeft = doc.left,
		docTop = doc.top,
		boxWidth = width || this[0].offsetWidth,
		boxHeight = height || this[0].offsetHeight;

        if (fixed) {
            minX = 0;
            maxX = winWidth - boxWidth;
            centerX = maxX / 2;
            minY = 0;
            maxY = winHeight - boxHeight;
            var hc = winHeight * 0.382 - boxHeight / 2; // 黄金比例垂直居中
            centerY = (boxHeight < 4 * winHeight / 7) ? hc : maxY / 2;
        } else {
            minX = docLeft;
            maxX = winWidth + minX - boxWidth;
            centerX = maxX / 2;
            minY = docTop;
            maxY = winHeight + minY - boxHeight;
            var hc = winHeight * 0.382 - boxHeight / 2 + minY; // 黄金比例垂直居中
            centerY = (boxHeight < 4 * winHeight / 7) ? hc : (maxY + minY) / 2;
        };
        if (centerX < 0) centerX = 0;
        if (centerY < 0) centerY = 0;
        //网页特殊布局修改center-22像素
        return { minX: minX, minY: minY, maxX: maxX, maxY: maxY, centerX: (centerX), centerY: centerY };
    };
    (function() {
        var regular, zIndex = 0;

        // 元素拖动模块
        // @param {Object}
        // @return {Object}
        $.fn.drag = function(options) {
            var data = options,
			defaults = $.fn.drag.defaults,
			limit, cache, isTemp, isDown, $move, $elem = this;

            // 合并默认配置
            for (var i in defaults) {
                if (data[i] === undefined) data[i] = defaults[i];
            };

            // 设置触点
            var on = $(data.on) || this;

            // 按下
            var down = function(event) {
                isDown = true;
                data.downFn && data.downFn();

                // 叠加高度			
                var old = $elem[0].style.zIndex || data.zIndex;
                zIndex = old > zIndex ? old : zIndex;
                zIndex++;

                // 缓存拖动相关的数据
                if (data.limit) limit = $elem.limit(data.fixed);
                // 被移动元素的属性缓存
                cache = function() {
                    var doc = $.doc();
                    return {
                        x: event.clientX,
                        y: event.clientY,
                        left: parseInt($elem[0].style.left),
                        top: parseInt($elem[0].style.top),
                        zIndex: zIndex,
                        width: $elem[0].offsetWidth,
                        height: $elem[0].offsetHeight,
                        docLeft: doc.left,
                        docTop: doc.top
                    };
                } ();

                // 对于超过预设尺寸的用替身代替拖动，保证流畅
                if (cache.width * cache.height >= data.showTemp) {
                    isTemp = true;

                    data.temp.css({
                        'width': cache.width - 2 + 'px',
                        'height': cache.height - 2 + 'px',
                        'left': cache.left + 'px',
                        'top': cache.top + 'px',
                        'zIndex': cache.zIndex,
                        'display': 'block'
                    });
                };

                $.clsSelect();
                regular = setInterval($.clsSelect, 20);

                document.body.setCapture && $elem[0].setCapture(); // IE下鼠标超出视口仍可被监听
                $(document).bind('mousemove', move).bind('mouseup', up);
            };

            //on.live('mousedown', down);
            jQuery(data.on).live("mousedown", down);

            // 移动
            var move = function(event) {
                if (isDown === false) return;

                $move = isTemp ? data.temp : $elem;
                var doc = $.doc();
                var x = event.clientX,
				y = event.clientY,
				l = cache.left - cache.x + x - cache.docLeft + doc.left,
				t = cache.top - cache.y + y - cache.docTop + doc.top;

                if (limit) {
                    if (l > limit.maxX) l = limit.maxX;
                    if (l < limit.minX) l = limit.minX;
                    if (t > limit.maxY) t = limit.maxY;
                    if (t < limit.minY) t = limit.minY;
                };

                $move.css({
                    'left': l + 'px',
                    'top': t + 'px'
                });
            };
            // 松开移动
            var up = function() {
                isDown = false;

                $(document).unbind('mousemove', move).unbind('mouseup', up);
                document.body.releaseCapture && $elem[0].releaseCapture(); // IE释放鼠标监控
                clearInterval(regular);

                if (isTemp) {
                    $elem.cssFlash('left', data.temp.css('left'), null, 150).
					cssFlash('top', data.temp.css('top'), function() {
					    data.upFn && data.upFn();
					}, 150);

                    data.temp.css('display', 'none');
                    isTemp = false;
                } else {
                    data.upFn && data.upFn();
                };
            };

            return this;
        };

        $.fn.drag.defaults = {
            on: null, 			// 触点
            downFn: null, 		// 按下后的回调函数
            upFn: null, 			// 松开后的回调函数
            fixed: false, 		// 是否静止定位
            limit: true, 		// 是否限制挪动范围 
            zIndex: 1, 			// 初始叠加高度
            temp: null, 			// 拖动用的替身元素
            showTemp: 100000		// 超过此面积的层使用替身代替拖动
        };
    })();

    // IE6 Fixed 支持模块
    var position;
    $(function() {

        // 给IE6 fixed 提供一个"不抖动的环境"
        // 只需要 html 与 body 标签其一使用背景静止定位即可让IE6下滚动条拖动元素也不会抖动
        // 注意：IE6如果 body 已经设置了背景图像静止定位后还给 html 标签设置会让 body 设置的背景静止(fixed)失效	
        $.isIE6 && $('body').css('backgroundAttachment') !== 'fixed' && $('html').css({
            backgroundImage: 'url(about:blank)',
            backgroundAttachment: 'fixed'
        });

        position = {
            fixed: $.isIE6 ?
		function(elem) {
		    var style = elem.style,
				doc = $.doc(),
				de = document.documentElement,
				de2 = '(document.documentElement)',
				left = parseInt(style.left) - de.scrollLeft,
				top = parseInt(style.top) - de.scrollTop;
		    this.absolute(elem);
		    style.setExpression('left', 'eval(' + de2 + '.scrollLeft + ' + left + ') + "px"');
		    style.setExpression('top', 'eval(' + de2 + '.scrollTop + ' + top + ') + "px"');
		} :
		function(elem) {
		    elem.style.position = 'fixed';
		},
            absolute: $.isIE6 ?
		function(elem) {
		    var style = elem.style;
		    style.position = 'absolute';
		    style.removeExpression('left');
		    style.removeExpression('top');
		} :
		function(elem) {
		    elem.style.position = 'absolute';
		}
        };
    });

    // 锁屏遮罩 && 对话框替身 && iframe遮罩 
    // 防止IE6锁屏遮罩被下拉控件穿透
    // 防止拖动时光标落入iframe导致指针捕获异常
    var publicTemplate = '\
	<div id="uiIframeMask"></div>\
	<div id="uiOverlay"><div>\
		<!--[if IE 6]><iframe src="about:blank"></iframe><![endif]-->\
	</div></div>\
	<div id="uiTempWrap"><div id="uiTemp">\
		<!--[if IE 6]><iframe src="about:blank"></iframe><![endif]-->\
	</div></div>\
	';
     var template = '\
  <div id="<%=id%>" class="ui-dialog-w">\
  <% var _css = "ui-dialog ui-dialog-focus";\
	if (!title) _css += " ui-dialog-noTitle";\
  	if (!drag) _css += " ui-dialog-noDrag";\
  %>\
  <div id="<%=id%>Dialog" class="<%=_css%>">\
            <table>\
                <tr><td class="ui-dialog-lt"></td><td class="ui-dialog-t"></td><td class="ui-dialog-rt"></td></tr>\
                <tr><td class="ui-dialog-l"></td>\
                    <td class="ui-dialog-c" id="<%=id%>DialogContent">\
                        <div class="<%="ui-dialog-" + icon%> ui-dialog-i"  style="width:<%=minWidth%>px;">\
                            <% if (title) { %>\
                            <div class="ui-dialog-header">\
                                <div class="ui-dialog-title"><%=title%></div>\
					  	        <a class="ui-dialog-close" href="#"><%=closeText%></a>\
                            </div>\
                            <% } %>\
                            <div class="ui-dialog-content">\
                                <div class="ui-dialog-content-i"><%=content%></div>\
                                <div class="loadingTip"><%=loadingTip%></div>\
                            </div>\
                            <% if (yesFn || noFn) { %>\
                            <div class="ui-dialog-footer">\
                                <% if (yesFn) { %><span class="btn-submit"><button class="ui-dialog-yes"><%= yesText%></button></span><% } %>\
						        <% if (noFn) { %><span class="btn-reset"><button class="ui-dialog-no"><%=noText%></button></span><% } %>\
                            </div>\
                            <% } %>\
                            <div class="ui-dialog-content-mark"></div>\
                        </div>\
                    </td>\
                    <td class="ui-dialog-r"></td>\
                </tr>\
                <tr><td class="ui-dialog-lb"></td><td class="ui-dialog-b"></td><td class="ui-dialog-rb"></td></tr>\
            </table>\
            <!--[if IE 6]><iframe id="<%=id%>ie6SelectMask" class="aui_ie6_select_mask" src="about:blank"></iframe><![endif]-->\
        </div>\
    </div>';

    var count = 0,
	loadList = [],
	lockList = [],
	dialogList = {},
	$html = $('html'),
	isFilters = ('filters' in document.documentElement),
    //lockMouse = ['DOMMouseScroll', 'mousewheel', 'scroll', 'contextmenu'],
	lockMouse = ['contextmenu'],
	$iframe_mask, $temp_wrap, $temp, $overlay, topBoxApi, lockBoxApi, lockClick,
	topBox, zIndex, dialogReady, docMouse, docKey;

    // 对话框核心
    // @param {Object}
    // @param {Object}
    // @return {Object}
    var dialog = function(data) {
        
        // 解析模板并插入文档
        data.tmpl && (data.content = $.tmpl(data.tmpl, data.content));
        var html = $.tmpl(template, data);
        $('body').append(html);
        // 获取DOM
        var id = '#' + data.id;
        var ui = {
            wrap: $(id), 							// 外套
            dialog: $(id + 'Dialog'), 				// 对话框
            dialogContent: jQuery(id + ' .ui-dialog-c'), // 内容区外套 决定宽度
            idialogContent: jQuery(id + ' .ui-dialog-i'), // 内容区外套 决定宽度
            title: jQuery(id + ' .ui-dialog-title'), 			   // 标题拖动触点
            content: jQuery(id + " .ui-dialog-content"), 		   // 内容 决定高度
            yesBtn: jQuery(id + ' .ui-dialog-yes'), 				   // 确定按钮
            noBtn: jQuery(id + ' .ui-dialog-no'), 				   // 取消按钮
            closeBtn: jQuery(id + ' .ui-dialog-close'), 			   // 关闭按钮
            ie6_select_mask: $(id + 'ie6SelectMask')	// IE6 下拉控件遮罩
        };

        // 缓存属性
        var winWidth, winHeight, docLeft, docTop, boxWidth, boxHeight, boxLeft, boxTop;
        var refreshCache = function() {
            var win = $.win(),
			doc = $.doc();
            winWidth = win.width;
            winHeight = win.height;
            docLeft = doc.left;
            docTop = doc.top;
            boxWidth = ui.dialog[0].offsetWidth;
            boxHeight = ui.dialog[0].offsetHeight;
        };
        refreshCache();
        var isInstall, timer, ie6SelectMask, $follow = null;

        // 锁屏
        var lock = {
            on: function() {
                lockList.push(api);

                position.fixed(ui.dialog[0]);
                lock.zIndex();

                // 限制按键
                if (!docKey) docKey = function(event) {
                    var key = event.keyCode;
                    // 切换按钮焦点
                   // (key === 37 || key === 39 || key === 9) && lockBoxApi.focus();
                };

                // 遮罩点击
                if (!lockClick) lockClick = function(event) {
                    data.lockClick ? lockBoxApi.close && lockBoxApi.close() : docMouse(event);
                };

                // 限制鼠标
                if (!docMouse) docMouse = function(event) {
                    $.stopBubble(event);
					$.stopDefault(event);
                };

                if (lockList.length === 1) {
                    // 绑定全局事件中断用户操作
                    $(document).bind('keydown', docKey);
                    $.each(lockMouse, function(i, name) {
                        $(document).bind(name, docMouse);
                    });

                    // 绑定遮罩点击事件
                    $overlay.bind('click', lockClick);

                    // 对现代浏览器优雅的消除滚动条实现全屏锁定
                    var noCenter = $('body').css('backgroundPosition');
                    noCenter = noCenter && noCenter.split(' ')[0];
                    noCenter = noCenter !== 'center' && noCenter !== '50%';
                    noCenter && $.doc().height > winHeight && $html.addClass('ui-page-full');

                    // 显示遮罩
                    data.effect && !isFilters ?
					$overlay.addClass('ui-dialog-opacity').opacityFlash(1) :
					$overlay.removeClass('ui-dialog-opacity');
                    $html.addClass('ui-page-lock');

                };
                // 对话框中部分操作不受全局的限制
                ui.dialog.bind('contextmenu', function(event) {
                    $.stopBubble(event);
                });
                ui.dialog.bind('keydown', function(event) {
                    var key = event.keyCode;
                    if (key === 9 || key === 38 || key === 40 || key === 8) $.stopBubble(event);
                });

                lockBoxApi = api;
            },

            // 关闭锁屏
            off: function(fn) {
                lockList.splice(lockList.length - 1, 1);

                var out = function() {

                    if (lockList.length === 0) {// 只有一个对话框在调用锁屏
                        $html.removeClass('ui-page-lock');
                        $html.removeClass('ui-page-full');
                        $.each(lockMouse, function(i, name) {
                            $(document).unbind(name, docMouse); // 解除页面鼠标操作限制
                        });
                        $(document).unbind('keydown', docKey); // 解除屏蔽的按键
                        docKey = docMouse = null;
                        lockList = [];
                    } else {
                        // 多个调用锁屏的对话框支持ESC键连续使用
                        lockBoxApi = topBoxApi = lockList[lockList.length - 1].zIndex();
                    };

                    fn && fn();
                };

                data.effect && lockList.length === 0 && !isFilters ?
				$overlay.opacityFlash(0, out) : out();
            },

            // 叠加高度
            zIndex: function() {
                $overlay.css('zIndex', zIndex);
                $iframe_mask.css('zIndex', zIndex);
            }
        };

        // 控制接口
        // 每个对话框实例都会返回此接口
        // 按钮回调函数的"this"指向此接口
        // 调用存在id名称对话框不会执行，而是返回此接口
        var api = {
            // 内容
            content: function(content, type) {
                if (content === undefined) {
                    return ui.content;
                } else {
                    api.loading.off().zIndex().focus();
                    if ("1" == type) {
                        ui.dialogContent.html(content);
                    }
                    else {
                        ui.content.html(content);
                    }
                    return api;
                };
            },
            title: function(title) {
                if (title === undefined) {
                    return ui.title.text();
                } else {
                    ui.title.html(title);
                    return api;
                };
            },
            // 重置对话框大小
            size: function(width, height, fn) {
                var dw, dh, w, h;
                var td = ui.idialogContent;
                var dContent = ui.content;
                dContent.css({
                    'overflow': ''
                });
                dw = td.width();
                dh = ui.content.height();

                if (!width) width = data.width;
                if (!height) height = data.height;
                w = width;
                h = height;
                if (data.maxWidth != "auto" && dw > data.maxWidth) {
                    w = data.maxWidth; ;
                    dContent.css({ 'overflow': 'auto' });
                }
                if (data.maxHeight != "auto" && dw > data.maxHeight) {
                    h = data.maxHeight;
                    dContent.css({ 'overflow': 'auto' });
                }
                ready = function() {
                    ie6SelectMask();
                    fn && fn.call(api);
                };

                data.width = w;

                data.height = h;
                if (w != "auto") {
                    if (w <= data.minWidth) {
                        w = data.minWidth;
                    }
                    w = w + "px";
                } else {
                    if (dw <= data.minWidth) {
                        w = data.minWidth;
                    }
                }
                if (h != "auto") {
                    h = h + "px";
                }
                //alert(w);
                td.css({
                    'width': w
                });
                dContent.css({
                    'height': h
                });
                ready();

                return api;
            },
            // 坐标定位
            position: function(left, top, fixed) {
                fixed = fixed || data.fixed || false;
                isInstall && refreshCache();
                // 防止Firefox、Opera在domReady调用对话框时候获取对象宽度不正确,
                // 导致对话框left参数失效
                ui.dialog[0].style.position = 'absolute';

                var limit = ui.dialog.limit($.isIE6 ? false : fixed);

                if (left === undefined || left === 'center') {
                    boxLeft = limit.centerX;
                } else if (left === 'left') {
                    boxLeft = limit.minX;
                } else if (left === 'right') {
                    boxLeft = limit.maxX;
                } else if (typeof left === 'number') {
                    if (data.limit) {
                        left = left > limit.maxX ? limit.maxX : left;
                        left = left < limit.minX ? limit.minX : left;
                    };
                    boxLeft = left;
                };

                if (top === undefined || top === 'center') {
                    boxTop = limit.centerY;
                } else if (top === 'top') {
                    boxTop = limit.minY;
                } else if (top === 'bottom') {
                    boxTop = limit.maxY;
                } else if (typeof top === 'number') {
                    if (data.limit) {
                        top = top > limit.maxY ? limit.maxY : top;
                        top = top < limit.minY ? limit.minY : top;
                    };
                    boxTop = top;
                };

                data.left = left;
                data.top = top;

                if (data.effect && isInstall) {
                    ui.dialog.cssFlash('left', boxLeft).
					cssFlash('top', boxTop);
                } else {
                    ui.dialog.css({
                        'left': boxLeft + 'px',
                        'top': boxTop + 'px'
                    });
                };
                if (fixed)
                    position.fixed(ui.dialog[0]);

                return api;
            },

            // 跟随元素
            follow: function(elem) {
                if (!elem) return api;

                if (typeof elem === 'string') elem = $(elem)[0] || $('#' + elem)[0];

                // 删除旧的安装标记
                $follow && $follow[0].artDialog && ($follow[0].artDialog = null);

                // 给元素做个新的安装标记
                elem.artDialog = data.id;

                $follow = $(elem);
                data.follow = elem;

                // 刷新缓存
                isInstall && refreshCache();

                // 适应页边距
                var w = (boxWidth - $follow[0].offsetWidth) / 2,
				h = $follow[0].offsetHeight,
				p = $follow.offset(),
				l = p.left,
				t = p.top;
                if (w > l) w = 0;
                if (t + h > docTop + winHeight - boxHeight) h = 0 - boxHeight;

                return api.position(l + docLeft - w, t + h);
            },

            // 加载提示
            loading: {
                on: function() {
                    ui.dialog.addClass('ui-dialog-loading');
                    return api;
                },
                off: function() {
                    ui.dialog.removeClass('ui-dialog-loading');
                    return api;
                }
            },

            // 置顶对话框
            zIndex: function() {
                zIndex++;
                ui.dialog.css('zIndex', zIndex);
                lockList.length === 0 && $iframe_mask.css('zIndex', zIndex);

                // IE6与Opera叠加高度受具有绝对或者相对定位的父元素z-index控制
                ui.wrap.css('zIndex', zIndex);
                $temp_wrap.css('zIndex', zIndex + 1);

                // 点亮顶层对话框
                topBox && topBox.removeClass('ui-dialog-focus');
                topBox = ui.dialog;
                topBox.addClass('ui-dialog-focus');

                // 保存顶层对话框的AIP
                topBoxApi = api;
                return api;
            },

            // 元素焦点处理
            focus: function(elem) {
                if (typeof elem === 'string') elem = jQuery(elem).get(0);
                elem = ($.isElem(elem) && elem) || ui.noBtn.get(0) || ui.yesBtn.get(0);
                // 延时可防止Opera会让页面滚动的问题
                // try可以防止IE下不可见元素设置焦点报错的问题
                setTimeout(function() {
                    try {
                        elem.focus();
                    } catch (_) { };
                }, 40);

                return api;
            },

            // 显示对话框
            show: function(fn) {
                // 对原生支持opacity浏览器使用特效
                // IE7、8浏览器仍然对PNG启用滤镜“伪”支持，如果再使用透明滤镜会造成PNG黑边
                // 想支持IE透明褪色？忍痛割爱不使用PNG做皮肤即可
                data.effect && !isFilters ?
				ui.dialog.addClass('ui-dialog-opacity').opacityFlash(1, fn, 150) :
				fn && fn();
                ui.wrap.css('visibility', 'visible');

                return api;
            },

            // 隐藏对话框
            hide: function(fn) {
                var fn2 = function() {
                    var o = ui.dialog[0].style.opacity;
                    if (o) o = null;
                    ui.wrap.css('visibility', 'hidden');
                    fn && fn();
                };

                data.effect && !isFilters ?
				ui.dialog.removeClass('ui-dialog-opacity').opacityFlash(0, fn2, 150) :
				fn2();

                return api;
            },

            // 关闭对话框
            close: function() {
                var tempDialog = dialogList[data.id];
                if (!tempDialog) return null;
                // 停止计时器
                api.time();

                dialogList && dialogList[data.id] && delete (dialogList[data.id]);
                data.lock && ui.dialog.css('visibility', 'hidden');

                var closeFn = function() {

                    if ($follow && $follow[0]) $follow[0].artDialog = null;
                    if (api === topBoxApi) topBoxApi = null;
                    if (topBox === ui.dialog) topBox = null;

                    // 在文档中删除对话框所有节点与引用
                    var remove = function() {

                        // 执行关闭回调函数
                        data.closeFn && data.closeFn.call(api, window);
                        // 从文档中移除对话框节点
                        ui.wrap.remove();

                        $.each(api, function(name) {
                            delete api[name];
                        });
                        api = null;
                    };
                    api.hide(remove);
                };
                data.lock ? lock.off(closeFn) : closeFn();

                return null;
            },

            // 定时器关闭对话框
            time: function(second) {
                timer && clearTimeout(timer);
                if (second){ timer = setTimeout(function() {
                    api.closeFn();
                    clearTimeout(timer);
                }, 1000 * second);
                
                }

                return api;
            },

            // 确定按钮行为
            yesFn: function() {
                return typeof data.yesFn !== 'function' || data.yesFn.call(api, window) !== false ?
				api.close() : api;
            },

            // 取消按钮行为
            noFn: function() {
                return typeof data.noFn !== 'function' || data.noFn.call(api, window) !== false ?
				api.close() : api;
            },
            // 关闭按钮行为
            closeFn: function(event) {
                event && $.stopDefault(event);
				var fn =  data.noFn;				
                return typeof fn !== 'function' || fn.call(api, window) !== false ?
				api.close() : api;
            },
            bindDrag: function(cssExpr) {
                // 启用拖动支持
                data.drag && id && ui.dialog.drag({
                    on: cssExpr, 							// 触点
                    fixed: $.isIE6 ? false : data.fixed, 	// 是否静止定位
                    temp: $temp, 							// 替身
                    showTemp: data.showTemp, 				// 超过此面积采用替身
                    zIndex: data.zIndex, 					// 初始叠加高度
                    limit: data.limit, 						// 限制挪动范围
                    downFn: function() {							// 按下
                        data.fixed && position.fixed($temp[0]);
                        //if (data.lock) lockBoxApi = api;
                        //api.zIndex().focus();
                        ui.dialog.addClass('ui-dialog-move');
                        $html.addClass('ui-page-move');
                    },
                    upFn: function() {							// 松开
                        $.isIE6 && data.fixed && position.fixed(ui.dialog[0]);
                        position.absolute($temp[0]);
                        ui.dialog.removeClass('ui-dialog-move');
                        $html.removeClass('ui-page-move');
                    }
                });

            },
            // {供外部插件访问}
            ui: ui, 	// 结构
            data: data	// 配置

        };
        data.onPreRender && data.onPreRender.call(api);
        if (data.lock) {
            //data.fixed = true;
            data.follow = null;
        };
        if (data.follow) data.fixed = false;
        // 判断样式类是否存在
        function hasClass(className, name) {
            var reg = new RegExp('(\\s|^)' + name + '(\\s|$)');
            return className.match(reg) ? true : false; ;
        }

        // 监听对话框中鼠标的点击
        ui.dialog.live('click', function(event) {
            var node = this.nodeName.toLowerCase();
            $cur = this.className;
            if (hasClass($cur, "ui-dialog-yes")) {
                api.yesFn();
            }
            else if (hasClass($cur, "ui-dialog-no")) {
                api.noFn();
            }
            else if (hasClass($cur, "ui-dialog-close")) {
                api.closeFn(event);
            }
            else {
                node === 'td' || node === 'div' && api.zIndex();
                ie6SelectMask();
            }
        });

        // 给确定按钮添加一个 Ctrl + Enter 快捷键
        // 只对消息内容有按键交互操作的对话框生效
        ui.content.bind('keyup', function(event) {
            event.keyCode === 27 && $.stopBubble(event); // 防止输入的过程中按ESC退出
            event.ctrlKey && (event.keyCode === 13) && api.yesFn();
        });

        // 固化对话框
        // 防止自适应结构遇到边界会自动瘦身
        // 副作用：固化后对异步写入的内容自适应机制可能会异常
        !data.limit && ui.dialog.css({
            width: ui.dialog[0].clientWidth + 'px',
            height: ui.dialog[0].clientHeight + 'px'
        });

        // 处理让IE6支持PNG皮肤
        // IE6 无法原生支持具有阿尔法通道的PNG格式图片，但可以采用滤镜支持
        // 使用滤镜比较麻烦的地方在于它CSS中定义的图片路径是针对HTML文档，所以最好采用绝对路径
        if ($.isIE6) {
            var list = ui.wrap[0].getElementsByTagName('*');
            $.each(list, function(i, elem) {
                // 获取皮肤CSS文件定义的“ie6png”属性
                var png = $(elem).css('ie6png'),
				pngPath = $.dialog.defaults.path + png;
                if (png) {
                    elem.style.backgroundImage = 'none';
                    elem.runtimeStyle.filter = "progid:DXImageTransform.Microsoft." +
					"AlphaImageLoader(src='" + pngPath + "',sizingMethod='crop')";
                };
                png = pngPath = null;
            });
        };

        // IE6覆盖下拉控件的遮罩
        // 原理：每个对话框下使用一个同等大小的iframe强制遮盖下拉控件
        ie6SelectMask = function() {
            ui.ie6_select_mask[0] && ui.ie6_select_mask.css({
                'width': ui.dialog[0].offsetWidth,
                'height': ui.dialog[0].offsetHeight
            });
        };
        // 显示对话框
        api.zIndex();
        data.time && api.time(data.time);
        data.lock && lock.on();
        data.follow ? api.follow(data.follow) : api.position(data.left, data.top, data.fixed);
        data.show && api.show();
        // 启用拖动支持
        api.bindDrag(id + " .ui-dialog-title");
        ie6SelectMask();
        setTimeout(ie6SelectMask, 40); // 有时候IE6还得重新执行一次才有效

        // 智能定位按钮焦点
        data.focus && api.focus(data.focus);



        //自定义模板第一次content的内容输出数据到dialogContent里面
        if ("profile" == data.type) {
            api.content(data.content, 1);
        }

        // 执行定义的初始化函数
        data.initFn && data.initFn.call(api, window);
        api.size(data.width, data.height);
        data.follow ? api.follow(data.follow) : api.position(data.left, data.top, data.fixed);
        // 设置安装标记
        isInstall = true;

        $(window).bind('unload', function() {
            if (!api) return;
            data.effect = false;
            api.close;
        });



        return api;
    };

    // 对话框入口代理
    // @param {Object}
    // @param {Function}
    // @param {Function}
    // @return {Object}
    $.fn.dialog = function(options, yesFn, noFn) {

        // 调用其他窗口的对话框
        var win = options.window || $.dialog.defaults.window;
        if (typeof win === 'string' && win !== 'self') win = window[win];
        // IE8要注意:
        // window.top === window 为 false
        // window.top == window 为 true
        if (win && window != win && win.art && win.art.dialog) {
            options.window = false;
            return win.art.dialog(options, yesFn, noFn);
        };

        var data = options || {},
		defaults = $.dialog.defaults;
         
        // 判断参数类型
        if (typeof data === 'string') data = { content: data, fixed: true };
        //if (typeof data.width === 'number') data.width = data.width + 'px';
        //if (typeof data.height === 'number') data.height = data.height + 'px';

        if (document.compatMode === 'BackCompat') return alert(data.content);

        // 整合跟随模式到主配置
        data.follow = this[0] || data.follow;

        // 整合按钮回调函数到主配置
        data.yesFn = data.yesFn || yesFn;
        data.noFn = data.noFn || noFn;

        // 如果此时对话框相关文件未就绪则储存参数，等待就绪后再统一执行
        if (!dialogReady) return loadList.push(data);

        // 返回同名ID对话框API
        if (dialogList[data.id]) return dialogList[data.id].zIndex().show().focus();

        // 返回跟随模式重复的调用
        if (data.follow) {
            var elem = data.follow;
            if (typeof elem === 'string') elem = $('#' + elem)[0];
            if (elem.artDialog) return dialogList[elem.artDialog].
			follow(elem).zIndex().show().focus();
        };

        // 生成唯一标识
        count++;
        data.id = data.id || 'uiDialog' + count;

        // 合并默认配置
        for (var i in defaults) {
            if (data[i] === undefined) 
            {data[i] = defaults[i];
            //if(defaults[i]=="确定"){data[i]=DB.core.getlan(4,"OK","\u786E\u5B9A");}
           // if(defaults[i]=="取消"){data[i]=DB.core.getlan(4,"Cancel","\u53D6\u6D88");}
           // if(defaults[i]=="提示"){data[i]=DB.core.getlan(4,"Tips","提示");}
            }
        };

        // 获取多个对话框中zIndex最大的
        zIndex = zIndex || data.zIndex;
        // 使用第一个皮肤
        if ($.isArray(data.skin)) data.skin = data.skin[0];

        return dialogList[data.id] = dialog(data);
    };

    $.dialog = $().dialog;

    // 对外暴露默认配置
    var defaults = {

        // {模板需要的}
        title: '\u63D0\u793A', 	// 标题. 默认'提示'
        type: "system",
        tmpl: null, 				// 供插件定义内容模板 [*]
        content: null, 			// 内容
        yesFn: null, 			// 确定按钮回调函数
        noFn: null, 				// 取消按钮回调函数
        yesText: '\u786E\u5B9A', // 确定按钮文本. 默认'确定'
        noText: '\u53D6\u6D88', 	// 取消按钮文本. 默认'取消'
        width: 'auto', 			// 宽度
        height: 'auto', 			// 高度
        minWidth: 'a', 			// 最小宽度
        minHeight: 100, 		// 最小高度
        maxWidth: 'auto', 			// 最大宽度
        maxHeight: 'auto', 		// 最大高度
        skin: 'default', 		// 皮肤
        icon: 'system',    	   // 消息图标
        border: true, 			// 是否有边框
        loadingTip: '', // 加载状态的提示
        closeText: '\xd7', 		// 关闭按钮文本. 默认'�'

        // {逻辑需要的}
        fixed: true, 			// 是否静止定位
        focus: false, 			// 是否自动聚焦
        window: 'self', 			// 设定弹出的窗口 [*]
        esc: true, 				// 是否支持Esc键关闭
        effect: false, 			// 是否开启特效
        lock: true, 			// 是否锁屏
        lockClick: false, 		// 点击锁屏遮罩是否关闭对话框
        left: 'center', 			// X轴坐标
        top: 'center', 			// Y轴坐标
        time: null, 				// 自动关闭时间
        initFn: null, 			// 对话框初始化后执行的函数
        closeFn: null, 			// 对话框关闭执行的函数
        follow: null, 			// 跟随某元素
        drag: true, 				// 是否支持拖动
        limit: true, 			// 是否限制位置
        loadBg: true, 			// 预先加载皮肤背景
        path: "1", 		// 当前JS路径. 供插件调用其他文件 [*]
        show: true, 				// 是否显示
        zIndex: 1989, 			// 对话框最低叠加高度值(重要：此值不能过高，否则会导致Opera、Chrome等浏览器表现异常) [*]
        showTemp: 360000			// 指定超过此面积的对话框拖动的时候用替身 360000 [*]

    };
    $.fn.dialog.defaults = window.artDialogDefaults || defaults;

    // 开启IE6 CSS背景图片缓存，防止它耗费服务器HTTP链接资源
    try {
        document.execCommand('BackgroundImageCache', false, true);
    } catch (_) { };

    // DOM就绪后才执行的方法
    var allReady = function() {
        // 载入核心CSS文件
        if (!dialogReady) {
            dialogReady = true;
        }
        $('body').append(publicTemplate);
        $iframe_mask = $('#uiIframeMask');
        $overlay = $('#uiOverlay');
        $temp_wrap = $('#uiTempWrap');
        $temp = $('#uiTemp');

        // 监听全局键盘
        var esc = function(event) {
            event.keyCode === 27 && topBoxApi && topBoxApi.data.esc &&
		    topBoxApi.closeFn(); // Esc
        };
        $(document).bind('keyup', esc);

if (!('ontouchend' in document)) {
        // 监听浏览器窗口变化
        // 调节浏览器窗口后自动重置位置
        // 通过延时控制各个浏览器的调用频率
        var delayed,
		docH = $.doc();
        var winResize = function() {
            delayed && clearTimeout(delayed);

            // 防止IE 页面大小变化也导致执行onresize的BUG
            var o = docH;
            docH = $.doc();
            if (Math.abs(o.height - docH.height) > 0 ||
			Math.abs(o.width - docH.width) === 17) return clearTimeout(delayed);

            delayed = setTimeout(function() {
                $.each(dialogList, function(name, val) {
                    val.data.follow ?
					val.follow(val.data.follow) :
					(typeof val.data.left === 'string' ||
						typeof val.data.top === 'string') &&
					val.position(val.data.left, val.data.top);
                });
                clearTimeout(delayed);
            }, 150);
        };
        $(window).bind('resize', winResize);
};

        // 批量执行文档未就绪前的请求
        if (loadList.length > 0) {
            $.each(loadList, function(i, name) {
                $.dialog(name);
            });
            loadList = null;
        };
    };
    $(allReady);

    // 指定窗口植入自身
    $.fn.dialog.inner = function(win, fn) {
        // iframe跨域没有权限操作
        try {
            win.document;
        } catch (_) {
            return;
        };
        // frameset
        if (win.document.getElementsByTagName('frameset').length !== 0)
            return win.parent.document.getElementsByTagName('frameset').length === 0 ? $.fn.dialog.inner(win.parent, fn) : false;

        $(function() {
            // IE8要注意:
            // window.top === window 为false
            // window.top == window 为true
            if (win == window) return;
            if (win.art) {
                fn && fn();
            } else {
                win.artDialogDefaults = $.fn.dialog.defaults;
                win.artDialogDefaults.loadBg = false;
                var url = $.getArgs === '' ? $.getUrl : $.getUrl + '?' + $.getArgs;
                $.getScript(url, fn, win.document);
            };
        });
    };
    $.dialog.inner(window.parent);

    $.fn.dialog.dialogList = dialogList;

})(art);
//-------------end
//-------------dialog扩展包[此部分是独立的，不需要可以删除]

var isDialogTipsOpen = false;
(function($, jq) {

    var _alert = window.alert;
    var _name = 'ui';
    var _html = function(elem, content) {
        jq(elem).html(content);
    };
    var _load = function(url, fn, cache) {
        jq.ajax({
            url: url,
            success: function(data) {
                fn && fn(data);
            },
            cache: cache
        });
    };
    $.fn.dialog.parent = window;
    /**
    * 获得指定对话框
    * $.dialog.get("id");
    */
    $.fn.dialog.get = function(id, win) {
        win = win || window;
        return win.art.dialog.dialogList[id];
    };
    /**
    * 关闭对话框
    * $.dialog.close("id");
    * 
    */
    $.fn.dialog.close = function(id, win) {
        win = win || window;
        var d = win.art.dialog.dialogList[id];
        if (!!d) {
            d.close();
        }
    };
    /**
    * 警告
    * $.dialog.alert("",function(dApi){});
    * @param {String} 消息内容
    * @return {Object} 对话框操控接口
    */
    $.fn.dialog.alert = function(content, func) {
 
        content = '<div class="dialogTips fixfloat"><div class="ui-dialog-icon"><span></span></div><div class="ui-dialog-text">' + content + '</div></div>';
        return $.dialog({
            id: _name + 'Alert', 
           
            icon: "alert",
            maxWidth: 600,
            width: 350,
            window: 'top',
            content: content,
            yesFn: function(here) {
                if (typeof (func) === 'function') {
                    func.call(this, here);
                }
                return true;
            }
        });
    };
    /**
    * 确认
    * @param {String} 消息内容
    * @param {Function} 确定按钮回调函数
    * @param {Function} 取消按钮回调函数
    * @return {Object} 对话框操控接口
    */
    $.fn.dialog.confirm = function(content, yes, no) {
 
        content = '<div class="dialogTips fixfloat"><div class="ui-dialog-icon"><span></span></div><div class="ui-dialog-text">' + content + '</div></div>';
        return $.dialog({
            id: _name + 'Confirm',
            icon: "confirm",
            content: content,
            maxWidth: 600,
            width: 350,
            window: 'top',
            yesFn: function(here) {
                return yes && yes.call(this, here);
            },
            noFn: function(here) {
                return no && no.call(this, here);
            }
        });
    };
    /**
    * 提问
    * @param {String} 提问内容
    * @param {Function} 回调函数. 接收参数：输入值
    * @param {String} 默认值
    * @return {Object} 对话框操控接口
    */
    $.fn.dialog.prompt = function(content, yes, value) {
 
        value = value || '';
        var input = _name + 'PromptInput';
        content = '<div class="dialogTips fixfloat"><div class="ui-dialog-icon"><span></span></div><div class="ui-dialog-text"><div class="label">' + content + '</div><div class="filed"><input id="' + input + '" value="' + value + '" type="text"  /></div></div></div>';
        return $.dialog({
            id: _name + 'Prompt',
            icon: 'prompt',
            content: content,
            maxWidth: 600,
            width: 350,
            window: 'top',
            focus: input,
            yesFn: function(here) {
                return yes && yes.call(this, here.art('#' + input)[0].value, here);
            },
            noFn: true
        });
    };
    /**
    * 提示
    * @param {String} 提示内容
    * @param {Number} 显示时间
    * @return {Object} 对话框操控接口
    */
    $.fn.dialog.tips = function(content, type, time) {
        var icon = type;
        if ("number" == typeof (type)) {
            switch (type) {
                default:
                case 1:
                    icon = "succeed"; //恭喜您，您的操作已成功！
                    if (!content)
                        content = "恭喜您，您的操作已成功！";
                    break;
                case 2:
                    icon = "failed"; //对不起，操作失败！
                    if (!content)
                        content = "对不起，您的操作失败！";
                    break;
                case 3:
                    icon = "correct"; //恭喜、奖励、激励、通过等操作！
                    if (!content)
                        content = "恭喜您，成功通过！";
                    break;
                case 4:
                    icon = "forbidden"; //对不起，你不可以***，你可以***！
                    if (!content)
                        content = "对不起，您没有权限进行该操作！";
                    break;
            }
        }
        if (!content) {
            switch (icon) {
                default:
                case "succeed":
                    content = "恭喜您，您的操作已成功！";
                    break;
                case "failed":
                    content = "对不起，您的操作失败！";
                    break;
                case "correct":
                    content = "恭喜您，成功通过！";
                    break;
                case "forbidden":
                    content = "对不起，您没有权限进行该操作！";
                    break;
            }
        }
        var miao='';//DB.core.getlan(3,"after3seconds","3秒后自动关闭");
        content = '<div class="dialogTips fixfloat"><div class="ui-dialog-icon"><span></span></div><div class="ui-dialog-text">' + content + '</div><div class="closeTip">'+miao+'</div></div>';
        function closeTips() {
            var doc = jQuery(document);
            doc.data("uiTipsClickCount", doc.data("uiTipsClickCount") + 1);
            if (!isDialogTipsOpen) {
                isDialogTipsOpen = window.setInterval(function() {
                    if (doc.data("uiTipsClickCount") >= 2) {
                        //alert(isDialogTipsOpen);
                        if (!!isDialogTipsOpen) {
                            $.dialog.close("uiTips");
                        }
                        doc.data("uiTipsClickCount", 0);
                        window.clearInterval(isDialogTipsOpen);
                        isDialogTipsOpen = null;
                    }
                }, 100);
            }
        } 
        return $.dialog({
            id: _name + 'Tips',
            icon: icon,
            content: content,
            maxWidth: 600,
            width: 350,
            lock: false,
            drag: false,
            window: 'top',
            onPreRender: function() {
                jQuery(document).data("uiTipsClickCount", 0);
            },
            initFn: function() {
                jQuery(document).bind("click", closeTips);
            },
            closeFn: function() {
                jQuery(document).unbind("click", closeTips);
            },
            time: time || 3
        });
    };
    /**
    * Ajax生成内容
    * @param {String} url
    * @param {Object, String} 配置参数. 传入字符串表示使用模板引擎解析JSON生产内容
    * @param {Boolean} 是否允许缓存. 默认true
    * @return {Object} 对话框操控接口
    */
    $.fn.dialog.load = function(url, options, cache) {
        cache = cache || false;
        var opt = options || {},
		tmpl = typeof opt === 'string' ? opt : null,
		ajaxLoad,
		data = {
		    window: 'top',
		    content: 'loading..',
		    initFn: function(here) {
		        var api = this;
		        api.loading.on();
		        _load(url, function(content) {
		            api.data.effect = false;
		            if (tmpl) content = $.tmpl(tmpl,
						window.JSON && JSON.parse ?
						JSON.parse(content) :
						eval('(' + content + ')'));
		            _html(api.ui.content[0], content);
		            api.data.left === 'center' && api.data.top === 'center' && api.position('center', 'center');

		            api.loading.off();
		            opt.initFn && opt.initFn.call(api, here);
		        }, cache);

		    },
		    closeFn: function(here) {
		        opt.closeFn && opt.closeFn.call(this, here);
		    }
		};

        if (opt.tmpl) {
            tmpl = opt.tmpl;
            opt.tmpl = null;
        };

        for (var i in opt) {
            if (data[i] === undefined) data[i] = opt[i];
        };

        var dig = $.dialog(data);
    };
    /**
    * 弹窗
    * @param {String} iframe地址
    * @param {Object} 配置参数. 这里传入的回调函数接收的第1个参数为iframe内部window对象
    * @return {Object} 对话框操控接口
    */
    $.fn.dialog.open = function(url, options) { 
        var load, $iframe, iwin,
		opt = options,
		id = _name + 'Open',
		data = { 
		    window: 'top',
		    content: { url: url },
		    tmpl: '<iframe class="' + id + '" src="<%=url%>" frameborder="0" allowtransparency="true"></iframe>',
		    initFn: function(here) {
		        var api = this;
		        $iframe = $('iframe', api.ui.content[0]);
		        iwin = $iframe[0].contentWindow;
		        api.loading.on();
		        load = function() {
		            // 植入artDialog文件
		            $.dialog.inner(iwin, function() {
		                // 给当前对话框iframe里面扩展一个关闭方法
		                iwin.art.fn.dialog.close = function() {
		                    api.close();
		                };
		                // 传递来源window对象
		                iwin.art.fn.dialog.parent = window;
		            });

		            api.data.effect = false;

		            // 探测iframe内部是否可以被获取，通常只有跨域的下获取会失败
		            // google chrome 浏览器本地运行调用iframe也被认为跨域
		            if (api.data.width === 'auto' && api.data.height === 'auto') try {
		                var doc = $.doc(iwin);
		                api.size(doc.width, doc.height);
		            } catch (_) { };

		            // IE6、7获取iframe大小后才能使用百分百大小
		            api.ui.content.addClass('art_full');
		            $iframe.css({
		                'width': '100%',
		                'height': '100%'
		            });
		            api.data.left === 'center' && api.data.top === 'center' && api.position('center', 'center');
		            api.loading.off();
		            opt.initFn && opt.initFn.call(api, here);
		        };
		        $iframe.bind('load', load);
		    },
		    closeFn: function(here) {
		        $iframe.unbind('load', load);
		        // 重要！需要重置iframe地址，否则下次出现的对话框在IE6、7无法聚焦input
		        // IE删除iframe后，iframe仍然会留在内存中出现上述问题，置换src是最容易解决的方法
		        $iframe[0].src = 'about:blank';
		        opt.closeFn && opt.closeFn.call(this, here);
		    }
		};
        // 回调函数第二个参数指向iframe内部window对象
        if (opt.yesFn) data.yesFn = function(here) {
            return opt.yesFn.call(this, iwin, here);
        };
        if (opt.noFn) data.noFn = function(here) {
            return opt.noFn.call(this, iwin, here);
        };

        for (var i in opt) {
            if (data[i] === undefined) data[i] = opt[i];
        };

        $.dialog(data);

        return iwin;
    };


    // 替换内置alert函数[可选]
    // 引入js带上'plus'参数即可开启：artDialog.js?plus
    if ($.getArgs === 'plus') window.alert = $.fn.dialog.alert;

    // 给jQuery增加"dialog"插件
    if (jq && !jq.dialog && !jq.fn.dialog) {
        jq.extend({

            dialog: art.dialog
        });
        jq.fn.dialog = function(options, yesFn, noFn) {
            return art(this[0]).dialog(options, yesFn, noFn);
        };
    };

})(art, window.jQuery);
//-------------end



//对话框的参数设置
var settings = {
    id: "id",
    title:'\u63D0\u793A', 	// 标题. 默认'提示'DB.core.getlan(3,'Tips','\u63D0\u793A')
    type: "system",             //system系统对话框|profile个性对话框,自定义模板第一次content的内容输出数据到dialogContent里面
    skin: "default",
    initFn: null, 			// 对话框初始化后执行的函数
    content: null, 			// 内容
    yesFn: null, 			// 确定按钮回调函数
    noFn: null, 				// 取消按钮回调函数    
    closeFn: null, 			// 对话框关闭执行的函数
    yesText: '\u786E\u5B9A', // 确定按钮文本. 默认'确定'DB.core.getlan(4,'OK','\u786E\u5B9A')
    noText: '\u53D6\u6D88', 	// 取消按钮文本. 默认'取消'DB.core.getlan(4,'Cancel','\u53D6\u6D88')
    width: 'auto', 			// 宽度
    height: 'auto', 			// 高度
    minWidth: 300, 			// 最小宽度
    minHeight: 100, 		// 最小高度
    maxWidth: 'auto', 			// 最大宽度
    maxHeight: 'auto', 		// 最大高度
    fixed: true, 			// 是否静止定位
    focus: true, 			// 是否自动聚焦
    window: 'self', 			// 设定弹出的窗口 [*]
    esc: true, 				// 是否支持Esc键关闭
    lock: true, 			// 是否锁屏
    lockClick: false, 		// 点击锁屏遮罩是否关闭对话框
    left: 'center', 			// X轴坐标
    top: 'center', 			// Y轴坐标
    time: null, 				// 自动关闭时间        
    follow: null, 			// 跟随某元素
    drag: true, 				// 是否支持拖动
    limit: true, 			// 是否限制位置
    show: true			// 是否显示
}




/*

//对话框的回调函数initFn、yesFn、noFn、closeFn的this都是指向当前对话框
var api = this;
//或者
var api = $.dialog.get("id");

api.ui   ui对象
api.data 参数配置

对话框的方法
// 内容
api.content(content, type);
// 重置对话框大小
api.size(width, height, fn);
//坐标定位
api.position(left, top, fixed);
// 跟随元素
api.follow(elem);
// 加载提示
api.loading.on();
api.loading.off();
// 置顶对话框
api.zIndex();
// 元素焦点处理
api.focus(elem);
// 显示对话框
api.show(fn);
// 隐藏对话框
api.hide(fn);
// 关闭对话框
api.close();
// 定时器关闭对话框
api.time(second);
// yesFn
// noFn
// closeFn
*/ 
DB.package("DB.Ui", function() { 
this.treeInit= function(spanid)
{ $(".tree0").show();
	  DB.Ui.treeaa(spanid,0);
	  DB.Ui.treeaa(spanid,1);
	  DB.Ui.treeaa(spanid,2);
	  DB.Ui.treeaa(spanid,3);
	  DB.Ui.treeaa(spanid,4);
	  DB.Ui.treebb(spanid,0);
	  DB.Ui.treebb(spanid,1);
	  DB.Ui.treebb(spanid,2);
	  DB.Ui.treebb(spanid,3);
	  DB.Ui.treebb(spanid,4);
}
this.treeaa= function(spanid,ceng) 
 {
	  $(spanid).find(".tree"+ceng).each(function(i){
          var arr=$(this).attr("alt").split("|");
		  if($(spanid).find(".t_parent"+arr[1]).length>0)
		  { $(this).find(".t_j").addClass("t_jia");
		  DB.Ui.bindclick(this,arr[1],spanid);
		  }else
		  {$(this).find(".t_j").addClass("t_wu");
		  }
		  $(spanid).find(".t_parent"+arr[1]).addClass("tree"+(ceng+1));
		  if($(this).nextAll(".tree"+ceng).length<1)
		  {
			  $(this).addClass("shang");
		  }
		  if($(this).prevAll(".tree"+ceng).length<1&&ceng==0)
		  {
			  $(this).addClass("xia");
		  }
		  if($(this).nextAll(".tree"+0).length>0&&ceng>0)
		  {
			  $(".tree"+(ceng)).addClass("tree_border1");
		  }
		  
		  $(this).after($(spanid).find(".t_parent"+arr[1]));
     });
 }
this.treebb= function(spanid,ceng) 
 {
	  $(spanid).find(".tree"+ceng).each(function(i){
          var arr=$(this).attr("alt").split("|");
		  if($(this).nextAll(".t_parent"+arr[0]).length>0&&ceng>0)
		  {
			  $(spanid).find(".t_parent"+arr[1]).find(".t_shu").addClass("borderight");
			  var t=$(this).nextAll(".t_parent"+arr[0]).get(0);
			  var alt=$(t).attr("alt");
			  DB.Ui.treecc(this,alt,".t_shu","borderight");
		  }
		  if($(this).nextAll(".t_parent"+arr[0]).length>0&&ceng>1)
		  {
			  $(spanid).find(".t_parent"+arr[1]).find(".t_shu1").addClass("borderleft");
			  var t=$(this).nextAll(".t_parent"+arr[0]).get(0);
			  var alt=$(t).attr("alt");
			   DB.Ui.treecc(this,alt,".t_shu1","borderleft");
		  }
		  
     });
 }
 this.treecc= function(spanid,alt,id,cla) 
 {
	 var arr=$(spanid).nextAll("li");
	 for(var i=0;i<arr.length;i++){
	    if($(arr[i]).attr("alt")==alt){
			return;
		  }
		  $(arr[i]).find(id).addClass(cla); 
	 }
	  
 }
 this.bindclick= function(spanid,alt,sid)  
 {
	 $(spanid).find('a').bind("click", function(){
        $(sid).find(".t_parent"+alt).toggle();
		$(this).find(".t_j").toggleClass("t_jia");
		$(this).find(".t_j").toggleClass("t_jian"); 
		var arr=$(this).attr("alt").split("|");
		if($(this).nextAll(".t_parent"+arr[0]).length>0){
			var t=$(this).nextAll(".t_parent"+arr[0]).get(0);
			  var alt1=$(t).attr("alt"); 
			  if($(this).find(".t_j").hasClass("t_jia")){
			   DB.Ui.treedd(this,alt1,sid);
			  }
		}
    }); 
 }
 this.treedd= function(spanid,alt) 
 {
	 var arr=$(spanid).nextAll("li");
	 for(var i=0;i<arr.length;i++){
	    if($(arr[i]).attr("alt")==alt){
			return;
		  }
		  $(sid).find(arr[i]).hide(); 
		  $(sid).find(arr[i]).find(".t_j").addClass("t_jia");
		  $(sid).find(arr[i]).find(".t_j").removeClass("t_jian");
	 }
	  
 } 
}); 
DB.package("DB.Ui", function() { 
    var spanId;
    var page = 1;
    var pageSize = 20;
    var _this = this;
    var pageCount;
    var reCount;
    var argName = "page";
    var style = 1; //0简单 //1普通 //2显示数字
    var mode = 0; //0普通 1ajax
    var ss = "DB.Ui.";

    var Home="首页";
    var Total="共";
    var Page="页";
    var Previous="上一页";
    var Next="下一页";
    var Last="尾页";
    var Count="数量";
    var Go="转到"; 
    var Di="第";
    var _t=0;
    this.okFn=function(){};
    this.pageInit = function(id, count, arguments,t,_okFn) {
            if(t!=null ){ _this._t=t; }
        if (!!_okFn){_this.okFn=_okFn}
                   // okFn.call(this, lstspaceId);
        _this.spanId = "." + id;
        _this.pageCount = count;
        if (arguments != null) {
            if (arguments.pSize != null) { _this.pageSize = arguments.pSize; }
            if (arguments.pName!= null) { _this.argName = arguments.pName; }
           if (arguments.argName != null) { _this.argName = arguments.pName; }
            if (arguments.style != null) { _this.style = arguments.style; }
            if (arguments.mode != null) { _this.mode = arguments.mode; }
            if (arguments.pIndex != null) { _this.page = arguments.pIndex; }
            else {
                _this.page = DB.core.Q(_this.argName);
            }
          if (arguments.Home!= null) { _this.Home= arguments.Home; }
            if (arguments.Total != null) { _this.Total = arguments.Total; }
            if (arguments.Page != null) { _this.Page = arguments.Page; }
            if (arguments.Previous != null) { _this.Previous = arguments.Previous; }
            if (arguments.Next != null) { _this.Next = arguments.Next; }
            if (arguments.Last != null) { _this.Last = arguments.Last; }
            if (arguments.Count != null) { _this.Count = arguments.Count; }
            if (arguments.Go != null) { _this.Go = arguments.Go; }
            if (arguments.Previous != null) { _this.Di = arguments.Page+" ";_this.Page=""; } 
         if (arguments.Previous != null&&arguments.Previous=="上一页") { _this.Di =Di ;_this.Page=Page; } 
        }
        _this.checkPages();
        _this.pageCreate();
    }
    this.checkPages = function() { //进行当前页数和总页数的验证
        if (isNaN(parseInt(_this.page))) _this.page = 1;
        if (isNaN(parseInt(_this.pageCount))) _this.pageCount = 1;
        if (_this.page < 1) _this.page = 1;
        if (_this.pageCount < 1) _this.pageCount = 1;
        if (_this.page > _this.pageCount) _this.page = _this.pageCount;
        _this.page = parseInt(_this.page);
        _this.pageCount = parseInt(_this.pageCount);
    }
    this.toPage = function(tpage,aname) { //页面跳转
        var turnTo = 1;
        if (typeof (tpage) == 'object') {
            turnTo = tpage.options[page.selectedIndex].value;
        } else {
            turnTo = tpage;
        }
     if(_this.mode==1){
        self.location.href = _this.createUrl(turnTo,aname);}
     else{
       if (!!_this.okFn)
                    _this.okFn.call(_this, tpage);
       }
    }
  this.createUrl = function(tpage,aname) { //生成页面跳转url
        if (isNaN(parseInt(tpage))) tpage = 1;
        if (tpage < 1) tpage = 1;
        if (tpage > _this.pageCount) tpage = _this.pageCount;
        var pname = location.pathname;
        var args = location.search;
        var url = location.protocol + '//' + location.host + pname;
        if(_this._t==1&&pname.indexOf('.')<0)
        {
        if(url.substring(url.length-1)=="/"){
           url=url.substring(0,url.length-1);
        } 
           url=url+"-"+aname+tpage;
        }else{
        
        var reg = new RegExp('([\?&]?)' + aname+ '=[^&]*[&$]?', 'gi');
        args = args.replace(reg, '$1');
        if (args == '' || args == null) {
            args += '?' + aname+ '=' + tpage;
        } else if (args.substr(args.length - 1, 1) == '?' || args.substr(args.length - 1, 1) == '&') {
            args += aname + '=' + tpage;
        } else {
            args += '&' + aname+ '=' + tpage;
        }
        }
        return url + args;
    }
    this.pageCreate = function() {
        var strHtml = '', prevPage = _this.page - 1, nextPage = _this.page + 1;

        var aa = '', a = '', b = '', c = '', d = '', e = '', f = '';
        aa += '<span class="count">{00}' + _this.pageCount + '{01}</span>';
        //aa += '<span class="count">{02}' + _this.page + '{01}</span>';
       a += '<span class="indexpage ic" title="{0}">{0}</span><span class="prepage ic" title="{1}">{1}</span>';
        b += '<span class="indexpage ic pointer" title="{0}"><a href="javascript: ' + ss + 'toPage(1,\''+_this.argName+'\');">{0}</a></span>';
        b += '<span class="prepage ic pointer" title="{1}"><a href="javascript:' + ss + 'toPage(' + prevPage + ',\''+_this.argName+'\');">{1}</a></span>';
        c += '<span class="nextpage ic" title="{2}">{2}</span><span class="lastpage ic" title="{3}">{3}</span>';
        d += '<span class="nextpage ic pointer" title="{2}"><a href="javascript:' + ss + 'toPage(' + nextPage + ',\''+_this.argName+'\');">{2}</a></span>';
        d += '<span class="lastpage ic pointer" title="{3}"><a href="javascript:' + ss + 'toPage(' + _this.pageCount + ',\''+_this.argName+'\');">{3}</a></span>';

        switch (_this.style) {
            case 0:
                if (prevPage < 1) {
                    strHtml += a;
                } else {
                    strHtml += b;
                }
                if (nextPage > this.pageCount) {
                    strHtml += c;
                } else {
                    strHtml += d;
                }
                break;
            case 1:
                strHtml += aa;
                if (prevPage < 1) {
                    strHtml += a;
                } else {

                    strHtml += b;
                }
                var m = _this.page - 5; var n = _this.page + 5;
                if (m < 1) { m = 1 }
                if (n > _this.pageCount) { n = _this.pageCount }
                for (var i = m; i <= n; i++) {
                    if (i > 0) {
                        if (i == _this.page) {
                            strHtml += '<span class="thispage color9" title="{4}： ' + i + '">' + i + '</span>';
                        } else {
                            strHtml += '<span class="thepage" title="{4}：' + i + '"><a href="javascript:' + ss + 'toPage(' + i + ',\''+_this.argName+'\');">' + i + '</a></span>';
                        }
                    }
                }
                if(n<_this.pageCount){
                   strHtml += '<span class="thepage" title="{4}：' + (_this.page+5)+ '"><a href="javascript:' + ss + 'toPage(' +(_this.page+5)+',\''+_this.argName+'\');">...</a></span>';
                   strHtml += '<span class="thepage" title="{4}：' + _this.pageCount + '"><a href="javascript:' + ss + 'toPage(' + _this.pageCount + ',\''+_this.argName+'\');">' + _this.pageCount + '</a></span>';
                }
                if (nextPage > this.pageCount) {
                    strHtml += c;
                } else {
                    strHtml += d;
                }
                var strHtml1 = "";
                if (_this.pageCount > 0) {
                    strHtml1 += '<div class="selectPage hoverMenu bg"><div class="select-item">{02}' + _this.page + '{01}</div><ul class="item-list">';
                    for (var i = 1; i <= _this.pageCount; i++) {
                         if (i == _this.page) {
                            strHtml1 += '<li><a class="pageselect'+i+'" href="javascript:' + ss + 'toPage(' + i + ',\''+_this.argName+'\');">{02}' + i + '{01}</a></li>';
                        } else {
                            strHtml1 += '<li><a class="pageselect'+i+'" href="javascript:' + ss + 'toPage(' + i + ',\''+_this.argName+'\');">{02}' + i + '{01}</a></li>';
                        }
                    }
                    strHtml1 += '</ul></div><div class="clear"></div>';
                }
                strHtml = strHtml + strHtml1;
                break;
                case 2: 
                if (prevPage < 1) {
                    strHtml += a;
                } else {

                    strHtml += b;
                }
                var m = _this.page - 5; var n = _this.page + 5;
                if (m < 1) { m = 1 }
                if (n > _this.pageCount) { n = _this.pageCount }
                  for (var i = m; i <= n; i++) {
                     if (i == _this.page) {
                            strHtml += '<span class="thispage color9';
                            if(i==n){strHtml += ' noborder';}
                            strHtml += '" title="{4}： ' + i + '">' + i + '</span>';
                        }
                        else {
                            strHtml += '<span class="thepage ';
                            if(i==n){strHtml += ' noborder';}
                            strHtml += '" title="{4}：' + i + '"><a href="javascript:' + ss + 'toPage(' + i + ',\''+_this.argName+'\');">' + i + '</a></span>';
                        }
                }
                if(n<_this.pageCount){
                   strHtml += '<span class="thepage" title="{4}：' + (_this.page+5)+ '"><a href="javascript:' + ss + 'toPage(' +(_this.page+5) + ',\''+_this.argName+'\');">...</a></span>';
                   strHtml += '<span class="thepage lastpage" title="{4}：' + _this.pageCount + '"><a href="javascript:' + ss + 'toPage(' + _this.pageCount + ',\''+_this.argName+'\');">' + _this.pageCount + '</a></span>';
                }
                if (nextPage > this.pageCount) {
                    strHtml += c;
                } else {
                    strHtml += d;
                }
                var strHtml1 = "";
                 
                strHtml = strHtml + strHtml1;
                strHtml = strHtml.replace(/\{0\}/ig, '&nbsp;&nbsp;');
                strHtml = strHtml.replace(/\{1\}/ig, '&nbsp;&nbsp;');
                strHtml = strHtml.replace(/\{2\}/ig,'&nbsp;&nbsp;');
                strHtml = strHtml.replace(/\{3\}/ig,'&nbsp;&nbsp;');
                break;
        } 
        strHtml = strHtml.replace(/\{00\}/ig, _this.Total);
        strHtml = strHtml.replace(/\{01\}/ig, _this.Page);
        strHtml = strHtml.replace(/\{02\}/ig, _this.Di);
        strHtml = strHtml.replace(/\{0\}/ig, _this.Home);
        strHtml = strHtml.replace(/\{1\}/ig, _this.Previous);
        strHtml = strHtml.replace(/\{2\}/ig, _this.Next);
        strHtml = strHtml.replace(/\{3\}/ig, _this.Last);
        strHtml = strHtml.replace(/\{4\}/ig, _this.Page);
        strHtml = strHtml.replace(/\{5\}/ig, _this.Count);
        strHtml = strHtml.replace(/\{5\}/ig, _this.Go);
        strHtml = "<div class=\"compage1\" style=\"float:left\">" + strHtml + "</div>";
        var wh = $(_this.spanId).parent().width();
        $(_this.spanId).addClass("compage");
        $(_this.spanId).find("span").css("float", "left");
        $(_this.spanId).find("span").css("display", "inline");

        if ($(_this.spanId).length > 0) {
            $(_this.spanId).parent().show();
            $(_this.spanId).html(strHtml);
            var w = $(".compage1");
            var wh1 = w.width();
            var l = parseInt((wh - wh1) / 2);if (l < 0) { l = -l; }
            w.css("margin-left",l+"px")
            DB.Ui.hoverMenu(".selectPage",_this.argName,".pageselect");
           
        }

    } 
}); 
DB.package("DB.Ui", function() { 
this.hoverMenu=function(spanId,arg,sid)
{   
   $(spanId).hover(
  function () {
    $(this).addClass("hover");
  },
  function () {
    $(this).removeClass("hover");
  }
  ); 
  if(arg!=null){
    var a=DB.core.Q(arg);
  if(a==""){return;}
    var b=$(sid+a).html();
   $(sid + a).parent().parent().find(".selected").removeClass("selected"); 
   $(sid+a).addClass("selected");
   $(spanId).find(".select-item").html(b);
  }
} 
}); 
DB.package("DB.core", function() { 
this.c= function() {
$.dialog({
        id: "",
        title: "生成管理",
        content: "", 
         height: 100,
        initFn: function() {
        // 对话框初始化后执行的函数
         var api = this;
        api.loading.on();
        var content="";
content+='<input type="button" onClick="DB.core.c.clear();" value="清空缓存" class="btn-button-1"/>';
content+='<input type="button" onClick="DB.app.block.js();" value="生成js" class="btn-button-1"/><br>';
content+='<input type="button" onClick="DB.app.space.c(1);" value="生成系统空间" class="btn-button-1"/>';
content+='<input type="button" onClick="DB.app.space.c(2);" value="生成门户空间" class="btn-button-1"/>';
content+='<input type="button" onClick="DB.app.space.c(3);" value="生成个人空间" class="btn-button-1"/><br>';
content+='<input type="button" onClick="DB.app.space.c(4);" value="生成企业空间" class="btn-button-1"/>';
content+='<input type="button" onClick="DB.app.space.c(5);" value="生成部落空间" class="btn-button-1"/>';
content+='<input type="button" onClick="DB.app.space.c(6);" value="生成事件空间" class="btn-button-1"/>';

        api.content("<fieldset class=\"fieldset fieldset-style-1\">"+content+"</<fieldset>");
        api.loading.off();
        return false;
        },
        yesFn: function() {
          // 确定按钮回调函数
         },
        noFn: function() {
          // 取消按钮回调函数
         },
        closeFn: function() {

         // 对话框关闭执行的函数
         }
        });
}
this.clear= function() {
$.dialog.confirm("确认清空缓存吗？",
function(){
$.post('ajax.aspx',{a:'c'},function(data) {
            //if (!DB.Core.resolveResult(data)) {
            //    return;
            // }
             $.dialog.tips(data.Msg,data.Code);
           },"json");
},
function(){}
);
}
this.ca= function() {
$.post('ajax.aspx',{a:'all'},function(data) {
             //$.dialog.tips(data.Msg,data.Code);
           },"json");
} 
}); 
DB.package("DB.core", function() { 
this.re= function(data) {
   if(data==null||data.Code==null){
  var tip=DB.core.getlan(3, "NetworkError", "网络错误!请稍候再试");
   $.dialog.tips(tip,0);return true;
    }
} 
}); 
DB.package("DB.core", function() { 
var _this=this;
this.Q= function(str) {
 var url=location.href;
 var a=DB.core.Gf(location.href.toLowerCase(),str.toLowerCase());
return unescape(a);
}
this.Q1= function(str) {
 var url=location.href;
 var a=DB.core.Gf(location.href,str);
return unescape(a);
}
this.Gf=function(sHref,sArgName) 
{ 
var args = sHref.split("?"); 
var retval = ""; 
var bbsRightFrame=""

if(args[0] == sHref) /*参数为空*/ 
{ 
return retval; /*无需做任何处理*/ 
} 
var str = args[1]; 
args = str.split("&"); 
for(var i = 0; i < args.length; i ++) 
{ 
str = args[i]; 
var arg = str.split("="); 
if(arg.length <= 1) continue; 
if(arg[0] == sArgName) retval = arg[1]; 
} 
return retval; 
}
this.gUrl = function (aN,va) { //生成页面跳转url 
    var pname=location.pathname;
	var url = location.protocol + '//' + location.host + pname;
	var args = location.search;
	var reg = new RegExp('([\?&]?)' + aN+ '=[^&]*[&$]?', 'gi');
	args = args.replace(reg,'$1');
	if (args == '' || args == null) {
		args += '?' + aN + '=' + va;
	} else if (args.substr(args.length - 1,1) == '?' || args.substr(args.length - 1,1) == '&') {
			args += aN  + '=' + va;
	} else {
			args += '&' + aN  + '=' + va;
	}
	return url + args;
}
this.gUrl2 = function (aN,va,aN1,va1) { //生成页面跳转url 
    var pname=location.pathname;
	var url = location.protocol + '//' + location.host + pname;
	var args = location.search;
	var reg = new RegExp('([\?&]?)' + aN+ '=[^&]*[&$]?', 'gi');
	args = args.replace(reg,'$1');
	if (args == '' || args == null) {
		args += '?' + aN + '=' + va;
	} else if (args.substr(args.length - 1,1) == '?' || args.substr(args.length - 1,1) == '&') {
			args += aN  + '=' + va;
	} else {
			args += '&' + aN  + '=' + va;
	}

    reg = new RegExp('([\?&]?)' + aN1+ '=[^&]*[&$]?', 'gi');
	args = args.replace(reg,'$1');
	if (args == '' || args == null) {
		args += '?' + aN1 + '=' + va1;
	} else if (args.substr(args.length - 1,1) == '?' || args.substr(args.length - 1,1) == '&') {
			args += aN1  + '=' + va1;
	} else {
			args += '&' + aN1  + '=' + va1;
	}
	return url + args;
}
this.sUrl = function (aN,va) { 
  va=escape(va);
  var a=_this.gUrl(aN,va);location.href=a;
}
this.sUrl2 = function (aN,va,aN1,va1) { 
  var a=_this.gUrl2(aN,va,aN1,va1);location.href=a;
} 
}); 
DB.package("DB.core", function() { 
this.search= function(spanId,arg,url) {
var text=$(spanId).val();
var tt=$(spanId).attr('alt');
if(text==""||tt==text){
    var tip=DB.core.getlan(3,"Pleaseforcontent","请输入要搜索的内容！");
    $.dialog.tips(tip,2);
    $(spanId).focus();
   }else{
       if(url==null||url==''){
     DB.core.sUrl(arg,text);}else{
      var  a=escape(text);
       a=url+'?'+arg+'='+a;
       location.href=a;
       }
   }
}
this.searchRe=function(spanId)
{
  var a=$(spanId).val();
  var alt= $(spanId).attr("alt");
if(a==""||a==alt){$(spanId).focus();return;}
  a=escape(a);
  a=DB.SpacePath+'searchRe?University='+a+'&SpaceName='+a;
  location.href=a;
}   
this.searchbind=function(spanId)
{  
   var id=$(spanId).attr("id");
   var a=DB.core.Q(id);
    $(spanId).bind("change", function(){
         var text=$(this).val();
        DB.core.sUrl(id,text);
    }); 
   $(spanId).val(a);
}
  
}); 
DB.package("DB.core", function() { 
this.ChangeStyle=function(cla){
$('body').removeClass('red');
$('body').removeClass('yellow');
$('body').removeClass('green');
$('body').removeClass('blue');
$('body').removeClass('white');
$('body').removeClass('gray');
$('body').removeClass('black');
$('body').addClass(cla);
$.post('/ajax.aspx',{a:'ChangeStyle',styleId:cla},function(data) {
             
           },"json");
} 
}); 
DB.package("DB.core", function() { 
this.jsonLan = function() {
    var lan = "";
    var jsonLan;
    $("#db_lan li").each(function(i) {
        lan +="'"+$(this).attr("class")+"':'"+$(this).html()+"',";
    });
    if (lan != "") {
        jsonLan = eval("({" + lan + "})");
        return jsonLan;
    } else {
        return eval("({})");;
    }
}
this.getlan = function(lanClassId,lankey,lanName) {
    if(1!=1){return lanName;}
    var lan = $("#db_lan ."+lankey).html();
    if(lan==null||lan==""){lan=lanName;$("#db_lan").append('$l2('+lanClassId+','+lankey+','+lanName+')}');}
     return lan;
} 
}); 
DB.package("DB.core", function() { 
this.menuChild= function(t,parentId) {
    $(".NavParentId").removeClass("on");
    $(t).addClass("on");
    $(".NavChild").hide();
    $(".NavParentId"+parentId).fadeIn(200); 
}
 
}); 
DB.package("DB.core", function() { 
this.loginout= function(d) {
var tip=DB.core.getlan(3,'ExitAdminTip','您要退出管理吗？');
$.dialog.confirm(tip,
function(){
$.post('ajax.aspx',{a:'loginout'},function(data) {
             if(DB.core.re(data)){return;}
             $.dialog.tips(data.Msg,data.Code);
if(data.Code==1){
location.href=data.Com;
}
           },"json");
},
function(){}
);
} 
}); 
DB.package("DB.core", function() { 
this.SetLanType= function(lanId) {
var tip=DB.core.getlan(3,'SetupfortheLan','您要改变网站显示语言吗?');
$.dialog.confirm(tip,
function(){
$.post('ajax.aspx',{a:'l',lanId:lanId},function(data) {
             if(DB.core.re(data)){return;}
             $.dialog.tips(data.Msg,data.Code);
if(data.Code==1){
location.reload();
}
           },"json");
},
function(){}
);
} 
}); 
DB.package("DB.core", function() { 
    this.navDown = function(spanId, navId) {
      if($(".NavParentId" + navId).length<1)
        {return;
         }
        var left = $(spanId).offset().left;
        var top = $(spanId).offset().top;
        var newId = "navDown" + navId;
      if($("#" + newId).length<1){
        var temp = '<div id="' + newId + '" class="navDown color2 none"></div>';
        $("body").append(temp);
        $("#" + newId).append($(".NavParentId" + navId));$(".NavParentId" + navId).show();
       $("#" + newId).hover(
         function () { 
       },
       function () {
          $(this).fadeOut(200);
            }
            ); 
       }
          $('.navDown').hide();
        $("#" + newId).css("position", "absolute");
        $("#" + newId).css("left", left + "px");
        $("#" + newId).css("top", (top+13) + "px");
        $("#" + newId).show();
    } 
}); 
DB.package("DB.core", function() { 
 var _this=this;
this.jsondate= function(date1,t) {
 if(date1==""){return "";}
var date  = new Date(parseInt(date1.replace("/Date(", "").replace(")/", ""), 10)); 
var now = "";
if(date.getFullYear()<1000){return "";}
if(t==null||t==0){
now = date.getFullYear()+"-";  
now = now + (date.getMonth()+1)+"-";
now = now + date.getDate()+" ";
now = now + date.getHours()+":";
now = now + date.getMinutes()+":";
now = now + date.getSeconds()+"";
}else if(t==1){ now=_this.jdate(date);
}
return now;

}
this.jdate= function(date1) {
 if(date1==""){return "";}
var date  = new Date(date1); 
var now = "";
var today=new Date();
if(date.getFullYear()<today.getFullYear()){
now =date.getFullYear()+"-"+(date.getMonth()+1)+'-'+ date.getDate();
}else if(date.getMonth()<today.getMonth()){
 now =(date.getMonth()+1)+'月'+ date.getDate()+'日';
}else if(date.getDate()<today.getDate()){
   if((today.getDate()-date.getDate())<10){
   now =(today.getDate()-date.getDate())+"天前";
   }else{
      now =(date.getMonth()+1)+'月'+ date.getDate()+'日';
  }
}else if(date.getHours()<today.getHours()){
   now =(today.getHours()-date.getHours())+"小时前";
}else if(date.getMinutes()<today.getMinutes()){
   now =(today.getMinutes()-date.getMinutes())+"分钟前";
}
else if(date.getSeconds()<today.getSeconds()){
   now =(today.getSeconds()-date.getSeconds())+"秒前";
}                          
 
return now;

}


var _this=this;
this.jsondate= function(date1,t) {
 if(date1==""){return "";}
var date  = new Date(parseInt(date1.replace("/Date(", "").replace(")/", ""), 10)); 
var now = "";
if(date.getFullYear()<1000){return "";}
if(t==null||t==0){
now = date.getFullYear()+"-";  
now = now + (date.getMonth()+1)+"-";
now = now + date.getDate()+" ";
now = now + date.getHours()+":";
now = now + date.getMinutes()+":";
now = now + date.getSeconds()+"";
}else if(t==1){ now=_this.jdate(date);
}
return now;

}
this.jdate= function(date1) {
 if(date1==""){return "";}
var date  = new Date(date1); 
var now = "";
var today=new Date();
if(date.getFullYear()<today.getFullYear()){
now =date.getFullYear()+"-"+(date.getMonth()+1)+'-'+ date.getDate();
}else if(date.getMonth()<today.getMonth()){
 now =(date.getMonth()+1)+'月'+ date.getDate()+'日';
}else if(date.getDate()<today.getDate()){
   if((today.getDate()-date.getDate())<10){
   now =(today.getDate()-date.getDate())+"天前";
   }else{
      now =(date.getMonth()+1)+'月'+ date.getDate()+'日';
  }
}else if(date.getHours()<today.getHours()){
   now =(today.getHours()-date.getHours())+"小时前";
}else if(date.getMinutes()<today.getMinutes()){
   now =(today.getMinutes()-date.getMinutes())+"分钟前";
}
else if(date.getSeconds()<today.getSeconds()){
   now =(today.getSeconds()-date.getSeconds())+"秒前";
}                          
 
return now;

}


 
}); 
DB.package("DB.core", function() { 
this.adminlogin= function() {
var adminName =$("#adminName").val();
var adminPassword  =$("#adminPassword").val();
var adminCode =$("#adminCode").val();
var checkCode =$("#checkCode").val();

var lan_adminName=DB.core.getlan(3,"Pleasefillusername","请填写用户名！");
var lan_adminPassword=DB.core.getlan(3,"Pleasefillpassword","请填写密码！");
var lan_checkCode=DB.core.getlan(3,"Pleasefillcode","请填写正确的验证码！点击图片可刷新验证码！");
if(adminName==""){
 $.dialog.tips(lan_adminName,2);return;
}
if(adminPassword  ==""){
 $.dialog.tips(lan_adminPassword,2);return;
}
if(lan_checkCode.length<6){
 $.dialog.tips(lan_checkCode,2);return;
}
$(".loginbtn").attr("disabled","disabled");
$.post('/ajax.aspx',{a:'adminlogin',adminName:escape(adminName),adminPassword:escape(adminPassword),adminCode :escape(adminCode),checkCode:escape(checkCode)},function(data) {$(".loginbtn").removeAttr("disabled");
             if(DB.core.re(data)){return;}
             $.dialog.tips(data.Msg,data.Code);
if(data.Code==1){
var url=DB.core.Q("ReturnUrl");if(url==""){url=data.Com;}
    location.href= url;
}else{DB.core.checkcode('#checkCodeimg');$(".loginbtn").removeAttr("disabled");}
           },"json");
}
this.checkcode= function(spanId,h) {
if(h==null){h=14;}
$(spanId).attr('src','/ajax.aspx?a=checkCode&h='+h+'&r='+Math.random());$(spanId).show();

} 
}); 
DB.package("DB.core", function() { 
this.keyUp= function(code,fun,e) {
var currKey=0,e=e||event;
currKey=e.keyCode||e.which||e.charCode;
var keyName = String.fromCharCode(currKey);
   // alert("按键码: " + currKey + " 字符: " + keyName);
if (!!okFn&&code==currKey )
       okFn.call(this);
}
 
}); 
DB.package("DB.core", function() { 
this.AddFavorite=function(sURL, sTitle) { 
var tip=DB.core.getlan(3,"Favoritefails","加入收藏失败，请使用Ctrl+D进行添加!");  
    try {   
        window.external.addFavorite(sURL, sTitle);   
    } catch (e) {   
        try {   
            window.sidebar.addPanel(sTitle, sURL, "");   
        } catch (e) {   
            $.dialog.alert(tip);   
        }   
    }   
}   
/**   
 *    
 * @param {} obj 当前对象，一般是使用this引用。   
 * @param {} vrl 主页URL   
 */   
this.SetHome=function(obj, vrl) {  
var tip=DB.core.getlan(3,"Favoritefails","操作失败请手动添加!");   
    try {   
        obj.style.behavior = 'url';   
        obj.setHomePage(vrl);   
    } catch (e) {   
        if (window.netscape) {   
            try {   
                netscape.security.PrivilegeManager   
                        .enablePrivilege("UniversalXPConnect");   
            } catch (e) {   
               $.dialog.alert(tip); 
            }   
            var prefs = Components.classes['@mozilla.org/preferences-service;1']   
                    .getService(Components.interfaces.nsIPrefBranch);   
            prefs.setCharPref('browser.startup.homepage', vrl);   
        }   
    }   
}   

this.copyToClipBoard=function() {
    var clipBoardContent=""; 
    clipBoardContent+=document.title; 
    clipBoardContent+=""; 
    clipBoardContent+=location.href; 
    window.clipboardData.setData("Text",clipBoardContent); 
    $.dialog.alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友"); 
} 
 
}); 
DB.package("DB.core", function() { 
this.video=function(spanId,url,wh,hi,t){
if($(spanId).find("object").length>0){$(spanId).show();return;}
		var te='<div class="closevideo color4 bg" onclick="$(\''+spanId+'\').hide();"></div>';
	te+='<object type="application/x-shockwave-flash" data="/images/vi/v3.swf" width="'+wh+'" height="'+hi+'" class="vcastr3">';
		te+='<param name="movie" value="/images/vi/v3.swf"/> ';
		te+='<param name="allowFullScreen" value="true" />';
		te+='<param name="FlashVars" value="xml=';
		te+='	<vcastr>';
		te+='		<channel>';
		te+='			<item>';
		te+='				<source>http://sk.dianbu.net/images/vi/1.flv</source>';
		te+='				<duration></duration>';
		te+='				<title>你爱我像谁</title>';
		te+='			</item>';
		te+='			<item>';
		te+='				<source>http://sk.dianbu.net/images/vi/2.flv</source>';
		te+='				<duration></duration>';
		te+='				<title>justinbieber-baby</title>';
		te+='			</item>';
		te+='		</channel>';
		te+='		<config>';
 
		te+='		<bufferTime>5</bufferTime>';
		te+='		<contralPanelAlpha>0.9</contralPanelAlpha>';
		te+='		<controlPanelBgColor>0xcccccc</controlPanelBgColor>';
		te+='		<controlPanelBtnColor>0xffffff</controlPanelBtnColor>';
		te+='		<contralPanelBtnGlowColro>0xffffff</contralPanelBtnGlowColro>';
		te+='		<controlPanelMode>float</controlPanelMode>';
		te+='		<defautVolume>1</defautVolume>';
if(t==null||t==0){
		te+='		<isAutoPlay>false</isAutoPlay>';}
		te+='		<isLoadBegin>true</isLoadBegin>';
		te+='		<isshowabout>true</isshowabout>';
		te+='		<scaleMode>showAll</scaleMode>';
 

		te+='		</config>';
		te+='		<plugIns>';
		te+='			<logoPlugIn>';
		te+='				<url>/images/vi/logoPlugIn.swf</url>';
		te+='				<logoText></logoText>';
		te+='				<logoTextAlpha>0.75</logoTextAlpha>';
		te+='				<logoTextFontSize>11</logoTextFontSize>';
		te+='				<logoTextLink>http://www.dianbu.net</logoTextLink>';
		te+='				<logoTextColor>0xffffff</logoTextColor>';
		te+='				<textMargin>10 10 auto auto</textMargin>';
		te+='			</logoPlugIn>';
		te+='		</plugIns>';
	te+='	</vcastr>"/>';
		te+='</object>';
$(spanId).html(te);$(spanId).find("object").focus();
}
this.video1=function(spanId,url,wh,hi,t){
var arr=url.split('$');
if($(spanId).find("object").length>0){$(spanId).show();return;}
		var te='<div class="closevideo color4 bg" onclick="$(\''+spanId+'\').hide();"></div>';
	te+='<object type="application/x-shockwave-flash" data="/images/vi/v3.swf" width="'+wh+'" height="'+hi+'" class="vcastr3">';
		te+='<param name="movie" value="/images/vi/v3.swf"/> ';
		te+='<param name="allowFullScreen" value="true" />';
		te+='<param name="FlashVars" value="xml=';
		te+='	<vcastr>';
		te+='		<channel>';
for(var i=0;i<arr.length;i++){
 if(arr[i]==""){continue;}
    var arrArr=arr[i].split('|');
  var aText="";
   if(arrArr.length>1){
   aText=arrArr[0];}
  var aurl=arrArr[arrArr.length-1];
if(DB.ImgPath!=null&&DB.ImgPath!=""){
     if(aurl.length>DB.ImgPath.length&&aurl.substring(0,aurl.length).toLowerCase()==DB.ImgPath.toLowerCase()){
     }else if(aurl.length>7&&aurl.substring(0,7).toLowerCase()=="http://"){
     }else{aurl=DB.ImgPath.trimEnd('/')+'/'+aurl.trimStart('/');}
  
}
		te+='			<item>';
		te+='				<source>'+aurl+'</source>';
		te+='				<duration></duration>';
		te+='				<title>'+aText+'</title>';
		te+='			</item>';
} 
		te+='		</channel>';
		te+='		<config>';
 
		te+='		<bufferTime>5</bufferTime>';
		te+='		<contralPanelAlpha>0</contralPanelAlpha>';
		te+='		<controlPanelBgColor>0x000000</controlPanelBgColor>';
		te+='		<controlPanelBtnColor>0xffffff</controlPanelBtnColor>';
		te+='		<contralPanelBtnGlowColro>0xffffff</contralPanelBtnGlowColro>';
		te+='		<controlPanelMode>float</controlPanelMode>';
		te+='		<defautVolume>1</defautVolume>';
if(t==null||t==0){
		te+='		<isAutoPlay>false</isAutoPlay>';}
else{           te+='		<isAutoPlay>true</isAutoPlay>';}
		te+='		<isLoadBegin>true</isLoadBegin>';
		te+='		<isshowabout>true</isshowabout>';
		te+='		<scaleMode>showAll</scaleMode>';
 

		te+='		</config>';
		te+='		<plugIns>';
		te+='			<logoPlugIn>';
		te+='				<url>/images/vi/logoPlugIn.swf</url>';
		te+='				<logoText></logoText>';
		te+='				<logoTextAlpha>0.75</logoTextAlpha>';
		te+='				<logoTextFontSize>11</logoTextFontSize>';
		te+='				<logoTextLink>http://www.dianbu.net</logoTextLink>';
		te+='				<logoTextColor>0xffffff</logoTextColor>';
		te+='				<textMargin>10 10 auto auto</textMargin>';
		te+='			</logoPlugIn>';
		te+='		</plugIns>';
	te+='	</vcastr>"/>';
		te+='</object>';
$(spanId).html(te);$(spanId).find("object").focus();
}
this.flash=function(spanId,url,wh,hi,outType){
   var temp='<embed height="'+hi+'" width="'+wh+'" src="'+url+'" type="application/x-shockwave-flash" allowfullscreen="true" wmode="transparent" allownetworking="all" allowscriptaccess="always" ';
if(outType==1){temp+='autostart="true" ';}else{temp+='autostart="false" ';}
temp+='>';
 $(spanId).html(temp);

} 
}); 
DB.package("DB.core", function() { 
var _this=this; 
this.editor = function(name,spaceId, config) {

        if (!!CKEDITOR.instances[name]) {
            try {

                CKEDITOR.instances[name].destroy();

            }
            catch (ex) {
                delete CKEDITOR.instances[name];
            }

        }


        var editor = null;
        //type预留参数 1: 2: 3 设置显示的编辑器的配置:
        config = $.extend({
            type: 1,
			width:500,height:400,
            skin: 'kama',
            resize_enabled: false
        }, config || {});
        switch (config.type) {
            default:
            case 0: //自定义
                break;
            case 1: //工具栏=Basic简化版

                config = $.extend({
                    toolbar: [['Source', '-', 'Bold', 'Italic', 'Underline', 'Strike', '-', 'Link', '-', 'MyButton']]
                }, config);
				//config.width = 500;
				//config.height = 400;
				//config.skin='v2';
                break;
            case 2: //工具栏=Full全功能版
                config = $.extend({
                    toolbar:[['Source','-','Save','NewPage','Preview','-','Templates'],['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print','SpellChecker','Scayt'],['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],['Maximize','ShowBlocks','-','About'],['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],['Image','Flash','File','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],['Styles','Format','Font','FontSize'],['TextColor','BGColor']],
filebrowserImageUploadUrl : '/other/ckfinder/core/connector/aspx/connector.aspx?spaceId='+spaceId+'&command=QuickUpload&type=Images',filebrowserImageBrowseUrl : '/other/ckfinder/ckfinder.html?spaceId='+spaceId+'&Type=Images',resize_enabled: true
                }, config);
                break;
            case 3:
                config = $.extend({
                    toolbar: [['Source', '-', 'Bold', 'Italic', 'Underline', 'Strike', '-', 'Link', '-', 'MyButton']],
                    toolbarStartupExpanded: false
                }, config);
                break;
            case 4:
                config = $.extend({
                    toolbar: 'Full',
                    toolbarStartupExpanded: false
                }, config);
                break;

            //            case 5:                                                                                                                                                                      
            //                config = $.extend({                                                                                                                                                                      
            //                    toolbar: [['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript']],                                                                                                                                                                      
            //                    toolbarStartupExpanded: false                                                                                                                                                                      
            //                }, config);                                                                                                                                                                      
            //                break;                                                                                                                                                                      

            //            case 5:                                                                                                                                                                    
            //                config = $.extend({                                                                                                                                                                    
            //                    toolbar: [['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript']],                                                                                                                                                                    
            //                    toolbarStartupExpanded: false                                                                                                                                                                    
            //                }, config);                                                                                                                                                                    
            //                break;                                                                                                                                                                    
            case 6:
                break;
        }
        editor = CKEDITOR.replace(name, config);
        return editor;
    }
 
this.bindCkFinder=function(spanId,setf,spaceId)
    {  SetFileField=function(fileUrl) {
	$(setf).val(fileUrl);
          }
		 var finder = new CKFinder();
		 finder.basePath = '/other/ckfinder/'; 
		 finder.selectActionFunction =  SetFileField; 
		  $(spanId).bind("click", function(){
		  finder.popup();
		  });
	 
} 
}); 
DB.package("DB.core", function() { 
this.login=function(v){
var tip=DB.core.getlan(3,'Pleasefillnamepassword','请填写用户名、密码！');
var account=$("#Account").val();
var password=$("#Password").val();
if(account==""||account==v||password=="")
{$.dialog.tips(tip,2);
}
if(account==""||account==v)
{$("#Account").focus();return;
}
if( password=="")
{$("#Password").focus();return;
}

var auto=0;
var user_active=0;
if($('#autoLogin').attr('checked')){auto=1;}
if($('#user_active').attr('checked')){user_active=1;}
$.post('ajax.aspx',{a:'user_login',account:account,password:password,auto:auto,user_active:user_active},function(data) {
             if(DB.core.re(data)){return;}
             $.dialog.tips(data.Msg,data.Code);
if(data.Code==1){ 
   if(data.Lan!=null&&data.Lan==-1){
  $(".user_active").show();$("#user_active").attr("checked","checked");return;
  }
   var rurl=DB.core.Q('ReturnUrl');
   if(rurl!=""){location.href=rurl;}else{
   location.href=data.Data;}
}
           },"json");
}
this.loginA=function(v){
var tip=DB.core.getlan(3,'Pleasefillnamepassword','请填写用户名、密码！');
var account=$("#Account").val();
var password=$("#Password").val();
if(account==""||account==v||password=="")
{$.dialog.tips(tip,2);
}
if(account==""||account==v)
{$("#Account").focus();return;
}
if( password=="")
{$("#Password").focus();return;
}

var auto=0;
var user_active=0;
if($('#autoLogin').attr('checked')){auto=1;}
if($('#user_active').attr('checked')){user_active=1;}
$.post('ajax.aspx',{a:'user_login',account:account,password:password,auto:auto,user_active:user_active},function(data) {
             if(DB.core.re(data)){return;}
             $.dialog.tips(data.Msg,data.Code);
if(data.Code==1){ 
   if(data.Lan!=null&&data.Lan==-1){
  $(".user_active").show();$("#user_active").attr("checked","checked");return;
  }
   location.reload();}
           },"json");
}

this.logincheck=function(spanId,v){
  var a= $(spanId).val();$(spanId).addClass('ontext');
  if(a==v){$(spanId).val('');}
}
this.logincheck1=function(spanId,v){
  var a= $(spanId).val();$(spanId).removeClass('ontext');
  if(a==''){$(spanId).val(v);}
}
this.checkAutoLogin=function(){
   $.post('ajax.aspx',{a:'checkAutoLogin'},function(data) {
             if(DB.core.re(data)){return;} 
if(data.Code==1){ $.dialog.tips(data.Msg,data.Code);
    $('#autoLogin').attr('checked','checked');$("#Password").val('111111111111111111111');
$("#Account").val(data.Com);
   var rurl=DB.core.Q('ReturnUrl');
   if(rurl!=""){
   setTimeout("location.href='"+rurl+"'",3000);}else{
   setTimeout("location.href='"+data.Data+"'",3000);}
}
           },"json");
}
this.uloginout=function(){ 
var tip=DB.core.getlan(3,"sureexit","您确定退出吗？");
$.dialog.confirm(tip,
function(){
$.post('ajax.aspx',{a:'UserLoginout'},function(data) {
           if(DB.core.re(data)){return;} $.dialog.tips(data.Msg,data.Code);
if(data.Code==1){ 
location.href=data.Data; 
}
           },"json");
},
function(){}
);
   
}

this.l=function(){

  var dialogId="dialogId_login";
	var temp=''; 
	   temp+='<div class="w_login_left3">';
       temp+='<div class="w_login_left3a color1">';
       temp+='   <span style="font-size: 11px;">WELCOME TO JOIN US !</span><br>';
       temp+='   账户：<br><input maxlength="32" value="用户邮箱/用户名" onblur="DB.core.logincheck1(this,\'用户邮箱/用户名\')" onfocus="DB.core.logincheck(this,\'用户邮箱/用户名\')" class="text color4" id="Account"><br>';
       temp+='   密码：<br><input type="password" maxlength="21" onblur="DB.core.logincheck1(this,\'\')" onfocus="DB.core.logincheck(this,\'\')" class="text color4" id="Password">';
       temp+='   <br><label for="autoLogin" class="auotocheck">';
       temp+='    <input type="checkbox" tabindex="3" name="autoLogin" title="为了确保您的信息安全，请不要在网吧或者公共机房勾选此项！" maxlength="6" id="autoLogin">下次自动登录 </label>';
       temp+='    <label style="display: none; padding-top: 0pt;" for="user_active" class="auotocheck user_active">';
       temp+='    <input type="checkbox" name="user_active" id="user_active">激活账户 </label>';
       temp+='</div>';
       temp+='<div class="w_login_left3b">';
       temp+='    <span class="w_login_left3b1 color5 ic"><a target="_self" href="http://space.dianbu.net/reg">注册 </a></span>';
       temp+='    <span class="w_login_left3b2 color3"><a target="_self" href="http://space.dianbu.net/getpassword">忘记密码 </a> <a target="_self" href="http://space.dianbu.net/reg">注册 </a><div class="clear"></div></span>';
       temp+='    <span class="w_login_left3b3 color5 "><a href="javascript:void(0)" class="loginbtn ic" onclick="DB.core.loginA(\'用户邮箱/用户名\');">登录</a></span> ';
       temp+='</div>';
       temp+='  </div>';
         
	 $.dialog({
        id: dialogId, width:390,height:230,
		title:"",
        drag: true,
		lock: false, 
        content: "", // 内容 
        initFn: function() {
        // 对话框初始化后执行的函数
         var api = this;
        api.loading.on(); 
        api.content(temp);
         
        if(!DB.core.bro('ie')){
        $('#uiOverlay div').css("background-color","#000");
        }
       var t='<a href="javascript:;" class="ui-dialog-close" style="height:15px;">X</a>';
        $('.ui-dialog-footer').html(t);
        //$('.ui-dialog-footer').addClass('ui-dialog-title');
        $('.ui-dialog-footer').css("border-top","0");
        $('.ui-dialog-close').css("float","right");
        $('.ui-dialog-close').css("top","-9px");
        $('.ui-dialog-close').css("right","-12px");
        $('.ui-dialog-close').css("position","relative");  
        $('.ui-dialog-l,.ui-dialog-r,.ui-dialog-t,.ui-dialog-b').addClass('ui-dialog-title');
        $('.ui-dialog-l,.ui-dialog-r,.ui-dialog-t,.ui-dialog-b').css("cursor","move");  
        $('.ui-dialog-l,.ui-dialog-r,.ui-dialog-t,.ui-dialog-b').css("padding-left","0"); 
         $('.vcastr3').focus();
	   
	   api.loading.off();
        },
        yesFn: function() { 
             return false;
         },
        noFn: function() {
          // 取消按钮回调函数
         },
        closeFn: function() {

         // 对话框关闭执行的函数
         }
        });
} 
}); 
 function Autoimg(t,wh,he)
 { $(t).hide();var x=$(t).width();
 var y=$(t).height();
 if(he>y)
 {
   $(t).css("margin-top",parseInt((he-y)/2)+"px");
 }
  else if(x/y>wh/he&&y!=0&&x!=0)
   {
   $(t).css("width",wh+"px");
   var yyy=parseInt(wh*(y/x));
   $(t).css("height",yyy+"px");
   var yy;
   yy=parseInt((he-yyy)/2);
   if(yy>0&&yyy>he){yy=-yy;}
   
   $(t).css("margin-top",yy+"px");
   $(t).css("margin-bottom",yy+"px"); 
   }else if(he==0){
    if(x>wh){
      $(t).css("width",wh+"px");
   }
}
else if(x!=0){
   // $(this).attr("height",he);
	$(t).css("height",he+"px");
	var xx;
	//xx=parseInt(y*(wh/he));
	//$(this).css("width",xx+"px");
  }
  $(t).fadeIn(1000);
 } 
DB.package("DB.core", function() { 
this.loadyear=function(spanId,now1)
{spanId=spanId.trimStart('#'); 
var today = new Date();
    var year = today.getFullYear();
    var day1=$("#"+spanId).find("option").get(0);
         var dayHtml=$(day1).text();
	var birthdayYear=document.getElementById(spanId);  
	for(var i=0;i<year-1899;i++)
	{
		if(i==0)
		{
		birthdayYear[i] = new Option(dayHtml,"0");
		}
		else
		{
		birthdayYear[i] = new Option(year-i+1,year-i+1);
		}
		 
	} 
	$("#"+spanId).val(now1);
	 
}
this.binddate=function(yearId,monthId,dayId){
  $(yearId).bind("change", function(){
      DB.core.loadday(yearId,monthId,dayId);
    }); 
    $(monthId).bind("change", function(){
      DB.core.loadday(yearId,monthId,dayId);
    }); 
  DB.core.loadday(yearId,monthId,dayId)
}
this.loadday=function(yearId,monthId,dayId)
{   dayId=dayId.trimStart('#');
     var year=$(yearId).val();var temp="";
	     var month=$(monthId).val();
	     var day=$("#"+dayId).val();
         var day1=$("#"+dayId).find("option").get(0);
         var dayHtml=$(day1).text();
	 if(month=="0"||month=="")
	 {
	    return;
	 }
	var daysInMonth = new Date(year,month, 0).getDate();
	var birthdayDay=document.getElementById(dayId);  birthdayDay.options.length = 1 ;
      for(var i=0;i<daysInMonth+1;i++)
	{
		if(i>0)
		{
		birthdayDay[i] = new Option(i,i);  
		}else
		{birthdayDay[i] = new Option(dayHtml,''); 
		}
	}
$("#"+dayId).val(day);

}   
}); 
function ubb(sls,sls1,content,ww)
{$(".commentubb").hide();
$(".replycontent").show();$(".replycontent").val('');
var temp='<iframe id="ubb"'+content+' name="ubb" src="/other/editor/u1.htm?id='+content+'&ww='+ww+'" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>';
$(sls1).hide();
$(sls).html(temp);
$(sls).show();
} 
DB.package("DB.core", function() { 
var _this=this;
var dialogId="dialogComplaint";
this.Complaint=function(t,tspaceId){
var lan_Add=DB.core.getlan(4,"举报","举报");

var lan_1=DB.core.getlan(4,"举报原因","举报原因");
if(t==2){lan_1=DB.core.getlan(4,"建议分类","建议分类");}
var lan_2=DB.core.getlan(4,"详细描述","详细描述"); 
$.dialog({
        id: dialogId,
        title: lan_Add,
        content: "", // 内容
         width: 500,
        height: 250,
        initFn: function() {
        // 对话框初始化后执行的函数
         var api = this;
        api.loading.on();
        var content="<li>亲爱的用户：欢迎使用安全中心建议、举报系统，您的建议、举报信息我们将在取证后进行处理，并有特别奖励送出，感谢您的支持，请不要恶意举报哦！ </li>";
        content+='<li class="ComplaintClass_li"> <label class="label">'+lan_1+'</label> <div class="field"> <select class="select" name="ComplaintClass" id="ComplaintClass"> <option value=""></option> </select> </div> <div id="ComplaintClassAlt" class="formAlt"></div> <div id="ComplaintClassTip" class="formTip"></div> </li>'; 
        content+='<li class="ComplaintMemo_li"> <label class="label">'+lan_2+'</label> <div class="field"> <textarea class="text" name="ComplaintMemo" id="ComplaintMemo"></textarea> </div> <div id="ComplaintMemoAlt" class="formAlt"></div> <div id="ComplaintMemoTip" class="formTip"></div> </li>';  
        api.content("<fieldset class=\"fieldset fieldset-style-1\"><ul>"+content+"</ul></<fieldset>");
       var hh="";
        if(t==1)
        {
           hh='<option value="1">发布非法广告</option><option value="2">内容反动</option><option value="3">内容色情</option>';
           hh+='<option value="4">管理员不称职</option><option value="5">内容涉及人事攻击</option><option value="6">恶意网址举报</option><option value="7">其他</option>';
		   $("#ComplaintClass").html(hh);       
        }
       else if(t==2){
           api.title("建议");
           hh='<option value="1">网站设计方面</option><option value="2">网站内容方面</option><option value="3">网站管理方面</option>';
           hh+='<option value="4">其它</option>';
		   $("#ComplaintClass").html(hh); 
       }
        api.loading.off();
        },
        yesFn: function() {
           _this.ComplaintAdd(t,tspaceId);
			 return false;
         },
        noFn: function() {
      
          // 取消按钮回调函数
         },
        closeFn: function() {

         // 对话框关闭执行的函数
         }
        });
}
this.ComplaintAdd=function(t,tspaceId){
var tip="";
var spaceId=DB.loginSpaceId;
if(tspaceId==null){
tspaceId=spaceId;
}
var ComplaintUrl=location.href;
var ComplaintClass=$("#ComplaintClass").val();
var ComplaintMemo=$("#ComplaintMemo").val();
if(ComplaintMemo==""){
  tip=DB.core.getlan(28,"ComplaintMemoTip","请填写详细描述");
   $.dialog.tips(tip,2);return;
}
if(ComplaintMemo.length>2000){
  tip=DB.core.getlan(28,"ComplaintMemoTip1","描述不得超过2000个字符");
   $.dialog.tips(tip,2);return;
}
  $.post('ajax.aspx',{a:'ComplaintAdd' ,spaceId:spaceId,ComplaintClass:ComplaintClass,ComplaintType:t,ComplaintMemo:ComplaintMemo,tspaceId:tspaceId
  },function(data) {
             if(DB.core.re(data)){return;} $.dialog.tips(data.Msg,data.Code); 
if(data.Code==1){ 
     $.dialog.close(dialogId);
     }
   },"json");
} 
}); 
DB.package("DB.core", function() { 

this.bro=function(spanId)
{  var re;
   var userAgent = navigator.userAgent.toLowerCase();     
jQuery.browser = {   
    version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],   
    safari: /webkit/.test( userAgent ),   
   opera: /opera/.test( userAgent ),   
    msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),   
   mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )   
 };  
  switch(spanId){
     case "ie":
      re=jQuery.browser.msie;
     break;
     case "msie":
      re=jQuery.browser.msie;
     break;
     case "noie":
     if(jQuery.browser.msie){re=fasle}else{re=true;} 
     break;
    case "mozilla":
      re=jQuery.browser.mozilla;
    case "ff":
      re=jQuery.browser.mozilla;
  }
 return re;
}
 
}); 
//描述：String原型扩展,去除开头某个字符
String.prototype.trimStart = function(trimString) {
    var re = new RegExp("^" + trimString + "*", "g");
    return this.replace(re, "");
}

//日期：2010-11-20
//描述：String原型扩展,去除末尾某个字符
String.prototype.trimEnd = function(trimString) {
    var re = new RegExp(trimString + "*$", "g");
    return this.replace(re, "");
}

//格式字符串 //alert(" http://{0}/{1}/{2}".format("www.meizz.com", "web", "abc.htm"));
String.prototype.format = function() {
    if (arguments.length == 0) return this;
    for (var s = this, i = 0; i < arguments.length; i++)
        s = s.replace(new RegExp("\\{" + i + "\\}", "g"), arguments[i]);
    return s;
} 
DB.package("DB.core", function() { 
    /**
    * 图片加载中自适应
    * e.g autoSize(ImgD,W,H,M)
    * <img src="" onload ="autoSize(this,88,88,0)" />
    * <img src="" onload ="autoSize(this,88,88,0)" />
    * @method
    * @param <String|Object> ImgD
    * @param <int> W 最大宽度
    * @param <int> H 最大高度
    * @param <int> M 边距
    * @returns <Image> ImgD 图片对象
    */
    this.autoSize = function(ImgD, W, H, M) {;
        var tImg = new Image();
        if (typeof (ImgD) != "object" && typeof (ImgD) == "string") {
            ImgD = document.getElementById(ImgD);
        }
        tImg.src = ImgD.src;
        var w = tImg.width;
        var h = tImg.height;
        if (typeof M == "undefined")
            M = 0;
        if (w > 0 && h > 0 && W > 0 && H > 0) {
            if (w / h >= W / H) {
                if (w > W) {
                    ImgD.width = W; ImgD.height = (h * W) / w;
                }
                else {
                    ImgD.width = w; ImgD.height = h;
                }
            }
            else {
                if (h > H) {
                    ImgD.height = H; ImgD.width = (w * H) / h;
                }
                else {
                    ImgD.width = w; ImgD.height = h;
                }
            }
            if (M > -1) {
                //ImgD.style.marginLeft=M+(W-ImgD.width)/2+'px';
                ImgD.style.marginLeft = "auto";
                ImgD.style.marginRight = "auto";
                ImgD.style.marginTop = M + (H - ImgD.height) / 2 + 'px';
            }
        }
       $(ImgD).hide(); $(ImgD).fadeIn(200);
        return ImgD;
    }

/**
* 预加载图片
* eg. imgPreload('demo.jpg');
*     imgPreload(['demo.jpg','demo2.jpg']);
* @method
* @param <String|Array> src 图片的地址
* @return <Array> src 图片地址的集合
*/
this.imgload=function(src) {
    var src = (src && src.constructor === Array) ? src : [src];
    for (var v in src) {
        var img = new Image();
        img.src = v;
    }
    return src;
}
    this.autoSize1 = function(ImgD,ImgR,othernum) {
         var dnum=15;        
        if($(ImgR).length>0&&$(ImgR).css("display")!="none"&&$(ImgR).width()>othernum){
         dnum=dnum+$(ImgR).width();
     }else{dnum=dnum+othernum;}
       var tImg = new Image();
      var ImgT =$(ImgD);
        if (typeof (ImgD) != "object" && typeof (ImgD) == "string") {
            ImgT = $(ImgD);//document.getElementById
        }
        tImg.src = ImgT.attr("src");
        var w = tImg.width;
        var h = tImg.height;
       var wwh = $(window).width()-dnum;
       var whh= $(window).height();
      if(w>wwh||ImgT.width()>wwh){
            ImgT.width(wwh);
      }else if(ImgT.width()<wwh){
           if(wwh>w){ ImgT.width(w);}else{ImgT.width(wwh);}
      }else if(ImgT.width()>w){
          ImgT.width(w);
      }
} 
}); 
DB.package("DB.core", function() { 
this.full=function(spanId,t,css1,css2){
$(spanId).toggle();$(t).toggleClass(css1);$(t).toggleClass(css2);
} 
}); 
DB.package("DB.core", function() { 
this.cover=function(spanId,coverId)
{ 
  var spaceId=DB.loginSpaceId;
$.post('ajax.aspx',{a:'Cover_Copy', spaceId:spaceId,coverId:coverId},function(data) {
 if(DB.core.re(data)){return;}$.dialog.tips(data.Msg,data.Code);
  if(data.Code==1){ 
           
     }
      },"json");
}
this.greet=function(spanId,tospaceId)
{ 
  var spaceId=DB.loginSpaceId;
$.post('ajax.aspx',{a:'Add_Greet', spaceId:spaceId,tospaceId:tospaceId},function(data) {
 if(DB.core.re(data)){return;}$.dialog.tips(data.Msg,data.Code);
  if(data.Code==1){ 
           
     }
      },"json");
}
this.delgreet=function(spanId,transId)
{ 
  var spaceId=DB.loginSpaceId;
$.post('ajax.aspx',{a:'Del_Greet', spaceId:spaceId,transId:transId},function(data) {
 if(DB.core.re(data)){return;}$.dialog.tips(data.Msg,data.Code);
  if(data.Code==1){ 
           $(spanId).parent().remove();
     }
      },"json");
}

  
}); 
 

