﻿var timoutid;
$(document).ready(function() {

    //---------インゲームトップ初心者ガイド start------------//
    //インゲームトップ初心者ガイド部分
    $(".ggword_box").load("/client/CcLinkFile/ingame/gmtsangoku.html");
    $("#gameGuideImgId div").each(function(index) {
        $(this).click(function() {
            if (index == 0) {
                //無敵三国ガイド導入、イメージ設定
                $(".ggword_box").load("/client/CcLinkFile/ingame/gmtsangoku.html");
                $("#gmtsangokuId").attr("src", "/client/attachments/images/green/topg_sagoku_green.jpg");
            } else if (index == 1) {
                //カエサル帝国ガイド導入、イメージ設定
                $(".ggword_box").load("/client/CcLinkFile/ingame/gmcaesary.html");
                $("#gmcaesaryId").attr("src", "/client/attachments/images/green/topg_ca_green.jpg");
            } else if (index == 2) {
                //明珠三国ガイド導入、イメージ設定
                $(".ggword_box").load("/client/CcLinkFile/ingame/gmeisyu.html");
                $("#gmeisyuId").attr("src", "/client/attachments/images/green/topg_lm_green.jpg");
            }
        });
    });
    //画像loading、ajaxリクエスト開始、終了処理
    $("#gameGaiduBoxId span").bind("ajaxStart", function() {
        //ガイドボックスクリア
        $(".ggword_box").html("");
        $("#gmtsangokuId").attr("src", "/client/attachments/images/green/topg_sagoku_gray.jpg");
        $("#gmcaesaryId").attr("src", "/client/attachments/images/green/topg_ca_gray.jpg");
        $("#gmeisyuId").attr("src", "/client/attachments/images/green/topg_lm_gray.jpg");
        //整个页面中任意ajax交互开始前，function中的内容会被执行
        //$(this).show();
    }).bind("ajaxStop", function() {
        //整个页面中任意ajax交互结束后，function中的内容会被执行  
        $(this).slideUp("1000");
    });
    //---------インゲームトップ初心者ガイド end------------//

    //---------インゲームトップニュース start------------//
    $("#newslistallId").load("/client/api/getIndexNewsList.aspx?ccLinkId=0&gameId=-1");
    $("#newslistingame").load("/client/api/getIndexNewsList.aspx?ccLinkId=0&gameId=0");
    $("#newslistmt3goku").load("/client/api/getIndexNewsList.aspx?ccLinkId=0&gameId=52");
    $("#newslistcaesary").load("/client/api/getIndexNewsList.aspx?ccLinkId=0&gameId=51");
    $("#newslisthoushinki").load("/client/api/getIndexNewsList.aspx?ccLinkId=0&gameId=55");
    $("#newslistaurora").load("/client/api/getIndexNewsList.aspx?ccLinkId=0&gameId=56");

    $("#gameNewsnaviId li").each(function(index) {
        $(this).mouseover(function() {
            var liNode = $(this);
            timoutid = setTimeout(function() {
                $("div.contentin").removeClass("contentin");
                $("#gameNewsnaviId li.newsnow").removeClass("newsnow");
                $("div").eq(index).addClass("contentin");
                $("div.contentfirst:eq(" + index + ")").addClass("contentin");
                liNode.addClass("newsnow");
            }, 300);
        }).mouseout(function() {
            clearTimeout(timoutid);
        });
    });
    //------------インゲームトップニュース end------------//

});

