/**
 * Web developer public js class
 * @author gaoli
 * @date 2010-10-30
 */

(function(win, U, $) {

    win[U] = {
        /**
         * Registers module
         * @param mods {Object}
         * @param cover {string}
         */
        add: function(mods, cover) {
            if (cover === undefined) cover = false;
            for (var i in mods)
                if (cover || !(i in this)) this[i] = mods[i];
            return this;
        }
    };

    win[U].add({
        /**
         * ie
         */
        ie: $.browser.msie,

        /**
         * ie6 | ie7
         */
        ie6: $.browser.msie && $.browser.version < 7,
        ie7: $.browser.msie && $.browser.version < 8,

        /**
         * hoverToggle
         * @param obj {Object}
         */
        hoverToggle: function(object) {
            $.each(object, function(obj, name) {
                $(obj).hover(function() {
                    $(this).addClass(name);
                }, function() {
                    $(this).removeClass(name);
                })
            })
        },

        /**
         * clearDefault
         * @param obj {jQueryObj}
         */
        clearDefault: function(obj, className) {
            if (className != undefined) {
                obj.addClass(className);
            }
            obj.focus(function() {
                if (this.value == this.defaultValue) {
                    this.value = "";
                    if (className != undefined)
                        $(this).removeClass(className);
                }
            }).blur(function() {
                if (this.value == '') {
                    this.value = this.defaultValue;
                    if (className != undefined)
                        $(this).addClass(className);
                }
            });
        },

        /**
         * Get cookie
         * @param
         * @return
         */
        getCookie: function(name) {
            var cookie_start = document.cookie.indexOf(name);
            var cookie_end = document.cookie.indexOf(";", cookie_start);
            return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
        },

        /**
         * Set cookie
         * @param
         * @return
         */
        setCookie: function(cookieName, cookieValue, seconds, path, domain, secure) {
            var expires = new Date();
            expires.setTime(expires.getTime() + seconds);
            document.cookie = escape(cookieName) + '=' + escape(cookieValue)
                    + (expires ? '; expires=' + expires.toGMTString() : '')
                    + (path ? '; path=' + path : '/')
                    + (domain ? '; domain=' + domain : '')
                    + (secure ? '; secure' : '');
        },

        /**
         * Show footer information
         * @return
         */
        showFooter: function(footStyle) {
            if (footStyle == "white") {
                document.write('<div class="layout foot foot_white"><div class="foot_link"><a href="http://corp.dukuai.com/corp/page/intro.html" title="" target="_blank" rel="nofollow">公司简介</a> | <a href="http://corp.dukuai.com/corp/page/news.html" title="" target="_blank" rel="nofollow">公司动态</a> | <a href="http://corp.dukuai.com/corp/page/partners.html" title="" target="_blank" rel="nofollow">合作伙伴</a> | <a href="http://corp.dukuai.com/corp/page/join.html" title="" target="_blank" rel="nofollow">诚聘英才</a> | <a href="http://corp.dukuai.com/corp/page/law.html" title="" target="_blank" rel="nofollow">法律声明</a> | <a href="http://corp.dukuai.com/corp/page/contact.html" title="" target="_blank" rel="nofollow">联系我们</a> | <a href="http://www.19lou.com/help.php" title="" target="_blank" rel="nofollow">帮助中心</a> | <a href="http://www.19lou.com/misc/links/more.html" title="" target="_blank">友情链接</a></div><p class="foot_copyright">&copy;copyright2001-2012 杭州十九楼网络传媒有限公司 版权所有  ICP证：浙B2-20070008</p></div>');
            } else {
                document.write('<div class="layout foot"><div class="foot_link"><a href="http://corp.dukuai.com/corp/page/intro.html" title="" target="_blank" rel="nofollow">公司简介</a> | <a href="http://corp.dukuai.com/corp/page/news.html" title="" target="_blank" rel="nofollow">公司动态</a> | <a href="http://corp.dukuai.com/corp/page/partners.html" title="" target="_blank" rel="nofollow">合作伙伴</a> | <a href="http://corp.dukuai.com/corp/page/join.html" title="" target="_blank" rel="nofollow">诚聘英才</a> | <a href="http://corp.dukuai.com/corp/page/law.html" title="" target="_blank" rel="nofollow">法律声明</a> | <a href="http://corp.dukuai.com/corp/page/contact.html" title="" target="_blank" rel="nofollow">联系我们</a> | <a href="http://www.19lou.com/help.php" title="" target="_blank" rel="nofollow">帮助中心</a> | <a href="http://www.19lou.com/misc/links/more.html" title="" target="_blank">友情链接</a></div><p class="foot_copyright">&copy;copyright2001-2012 杭州十九楼网络传媒有限公司 版权所有  ICP证：浙B2-20070008</p></div>');
            }
        },
	
		
        /**
         * Show topic footer information
         * @return
         */		
		showTopicFooter:function(opt){
			var defaults = {PM:'',Plan:'',UI:'',Flash:'',F2E:'',Edit:'',bgcolor:'#000000'};
			opt = $.extend({},defaults,opt);
			document.write('<div id="goTopicTop"><p><a href="javascript:;">回专题顶部</a><span></span></p></div>');
			document.write('<div class="topic-foot"><div class="tf-bd"><dl class="about-company"><dt><a href="http://www.19lou.com/" target="_blank" title="19楼">19lou.com</a></dt><dd><a href="http://corp.dukuai.com/corp/page/intro.html" target="_blank" rel="nofollow">公司简介</a><a href="http://corp.dukuai.com/corp/page/partners.html" target="_blank" rel="nofollow">合作伙伴</a><a href="http://www.19lou.com/help.php" target="_blank" rel="nofollow">帮助中心</a><a href="http://corp.dukuai.com/corp/page/join.html" target="_blank" rel="nofollow">诚聘英才</a><a href="http://corp.dukuai.com/corp/page/contact.html" target="_blank" rel="nofollow">联系我们</a></dd><dd>2001-2012 杭州十九楼网络传媒有限公司 版权所有 ICP证：浙B2-20070008</dd></dl>');
			document.write('<dl class="about-topic"><dt><a class="demo" href="http://demo.19lou.com/" target="_blank" title="19楼起点站">19楼起点站</a><a class="ued" href="http://www.19ued.com/" target="_blank" title="19云">19云</a></dt><dd><span>产品:'+opt.PM+'&nbsp;/&nbsp;</span><span>策划:'+opt.Plan+'&nbsp;/&nbsp;</span><span>视觉:'+opt.UI+'&nbsp;/&nbsp;</span><span>视频:'+opt.Flash+'&nbsp;/&nbsp;</span><span>前端:'+opt.F2E+'&nbsp;/&nbsp;</span><span>运营:'+opt.Edit +'&nbsp;/</span></dd></dl>');

			
			//goTopicTop
			function goTopicTop(opt){			
				var win = $(window), gobtn = $("#goTopicTop");
				gobtn.find('span').css({"background-color":opt});
				var changeOpacity = function (opa){
					if(Ued.ie){				
						gobtn.find('span').css({"filter":"alpha(opacity="+opa+")"});				
					}else{
						gobtn.find('span').css({"opacity":opa/100});
					}	
				} 		
					changeOpacity(30);
					(Ued.ie6) ? gobtn.css("position","absolute") : gobtn.css({"position":"fixed","bottom":"90px"})
					win.bind("scroll resize", function(){
						(win.scrollTop() == 0) ? gobtn.fadeOut() : gobtn.fadeIn();
						if(Ued.ie6){
						gobtn.css("top",win.height() + win.scrollTop() - 143 + "px");
						}
					});
				gobtn.find('a').click(function () {
					$('body,html').animate({
					scrollTop: 0
					}, 300);
					return false;
				}); 			

				gobtn.find('a').hover(function(){
					changeOpacity(60);
				},function(){
					changeOpacity(30);
				});
			}
			goTopicTop(opt.bgcolor);
		},		
		

        /**
         * Copy to clipboard
         * @param string txt
         * @return string
         */
        copyToClipboard: function(txt) {
            //IE
            if (window.clipboardData) {
                window.clipboardData.clearData();
                window.clipboardData.setData("Text", txt);
            }
            //Firefox
            else if (window.netscape) {
                try {
                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                } catch(e) {
                    alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
                }
                var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
                if (!clip) {
                    return;
                }
                var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
                if (!trans) {
                    return;
                }
                trans.addDataFlavor('text/unicode');
                var str = new Object();
                var len = new Object();
                var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
                var copytext = txt;
                str.data = copytext;
                trans.setTransferData("text/unicode", str, copytext.length * 2);
                var clipid = Components.interfaces.nsIClipboard;
                if (!clip) {
                    return false;
                }
                clip.setData(trans, null, clipid.kGlobalClipboard);
            }
        },

        /**
         * 通用弹窗组件
         * @param
         * @return
         */
        showWindow: function(options) {

            $(".showWindow_box").remove();

            var showWindowClose = function() {
                obj.remove();
            };

            //options
            var defaults = {
                type:"gray",id:"defaultId",title:"",content:"",loading:0,masking:0,
                button:[
                    {
                        idname:"confirm_id",
                        title:"确定",
                        classname:"btn_sm_m",
                        callback:function() {
                            return true;
                        }
                    },
                    {
                        idname:"cancel_id",
                        title:"取消",
                        classname:"btn_option_m",
                        callback:function() {
                            return true;
                        }
                    }
                ],
                callback:function() {
                    return true;
                },tips:""
            };

            var oriButton = options.button;

            //extend
            if (options.button) {
                if (!$.isArray(options.button)) {
                    var obj = options.button;
                    options.button = [obj];
                } else if (options.button.length < 2) {
                    options.button.push("");
                }
                $.each(options.button, function(i) {
                    options.button[i] = $.extend({}, defaults.button[i], options.button[i]);
                })
            }

            options = $.extend({}, defaults, options);

            //content
            if (options.type == "green") {
                $(document.body).append('<div id="' + options.id + '" class="showWindow_box showWindowGreen"><div class="showWindow"><div class="showWindow_head"><div class="showWindow_head_bg"></div><h3 class="showWindow_title">' + options.title + '</h3><a class="showWindow_close" href="javascript:;" title="关闭">关闭</a></div><div class="showWindow_content"><div class="showWindow_content_bg"></div></div><div class="showWindow_foot"><div class="showWindow_foot_bg"></div><div class="showWindow_button"></div></div></div></div>');
            } else {
                if (options.masking) {
                    $(document.body).append('<div id="' + options.id + '" class="showWindow_box"><div class="showWindow_masking"></div><div class="showWindow"><div class="showWindow_bg"></div><div class="showWindow_main"><h3 class="showWindow_title">' + options.title + '</h3><a class="showWindow_close" href="javascript:;" title="关闭">关闭</a><div class="showWindow_content"></div><div class="showWindow_button"></div></div></div></div>');
                } else {
                    $(document.body).append('<div id="' + options.id + '" class="showWindow_box"><div class="showWindow"><div class="showWindow_bg"></div><div class="showWindow_main"><h3 class="showWindow_title">' + options.title + '</h3><a class="showWindow_close" href="javascript:;" title="关闭">关闭</a><div class="showWindow_content"></div><div class="showWindow_button"></div></div></div></div>');
                }
            }

            //loading
            var obj = $("#" + options.id);
            var fetchContent = obj.find(".showWindow_content");

            if (options.loading) {
                fetchContent.html("等待中...");
                $.post(options.loading.url, function(data) {
                    if (options.loading.callback) {
                        fetchContent.html(options.loading.callback(data));
                    } else {
                        fetchContent.html(data);
                    }
                });
            } else {
                (typeof options.content == "string") ? fetchContent.append(options.content) : fetchContent.append(options.content.html());
            }

            //focus and blur
            obj.find(".txt").each(function() {
                $(this).focus(function() {
                    $(this).addClass("getFocus");
                })
                $(this).blur(function() {
                    $(this).removeClass("getFocus");
                })
            })


            //close
            obj.find(".showWindow_close").bind("click", function() {
                (options.callback()) ? showWindowClose() : "";
            });

            //button
            if (oriButton != undefined) {
                $.each(options.button, function(i) {
                    obj.find(".showWindow_button").append('<a id="' + this.idname + '" class="' + this.classname + '"><span>' + this.title + '</span></a>');
                    var cb = this.callback;
                    obj.find(".showWindow_button a").eq(i).bind("click", function() {
                        (cb()) ? showWindowClose() : "";
                    });
                });
            }

            //tips
            obj.find(".showWindow_button").append('<span class="showWindow_tips">' + options.tips + '</span>');

            //positionConfig
            var showWindowObj = obj.find(".showWindow"),
                    showWindowHeight = showWindowObj.height(),
                    showWindowWidth = showWindowObj.width(),
                    positionConfig = function() {
                        obj.css({
                            position : (Ued.ie6) ? "absolute" : "fixed",
                            top : (Ued.ie6) ? $(window).scrollTop() : "0",
                            height : $(window).height()
                        });
                        if (options.masking) {
                            obj.find(".showWindow_masking").css({
                                position : (!Ued.ie6) ? "fixed" : "" ,
                                height : $(window).height()
                            });
                        }
                        obj.find(".showWindow").css({
                            top : $(window).height() / 2,
                            left : $(window).width() / 2,
                            marginTop : -showWindowHeight / 2,
                            marginLeft : -showWindowWidth / 2
                        });
                        if (options.type == "green") {
                            obj.find(".showWindow_content_bg").css({
                                height : obj.find(".showWindow_ul").height()
                            });
                        }
                        ;
                    };

            //ie6
            if (Ued.ie6) {
                $(window).scroll(function() {
                    $(".showWindow_box").css({"top":$(window).scrollTop()});
                });
            }

            if ((Ued.ie6 || Ued.ie7) && options.type != "green") {
                obj.find(".showWindow_bg").css({
                    "width": showWindowWidth + 12,
                    "height": showWindowHeight + 12
                });
                obj.find(".showWindow").css({
                    "width": showWindowWidth,
                    "height": showWindowHeight
                });
                obj.find(".showWindow_title").css("width", showWindowWidth - 42);
            }

            //init
            positionConfig();


            $(".showWindow").jqDrag(".showWindow_title");
            $(window).bind("resize", positionConfig);
        },

        /**
         * 显示弹窗提示
         * @param
         * @return
         */
        showWinTips:function(options) {
            var defaults = {message:"",target:""};
            options = $.extend({}, defaults, options);
            $(options.target).addClass("error_txt").focus();
            $(".showWindow_tips").text(options.message);
        },

        /**
         * 清除弹窗提示
         * @param
         * @return
         */
        clearWinTips:function() {
            $(".showWindow input").removeClass("error_txt");
            $(".showWindow_tips").text("");
        },

        /**
         * 通用汽泡组件
         * @param array [{id,arrow,url,content,obj,cutTop,cutLeft},{}...]
         */
        tipBubble: function(array) {
            for (var i = 0; i < array.length; i++) {
                var bubbleObj = array[i],
                        obj = $(bubbleObj.obj);

                if (obj[0]) {
                    var id = bubbleObj.id, arrow = bubbleObj.arrow, url = bubbleObj.url || '', content = bubbleObj.content,
                            objTop = obj.offset().top, objLeft = obj.offset().left,
                            cutTop = bubbleObj.cutTop || '', cutLeft = bubbleObj.cutLeft || '',
                            bubbleHtml = '';

                    (cutLeft == '') ? objLeft = objLeft - 30 + "px" : objLeft = objLeft - cutLeft + "px";

                    if (arrow == undefined || arrow == 'down') {
                        bubbleHtml = bubbleHtml + '<div id="' + id + '" class="tipBubble arrowTop"><div class="rc"><p></p></div><div class="bd">';
                        (cutTop == '') ? objTop = objTop + 25 + "px" : objTop = objTop + cutTop + "px";
                    } else {
                        bubbleHtml = bubbleHtml + '<div id="' + id + '" class="tipBubble"><div class="rc"><p></p></div><div class="bd">';
                        (cutTop == '') ? objTop = objTop - 40 + "px" : objTop = objTop - cutTop + "px";
                    }

                    (url == '') ? bubbleHtml = bubbleHtml + content : bubbleHtml = bubbleHtml + '<a href="' + url + '" target="_blank">' + content + '</a>';
                    bubbleHtml = bubbleHtml + '</div><div class="rc"><p></p></div><div class="arrow"></div><a class="close" href="javascript:;">关闭</a></div>';

                    $(bubbleHtml).prependTo("body").css({
                        top: objTop,
                        left: objLeft
                    }).find(".close").click(function() {
                        $(this).parent(".tipBubble").remove();
                    });
                }
            }
        },

        /**
         * 通用幻灯组件
         *
         */
        slidePlayer: function(object, options) {

            var obj = $(object), slideItem = obj.find("li"), slidePageArea, slidePage, slideTitleArea, slideTitle, autoplay,
                    n = 0, j = 0, t, itemCount = slideItem.size(),
                    defaults = {width:"300px",height:"200px",fontsize:"12px",lineheight:"21px",right:"0",bottom:"3px",time:"5000"},
                    options = $.extend(defaults, options);

            //slideInit
            obj.css({position:"relative",margin:"0",padding:"0",width:options.width,height:options.height,overflow:"hidden",zIndex:"0"});
            slideItem.css({position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"});
            slideItem.each(function(i) {
                if (i != 0) {
                    $(this).hide();
                }
            });
            slideItem.find("img").css({width:"100%",height:"100%",border:"none"});

            //slidePage
            slidePageArea = $('<div class="slidePage" style="position:absolute;z-index:20;right:' + options.right + ';bottom:' + options.bottom + '"></div>').prependTo(obj);
            slideItem.each(function(i) {
                slidePageArea.append("<a href='javascript:;'>" + (i + 1) + "</a>");
            });
            slidePage = slidePageArea.find("a");
            slidePage.css({float:"left",marginRight:"3px",width:"15px",height:"14px",textDecoration:"none",textAlign:"center",font:"700 12px/15px 'Simsun'",color:"#000",background:"#FFF"});

            //slideTitle
            obj.prepend("<div class='slideTitle'></div><div class='slideTitleBg'></div>");
            obj.find(".slideTitleBg").css({position:"absolute",bottom:"0",left:"0",width:"100%",background:"#000",opacity:"0.4",height:options.lineheight,overflow:"hidden",zIndex:"1"});
            slideTitleArea = obj.find(".slideTitle");
            slideTitleArea.css({position:"absolute",bottom:"0",left:"0",width:"100%",textIndent:"5px",height:options.lineheight,fontSize:options.fontsize,color:"#FFF",lineHeight:options.lineheight,overflow:"hidden",zIndex:"2"});
            slideTitle = obj.find("span");
            slideTitle.each(function(i) {
                $(this).appendTo(slideTitleArea);
                if (i != 0) {
                    $(this).hide();
                }
            });

            //resetPage
            resetPage = function(pageObj, i) {
                pageObj.css({color:"#000",background:"#FFF"}).eq(i).css({color:"#FFF",background:"#FF7D01"});
            }
            resetPage(slidePage, 0);

            //PageMouseover
            slidePage.mouseover(function() {
                n = j = this.innerHTML - 1;
                slideItem.eq(j).fadeIn("200").siblings("li").fadeOut("200");
                slideTitle.eq(j).show().siblings().hide();
                resetPage(slidePage, j);
            });

            //autoplay
            autoplay = function() {
                n = n >= (itemCount - 1) ? 0 : ++n;
                resetPage(slidePage, n);
                slidePage.eq(n).triggerHandler("mouseover");
            }

            //slideHover
            obj.hover(function() {
                clearInterval(t);
            }, function() {
                t = setInterval(autoplay, options.time)
            });

            t = setInterval(autoplay, options.time);
        }
    });

    /**
     * jQuery jqDnR plugin
     */
    $.fn.jqDrag = function(h) {
        return i(this, h, 'd');
    };
    $.fn.jqResize = function(h) {
        return i(this, h, 'r');
    };
    $.jqDnR = {dnr:{},e:0,drag:function(v) {
        if (M.k == 'd')E.css({left:M.X + v.pageX - M.pX,top:M.Y + v.pageY - M.pY}); else E.css({width:Math.max(v.pageX - M.pX + M.W, 0),height:Math.max(v.pageY - M.pY + M.H, 0)});
        return false;
    },stop:function() {
        E.css('opacity', M.o);
        $(document).unbind('mousemove', J.drag).unbind('mouseup', J.stop);
    }};
    var J = $.jqDnR,M = J.dnr,E = J.e,i = function(e, h, k) {
        return e.each(function() {
            h = (h) ? $(h, e) : e;
            h.bind('mousedown', {e:e,k:k}, function(v) {
                var d = v.data,p = {};
                E = d.e;
                if (E.css('position') != 'relative') {
                    try {
                        E.position(p);
                    } catch(e) {
                    }
                }
                M = {X:p.left || f('left') || 0,Y:p.top || f('top') || 0,W:f('width') || E[0].scrollWidth || 0,H:f('height') || E[0].scrollHeight || 0,pX:v.pageX,pY:v.pageY,k:d.k};
                $(document).mousemove($.jqDnR.drag).mouseup($.jqDnR.stop);
                return false;
            });
        });
    },f = function(k) {
        return parseInt(E.css(k)) || false;
    };

    /**
     * 系统维护公告
     */
    var afficheObj = $("#affiche");
    if (afficheObj[0]) {
        afficheObj.find("span").click(function() {
            afficheObj.remove();
        })
    }
    ;

    /**
     * 通用二级导航
     */
    var navCity = $("#sites"),
            navFloor = $(".nav_2010_link_main").find(".special"),
            navMail = $(".nav_user_mail_zone"),
            navCityShow, navCityHide, navFloorShow, navFloorHide, navMailShow, navMailHide;

    navCity.hover(function() {
        $(this).addClass("hover");
    }, function() {
        $(this).removeClass("hover");
    });

    navFloor.hover(function() {
        navCity.removeClass("navCityShow");
        navMail.removeClass("navMailShow");
        clearTimeout(navFloorHide);
        navFloorShow = setTimeout(function() {
            navFloor.addClass("navFloorShow");
        }, 150)
    }, function() {
        navFloorHide = setTimeout(function() {
            navFloor.removeClass("navFloorShow");
        }, 1000)
    });

    navMail.hover(function() {
        navCity.removeClass("navCityShow");
        navFloor.removeClass("navFloorShow");
        clearTimeout(navMailHide);
        navMailShow = setTimeout(function() {
            navMail.addClass("navMailShow");
        }, 150)
    }, function() {
        navMailHide = setTimeout(function() {
            navMail.removeClass("navMailShow");
        }, 1000)
    });

    Ued.hoverToggle({
        ".nav_2010_search_txt": "search_txt_hover",
        ".nav_2010_search_btn": "search_btn_hover"
    });

    Ued.clearDefault($("#keywords"));

    $(document).ready(function() {
        /**
         * 首页导航
         */
        var navObj = $("#nav");
        if (navObj[0]) {

            Ued.tipBubble([
                {id:"autoLogin",arrow:"down",content:"一个月内记住用户名、密码自动登录。",obj:".auto_login",cutTop:18,cutLeft:0}
            ]);

            var autoLoginObj = $("#autoLogin"),
                    autoLoginlabel = $(".nav_login").find(".auto_login");
            autoLoginlabel.hover(function() {
                autoLoginObj.show();
            }, function() {
                autoLoginObj.hide();
            });

            Ued.clearDefault($(".seach_text"));

            $("#sites").hover(function() {
                $(this).addClass("hover");
            }, function() {
                $(this).removeClass("hover");
            });

            $(".nav_mes").hover(function() {
                $(this).addClass("nav_mes_show");
            }, function() {
                $(this).removeClass("nav_mes_show");
            });

            $(".login_input,.seach_text").hover(function() {
                $(this).addClass("input_hover");
            }, function() {
                $(this).removeClass("input_hover");
            });

            $(".login_btn").hover(function() {
                $(this).css("background-position", "-309px -128px");
            }, function() {
                $(this).css("background-position", "-244px -128px")
            });

            $.fn.selectbox = function() {
                var obj = $(this).find("ul");
                obj.find("a").click(function() {
                    obj.prev().text($(this).text());
                });
                $(this).click(function() {
                    obj.toggle();
                    return false;
                });
                $("body").click(function() {
                    obj.hide();
                });
            };
            $(".seach_chose").selectbox();

            if ($(".nav_header").find("h3 a").length == 3) {
                $(this).addClass("city_name_long3");
            }
        }
        ;

        /**
         * 七巧版JS
         */
        var qqb = win["qqb_js"];
        if (qqb) {
            if (isFunction(qqb)) qqb();
            else if (isArray(qqb)) {
                $.each(qqb, function() {
                    this();
                });
            }
        }
        //七巧板变量置空
        win["qqb_js"]=null;
        //判断array
        function isArray(value) {
            return value && typeof value === 'object' && typeof value.length === 'number' && typeof value.splice === 'function' && !(value.propertyIsEnumerable('length'));
        }

        //判断function
        function isFunction(fn) {
            return !!fn && !fn.nodeName && fn.constructor != String && fn.constructor != RegExp && fn.constructor != Array && /function/i.test(fn + "");
        }
    });
})(window, "Ued", jQuery);
