/*begin*/
/*2011-05-11 15:26:26*/
jQuery(function() {
    jQuery("#gameCategoryListPy li a").mouseover(function() {
        type = jQuery(this).html();
        if (type == "\u53f0\u670d\u6e38\u620f" || type == "\u7f51\u9875\u6e38\u620f") type = "WEBG";
        jQuery("#gameCategoryListPy li").removeClass();
        jQuery(this).parent().addClass("currert");
        jQuery("#py_index").addClass("first");
        jQuery("#gameCategoryListPyFrame").show();
        html = "";
        if (type == "O" || type == "U") html = '<li style="width:200px; font-size:14px;">\u8be5\u5b57\u6bcd\u4e0b\u6682\u65e0\u6e38\u620f</li>';
        else for (key in gamelist) if (gamelist[key].name.toUpperCase() == type) for (key1 in gamelist[key].list) {
            if (gamelist[key].list[key1].hot == 1) tmpclass = 'class="hotgame"';
            else tmpclass = "";
            html += "<li " + tmpclass + "><a onclick=\"__utmTrackEvent('\u9996\u9875\u70b9\u51fb','\u9009\u62e9\u6e38\u620f-\u62fc\u97f3\u7d22\u5f15','" + gamelist[key].list[key1].name + '\');" href="http://trading.5173.com/search/' + gamelist[key].list[key1].gameid + '.shtml" title="' + gamelist[key].list[key1].name + '">' + gamelist[key].list[key1].name + "</a></li>"

        }
        if (type != "WEBG") jQuery("#gameCategoryListPy li:last").addClass("last");
        if (type != "A") jQuery("#py_a").parent().addClass("sec");
        jQuery("#gameCategoryListPyFrame").html(html)

    });
    jQuery(".home_gamelist .title").mouseover(function() {
        _removeGameListDiv()

    });
    jQuery(".appraise").mouseover(function() {
        _removeGameListDiv()

    });
    jQuery("#gameCategoryListPyFrame").bind("mouseleave", 
    function() {
        _removeGameListDiv()

    });
    function _removeGameListDiv() {
        if (jQuery("#gameCategoryListPyFrame").css("display") == "block") {
            jQuery("#gameCategoryListPyFrame").hide();
            jQuery("#gameCategoryListPy li").removeClass();
            jQuery("#py_index").addClass("first");
            jQuery("#py_a").parent().addClass("sec");
            jQuery("#gameCategoryListPy li:last").addClass("last")

        }

    }
    jQuery("#gameCategoryListPy li:last").addClass("last");
    jQuery("#diankaNavTab li").mouseover(function() {
        jQuery("#diankaNavTab li").removeClass("currert");
        jQuery(this).addClass("currert");
        jQuery(".cardlist").hide();
        jQuery("#diankaNavFrame" + this.id.substr(4)).show()

    });
    jQuery("#hotinfoTabNav li").mouseover(function() {
        jQuery("#hotinfoTabNav li").removeClass("currert");
        jQuery(this).addClass("currert");
        jQuery(".hotinfo_frame").hide();
        jQuery("#hotinfo" + this.id.substr(4)).show()

    })

});
function Each(list, fun) {
    for (var i = 0, len = list.length; i < len; i++) fun(list[i], i)

}
var objs = document.getElementById("numID").getElementsByTagName("li");
var tv = new TransformView("carousellist", "playcarouse", 226, objs.length, {
    onStart: function() {
        Each(objs, 
        function(o, i) {
            o.className = tv.Index == i ? "currert": ""

        })

    },
    Pause: 3E3

});
tv.Start();
Each(objs, 
function(o, i) {
    o.onmouseover = function() {
        o.className = "currert";
        tv.Auto = false;
        tv.Index = i;
        tv.Start()

    };
    o.onmouseout = function() {
        o.className = "";
        tv.Auto = true;
        tv.Start()

    }

});
if (document.getElementById("grouplist"))
 ued_marquee("grouplist", 22, 50, 5E3);
if (document.getElementById("marqueebox1"))
 ued_marquee("marqueebox1", 21, 50, 3E3);
if (document.getElementById("marqueebox2"))
 ued_marquee("marqueebox2", 21, 50, 3E3);
function ued_marquee(id, lineheight, speed, delay) {
    var t;
    var p = false;
    var o = document.getElementById(id);
    o.innerHTML += o.innerHTML;
    o.onmouseover = function() {
        p = true

    };
    o.onmouseout = function() {
        p = false

    };
    o.scrollTop = 0;
    function start() {
        t = setInterval(scrolling, speed);
        if (!p) o.scrollTop += 2

    }
    function scrolling() {
        if (o.scrollTop % lineheight != 0) {
            o.scrollTop += 2;
            if (o.scrollTop >= o.scrollHeight / 2) o.scrollTop = 0

        } else {
            clearInterval(t);
            setTimeout(start, delay)

        }

    }
    setTimeout(start, delay)

};


/**
通常，需要滚动显示的内容放在一个<ul>无序列表里，使用滚动特效，要把<ul>外层的DIV指定一个高度值，比如height:100px，如果不指定会出现问题。

开启滚动效果要在页面加载时调用$(element).rollList()函数，element则是元素的名称。
**/
    (function($){
$.fn.extend({
RollTitle: function(opt,callback){
if(!opt) var opt={};
var _this = this;
_this.timer = null;
_this.lineH = _this.find("li:first").height();
_this.line=opt.line?parseInt(opt.line,15):parseInt(_this.height()/_this.lineH,10);
_this.speed=opt.speed?parseInt(opt.speed,10):3000, //卷动速度，数值越大，速度越慢（毫秒
_this.timespan=opt.timespan?parseInt(opt.timespan,13):5000; //滚动的时间间隔（毫秒
if(_this.line==0) this.line=1;
_this.upHeight=0-_this.line*_this.lineH;
_this.scrollUp=function(){
_this.animate({
marginTop:_this.upHeight
},_this.speed,function(){
for(i=1;i<=_this.line;i++){
_this.find("li:first").appendTo(_this);
}
_this.css({marginTop:0});
});
}
_this.hover(function(){
clearInterval(_this.timer);
},function(){
_this.timer=setInterval(function(){_this.scrollUp();},_this.timespan);
}).mouseout();
}
})
})(jQuery); 

$(document.body).ready(function(){
$("#lastOrderProductul").RollTitle({line:1,speed:200,timespan:1500});
/**
 按照字母显示游戏
**/
//alert(!jQuery.isEmptyObject($(".ks-switchable-nav .ks-active")));
//alert($(".ks-switchable-nav .ks-active").length);
if(($(".ks-switchable-nav .ks-active")).length==0)//判断是否有选择游戏首字母
{
//    alert($(".ks-switchable-nav li:first-child").text());

    $(".ks-switchable-nav li:first-child").addClass("ks-active");
   $(".ks-switchable-content div:first-child").css("display","block");
   
   $(".ks-switchable-nav li").each(function(index){
//   alert($(this).text());
    $(this).click(function(){
       //alert($(this).text());
       //alert(index);
        $(".ks-switchable-nav li").removeClass("ks-active");
        $(".ks-switchable-content div").css("display","none");
        
        $(this).addClass("ks-active");
        $($(".ks-switchable-content div")[index]).css("display","block");
        //alert($($(".ks-switchable-content div")[2]).text());
        
    });
   });
}



}); 




/*end*/

