
function chkServerStatusTF(strHost) {
    var getHost;
    if (strHost != undefined) {
        getHost = strHost;
    } else {
        getHost = document.location.hostname.toString();
    }
    if (getHost.length > 0) {
        if (getHost.indexOf('0.45.162.') > 0 || getHost.indexOf('dev.hionegame.com') > 0 || getHost.indexOf('test.hionegame.com') > 0) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}

function getMemberDomain(isSecurity) {
    var strMemberDomain = 'http://member.hionegame.com';
    var strMemberDomainT = 'http://membertest.hionegame.com';
    var strMemberDomainD = 'http://memberdev.hionegame.com';
    var tmpDomain = '';
    tmpDomain = (chkServerStatusTF() == true) ? strMemberDomainT : strMemberDomain;
    if (document.location.hostname.indexOf('dev.hionegame.com') > 0) {
        tmpDomain = strMemberDomainD;
    }
    if (isSecurity != undefined) {
        if (isSecurity == true && tmpDomain.indexOf('member.') != -1) {
            tmpDomain = tmpDomain.replace(/http:/gi, 'https:');
        }
    }
    return tmpDomain;
}

function getCsDomainForFunc(isSecurity) {
    var strCsDomain = 'http://cs.hionegame.com';
    var strCsDomainT = 'http://cstest.hionegame.com';
    var strCsDomainD = 'http://csdev.hionegame.com';
    var tmpDomain = '';
    tmpDomain = (chkServerStatusTF() == true) ? strCsDomainT : strCsDomain;
    if (document.location.hostname.indexOf('dev.hionegame.com') > 0) {
        tmpDomain = strCsDomainD;
    }
    if (isSecurity != undefined) {
        if (isSecurity == true && tmpDomain.indexOf('cs.') != -1) {
            tmpDomain = tmpDomain.replace(/http:/gi, 'https:');
        }
    }
    return tmpDomain;
}


function sendH1LoginFrm() {
    var tUrl = getMemberDomain(true);
    tUrl += '/login/member_login.asp';
    var frm = document.frmLogin;
    if (document.location.hostname.indexOf('hionegame.com') > 0) {
    	if (frm.txtH1UserID.value.length < 5) {
    		alert('아이디를 입력해 주세요'); frm.txtH1UserID.focus(); return false;
    	}
    	if (frm.txtH1Password.value.length < 5) {
    		alert('패스워드를 입력해 주세요'); frm.txtH1Password.focus(); return false;
    	}
    }
    frm.target = 'fraAction';
    frm.action = tUrl;
    frm.submit();
}

function sendH1LoginFrmTopBar() {
    var tUrl = getMemberDomain(true);
    tUrl += '/login/member_login.asp';
    if (frm.txtH1UserID.value.length < 5) {
        alert('아이디를 입력해 주세요'); frm.txtH1UserID.focus(); return false;
    }
    if (frm.txtH1Password.value.length < 5) {
        alert('패스워드를 입력해 주세요'); frm.txtH1Password.focus(); return false;
    }
    var frm = document.frmLoginTopBar;
   	frm.target = 'fraAction';
   	frm.method = 'post';
   	frm.action = tUrl;
   	frm.submit();
}

function goMemberJoin(winTarget) {
    var tUrl = getMemberDomain(false);
    tUrl += '/join/member_join_01.asp';
    tUrl += '?url=' + encodeURIComponent(top.document.location.href);

    var strForm = '<form id="frmMemberJoin" name="frmMemberJoin" method="post" target="_top" action="' + tUrl + '">';
    strForm += '<input type="hidden" id="postUrl" name="postUrl" value="' + document.location.href + '"/>';
    strForm += '<input type="hidden" id="eventCode" name="eventCode" value=""/>';
    strForm += '<input type="hidden" id="eventValue" name="eventValue" value=""/>';
    strForm += '<input type="hidden" id="returnUrl" name="returnUrl" value="' + top.document.location.href + '"/>';
    strForm += '</form>';
    $(strForm).appendTo('body').submit();
}

function searchMemberInfo(winTarget) {
    var tUrl = getMemberDomain(false);
    tUrl += '/search/member_search_main.asp';
    tUrl += '?url=' + encodeURIComponent(top.document.location.href);

    var strForm = '<form id="frmMemberSearch" name="frmMemberSearch" method="post" target="_top" action="' + tUrl + '">';
    strForm += '<input type="hidden" id="postUrl" name="postUrl" value="' + document.location.href + '"/>';
    strForm += '<input type="hidden" id="eventCode" name="eventCode" value=""/>';
    strForm += '<input type="hidden" id="eventValue" name="eventValue" value=""/>';
    strForm += '<input type="hidden" id="returnUrl" name="returnUrl" value="' + top.document.location.href + '"/>';
    strForm += '</form>';
    $(strForm).appendTo('body').submit();
}

function openChangePrivateInfo(winTarget) {
    var tUrl = getCsDomainForFunc(false);
    tUrl += '/mypage/mypage_main.asp?url=' + encodeURIComponent(document.location.href);
    top.window.location.href = tUrl;
}

function goChangePrivateInfo(winTarget) {
    var tUrl = getCsDomainForFunc(true);
    tUrl += '/mypage/member_modify_info.asp?url=' + encodeURIComponent(document.location.href);
    top.window.location.href = tUrl;
}

function openChargeCashWin() {
    var tUrl = getCsDomainForFunc(false);
    tUrl += '/cash/charge_cash_pop.asp';
    window.open(tUrl, 'winChargeCash', 'width=452px,height=660px,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');
}

function gotoCSLoginPage() {
    var tUrl = getCsDomainForFunc(false);
    tUrl += '/memlogin/member_login.asp';
    top.document.location.href = tUrl + '?url=' + encodeURIComponent(top.document.location.href);
}
