﻿var sDomain = "";
var sUrl = "";
var nScrWidth = screen.width;
var nScrHeight = screen.height;
var nWidth;
var nHeight;
var TopPosition;
var LeftPosition;
var resize = "no";
var scroll = "no";

// JScript 파일

function openWindow(url, height, width)
{
    var obj = window.open(url, "", "height=" + height + ", width=" + width + ", scrollbars=yes");
    obj.focus();
    return obj;        
}

function openWindow(url, height, width, settings, winname)
{
    if (settings == "")
        settings = "scrollbars=yes";
    var obj = window.open(url, winname, "height=" + height + ", width=" + width + ", " + settings + "");
    obj.focus();
    return obj;        
}

/* SMS 발송 */
function popupSendSMS(Form)
{
    window.open("", "smsForm", "height=" + 530 + ", width=" + 600 + ", scrollbars=no", "sms");
    
    Form.target = "smsForm";
    Form.action = "/common/smsForm.aspx";
    Form.submit();   
}

// 아이디 중복확인
function PopupIdDupCheck()
{
    openWindow("/common/idDupCheck.aspx", "200", "400");
}

// 업체정보 팝업
function PopupCompanyInfo()
{
    nWidth = 650;
    nHeight = 520;
    
	sUrl = "/common/companyManage.aspx?";
	
    LeftPosition = (nScrWidth) ? (nScrWidth-nWidth)/2 : 0;
	TopPosition = (nScrHeight) ? (nScrHeight-nHeight)/2 : 0;
    
	window.open(sUrl, "companyInfo", "width="+nWidth+",height="+nHeight+",top="+TopPosition+",left="+LeftPosition+",toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes, menubar=no,dependent=yes");
}

// 회원정보 팝업
function PopupMemberInfo(target, mode, idx)
{
    var targetName = "MemberInfo";
    
     nWidth = 800;
     nHeight = 520;
    
	switch( target ) 
	{
		case "mbrReg" :
			 sUrl = "/member/memberCheck.aspx";
			 break;
		case "mbrManage" :
			 sUrl = "/member/memberManage.aspx?idx="+idx+"&hdnMode="+mode;
			 break;
		case "mbrView" :
			 sUrl = "/common/memberView.aspx?idx="+idx;
			 break;
        case "onembrView":
             sUrl = "/common/memberView.aspx?type=view&idx=" + idx;
             break;
		case "lumpsumList" :
			 sUrl = "/common/memberLumpsumPayList.aspx?idx="+idx;
			 break;
		default:
	}
	
	LeftPosition = (nScrWidth) ? (nScrWidth-nWidth)/2 : 0;
	TopPosition = (nScrHeight) ? (nScrHeight-nHeight)/2 : 0;
    
	window.open(sUrl, targetName, "width="+nWidth+",height="+nHeight+",top="+TopPosition+",left="+LeftPosition+",toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes, menubar=no,dependent=yes");
}

/* 공통 조회 팝업 */
function PopupSearch(target, param)
{
    nWidth = 530;
    nHeight = 450;
    var sUrl = "";

	switch( target ) 
	{
		case "postwork" :   // 우편번호
		case "posthome" :   // 우편번호
			sUrl = "../library/postSearch.aspx?";
			break;
		case "org" :     // 조직
			sUrl = "../library/orgSearch.aspx?";
			break;
		case "whoorg" :     // WHO조직
			sUrl = "../library/branchSearch.aspx?";
			break;
        case "manager":     // 짠유저
            sUrl = "../library/jJanUserSearch.aspx?";
            break;
        case "user":     // 소개인2(관리자용)
			sUrl = "../library/userSearch.aspx?";
			break;
        case "coreintro":     // 소개인2
            sUrl = "../library/coreIntroSearch.aspx?";
            break;
        case "jikchec":     // 직책
			sUrl = "../library/jikchecSearch.aspx?";
			break;			
		default:
	}

	LeftPosition = (nScrWidth) ? (nScrWidth-nWidth)/2 : 0;
	TopPosition = (nScrHeight) ? (nScrHeight-nHeight)/2 : 0;
	
	if (param != null && param != "") sUrl += "&"+param;

	window.open(sUrl, target, "width="+nWidth+",height="+nHeight+",top="+TopPosition+",left="+LeftPosition+",toolbar=no,location=no,directories=no,status=no,scrollbars="+scroll+",resizable="+resize+", menubar=no,dependent=yes");
}

/* 원장관리 */
function PopupLedgerInfo(target, no)
{
     nWidth = 650;
     nHeight = 500;
    
	switch( target ) 
	{
		case "ledgerManage" :
			 sUrl = "/member/ledgerManage.aspx?no="+no;
			 nHeight = 550;
			 scroll = "yes";
			 break;
		case "ledgerView" :
			 sUrl = "/common/ledgerView.aspx?no="+no;
			 break;
		default:
	}

	LeftPosition = (nScrWidth) ? (nScrWidth-nWidth)/2 : 0;
	TopPosition = (nScrHeight) ? (nScrHeight-nHeight)/2 : 0;

	window.open(sUrl, "ledgerInfo", "width="+nWidth+",height="+nHeight+",top="+TopPosition+",left="+LeftPosition+",toolbar=no,location=no,directories=no,status=no,scrollbars="+scroll+",resizable="+resize+", menubar=no,dependent=yes");
}

function PopupCmsJoin(cd)
{
    sUrl = "/common/cmsJoin.aspx?companyCd="+cd;

	window.open(sUrl, "cmsJoin");
}

/* CMS자금관리 */
function PopupCmsInfo(target, idx)
{
    var targetName = "cmsInfo";

     nWidth = 880;
     nHeight = 550;
    
	switch( target ) 
	{
		case "approvalReq" :
			 sUrl = "/cms/approvalReqManage.aspx?idx="+idx;
			 break;
		case "approvalRst" :
			 sUrl = "/cms/approvalRstManage.aspx?idx="+idx;
			 break;
		case "approvalView" :
			 sUrl = "/cms/approvalView.aspx?idx="+idx;
			 targetName = "approvalView";
			 nWidth = 700;
			 nHeight= 350;
			 break;
		case "transReq" :
		     sUrl = "/cms/transReqManage.aspx?idx=" + idx;
		     nHeight = 600;
			 break;
        case "transReqEfnc":
            sUrl = "/cms/transReqEfncManage.aspx?idx=" + idx;
            nHeight = 600;
            break;
        case "transRst":
			 sUrl = "/cms/transRstManage.aspx?idx="+idx;
			 break;
		case "transView" :
			 sUrl = "/cms/transView.aspx?idx="+idx;
			 targetName = "transView";
			 nWidth = 700;
			 nHeight= 350;
			 break;
		case "bankReq" :
		    targetName = "bankReq";
			 sUrl = "/cms/bankReqManage.aspx?idx="+idx;
			 break;
		case "bankRst" :
		    targetName = "bankRst";
			 sUrl = "/cms/bankRstManage.aspx?idx="+idx;
			 break;
		default:
	}

	LeftPosition = (nScrWidth) ? (nScrWidth-nWidth)/2 : 0;
	TopPosition = (nScrHeight) ? (nScrHeight-nHeight)/2 : 0;

	window.open(sUrl, targetName, "width="+nWidth+",height="+nHeight+",top="+TopPosition+",left="+LeftPosition+",toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable="+resize+", menubar=no,dependent=yes");
}

/* 일시불관리 */
function PopupLumpSumInfo(target, mode, id)
{
     nWidth = 800;
     nHeight = 500;
    
	switch( target ) 
	{
		case "lumpsumManage" :
			 sUrl = "/cms/lumpsumManage.aspx?mode="+mode+"&id="+id;
			 break;
		case "lumpsumInstallment" :
			 sUrl = "/cms/lumpsumInstallmentManage.aspx?mode="+mode+"&id="+id;
			 break;
		case "kcpPayManage" :
             nHeight = 600;
			 sUrl = "/cms/kcpPayManage.aspx?idx="+id;
			 break;
        case "upload" :
			 sUrl = "/cms/lumpUploadPop.aspx";
			 break;
		default:
	}

	LeftPosition = (nScrWidth) ? (nScrWidth-nWidth)/2 : 0;
	TopPosition = (nScrHeight) ? (nScrHeight-nHeight)/2 : 0;

	window.open(sUrl, "lumpsum", "width="+nWidth+",height="+nHeight+",top="+TopPosition+",left="+LeftPosition+",toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable="+resize+", menubar=no,dependent=yes");    
}

///* 영수증관리 */
//function PopupReceiptInfo(target, sno, name, fundCd, year)
//{
//     nWidth = 660;
//     nHeight = 600;
//    
//	switch( target ) 
//	{
//		case "receipt" :
//			 sUrl = "/member/receiptPrint.aspx?sno="+sno+"&name="+escape(name)+"&fundCd="+fundCd+"&year="+year;
//			 break;
//        case "member":
//			 sUrl = "/common/receiptCheck.aspx";
//			 break;
//		default:
//	}

//	LeftPosition = (nScrWidth) ? (nScrWidth-nWidth)/2 : 0;
//	TopPosition = (nScrHeight) ? (nScrHeight-nHeight)/2 : 0;

//	window.open(sUrl, "receiptPrint", "width="+nWidth+",height="+nHeight+",top="+TopPosition+",left="+LeftPosition+",toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable="+resize+", menubar=no,dependent=yes");
//}

/* 영수증관리 */
function PopupReceiptMngInfo(target, form, param) 
{
    nWidth = 700;
    nHeight = 700;
    var Form = form;

    switch (target) 
    {
        case "manage":
            sUrl = "/member/receiptManage.aspx";
            nHeight = 600;
            break;
        case "print":
            sUrl = "/member/receiptPrint.aspx";
            break;
        case "member":
            sUrl = "/common/receiptCheck.aspx";
            nWidth = 650;
            nHeight = 650;
            break;
        default:
    }

    LeftPosition = (nScrWidth) ? (nScrWidth - nWidth) / 2 : 0;
    TopPosition = (nScrHeight) ? (nScrHeight - nHeight) / 2 : 0;

    if (target == "print") 
    {
        window.open("", "receipt", "width=" + nWidth + ",height=" + nHeight + ",top=" + TopPosition + ",left=" + LeftPosition + ",toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=" + resize + ", menubar=no,dependent=yes");

        Form.target = "receipt";
        Form.action = sUrl;
        Form.submit();
    }
    else 
    {
        if (param != null && param != "") 
        {
            sUrl += "?" + param;
        }
        window.open(sUrl, "receiptManage", "width=" + nWidth + ",height=" + nHeight + ",top=" + TopPosition + ",left=" + LeftPosition + ",toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=" + resize + ", menubar=no,dependent=yes");
    }
}

/* 파일 다운로드 */
function FileDown(kind, fileName)
{
    location.href= "/library/fileDownload.aspx?kind="+kind+"&fileName="+fileName;
}

/* CMS 불능코드 */
function PopupCmsErrCode()
{
    nWidth = 600;
    nHeight = 500;
    
	LeftPosition = (nScrWidth) ? (nScrWidth-nWidth)/2 : 0;
	TopPosition = (nScrHeight) ? (nScrHeight-nHeight)/2 : 0;

	window.open("/common/cmsErrCode.aspx", "cmsErrCode", "width="+nWidth+",height="+nHeight+",top="+TopPosition+",left="+LeftPosition+",toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable="+resize+", menubar=no,dependent=yes");
}

/* FAQ */
function PopupFaq() 
{
    nWidth = 700;
    nHeight = 550;

    LeftPosition = (nScrWidth) ? (nScrWidth - nWidth) / 2 : 0;
    TopPosition = (nScrHeight) ? (nScrHeight - nHeight) / 2 : 0;

    window.open("/common/faqList.aspx", "faq", "width=" + nWidth + ",height=" + nHeight + ",top=" + TopPosition + ",left=" + LeftPosition + ",toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=" + resize + ", menubar=no,dependent=yes");
}

/* 핸드폰정기결제 */
function PopupLgdInfo(target, month) 
{
    nWidth = 800;
    nHeight = 600;

    switch (target) {
        case "req":
            sUrl = "/cms/lgdPayReqManage.aspx";
            break;
        case "res":
            sUrl = "/cms/lgdPayReqManage.aspx?mode=view&month=" + month;
            break;
        default:
    }

    LeftPosition = (nScrWidth) ? (nScrWidth - nWidth) / 2 : 0;
    TopPosition = (nScrHeight) ? (nScrHeight - nHeight) / 2 : 0;

    window.open(sUrl, "lumpsum", "width=" + nWidth + ",height=" + nHeight + ",top=" + TopPosition + ",left=" + LeftPosition + ",toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=" + resize + ", menubar=no,dependent=yes");
}

