﻿var s_nUrl      = location.href;
var s_nLenUrl   = parseInt(s_nUrl.length)
var s_nUrls     = s_nUrl.substring(0, s_nLenUrl + 1)
var r_dmn       = s_nUrls;

var ServiceLinkCommon = {
	CM_Home				: new SvcItemCommon("CM00", _WEB_URL_PORTAL),
	MB_InfoMain			: new SvcItemCommon("MB07", _SEC_URL_SSL + "/Member/mgrPri/mgrPri_Main.asp" ),
	MB_Join				: new SvcItemCommon("MB00", _SEC_URL_SSL + "/Member/Regist/Member_Regist_Step_01.asp", self) ,
	MB_Logout			: new SvcItemCommon("MB11", _SEC_URL_SSL + "/Member/Login/__Common_Logout_Proc.asp?r_dmn=" + r_dmn),
	MB_Login			: new SvcItemCommon("MB12", _SEC_URL_SSL + "/Member/Login/__Common_Login_Form.asp", self),
	MB_ChangePrivate 	: new SvcItemCommon("MB01", _SEC_URL_SSL + "/Member/MgrPri/Member_MgrPri_Check_Form.asp?proc_cd=CHGINFO"),
	MB_FindId			: new SvcItemCommon("MB03", _SEC_URL_SSL + "/Member/ForgotInfo/ForgotInfo_Main.asp" ),
	MB_FindPwd			: new SvcItemCommon("MB04", _SEC_URL_SSL + "/Member/ForgotInfo/ForgotInfo_Main.asp#ANCHOR_PASSWORD" ),	
	MB_Withdrawal		: new SvcItemCommon("MB05", _SEC_URL_SSL + "/Member/Withdrawal/Member_Withdrawal_Check_Form.asp" ),
	MB_WithdrawalCancel	: new SvcItemCommon("MB06", _SEC_URL_SSL + "/Member/Withdrawal/Member_Withdrawal_Cancel_Form.asp" ),
	MB_DekaronIkan	    : new SvcItemCommon("MB101", _SEC_URL_SSL + "/Dekaron_Ikan/Ikan_Step_01.asp" ),
	MB_SecuPassInfo		: new SvcItemCommon("MB19", _SEC_URL_SSL + "/Member/Login/__Common_Login_Security_Pwd_info.asp"),

	CS_News				: new SvcItemCommon("CS01", _WEB_URL_PORTAL + "/News/News_List.asp?ntc_sort=N"),
	CS_Event			: new SvcItemCommon("CS02", _WEB_URL_PORTAL + "/News/News_List.asp?ntc_sort=E"),
	CS_Maintenance		: new SvcItemCommon("CS03", _WEB_URL_PORTAL + "/News/News_List.asp?ntc_sort=M"),

	CS_Support			: new SvcItemCommon("CS10", _SPT_URL + "/FAQ/FAQ_Main.asp"),
	CS_Qna  			: new SvcItemCommon("CS11", _SPT_URL + "/Qna/Qna_Main.asp"),
	CH_Main				: new SvcItemCommon("CH01", _SEC_URL + "/Cash/Cash_Main.asp"),
	CH_Charge			: new SvcItemCommon("CH03", _SEC_URL_SSL + "/Cash/Charge/Charge_Main.asp"),	
	CH_MyCash_Main		: new SvcItemCommon("CH11", _SEC_URL_SSL + "/Cash/MyCash/MyCash_Main.asp"),

	MB_RegisterWithFrame		: new SvcItemCommon("MB20", _WEB_URL_PORTAL + '/?d_url=' + _SEC_URL + '/Member/Regist/Member_Regist_Step_01.asp', top) ,
	MB_ForgotInfoWithFrame		: new SvcItemCommon("MB21", _WEB_URL_PORTAL + '/?d_url=' + _SEC_URL + '/Member/ForgotInfo/ForgotInfo_Main.asp', top) ,
	MB_ChangePrivateWithFrame	: new SvcItemCommon("MB22", _WEB_URL_PORTAL + '/?d_url=' + _SEC_URL_SSL + '/Member/MgrPri/Member_MgrPri_Check_Form.asp?proc_cd=CHGINFO', top) ,
	
	CH_MainWithFrame			: new SvcItemCommon("CH11", _WEB_URL_PORTAL + '/?d_url=' + _SEC_URL + '/Cash/Cash_Main.asp', top) ,
	CH_ChargeWithFrame			: new SvcItemCommon("CH12", _WEB_URL_PORTAL + '/?d_url=' + _SEC_URL_SSL + '/Cash/Charge/Charge_Main.asp', top) ,
	CH_MyCashWithFrame			: new SvcItemCommon("CH13", _WEB_URL_PORTAL + '/?d_url=' + _SEC_URL_SSL + '/Cash/MyCash/MyCash_Main.asp', top) ,
	
	go : function(objSvc, objTarget, strParams) {
		var url = new String(objSvc.url);
		if(strParams) {
			if( url.search(/\?/) > -1){
				url = url + "&";
			}else{			
				url = url + "?";
			}
			url = url + strParams;
		}
		if(typeof(objTarget)!="object"){
			objSvc.target.location = url;
		}else{
			objTarget.location = url;
		}
		return;
	},
	
	Go : function(objSvc, objTarget) {
		ServiceLinkCommon.go(objSvc, objTarget) 
	}
}

function SvcItemCommon(id, url, target)
{ 	
	this.id = id; 
	this.url = url; 
	this.target = target;
	if(typeof(target)!='object')
		this.target =  self;
}

var ChannelingUrlControls = {
	GoRegisterUrl : function(v_cp_code, v_url){
		if (v_url.length > 0){
			top.location.href = v_url;
		}
		return;
	},
	GoForgotUrl : function(v_cp_code, v_url){
		if (v_url.length > 0){
			top.location.href = v_url;
		}
		return;
	},
	GoLogoutUrl : function(v_cp_code, v_url){
		if (v_url.length > 0){
			top.location.href = v_url;
		}
		return;
	},
	GoCSUrl : function(v_cp_code, v_url){
		if (v_url.length > 0){
			top.location.href = v_url;
		}
		return;
	}
}
