﻿
var v_L_INDEX_TOGGLE_ITEM_HOT = 'L_INDEX_TOGGLE_ITEM_HOT_LIST';

var ItemShopControls = {
    GetRandomItemImgView : function(v_layer, v_Item_List, v_item_count){
	    var v_content = '';
	    var v_Item_ViewCount = v_item_count;   //보여지는 갯수
	        v_Item_ViewCount = v_Item_ViewCount - 1;
    	var v_Item_Count = v_Item_List.length;          //총 아이템 리스트 갯수
	    
	    var v_Array_ItemList = ItemShopControls.GetRandomNumber(v_Item_Count); //총 아이템에서 랜덤 정렬
	    
	    //v_content += '<div class="hotItemBox">';
		//v_content += '<div class="innner">';
	        for (var i = 0; i <= v_Item_ViewCount; i++)
	        {
				//v_content += '<div class="armImg"><a href=""><img src="' + _IMG_URL + '/Tekki/2009/index/hotitem/arm_01.jpg" /></a></div>';
				//v_content += '<div class="itemName1">HAR-6</div>';
				//v_content += '<div class="itemName2">Heavy Assault Rifle</div>';
    	        v_content += v_Item_List[v_Array_ItemList[i]];
				//v_content += '<td>' + v_Item_List[v_Array_ItemList[i]] + '</td>';
    	        //if (i!=v_Item_ViewCount) 
    	         //   v_content += '<td width="12"></td>';
    	    }
        //v_content += '</div>';
		//v_content += '</div>';
	    
	    SetObjectStyle.SetinnerHTML(v_layer, v_content);    
	    setTimeout(function(){ItemShopControls.GetRandomItemImgView(v_layer, v_Item_List, v_item_count)}, 4950);
    },
    GetRandomNumber : function (itemcnt){
        var v_Array_Item_Index = new Array();
        var temp;
        var v_rnum;

        for(var i = 0; i < itemcnt; i++){
            v_Array_Item_Index.push(i);
        }

        for(var i = 0; i < v_Array_Item_Index.length; i++)
        {
            v_rnum = Math.floor(Math.random() * itemcnt);
            temp = v_Array_Item_Index[i];
            v_Array_Item_Index[i] = v_Array_Item_Index[v_rnum];
            v_Array_Item_Index[v_rnum] = temp;
        }
        return v_Array_Item_Index;
    },
    ItemView : function(v_item_index){
	openPopup('item_shop', '/Shop/Item/Item_Detail.asp?item_index=' + v_item_index, '570', '430')
    }

}

var YarouControls = {
	Validate : function(v_cp_code, v_login, v_user_id){
		if (v_login == 'True'){
			if(v_cp_code == 'GNTK')
				window.location.href = 'https://service.gamania.co.jp/gash/tekki/order.aspx?id=' + v_user_id;
			else if(v_cp_code == 'NMTK')
				window.location.href = 'http://game.netmarble.jp/cpsite/tekki/Point/Index.asp';
			else if(v_cp_code == 'GYTK')
				window.location.href = 'http://www.gameyarou.jp/?d_url=https://secure.gameyarou.jp/Cash/Cash_Main.asp';
			else if(v_cp_code == 'HGTK')
				window.location.href = 'http://tekki.hangame.co.jp/shopBuy.nhn';
		}else{
			var v_err_msg = '「鉄鬼ヤーロチャージ」を行うためには、ログインが必要になります。\nログインしてからご利用ください。';
			alert(v_err_msg);
		}
	},
	ValidatePopUp : function(v_cp_code, v_login, v_user_id){
		if (v_login == 'True'){
			if(v_cp_code == 'GNTK')
				window.open('https://service.gamania.co.jp/gash/tekki/order.aspx?id=' + v_user_id);
			else if(v_cp_code == 'NMTK')
				window.open('http://game.netmarble.jp/cpsite/tekki/Point/Index.asp');
			else if(v_cp_code == 'GYTK')
				window.open('http://www.gameyarou.jp/?d_url=https://secure.gameyarou.jp/Cash/Cash_Main.asp');
			else if(v_cp_code == 'HGTK')
				window.open('http://tekki.hangame.co.jp/shopBuy.nhn');
		}else{
			var v_err_msg = '「鉄鬼ヤーロチャージ」を行うためには、ログインが必要になります。\nログインしてからご利用ください。';
			alert(v_err_msg);
		}
	}
}