document.write('<script type="text/javascript" src="/comm-htdocs/js/oss_base.js"></script>');
document.write('<script type="text/javascript" src="/comm-htdocs/js/loadjs.js"></script>');
document.write('<script src="http://ossweb-img.qq.com/images/js/login/loginmanagerv3.js"></script>');
document.write('<script type="text/javascript" src="/comm-htdocs/js/game_area/lol_server_select.js"></script>');

var G_HERO={
							"22":"紫晶射手 艾希",
						  "34":"双重冰晶 艾尼维亚",
						  "20":"合金装备 努努",
						  "23":"恶魔之刃 泰达米尔",
						  "79":"美酒节特使 古拉加斯",
						  "113":"死亡骑士 瑟庄妮",
						  "2":"五杀摇滚鼓手 奥拉夫",
						  "106":"北地风暴 沃利贝尔",
						  "77":"四神之力 乌迪尔",
						  "48":"垃圾场 特朗德尔"
						 };
						 
function Undo()
{
	return;
}

function UnloginFunc()
{
$("#popInfoBox").html("亲爱的召唤师，本活动已过期");
showDialogs("popInfo");
return;
	LoginManager.login();
}

function SploginFunc()
{
$("#popInfoBox").html("亲爱的召唤师，本活动已过期");
showDialogs("popInfo");
return;
	LoginManager.login(GetUserItem);
}

function Fail()
{
    alert('非常抱歉，系统繁忙，请稍后再试！');
}

function GetParamValue(obj,num,vName)
{
	for(var i=0;i<obj[0].length;i++)
	{
		if(obj[0][i] == vName)
			return obj[num][i];
	}
	return null;
}

function GetUserItem()
{
	LoginFunc = function(){
		$("a[id^='hero_']").attr("class","noyet");
		$("em[id^='tip_']").html("未领取");
		var goUrl="http://apps.game.qq.com/cgi-bin/lol/act/a20130425aram/user_list.cgi?rid=" + Math.random();
		FloadJS(goUrl,
		function Success() {
			if(typeof(J_U_I_LIST)!="undefined" && J_U_I_LIST!=null) {
				var iRet = parseInt(unescape(J_U_I_LIST.iRet),10);
				if(iRet == 0) {
					for(var i=1;i<J_U_I_LIST["list"].length;i++)
					{
						var _tId=unescape(GetParamValue(J_U_I_LIST["list"],i,"iHeroID"));
						if(parseInt(unescape(GetParamValue(J_U_I_LIST["list"],i,"iType"))) > 0)
						{
							$("#hero_"+_tId).attr("class","yes");
							$("#tip_"+_tId).html("已领取");
							$("#hero_"+_tId).attr("title",unescape(GetParamValue(J_U_I_LIST["list"],i,"dTime"))+"领取至"+LOLServerSelect.zoneToName(unescape(GetParamValue(J_U_I_LIST["list"],i,"iArea"))));
						}
					}
					
				}
			}
		}
		,Undo);
		return;
	}
	LoginManager.checkLogin(LoginFunc, Undo);
}

function GetSkin(hero)
{
$("#popInfoBox").html("亲爱的召唤师，本活动已过期");
showDialogs("popInfo");
return;
	if($("#hero_"+hero+"").attr("class")=="yes")
	{
		$("#popInfoBox").html("您已经领取了该奖励");
		showDialogs("popInfo");
		return;
	}
	LoginFunc = function(){
		roleSelector = RoleSelector.init({
					'gameId' : 'lol', //业务ID
					'submitEvent' : function(roleObject){
						if(roleObject.submitData["areaid"] == "" || roleObject.submitData["roleid"] == "")
						{
							alert("对不起，请先选择大区");
							return;
						}
						SendSkin(hero,roleObject.submitData["areaid"]);
					}
				});
		roleSelector.show();
	}
	LoginManager.checkLogin(LoginFunc, SploginFunc);
}

function SendSkin(hero,areaid)
{
	LoginFunc = function(){
		$("#popInfoBox").html("领取中，请不要刷新页面");
		showDialogs("popInfo");
		var goUrl="http://apps.game.qq.com/cgi-bin/lol/act/a20130425aram/GetGift.cgi?areaid="+areaid+"&hero="+hero+"&rid=" + Math.random();
		FloadJS(goUrl,
		function Success() {
			if(typeof(J_ITEM_INFO)!="undefined" && J_ITEM_INFO!=null) {
				var iRet = parseInt(unescape(J_ITEM_INFO.iRet),10);
				if(iRet == 0) {
					$("#popInfoBox").html(G_HERO[hero]+"成功领取至"+LOLServerSelect.zoneToName(areaid));
					GetUserItem();
					toShare(G_HERO[hero]);
				}else if(iRet == 1){
					$("#popInfoBox").html("您今天已经领取了"+G_HERO[unescape(J_ITEM_INFO.iHero)]+"，请明天再来");
				}else{
					$("#popInfoBox").html(unescape(J_ITEM_INFO.sMsg));
				}
			}
		}
		,Undo);
		return;
	}
	LoginManager.checkLogin(LoginFunc, UnloginFunc);
}

function toShare(msg)
{
	var vShareInfo="#极地大乱斗#乱斗之王，称霸极地！我刚刚在《英雄联盟》新模式“极地大乱斗”的活动中赢取了“"+msg+"”皮肤，太赞了，总共有 多达10款皮肤可以免费领取，你也来参加吧！！！";
	var vImg="http://ossweb-img.qq.com/images/lol/act/a20130425aram/weibo.jpg";
	var share = new CommShare({
		id: 924 // 活动ID，必须指定
	});

  share.ShareMicroblog({
      content: vShareInfo,
      imgurl: vImg,
      complete: function(res) {
          if(res) {
              //alert(res.msg);
          } else {
              //alert("分享失败啦");
          }
          return false; // 阻止默认处理函数
      }
  });
}

/*  |xGv00|821f4d22951b6f8c89982a64b4e5a183 */