/************************************************************************************************
 *  
 * @version 0.1.0
 * ÃÖÃÊÀÛ¼ºÀÏ : 2008-05-14
 * ÃÖÃÊÀÛ¼ºÀÚ : Á¤¼ÒÈñ(Æ®¶óÀÌÆ°Å×Å©)
 * ÁÖÀÇ»çÇ×    : 
      1.  AMAK IT HUBÈ­ »ç¾÷¿¡¼­ »ç¿ëµÇ´Â SSO Login°ú °ü·ÃµÈ ³»¿ªÀ» Á¤ÀÇÇÑ´Ù.  
	      : ´ÜÀ§ ¾÷¹«¿¡ Á¾¼ÓÀûÀÎ ³»¿ªÀº º°µµ·Î ±â¼úÇÑ´Ù. 
	  2. ÇÔ¼öÀÇ ¼º°Ý¿¡ ¸Â°Ô Á¤ÀÇµÈ Grouping ³»¿¡ ±â¼úÇÑ´Ù. 
	  3. ½Å±Ô Ãß°¡½Ã ±âÁ¸ Ãß°¡µÈ Function ÀÌ ÀÖ´ÂÁö È®ÀÎ ÈÄ µî·ÏÇÑ´Ù. 
	  4. ÇÔ¼ö Á¤ÀÇ½Ã ¹Ýµå½Ã ÁÖ¼®°ú ÇÔ²² Á¤ÀÇÇÏ¿©¾ß ÇÑ´Ù.
	      ÁÖ¼®1Çà : »ý¼ºÀÚ ¹× »ý¼ºÀÏÀÚ Á¤º¸ 
	      ÁÖ¼®2Çà : ÇÔ¼öÀÇ °£´ÜÇÑ ¼³¸í
		  ÁÖ¼®3Çà : ÆÄ¶ó¹ÌÅÍ Á¤ÀÇ(ÆÄ¶ó¹ÌÅÍ°¡ ¿©·¯°³ÀÏ °æ¿ì, ÇàÀ» Ãß°¡ÇÑ´Ù. )
		  ÁÖ¼®4Çà : ¸®ÅÏ°ª Á¤ÀÇ (ÆÄ¶ó¹ÌÅÍÀÇ °¹¼ö Á¤º¸¿¡ µû¶ó 4ÇàÈÄ¿¡ Á¤ÀÇµÉ ¼ö ÀÖ´Ù. )
		  ex> 		  
				/ **
				 * ÀÔ·Â°ª¿¡ Æ÷ÇÔµÈ ¸ðµç ½ºÆäÀÌ½º ¹®ÀÚ¸¦ Á¦°Å ÈÄ ¸®ÅÏ
				 * @param str   Value
				 * @return ret  ½ºÆäÀÌ½º°¡ Á¦°ÅµÈ ¹®ÀÚ¿­
				 * /
				function removeSpaces(str) {
					var ret = "";
					if (str.length == 0) return ret;
				
					for (var i=0; i<str.length; i++) {
						if (str.charAt(i) != " ") ret += str.charAt(i);
					}
					return ret;
				}
	  6. ¼öÁ¤ ¹× º¯°æ½Ã ÇÏ´ÜÀÇ Version HistoryºÎ¿¡ ¹Ýµå½Ã ±â¼úÇÑ´Ù. 
 ==================================   Version History Start  ========================================
 2008-05-14 Writen by Á¤¼ÒÈñ 
      1. SSO ¿¬µ¿À» À§ÇÑ Javascript ÀÛ¼º. 
 ==================================   Version History End  ========================================

************************************************************************************************/

//var strCOMLoginUrlSSO = "https://ssotest.kofia.or.kr:4443/sso/jsp/login.jsp?";
//var strCOMLogoutUrlSSO = "https://ssotest.kofia.or.kr:4443/pls/orasso/ORASSO.wwsso_app_admin.ls_logout?";
//var strCOMLoginUrlSSO = "https://sso.kofia.or.kr/sso/jsp/login.jsp?";
var strCOMLoginUrlSSO = "https://secure.kofia.or.kr/fs/secure/login/COMLogin.jsp?";
var strCOMLogoutUrlSSO = "https://sso.kofia.or.kr/pls/orasso/ORASSO.wwsso_app_admin.ls_logout?";


/**
 * 2008-05-14 Writen by Á¤¼ÒÈñ
 * »ç¿ëÀÚÀÇ ·Î±×ÀÎ ¿©ºÎ¸¦ Ã¼Å©ÇÏ¿© ·Î±×ÀÎ ÆäÀÌÁö·Î ÀÌµ¿ÇÑ´Ù.  
  * @param ¼­ºñ½º±¸ºÐ  pServiceGb
  * @param ¿äÃ»URL     pUrlRequest
  * @param Ãë¼ÒURL     pUrlCancle
  * @return void
 */

function chkLoginForUI( pServiceGb, pUrlRequest, pUrlCancle) {
	var strUserID = '';
	strUserID = getCookie('user_id');
	
	if (strUserID == ''){
		alert('ÇöÀç ÀÌ¿ëÇÏ½Ã·Á´Â ¼­ºñ½º´Â ±ÝÀ¶ÅõÀÚÇùÈ¸ È¸¿ø¸¸ ÀÌ¿ë°¡´ÉÇÑ ¼­ºñ½º ÀÔ´Ï´Ù. \n·Î±×ÀÎ ÈÄ ÀÌ¿ëÇÏ¿© ÁÖ½Ê½Ã¿À. ');		
		switch( pServiceGb)
		{
			case 'WORK':
				goLoginWORK(pUrlRequest, pUrlCancle);
			break;
			case 'DIS':
				goLoginDIS(pUrlRequest, pUrlCancle);
			break;			
			case 'STAT':
				goLoginSTAT(pUrlRequest, pUrlCancle);
			break;
			case 'SYS':
				goLoginSYS(pUrlRequest, pUrlCancle);
			break;	
			case 'MGMT':
				goLoginMGMT(pUrlRequest, pUrlCancle);
			break;	 
			case 'FUNDSALES':
				goLoginFS(pUrlRequest, pUrlCancle);
			break;		
			default:
			break;
		}		
	}
}


/**
 * 2008-06-02 Writen by °­·Á¼±
 * »ç¿ëÀÚÀÇ ·Î±×ÀÎ ¿©ºÎ¸¦ Ã¼Å©ÇÏ¿© ·Î±×¾Æ¿ô ÆäÀÌÁö·Î ÀÌµ¿ÇÑ´Ù.  
 * @param ¼­ºñ½º±¸ºÐ  pServiceGb
 * @param ·Î±×¾Æ¿ô ÈÄ ÀÌµ¿ÇÒ URL pUrlDone  
 * @return void
 */

function chkLogOutForUI( pServiceGb, pUrlDone) {
	var strUserID = '';
	strUserID = getCookie('user_id');

	if (strUserID != ''){

		switch( pServiceGb)
		{
			case 'DIS':
				goLogOutDIS(pUrlDone);
			break;						
			case 'WORK':
				goLogOutWORK(pUrlDone);
			break;						
			case 'MGMT':
				goLogOutMGMT(pUrlDone);
			break;
			case 'SYS':
				goLogOutSYS(pUrlDone);
			break;	
			case 'STAT':
				goLogOutSTAT(pUrlDone);
			break;					
			case 'FUNDSALES':	
				goLogOutFS(pUrlDone);
			break;					
			default:
			break;
		}		
	}
}


/**
 * 2008-05-14 Writen by Á¤¼ÒÈñ
 * »ç¿ëÀÚÀÇ ·Î±×ÀÎ ¿©ºÎ¿¡ ´ëÇÑ true/false °ªÀ» ¸®ÅÏÇÑ´Ù. 
 * @return blnIsLogin ·Î±×ÀÎ ¿©ºÎ¿¡ ´ëÇÑ true false °ªÀ» ¸®ÅÏÇÑ´Ù. 
 */

function chkLogin( ) {
	var strUserID = '';
	var blnIsLogin = false;
	strUserID = getCookie('user_id');

	if (strUserID == ''){		
		blnIsLogin = false;
	}else{
		blnIsLogin = true;
	}

	return blnIsLogin;

}

/**
 * 2008-07-25 Writen by Àü»ó¹Ì
 * »ç¿ëÀÚÀÇ ¾îµå¹Î ¿©ºÎ¿¡ ´ëÇÑ true/false °ªÀ» ¸®ÅÏÇÑ´Ù. (roleId¿¡'G100020' (½Ã½ºÅÛ°ü¸®ÀÚ)¸¦ Æ÷ÇÔÇÒ °æ¿ì
 * @return blnIsAdmin ·Î±×ÀÎ ¿©ºÎ¿¡ ´ëÇÑ true false °ªÀ» ¸®ÅÏÇÑ´Ù. 
 */
function chkAdmin( ) {
	var strRoleID = '';
	var blnIsAdmin = false;
	strRoleID = getCookie('role_id');
	
	var i = 0;
	var vRoleIDArr = strRoleID.split("|"); 
	
	while ( i <= vRoleIDArr.length ){

		if (vRoleIDArr[i] == "G100020")
		{
			blnIsAdmin = true;
			break;
		}
		i++;
	}

	return blnIsAdmin;
}

/**

 * 2008-05-14 Writen by Á¤¼ÒÈñ
 * ÄíÅ°¿¡ ÀúÀåµÇ¾î ÀÖ´Â °ªÀ» ¸®ÅÏÇÑ´Ù. 
 * »ç¿ëÇÏ´Â ÄíÅ°¸í :È¸¿øid		(user_id)
 *					È¸¿ø¸í		(user_nm)
 *					È¸»ç¸í		(korean_nm)
 *					È¸¿ø±¸ºÐ	(member_gb)
 *					È¸»çÄÚµå	(company_cd)
 *					ºñ¹Ð¹øÈ£¸¸·áÀÏ(PassWord_ExDt)
 *					ºñ¹Ð¹øÈ£º¯°æÇÊ¿ä(PassWord_ChgNeed)
 *					ºñ¹Ð¹øÈ£º¯°æºÒ°¡(PassWord_ChgNot) 
 *                  ±ÇÇÑID       (role_id :N°³ °ª Æ÷ÇÔ '|'·Î ±¸ºÐ) 

 * @param pCookieName  ÄíÅ°¸íÀ» Á¶È¸ÇÑ´Ù. 
 * @return strCookieValue  ÄíÅ°°ªÀ» ¸®ÅÏÇÑ´Ù. 
 * 
 */

function getCookie( pCookieName)
{
    var strCookieNM = pCookieName + "=";
    var x = 0;
	var iCookieLen = 0;
	var strCookieValue = '';
   
    while ( x <= document.cookie.length ){
        var y = (x+strCookieNM.length);
        if ( document.cookie.substring( x, y ) == strCookieNM ) {
            if ( (iCookieLen=document.cookie.indexOf( ";", y )) == -1 ) {
                iCookieLen = document.cookie.length;
            }
			strCookieValue = document.cookie.substring( y, iCookieLen );
			
			
			strCookieValue = decodeURIComponent( strCookieValue );
			
			// 2008-06-16 Á¤¼ÒÈñ  
			// Null °ªÀÌ ¹®ÀÚÇüÅÂÀÇ NULL·Î ÀÎ½ÄÀÌ µÇ´Âµ¥¿¡ ´ëÇÑ ¹æ¾ÈÀÌ ¿ä±¸µÊ.
			if ( strCookieValue == 'NULL')
			{
				strCookieValue = ' ';
			}
        }
        x = document.cookie.indexOf( " ", x ) + 1;
        if ( x == 0 )
        break;
    }
    return strCookieValue;
}

/**
 * 2008-06-10 Writen by ÃÖ¼±´ö
 * ÄíÅ°¿¡ °ªÀ» ÀúÀåÇÑ´Ù. 
 * ¾÷¹«º° ÇÊ¿äÇÑ °æ¿ì »ç¿ëÇÑ´Ù.
 * 
 * @param pName ÄíÅ°¸í
 * @param pValue ÄíÅ°°ª
 *
 */
function setCookie(pName, pValue) {
	var cookieStr = pName + "=" + encodeURIComponent(pValue);
	document.cookie = cookieStr;
}


/**
 * 2008-06-10 Writen by ÃÖ¼±´ö
 * ÄíÅ°¿¡ °ªÀ» »èÁ¦ÇÑ´Ù. 
 * ¾÷¹«º° ÇÊ¿äÇÑ °æ¿ì »ç¿ëÇÑ´Ù.
 * 
 * @param pName ÄíÅ°¸í
 *
 */
function deleteCookie(pName) {
	if( getCookie(pName) ) {
		document.cookie = pName + "="  + ";expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

/**
 * 2008-05-14 Writen by Á¤¼ÒÈñ
 * SSOLoginPage·Î ÀÌµ¿À» ¾÷¹«Áö¿ø¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlRequest  Á¤»ó ·Î±äÈÄ ÀÌµ¿ÇÒ URL 
 * @param pUrlCancle   ·Î±ä ½ÇÆÐÈÄ ÀÌµ¿ÇÒ URL 
 */
function goLoginWORK( pUrlRequest, pUrlCancle){
	var strUrlRequest, strUrlCancle, strServGb;
	strUrlRequest = 'http://'+window.location.host+'/fs/work/html/index.html';
	strUrlCancle = 'http://'+window.location.host+'/fs/work/html/index.html';
	strServGb = 'WORK';	
	if (pUrlRequest != '')
	{
		strUrlRequest = pUrlRequest;
	}
	if (pUrlCancle != '')
	{
		strUrlCancle = pUrlCancle;
	}

	var strUrlSSO = '';

	strURLSSO = strCOMLoginUrlSSO;
	strURLSSO = strURLSSO + "p_requested_url=" + strUrlRequest;
	strURLSSO = strURLSSO + "&p_cancel_url=" + strUrlCancle;
	strURLSSO = strURLSSO + "&p_service_gb=" + strServGb;
	document.location.href=strURLSSO;
}

/**
 * 2008-05-15 update by °­·Á¼±
 * SSOLoginPage·Î ÀÌµ¿À» ¹ýÁ¤°ø½Ã¼­ºñ½º¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlRequest  Á¤»ó ·Î±äÈÄ ÀÌµ¿ÇÒ URL 
 * @param pUrlCancle   ·Î±ä ½ÇÆÐÈÄ ÀÌµ¿ÇÒ URL 
 * @param strServGb   ¼­ºñ½º±¸ºÐ(¹ýÁ¤°ø½Ã DIS)
 */
function goLoginDIS( pUrlRequest, pUrlCancle){
	var strUrlRequest, strUrlCancle, strServGb;	
	strUrlRequest = 'http://'+window.location.host+'/fs/dis/html/index.html';
	strUrlCancle = 'http://'+window.location.host+'/fs/dis/html/index.html';
	strServGb = 'DIS';		
	if (pUrlRequest != '')
	{
		strUrlRequest = pUrlRequest;
	}
	if (pUrlCancle != '')
	{
		strUrlCancle = pUrlCancle;
	}

	var strUrlSSO = '';

	strURLSSO = strCOMLoginUrlSSO;
	//strURLSSO = "https://ssotest.kofia.or.kr:4443/pls/orasso/ORASSO.wwsec_app_priv.login?";
	strURLSSO = strURLSSO + "p_requested_url=" + strUrlRequest;
	strURLSSO = strURLSSO + "&p_cancel_url=" + strUrlCancle;
	strURLSSO = strURLSSO + "&p_service_gb=" + strServGb;
	document.location.href=strURLSSO;
	
}



/**
 * 2008-05-24 update by ÀÓ³²Àç
 * SSOLoginPage·Î ÀÌµ¿À» Åë°è¼­ºñ½º¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlRequest  Á¤»ó ·Î±äÈÄ ÀÌµ¿ÇÒ URL 
 * @param pUrlCancle   ·Î±ä ½ÇÆÐÈÄ ÀÌµ¿ÇÒ URL 
 */
function goLoginSTAT( pUrlRequest, pUrlCancle){
	var strUrlRequest, strUrlCancle, strServGb;	
	strUrlRequest = 'http://'+window.location.host+'/fs/stat/html/index.html';
	strUrlCancle = 'http://'+window.location.host+'/fs/stat/html/index.html';
	strServGb = 'STAT';
	//alert(pUrlRequest);
	if (pUrlRequest != '')
	{
		strUrlRequest = pUrlRequest;
	}
	if (pUrlCancle != '')
	{
		strUrlCancle = pUrlCancle;
	}

	var strUrlSSO = '';

	strURLSSO = strCOMLoginUrlSSO;
	strURLSSO = strURLSSO + "p_requested_url=" + strUrlRequest;
	strURLSSO = strURLSSO + "&p_cancel_url=" + strUrlCancle;
	strURLSSO = strURLSSO + "&p_service_gb=" + strServGb;
	document.location.href=strURLSSO;
	//alert(strURLSSO);
}

/**
 * 2008-05-24 update by ÀÓ³²Àç
 * SSOLoginPage·Î ÀÌµ¿À» ½Ã½ºÅÛ°ü¸®¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlRequest  Á¤»ó ·Î±äÈÄ ÀÌµ¿ÇÒ URL 
 * @param pUrlCancle   ·Î±ä ½ÇÆÐÈÄ ÀÌµ¿ÇÒ URL 
 */
function goLoginSYS( pUrlRequest, pUrlCancle){
	var strUrlRequest, strUrlCancle, strServGb;	
	strUrlRequest = 'http://'+window.location.host+'/fs/sys/html/index.html';
	strUrlCancle = 'http://'+window.location.host+'/fs/sys/html/index.html';
	strServGb = 'SYS';

	if (pUrlRequest != '')
	{
		strUrlRequest = pUrlRequest;
	}
	if (pUrlCancle != '')
	{
		strUrlCancle = pUrlCancle;
	}

	var strUrlSSO = '';

	strURLSSO = strCOMLoginUrlSSO;
	strURLSSO = strURLSSO + "p_requested_url=" + strUrlRequest;
	strURLSSO = strURLSSO + "&p_cancel_url=" + strUrlCancle;
	strURLSSO = strURLSSO + "&p_service_gb=" + strServGb;

	document.location.href=strURLSSO;
}



/**
 * 2008-05-28 update by ÃÖ¼±´ö
 * SSOLoginPage·Î ÀÌµ¿À» ½Ã½ºÅÛ°ü¸®¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlRequest  Á¤»ó ·Î±äÈÄ ÀÌµ¿ÇÒ URL 
 * @param pUrlCancle   ·Î±ä ½ÇÆÐÈÄ ÀÌµ¿ÇÒ URL 
 */

function goLoginMGMT( pUrlRequest, pUrlCancle){
	var strUrlRequest, strUrlCancle, strServGb;	
	strUrlRequest = 'http://'+window.location.host+'/fs/mgmt/html/index.html';
	strUrlCancle = 'http://'+window.location.host+'/fs/mgmt/html/index.html';
	strServGb = 'MGMT';
	if (pUrlRequest != '')
	{
		strUrlRequest = pUrlRequest;
	}
	if (pUrlCancle != '')
	{
		strUrlCancle = pUrlCancle;
	}

	var strUrlSSO = '';
	strURLSSO = strCOMLoginUrlSSO;
	strURLSSO = strURLSSO + "p_requested_url=" + strUrlRequest;
	strURLSSO = strURLSSO + "&p_cancel_url=" + strUrlCancle;
	strURLSSO = strURLSSO + "&p_service_gb=" + strServGb;
	document.location.href=strURLSSO;
}

/**
 * 2008-05-14 Writen by Á¤¼ÒÈñ
 * SSOLoginPage·Î ÀÌµ¿À» ¾÷¹«Áö¿ø¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlRequest  Á¤»ó ·Î±äÈÄ ÀÌµ¿ÇÒ URL 
 * @param pUrlCancle   ·Î±ä ½ÇÆÐÈÄ ÀÌµ¿ÇÒ URL 
 */
function goLoginFS( pUrlRequest, pUrlCancle){
	var strUrlRequest, strUrlCancle, strServGb;
	strUrlRequest = 'http://'+window.location.host+'/fundsales/html/index.html';
	strUrlCancle = 'http://'+window.location.host+'/fundsales/html/index.html';
	strServGb = 'FUNDSALES';	
	if (pUrlRequest != '')
	{
		strUrlRequest = 'http://'+window.location.host+pUrlRequest;
	}
	if (pUrlCancle != '')
	{
		strUrlCancle = 'http://'+window.location.host+pUrlCancle;
	}

	var strUrlSSO = '';

	strURLSSO = strCOMLoginUrlSSO;
	strURLSSO = strURLSSO + "p_requested_url=" + strUrlRequest;
	strURLSSO = strURLSSO + "&p_cancel_url=" + strUrlCancle;
	strURLSSO = strURLSSO + "&p_service_gb=" + strServGb;
	top.document.location.href=strURLSSO;
}

/**
 * 2008-06-02 Writen by °­·Á¼±
 * SSOLogOutPage·Î ÀÌµ¿À» ¹ýÁ¤°ø½Ã¼­ºñ½º¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlDone  ·Î±×¾Æ¿ô ÈÄ ÀÌµ¿ÇÒ URL 
 */

function goLogOutDIS( pUrlDone){
	var strUrlDone;	
	//strUrlDone = 'http://'+window.location.host+'/fs/dis/index.jsp';
	strUrlDone = 'http://'+window.location.host+'/fs/secure/login/COMLogin.jsp';
	
	if (pUrlDone != '')
	{
		strUrlDone = pUrlDone;
	}

	var strUrlSSO = '';

	strURLSSO = strCOMLogoutUrlSSO;
	strURLSSO = strURLSSO + "p_done_url=" + strUrlDone;
	document.location.href=strURLSSO;
}



/**
 * 2008-06-03 Writen by Á¤¼ÒÈñ
 * SSOLogOutPage·Î ÀÌµ¿À» ¹ýÁ¤°ø½Ã¼­ºñ½º¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlDone  ·Î±×¾Æ¿ô ÈÄ ÀÌµ¿ÇÒ URL 
 */

function goLogOutWORK( pUrlDone){
	var strUrlDone;	
	strUrlDone = 'http://'+window.location.host+'/fs/work/html/index.html';
	if (pUrlDone != '')
	{
		strUrlDone = pUrlDone;
	}
	strURLSSO = strCOMLogoutUrlSSO;
	strURLSSO = strURLSSO + "p_done_url=" + strUrlDone;
	top.document.location.href=strURLSSO;
}

/**
 * 2008-06-05 Writen by ÃÖ¼±´ö
 * SSOLogOutPage·Î ÀÌµ¿À» ¹ýÁ¤°ø½Ã¼­ºñ½º¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlDone  ·Î±×¾Æ¿ô ÈÄ ÀÌµ¿ÇÒ URL 
 */

function goLogOutMGMT( pUrlDone){
	var strUrlDone;	
	strUrlDone = 'http://'+window.location.host+'/fs/mgmt/html/index.html';
	if (pUrlDone != '')
	{
		strUrlDone = pUrlDone;
	}

	strURLSSO = strCOMLogoutUrlSSO;
	strURLSSO = strURLSSO + "p_done_url=" + strUrlDone;
	top.document.location.href=strURLSSO;
}

/**
 * 2008-06-06 Writen by ÀÓ³²Àç
 * SSOLogOutPage·Î ÀÌµ¿À» Åë°è¼­ºñ½º¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlDone  ·Î±×¾Æ¿ô ÈÄ ÀÌµ¿ÇÒ URL 
 */

function goLogOutSTAT( pUrlDone){
	var strUrlDone;	
	strUrlDone = 'http://'+window.location.host+'/fs/stat/html/index.html';
	if (pUrlDone != '')
	{
		strUrlDone = pUrlDone;
	}

	var strUrlSSO = '';
	strURLSSO = strCOMLogoutUrlSSO;
	strURLSSO = strURLSSO + "p_done_url=" + strUrlDone;
	document.location.href=strURLSSO;
}


/**
 * 2008-06-06 Writen by ÀÓ³²Àç
 * SSOLogOutPage·Î ÀÌµ¿À» ½Ã½ºÅÛ°ü¸®¼­ºñ½º¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlDone  ·Î±×¾Æ¿ô ÈÄ ÀÌµ¿ÇÒ URL 
 */

function goLogOutSYS( pUrlDone){
	var strUrlDone;	
	strUrlDone = 'http://'+window.location.host+'/fs/sys/html/index.html';
	if (pUrlDone != '')
	{
		strUrlDone = pUrlDone;
	}

	strURLSSO = strCOMLogoutUrlSSO;
	strURLSSO = strURLSSO + "p_done_url=" + strUrlDone;
	top.document.location.href=strURLSSO;
}

/**
 * 2008-06-03 Writen by Á¤¼ÒÈñ
 * SSOLogOutPage·Î ÀÌµ¿À» ¹ýÁ¤°ø½Ã¼­ºñ½º¿¡¼­ »ç¿ëÇÏ´Â ÇüÅÂ·Î ¼öÇàÇÑ´Ù. 
 * @param pUrlDone  ·Î±×¾Æ¿ô ÈÄ ÀÌµ¿ÇÒ URL 
 */

function goLogOutFS( pUrlDone){
	var strUrlDone;	
	strUrlDone = 'http://'+window.location.host+'/fundsales/html/index.html';
	if (pUrlDone != '')
	{
		strUrlDone = 'http://'+window.location.host+pUrlDone;
	}
	strURLSSO = strCOMLogoutUrlSSO;
	strURLSSO = strURLSSO + "p_done_url=" + strUrlDone;
	top.document.location.href=strURLSSO;
}

/**
 * 2008-08-27 Writen by ¼­Áø
 * ±âÁ¸¿¡ ÀÖ´ø ±ÇÇÑÃ¼Å©ÀÇ ÅëÇÕ ÇÔ¼ö·Î ¼öÁ¤..
 * 'SYS'		- ½Ã½ºÅÛ °ü¸®ÀÚ ¿©ºÎ ( roleId : 'G100020' ½Ã½ºÅÛ ¾îµå¹Î)		// 2009/01/19 By SohuiJ
 * 'WORK'		- »ç¿ëÀÚÀÇ ¾÷¹«Áö¿ø admin ¿©ºÎ ( roleId : 'I200040' (°ø½ÃÅë°èºÎ)¸¦ Æ÷ÇÔÇÒ °æ¿ì)
 * 'STAT'		- »ç¿ëÀÚÀÇ Åë°è¿äÃ»Á¢¼öÀÚ,Ã³¸®ÀÚ ¿©ºÎ ( roleId : I600000 ) 
 * 'IVST'		- »ç¿ëÀÚÀÇ ÅõÀÚÀÚ¹®È¸»ç ¿©ºÎ ( roleId : W300035 )
 * 'EXP'		- ±ÝÀ¶ÅõÀÚÀü¹®ÀÎ·Â°ü¸®ÀÚ(roleId : I400160) 		// 2009/01/19 By SohuiJ
 * 'SAL'		- ÆÇ¸ÅÀÎ·Â½É»ç´ç´çÀÚ(roleId : I500010)		// 2009/01/19 By SohuiJ 
 * 'MGMT'		- ÇùÈ¸¾÷¹«±×·ì(roleId : I120000)		// 2009/01/19 By SohuiJ
 * 'ANN'		- ¾÷¹«Áö¿ø ¹ýÁ¤°ø½Ã´ã´çÀÚ ¿©ºÎ (roleId : 'I310000' Æ÷ÇÔÇÒ °æ¿ì)
 * @return ·Î±×ÀÎ »ç¿ëÀÚ roleId ¿©ºÎ¿¡ ´ëÇÑ true false °ªÀ» ¸®ÅÏÇÑ´Ù. 
 */
function chkRoleId( pChkAut ) {
	var strRoleID = getCookie('role_id');
	var strChkRoleId = '';
	var bInIsRoleId = false;

	switch( pChkAut ){
		case 'SYSAD':
			strChkRoleId = "G100020";
			break;
		case 'WORK': 
			strChkRoleId = "I120000";
			break;
		case 'STAT':
			strChkRoleId = "I600000";
			break;
		case 'IVST':
			strChkRoleId = "W300035";
			break;
		case 'EXP':
			strChkRoleId = "I400160";
			break;
		case 'SAL':
			strChkRoleId = "I500010";
			break;			
		case 'MGMT':
			strChkRoleId = "I120000";
			break;	
		case 'ANN': 
			strChkRoleId = "I310000";
			break;			
	}
	
	if( strChkRoleId == null || strChkRoleId == "" ) return false;
	var i = 0;
	var vRoleIDArr = strRoleID.split("|"); 
	
	while ( i <= vRoleIDArr.length ){
		if (vRoleIDArr[i] == strChkRoleId){
			bInIsRoleId = true;
			break;
		}
		i++;
	}
	return bInIsRoleId;
}
