var Cash =
{
	ITEM : { '21' : '1,000', '22' : '3,000', '23' : '5,000', '24' : '7,000', '25' : '10,000', '26' : '30,000'},
	start : function()
	{
		var CashPriceArrayLayer = $$('.cash_price_off');
		CashPriceArrayLayer[0].className = 'cash_price_on';
		CashPriceArrayLayer.each(Cash.build, this);
		
		document.CASH_FORM.ITEM_NUM[0].checked = true;
	},
	build : function(el)
	{
		el.addEvent(
			'click', function(event){
				Cash.setOff();
				this.className = 'cash_price_on';
				var item = this.getElement('.ITEM');
				item.checked = true;
				Cash.setPriceSpan(item.value);
			}
		);
	},
	setOff : function()
	{
		$$('.cash_price_on').each(function(el)
			{
				el.className = 'cash_price_off';
			}, this);
	},
	setPriceSpan : function(ITEM_NUM)
	{
		$('price_span').setText(this.ITEM[ITEM_NUM]);
	},
	submit : function()
	{
		if(!Login.getLogin())
		{
			alert('로그인 후 이용하시기 바랍니다.');
			location.href = '/Login/?DIR=' + document.location.href;
			return false;
		}
		
		if(IE_) {
			var F = document.CASH_FORM;
			
			var shape = "left=70,top=10,toolbar=no,location=no,directories=no,status=no,";
			shape += "menubar=no,scrollbars=no,resizable=no";
			
			// 결제수단마다 열리는 창크기가 모두 달라서 by dooil at 081115
			switch (F.CT_NUM.value) {
			case "1": // 핸드폰
				shape += ",width=450,height=545";
				break;
			case "2": // 신용카드
				shape += ",width=450,height=540";
				break;
			case "3": // 도서상품권
				shape += ",width=450,height=525";
				break;
			case "4": // 문화상품권
				shape += ",width=450,height=600";
				break;
			case "5": // 실시간계좌이체
				if(NT6_)
					alert('비스타 이용자 분들은 실시간계좌이체 시 "신한은행" 결제가\n해당 업체 사정으로 불가능 하오니 이점 많은 양해 부탁드립니다.');
				shape += ",width=450,height=560";
				break;
			default:
				shape += ",width=450,height=530";
			}
			//////////////////////////////////////////////////////
			
			var win = open("", 'CASHPOPUP', shape);
			F.action = '/Store/Cash/cashpopup.php';
			F.target = 'CASHPOPUP';
			F.submit();
		}
		else
		{
			alert('결제는 Internet Explorer에서만 가능합니다.');
		}
	},
	EndLayer : function()
	{
		var Windows = _Window.showPopUp();
		Windows.style.width    = '454px';
			
		var Param = {  'MODE' : 'Call'  };
		
		Param["Type"] =  "Page";
		
		Param.onComplete = function ()
		{
			UI.setScreenCenter(this);
		}.bind(Windows);
	    	  
	    AutoRun.setDocument(Windows, Param, 'EndLayer.php');
	}
}

addEvent(window, 'load', Cash.start);

function CashAlert()
{
	alert('실명인증과 기본정보 변경을 해주셔야 뮤직쉐이크닷컴 이용이 가능합니다.');
	document.location.href = '/MyMusicShake/My_Information/Basic_Information/';
}
