﻿// JScript 文件

 var d = new Date().toLocaleDateString();
 
 $(document).ready(function(){
   GetLeftGame();
   });
   
function GetLeftGame(){
  $('#leftGameList').append("<img src=\"/images/loading.gif\" />");
   $.ajax({
    url:'/GetSiteGame.ashx',
    data:'d=' + d,
    type:'get',
    success:BindLeftGame 
   });
 }
 
  function BindLeftGame(xml)
 { 
   $('#leftGameList').empty();
   //$('#leftGameList').append("<img alt=\"\" src=\"images/left_title.gif\" />");
   $(xml).find('Game').each(function(){
     var gameName = $(this).find('GameName').text();
     var gameCode = $(this).find('GameCode').text();
     if (gameCode == "083") {
        gameName = "Aion Kinah";
     }
     if (gameCode == "013")
     {  
        $('#leftGameList').append("<li><a href='/wow-gold/' title='" + FormatStr("013") + "'>World of Warcraft - US</a></li>");
     }
    else if (gameCode == "019") 
    { 
    $('#leftGameList').append("<li><a href='/world-of-warcraft-eu/' title='" + FormatStr("019") + "'>World of Warcraft - EU</a></li>");
    }
    else if (gameCode == "035")
    { 
    $('#leftGameList').append("<li><a href='/2Moons/' title='" + FormatStr("035") + "'>2Moons</a></li>");   
    }
    else if (gameCode == "065") 
    { 
    $('#leftGameList').append("<li><a href='/age-of-conan/' title='" + FormatStr("065") + "'>Age of Conan - US</a></li>");
    }
    else if (gameCode == "068") 
    {
    $('#leftGameList').append("<li><a href='/age-of-conan-eu/' title='" + FormatStr("068") + "'>Age of Conan - EU</a></li>");
    }
    else if (gameCode == "003") 
    { 
    $('#leftGameList').append("<li><a href='/eve/' title='" + FormatStr("003") + "'>EVE Online</a></li>");
    }
    else if (gameCode == "009") 
    { 
    $('#leftGameList').append("<li><a href='/everquest/' title='" + FormatStr("009") + "'>Ever Quest</a></li>");
    }
    else if (gameCode == "002") 
    {
    $('#leftGameList').append("<li><a href='/everquest-2/' title='" + FormatStr("002") + "'>Ever Quest 2</a></li>");
    }
    else if (gameCode == "001")
    {
    $('#leftGameList').append("<li><a href='/Final-Fantasy-XI-Gil/' title='" + FormatStr("001") + "'>Final Fantasy XI</a></li>");
    }
    else if (gameCode == "027") 
    { 
    $('#leftGameList').append("<li><a href='/Gaia-online/' title='" + FormatStr("027") + "'>Gaia online</a></li>");
    }
    else if (gameCode == "012") 
    { 
    $('#leftGameList').append("<li><a href='/lineage-2/' title='" + FormatStr("012") + "'>Lineage 2</a></li>");
    }
    else if (gameCode == "030") 
    {
    $('#leftGameList').append("<li><a href='/lord-of-the-rings/' title='" + FormatStr("030") + "'>Lord of the Rings Online</a></li>");
    }

    else if (gameCode == "014") 
    { 
    $('#leftGameList').append("<li><a href='/maple-story/' title='" + FormatStr("014") + "'>Maple Story</a></li>");
    }

    else if (gameCode == "070") 
    {
    $('#leftGameList').append("<li><a href='/mabinogi/' title='" + FormatStr("070") + "'>Mabinogi</a></li>");
    }
    else if (gameCode == "011")
    {
     $('#leftGameList').append("<li><a href='/swg/' title='" + FormatStr("011") + "'>Star Wars Galaxies</a></li>"); 
    }
    else if (gameCode == "083") 
    {
    $('#leftGameList').append("<li><a href='/Aion/' title='" + FormatStr("083") + "'>Aion Kinah US</a></li>");
    }
    else if (gameCode == "087") 
    { 
    $('#leftGameList').append("<li><a href='/Aion-eu/' title='" + FormatStr("087") + "'>Aion Kinah EU</a></li>");
    }
    else if (gameCode == "007")
    {
     $('#leftGameList').append("<li><a href='/gw/' title='" + FormatStr("007") + "'>Guild Wars</a></li>");
    }
    else if (gameCode == "079") 
    { 
    $('#leftGameList').append("<li><a href='/Warhammer-EU/' title='" + FormatStr("079") + "'>Warhammer Online EU</a></li>");
    }
    else if (gameCode == "078") 
    { 
    $('#leftGameList').append("<li><a href='/Warhammer-US/' title='" + FormatStr("078") + "'>Warhammer Online US</a></li>");
    }
    else if (gameCode == "010") 
    {
    $('#leftGameList').append("<li><a href='/Runescape2/' title='" + FormatStr("010") + "'>Runescape2</a></li>");
    }
    else if(gameCode=="092")
    {
         $('#leftGameList').append("<li><a href='/Cheap.092.Star_Trek_Online_-_EU.aspx' title='" + FormatStr("092") + "'>Star Trek Online - EU</a></li>");
    }
    else if(gameCode=="084")
    {
        $('#leftGameList').append("<li><a href='/Cheap.084.Runes_of_Magic.aspx' title='" + FormatStr("084") + "'>Runes of Magic</a></li>");
    }
    else if(gameCode=="080")
    {
        $('#leftGameList').append("<li><a href='/Cheap.080.Habbo.aspx' title='" + FormatStr("080") + "'>Habbo</a></li>");
    }
     else if(gameCode=="057")
    {
        $('#leftGameList').append("<li><a href='/Cheap.057.Cabal-US.aspx' title='" + FormatStr("057") + "'>Cabal-US</a></li>");
    }
     else if(gameCode=="085")
    {
        $('#leftGameList').append("<li><a href='/Cheap.085.Cabal-EU.aspx' title='" + FormatStr("085") + "'>Cabal-EU</a></li>");
    }
     else if(gameCode=="093")
    {
        $('#leftGameList').append("<li><a href='/Cheap.093.Hero_Online.aspx' title='" + FormatStr("093") + "'>Hero_Online</a></li>");
    }
     else if(gameCode=="005")
    {
        $('#leftGameList').append("<li><a href='/Cheap.005.Ragnarok_Online.aspx' title='" + FormatStr("005") + "'>Ragnarok_Online</a></li>");
    }
     else if(gameCode=="094")
    {
        $('#leftGameList').append("<li><a href='/Cheap.094.Grand_Fantasia.aspx' title='" + FormatStr("094") + "'>Grand_Fantasia</a></li>");
    }
     else if(gameCode=="095")
    {
        $('#leftGameList').append("<li><a href='/Cheap.095.Alganon.aspx' title='" + FormatStr("095") + "'>Alganon</a></li>");
    }
     else if(gameCode=="096")
    {
        $('#leftGameList').append("<li><a href='/Cheap.096.Fallen_Earth.aspx' title='" + FormatStr("096") + "'>Fallen_Earth</a></li>");
    }
     else if(gameCode=="097")
    {
        $('#leftGameList').append("<li><a href='/Cheap.097.WonderKing.aspx' title='" + FormatStr("097") + "'>WonderKing</a></li>");
    }
     else if(gameCode=="098")
    {
        $('#leftGameList').append("<li><a href='/Cheap.098.Requiem_Online.aspx' title='" + FormatStr("098") + "'>Requiem_Online</a></li>");
    }
//    else
//    {
//        $('#leftGameList').append("<li><a  href=\"Cheap." + gameCode +"." + gameName.replace(new RegExp(" ","gm"),"_") + ".aspx\"  title=\"" + FormatStr(gameCode) + "\">" + gameName + "</a></li>");
//    }
//     gameName = gameName.replace(new RegExp("_","gm")," ");
//     $('#leftGameList').append("<li><a  href=\"Cheap." + gameCode +"." + gameName.replace(new RegExp(" ","gm"),"_") + ".aspx\"  title=\"" + FormatStr(gameCode) + "\">" + gameName + "</a></li>");
   });
 } 
 
 
 function FormatStr(gameCode)
    {
        var titleKey = '';
        switch (gameCode)
        {
            case "004":
                titleKey = "Anarchy Online Credits, AO Credits";
                break;
            case "008":
                titleKey = "City of Villains";
                break;
            case "015":
                titleKey = "Dungeons Dragons Online Platinum";
                break;
            case "003":
                titleKey = "Eve Isk, Eve Online Isk";
                break;
            case "009":
                titleKey = "Everquest Platinum, Everquest Plat, EQ Plat, EQ Platinum";
                break;
            case "002":
                titleKey = "EQ2 Plat, EQ2 Gold, Everquest 2 Gold, Everquest 2 Platinum, Everquest 2 Plat, EQ2 Platinum";
                break;
            case "001":
                titleKey = "Final Fantasy XI Gil, FFXI Gil, Final Fantasy Gil";
                break;
            case "027":
                titleKey = "Gaia Gold, Gaia online Gold, Gaiaonline Gold";
                break;
            case "007":
                titleKey = "Guild Wars Gold";
                break;
            case "012":
                titleKey = "Adena, Lineage 2 Adena";
                break;
            case "014":
                titleKey = "Maple Story Mesos, MapleStory Mesos, Maple Story Meso";
                break;
            case "005":
                titleKey = "Ragnarok Online";
                break;
            case "016":
                titleKey = "RF Online";
                break;
            case "006":
                titleKey = "Rose Online";
                break;
            case "029":
                titleKey = "Scions of Fate";
                break;
            case "020":
                titleKey = "SilkRoad Gold, Silk Road Gold";
                break;
            case "011":
                titleKey = "SWG Credits, Star Wars Galaxies Credits";
                break;
            case "028":
                titleKey = "Vanguard-saga of heroes Gold, Vanguard Saga";
                break;
            case "019":
                titleKey = "World of Warcraft Gold, Warcraft Gold";
                break;
            case "013":
                titleKey = "World of Warcraft Gold, Warcraft Gold";
                break;
            case "030":
                titleKey = "Lord of the Rings Online";
                break;
            default:
                titleKey = "";
                break;
        }
        return titleKey;
    }