/*global tab&slide plugin*/
(function(a){a.fn.tabs=function(c){var d={current:0,type:"click",content:".tabContent",duration:300,active:"active",effect:false,pause:6000,nav:false,width:470,height:150,single:0,move:1};var b=a.extend(d,c);return this.each(function(){if(b.single>0){var m=a(this);var p=m.find("li");var e=p.length;var f="<li></li>";var q="";while(e--){q+=f}var j="<ul class='tabCon'>"+q+"</ul>";m.after(j);var g=m.parent().find(".tabCon li");var k=p.parent();var i=b.height;var l=b.width}else{var p=a(b.content);var g=b.controller?a(b.controller):a(this).find("li");var k=p.parent();var i=b.height;var l=b.width}var e=p.length;var s=0;var r;if(b.effect){k.wrap("<div class='tabContent'></div>")}g.eq(b.current).addClass(b.active);p.eq(b.current).addClass(b.active);if(b.effect!="slide"&&b.effect!="slideV"){p.not(":eq("+b.current+")").hide()}else{if(b.single&&b.effect=="slideV"){k.parent().css({overflow:"hidden",height:i*b.single+"px"})}else{k.parent().css({overflow:"hidden",height:i+"px",width:l+"px"})}}if(b.effect=="slide"){if(b.single){p.css({width:Math.floor(l/b.single)+"px","float":"left"});k.css({width:Math.floor(l/b.single)*e+"px"})}else{p.css({width:l+"px","float":"left"});k.css({width:l*e+"px"})}}if(b.effect=="slideV"){p.css({height:i+"px"})}if(b.effect=="fade"||b.effect=="fadeM"){p.css({position:"absolute",left:"0",top:"0"})}if(b.nav){var h=k.parent().css("position","relative");h.prepend("<a href='javascript:;' class='prev' style='display:none'></a>").append("<a href='javascript:;' class='next' style='display:none'></a>");var n=h.find(".prev");var o=h.find(".next");h.hover(function(){n.show();o.show()},function(){n.hide();o.hide()});n.click(function(){var w=g.parent().find("."+b.active).index();g.eq(w-1).trigger("mouseover")});o.click(function(){var w=g.parent().find("."+b.active).index();g.eq((w+1)-e).trigger("mouseover")})}switch(b.type){case"click":g.bind("click",t);break;case"hover":g.bind("mouseover",t);break;case"auto":g.bind("mouseover",t);var u=(b.single>0)?a(this).parent():a(this).parent().find(".tabContent");u.hover(function(w){clearInterval(r)},function(){v()});function v(){r=setInterval(function(){s=g.parent().find("."+b.active).index()+1;if(b.single&&b.effect=="slide"&&s==Math.floor(e/b.move)+e%b.move-(b.single-b.move)){s=0}else{if(b.single&&b.effect=="slideV"&&s==Math.floor(e/b.move)+e%b.move-(b.single-b.move)){s=0}else{if(s==e){s=0}}}g.eq(s).trigger("mouseover");s++},b.pause)}v();break}function t(y){y.stopPropagation();var x=a(this);var w=x.index();if(x.hasClass(b.active)){return false}x.siblings().removeClass(b.active);x.addClass(b.active);p.eq(w).siblings().removeClass(b.active);p.eq(w).addClass(b.active);switch(b.effect){case"fade":p.not(":eq("+w+")").css("display","none");p.eq(w).fadeIn(b.duration);break;case"fadeM":p.not(":eq("+w+")").fadeOut(b.duration);p.eq(w).fadeIn(b.duration);break;case"slide":k.stop();if(b.single){k.animate({marginLeft:"-"+Math.floor(l*(s/b.single))*b.move+"px"},b.duration)}else{k.animate({marginLeft:"-"+l*w+"px"},b.duration)}break;case"slideV":k.stop();if(b.single){k.animate({marginTop:"-"+i*(s*b.move)+"px"},b.duration)}else{k.animate({marginTop:"-"+i*w+"px"},b.duration)}break;default:p.not(":eq("+w+")").css("display","none");p.eq(w).css("display","block")}}a(".tabContent").bind("mouseover",function(w){if(!w.fromElement){clearInterval(r);if(b.nav){h.find(".prev").show();h.find(".next").show()}}})})}})(jQuery);

jQuery(function($){
  /*partner detection*/
    var getInstall = (function(){
        var s = document.body.id;
        var all = ['molo_style','wandoujia_style'];     
        return {
            is_molo : s==all[0],
            is_wandoujia : s==all[1],
            is_pc_embeded : s==all[0] || s==all[1]
        }
    })(); 
    
    if(!getInstall.is_pc_embeded){
      /*Scroll to the page plugin*/
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery); 
      /*Load Nav effect plugin*/
      (function(a){a.fn.suiMenu=function(b){var c=a.extend({style:"height:50px;width:100px;background-color:red;",initItemClass:".current",dur:600,id:""},b);this.each(function(){function g(a,b){var a=a||c.dur;d.stop(),d.animate({left:e.offset().left+(e.width()-f)/2+"px",top:e.offset().top+"px"},a,b)}var b=a(this),d=a("<div class='suiMenu' id='"+c.id+"' style='display:none;z-index:0;position:absolute;top:0;left:0;"+c.style+"' />").prependTo(a("body")),e=b.find(c.initItemClass),f=d.width();e.length>0&&g(0,function(){d.css("display","block"),b.hover(function(){d.show()},function(){g()}),b.find("li").bind("mouseover",function(b){d.stop();var e=a(this).offset(),g=a(this).width();d.animate({left:e.left+(g-f)/2+"px",top:e.top+"px"},c.dur)})}),a(window).bind("resize",function(){g(0)}),b.find("li").css({position:"relative","z-index":"1"})})}})(jQuery);
      /*Load jQ Animation extend*/
      jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}});

    }
    
    if(getInstall.is_pc_embeded){
        $("a").removeAttr("target");
        
        if(getInstall.is_molo){
            var $getInstall_applist = $("#molo_style").find(".list li,.list_2 li");
            $getInstall_applist.each(function(){
                var $this = $(this);
                var title = $this.find(".name").text();
                var id = $this.find("a").attr("href").match(/\d+/);
                var href = "javascript:molodownload('http:\/\/molo.nduoa.com\/web\/default\/apk\/id\/"+id+"','"+title+"')";
                $this.append('<div class="download_popup"></div>');
                $this.find(".download_popup").html('<a href="'+href+'"></a>');
            });
        }
        
        if(getInstall.is_wandoujia){
            var $getInstall_applist = $("#wandoujia_style").find(".list li,.list_2 li");
            $getInstall_applist.each(function(){
                var $this = $(this);
                var id = $this.find("a").attr("href").match(/\d+/);
                var label = $this.find(".name").text();
                var href = "http:\/\/wandoujia.nduoa.com\/web\/default\/apk\/id\/"+id;

                $this.append('<div class="download_popup"></div>');
                $('<a>').attr('href', href).click(function(e){
                    parent.appDownload({
                        name:label,
                        downloadUrl:href
                    });
                }).appendTo($this.find('.download_popup'));
            });     
        }
        
        var showDownBtn = true;
    }
    
    if(getInstall.is_wandoujia){
        
        var download_popup = $(".download_popup,.i_meta");  
        try{
            var tom = parent.getApplication();
        }catch(e){
            tom = {};
        }
        var appName_onpage = $getInstall_applist.find(".name");
        if (appName_onpage.length<1){
            appName_onpage = $(".dt_info h2")
        }
        
        var tom_length = tom.length;
        var temp='';
        
        while(tom_length--){
            temp += tom[tom_length]["labelName"];
        }
        
        
        $.each(appName_onpage,function(i,e){        
            //$("body").append("<h1 style='font-size:20px'>"+e.innerHTML+"</h1><br>")
            if( temp.indexOf(e.innerHTML) !=-1){
                download_popup.eq(i).find("a").addClass("status_installed");
            } 
        })
        
        var page_update = (function(){
            download_popup.click(function(){
                $(this).find("a").addClass("status_downloading");
            });
            
            window.RefreshMarketInstallStatus = function(){
                var flag = RefreshMarketInstallStatus.flag;
                if(flag==0){
                    download_popup.find(".status_downloading").removeClass("status_downloading").addClass("status_installing");
                    flag++;
                }
                
                if(flag==1){
                    download_popup.find(".status_installing").removeClass("status_installing").addClass("status_installed");
                    flag++;
                }
            }
            window.RefreshMarketInstallStatus.flag = 0;
        })();   
    }
    
    if(getInstall.is_wandoujia){
        $(".top_slide .con").tabs({
            type:"auto",
            content:".top_slide .tab_body li",
            effect:"slide",
            duration:300,
            pause:6000,
            width:547,
            height:210
        });
        $(".dt_slide .con").tabs({
            nav:true,
            type:"hover",
            content:".dt_slide .tab_body li",
            effect:"slide",
            duration:300,
            pause:6000,
            width:180,
            height:280
        });
    }
  
    if(!getInstall.is_pc_embeded){
        $(".top_slide .con").tabs({
            type:"auto",
            content:".top_slide .tab_body li",
            effect:"slide",
            duration:300,
            pause:6000,
            width:585,
            height:220
        });
        $(".dt_slide .con").tabs({
            nav:true,
            type:"auto",
            content:".dt_slide .tab_body li",
            effect:"slide",
            duration:300,
            pause:3000,
            width:407,
            height:280
        })
    }
  
    if(getInstall.is_molo){
        $(".top_slide .con").tabs({
            type:"auto",
            content:".top_slide .tab_body li",
            effect:"slide",
            duration:300,
            pause:6000,
            width:585,
            height:220
        });
        $(".dt_slide .con").tabs({
            nav:true,
            type:"hover",
            content:".dt_slide .tab_body li",
            effect:"slide",
            duration:300,
            pause:6000,
            width:358,
            height:280
        });
    }
    
  
    /*fix ie 6 hover bug*/  
    $.fn.hoverfix = function(){
        $(this).hover(function(e){
            $(this).addClass("hover");
        },function(){
            $(this).removeClass("hover");
        });
        return this;
    };
  
    /*fix ie 6 active bug*/ 
    $.fn.activefix = function(){
        var that = $(this);
        that.bind("mousedown",function(){
            $(this).addClass("active");
        }).bind("mouseup",function(){
            $(this).removeClass("active");
        }).bind("mouseout",function(){
            $(this).removeClass("active");
        });
        return this;
    }
  
    /*list limit*/
    $.fn.listlimit = function(num){
        var that = $(this);
        var li = that.find("li")
        var len = li.length;
        var more = $("<div class='list_more' />");
        var hidd_li = li.eq(num-1).nextAll();
     
        hidd_li.wrapAll($("<li class='hidd_wrap' style='display:none'></li>")).wrapAll("<ol></ol>");
     
        if(len>num){
            that.after(more);
            more.click(function(){
                hidd_li.parent().parent().slideDown();
                $(this).hide();
            });
        }else{
            return ;
        }     
    }
    $(".dl_count a").click(function(e){
        e.preventDefault();
        $.scrollTo( '#comment_block', 600, {easing:'swing'} ); 
    }) 
    $("#other_version ul").listlimit(5)
  
    $("#b").activefix();  
    $(".btn").activefix().hoverfix();
    $(".toggleBanner").hoverfix();
    $(".rom_steps .link").hoverfix();
    $(".rom_item li").hoverfix(); 
    $(".lt_block li").hoverfix();
    $(".list_rom li").hoverfix();
    $(".hidd_c").parent().hoverfix();
    $(".download_others span").hoverfix();

    if($('#jd-wrapper'))
    {
        $('#jd-wrapper').load('/web/ajax/justDownloaded',function(){
            $(".list_4").tabs({
                single:3,
                move:1,
                type:"auto",
                effect:"slide",
                duration:300,
                pause:2000,
                width:192,
                height:80
            });
            fnPopup($(this));
        });
    }
  
    $(".rom_con").tabs({
        type:"click",
        content:".text_row"
    });
    $(".daily_game_con").tabs({
        type:"hover",
        content:".daily_game .item"
    });
    $(".daily_soft_con").tabs({
        type:"hover",
        content:".daily_soft .item"
    });
  
        
    $(".dt_slide a").click(function(e){
        e.preventDefault();
    });
    
    $("#topic_list li").hoverfix();
    $(".toggleBanner").hoverfix();
    $(".rom_steps .link").hoverfix();
    $(".rom_item li").hoverfix();   
    $(".list_rom li").hover(function(){
        $(this).find(".info_box").css({
            display:"block"
        });
    },function(){
        $(this).find(".info_box").css({
            display:"none"
        });
    });
    
    $(".c_stars").each(function(){

        var $this = $(this);
        var ele = $this.find("b");
        var star_value = $(".star_value");
        var commentBox = $this.find(".commentBox");

        ele.hover(
            function(){
                if($this.hasClass("submited")){
                    return false;
                }
                $(this).nextAll("b").attr("class", "unstared");
                $(this).prevAll("b").andSelf().attr("class","stared");
            },
            function(){
                if($this.hasClass("submited")){
                    return false;
                }
                $(this).attr("class", "stared");
            }
            )
        .click(function(){
            commentBox.show();
            $this.addClass("submited");
        });
                                    
        $(".confirm").click(function(){
            var rating_value = $this.find(".stared").size();
            var target_type = $("input[name='rating_target_type']").val();
            var target_id = $("input[name='rating_target_id']").val();  
            commentBox.hide();
            $.post("/rating/add",
            {
                "rating_target_type":target_type,
                "rating_target_id": target_id,
                "rating_value":rating_value
            },function(){
                var su_message = $("<div>评分成功</div>").css({
                    "font-weight":"bold",
                    "font-size":"16px",
                    "text-indent":"30px"
                });
                su_message.appendTo($this).fadeOut(1200);
                ele.unbind("click");
            });
        });
                
        $(".del").click(function(){
            $this.find(".stared").attr("class","unstared");
            $this.removeClass("submited");
            commentBox.hide();
        });
    
    });


    if(!getInstall.is_pc_embeded){
        $(".howto_btn").click(function(){
            $(".howto").slideToggle();
        });

        if(typeof festivalLogo=="undefined"){
            $("#head .logo").bind("mouseover",function(){
                var $this = $(this);
                if($this.hasClass("hover")){
                    return;
                }
                $this.stop().end();
                $this.addClass("hover");

                $this.animate({
                    "top":"5px"
                },150,"swing").animate({
                    "top":"26px"
                },600,"easeOutBounce",function(){
                    $this.removeClass("hover");
                });
            })
        }
  
  
        $(".permission").each(function(){
            var $this = $(this);
            var normal = $this.find(".normal");
            var more = $this.find(".more");
            if (normal.find(".row").size()>0){
                more.show();
                more.click(function(){
                    $(this).hide();
                    normal.slideDown();
                });
            }
        });

        /*Social share*/
        (function(){
            var $this = $(".social_share");
            if($this.length<1){
                return ;
            }
            var html ="";
            var URI = location.href;
            var CONTENT = encodeURIComponent("《"+$(".dt_info h2").text()+"》很不错哦，分享一下～       ——来自#N多网#");
            var ico_URI = "/images/share/";
            var icons = [
            {
                name:"QQ空间",
                ico:"ico_qzone.png",
                url:"http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+URI
            },

            {
                name:"新浪微博",
                ico:"ico_sina.png",
                url:"http://v.t.sina.com.cn/share/share.php?title="+CONTENT+"&url="+URI+" &source="
            },

            {
                name:"百度搜藏",
                ico:"ico_baidu.png",
                url:"http://cang.baidu.com/do/add?it="+CONTENT+"&iu="+URI+"&tn="
            },

            {
                name:"人人网",
                ico:"ico_renren.png",
                url:"http://share.renren.com/share/buttonshare.do?title="+CONTENT+"&link="+URI
            },

            {
                name:"开心网",
                ico:"ico_kaixin.png",
                url:"http://www.kaixin001.com/repaste/share.php?rtitle="+CONTENT+"&rurl="+URI
            },

            {
                name:"搜狐微博",
                ico:"ico_sohu.png",
                url:"http://t.sohu.com/third/post.jsp?&title="+CONTENT+"&url="+URI+"&content=utf-8&pic="
            },

            {
                name:"腾讯微博",
                ico:"ico_qq_t.png",
                url:"http://v.t.qq.com/share/share.php?title="+CONTENT+"&url="+URI+"&appkey=&source=&site="
            }
            ];

            for(var i=0;i<icons.length;i++){
                html += ('<a target="_blank" class="social_icon" href="'+icons[i].url+'" title="'+icons[i].name+'"><img src="'+ ico_URI +icons[i].ico+'" alt="" /></a>');
            }
            $this.append("<span class='social_label'>分享到：</span><span class='social_icon_wrap'>"+html+"</span>");

        })();

        /*for XUZHICHAO*/
        $(".rom_content .text_row img").removeAttr("style");

        /*Nav plugin excute*/
        if($(".superMenu").find(".current").length<1){
            $(".superMenu li").eq(0).addClass("current");
        }

        $(".superMenu").suiMenu({
            dur:"300",
            style:"",
            id:"topNav_superMenu"
        });

    }
    
    $(".con").each(function(){
        $(this).css({
            "width":($(this).find("li").size())*15+"px"
        }).show();
    });
    
    function hidepopup(){
        $("#vispop").hide().removeAttr("id");
    }
        
    $(window).bind("resize",function(){
        $("#wrap").find(".overflow-x").removeClass("overflow-x")
    }).bind("blur",function(){
        hidepopup();
    }).bind("mouseout",function(e){
        if(!e.relatedTarget){
            hidepopup();
        }
    })
    
    function fnPopup(ele){
        //ele should be a jquery object contains <div class='popup'>
        var popup = ele.find(".popup");
        popup.each(function(){
            var $this = $(this);
            var parent  = $this.parent();
            var icon = parent.find(".icon img");
            var p_icon = $this.find(".p_icon");
        
            parent.one("mouseover",function(){
                p_icon.append(icon.clone());
            });
        
            $this.mouseover(function(){
                $this.hide();
            });
        
            parent.hover(function(){
                var icon_pos = icon.position();
                var left = icon_pos.left;
                var top = icon_pos.top-$this.height()-8;
                var right = $("body").width();
            
                if(left+$this.width()>right){
                    $this.addClass("overflow-x");
                }         
            
                if (top<=10) {
                    $this.addClass("below");
                    top = icon_pos.top+parent.height();
                }
                $this.css({
                    "position":"absolute",
                    "left":left,
                    "top":top
                }).fadeIn(100).attr("id","vispop");           
                if (showDownBtn) {
                    $(this).find(".download_popup").css({
                        "position":"absolute",
                        "left":icon_pos.left,
                        "top":icon_pos.top
                    }).show();
                }
            },function(){
                if (showDownBtn) {
                    $(this).find(".download_popup").hide();
                }
                $this.fadeOut(0).hide().removeAttr("id");
            });
            
        });      
    }
    
    fnPopup($("body"));
  
    $(".ex_search,#search").submit(function(){
        var content = $(this).find(".keywords").val();
        if(content == '搜索站内信息' || content == ""){
            return false;
        }
        window.location = $(this).attr('action') + '?q=' + content;
        return false;  
    }); 
    
   

});

