﻿//==============================================================================
// 1. 기   능   명 : 윈도우창 공통함수
// 2. 작   성   자 : 함께하는 e세상 소프트밸리(softvalley.co.kr)
// 3. 작 성  일 자 : 2007.02.07
// 4. 최 근 변경일 : 
// 8. 라 이 센 스  : All right reserved Softvalley, 소스를 수정하지 마세요.
//                   (alltry@softvalley.co.kr)
//==============================================================================

/* 
    화면사이트조정및 중앙정렬(윈도우의 형태에 따라 차이발생함)
    @param  nWidthSize      폭크기
    @param  nHeightSize     높이크기
*/
function fncWinResize(nWidthSize,nHeightSize)   
{
    var nWinLeftPos,nWinTopPos;
    var nHeightSize,nWidthSize
    
    nWinLeftPos	= Math.round((screen.availWidth/2)-(nWidthSize/2)) ;
    nWinTopPos	= Math.round((screen.availHeight/2)-(nHeightSize/2)) ;
    
//윈도우고전형태
//    nHeightSize=nHeightSize+51;
//    nWidthSize =nWidthSize +12;

//테마가있는경우
    nHeightSize=nHeightSize+51;
    nWidthSize =nWidthSize +12;

   try {
       top.window.resizeTo(nWidthSize,nHeightSize);
       top.window.moveTo(nWinLeftPos,nWinTopPos);
   } catch(e) {
   }   
}  

/* 새윈도우 */
function fncNewWindow(lnkURL,targetName,nWidth,nHeight)
{
    var gWinheight= 0;
   // nHeight=nHeight+15;
	var nWinLeftPos	= Math.round((screen.availWidth/2)-(nWidth/2)) ;
    var nWinTopPos	= Math.round((screen.availHeight/2)-(nHeight/2)) ;
    var gDialogsize = "width="+nWidth+",height="+nHeight+",left="+ nWinLeftPos+",top="+nWinTopPos
    var winopen = window.open(lnkURL,targetName,"status=yes,toolbar=no,menubar=no,location=no,resizable=1,"+gDialogsize,true);   
    if (winopen==null) {
        alert("윈도우XP를 이용하여 접속하시는 분께서는 팝업차단을 해제하여 주시기 바랍니다.\r\n\r\n팝업차단해제를 한다면 정상적으로 이 서비스를 이용하실 수 있습니다.\r\n\r\n화면위쪽에 있는 팝업차단안내를 눌러 [현재사이트를 항상허용]으로 설정해 주세요.");
    } else {    
        winopen.focus();
    }
}

/* 새윈도우download */
function fncNewWindowDown(lnkURL)
{
    popWindow = window.open(lnkURL,"down","status=no,toolbar=no,menubar=no,location=no,resizable=0,width=50,height=50,left=900,top=550",true);   
    if (popWindow==null) {
        alert("윈도우XP를 이용하여 접속하시는 분께서는 팝업차단을 해제하여 주시기 바랍니다.\r\n\r\n팝업차단해제를 한다면 정상적으로 이 서비스를 이용하실 수 있습니다.\r\n\r\n화면위쪽에 있는 팝업차단안내를 눌러 [현재사이트를 항상허용]으로 설정해 주세요.");
    } else {    
        popWindow.focus();
    }
}

/* 새윈도우 */
function fncNewWindowPos0(lnkURL,targetName,nWidth,nHeight)
{
    var gWinheight= 0;
    var gDialogsize = "width="+nWidth+",height="+nHeight+",left=0,top=0";
    var winopen = window.open(lnkURL,targetName,"status=yes,toolbar=no,menubar=no,location=no,resizable=1,"+gDialogsize,true);   
    if (winopen==null) {
        alert("윈도우XP를 이용하여 접속하시는 분께서는 팝업차단을 해제하여 주시기 바랍니다.\r\n\r\n팝업차단해제를 한다면 정상적으로 이 서비스를 이용하실 수 있습니다.\r\n\r\n화면위쪽에 있는 팝업차단안내를 눌러 [현재사이트를 항상허용]으로 설정해 주세요.");
    } else {    
        winopen.focus();
    }
}

/* 새윈도우(스크롤) */
function fncNewWindowScroll(lnkURL,targetName,nWidth,nHeight)
{
    nHeight=nHeight+15;
    var gWinheight= 0;
    var nWinLeftPos = ((screen.availWidth/2)-(nWidth/2)) ;
    var nWinTopPos  = ((screen.availHeight/2)-(nHeight/2)) ;

    var gDialogsize = "width="+nWidth+",height="+nHeight+",left=" + nWinLeftPos+",top="+nWinTopPos
    var winopen = window.open(lnkURL,targetName,"status=yes,toolbar=no,menubar=no,scrollbars=yes,location=no,resizable=yes,"+gDialogsize,true);   
    if (winopen==null) {
        alert("윈도우XP를 이용하여 접속하시는 분께서는 팝업차단을 해제하여 주시기 바랍니다.\r\n\r\n팝업차단해제를 한다면 정상적으로 이 서비스를 이용하실 수 있습니다.\r\n\r\n화면위쪽에 있는 팝업차단안내를 눌러 [현재사이트를 항상허용]으로 설정해 주세요.");
    } else {    
        winopen.focus();
    }
}

/* 새윈도우 */
function fncNewWindow01(lnkURL,targetName,nWidth,nHeight)
{
    var gWinheight= 0;
    nHeight=nHeight+15;
    var nWinLeftPos = ((screen.availWidth/2)-(nWidth/2)) ;
    var nWinTopPos  = ((screen.availHeight/2)-(nHeight/2)) ;

    var gDialogsize = "width="+nWidth+",height="+nHeight+",left="+ nWinLeftPos+",top="+nWinTopPos
    var winopen = window.open(lnkURL,targetName,"status=yes,toolbar=no,menubar=no,scrollbars=no,location=no,resizable=yes,"+gDialogsize,true);   
    if (winopen==null) {
        alert("윈도우XP를 이용하여 접속하시는 분께서는 팝업차단을 해제하여 주시기 바랍니다.\r\n\r\n팝업차단해제를 한다면 정상적으로 이 서비스를 이용하실 수 있습니다.\r\n\r\n화면위쪽에 있는 팝업차단안내를 눌러 [현재사이트를 항상허용]으로 설정해 주세요.");
    } else {    
        winopen.focus();
    }
}


//모달메시지화면
function fncMsgShow(msgID,btnType,n1,n2,n3) {

	if (msgID==0) return;
	var style 	= "dialogWidth:370px; dialogHeight:210px; center:yes;status:no;scroll:no;resizable:no;"
	var msgURL 	= "../common/tgac_init.jsp?msgID=" + msgID  + "&btnType=" + btnType + "&n1=" + n1 + "&n2=" + n2 + "&n3=" + n3;
//	var msg 	= new Array();
//	msg[0] 		= msgID ;
//	msg[1] 		= btnType;
    var szName = window.showModalDialog (msgURL,"", style );
    return szName;
}

//모달위의 메시지화면
function f_showMsgModal(msgID,btnType,n1,n2,n3) {
	
	if (msgID==0) return;
	var style 	= "dialogWidth:405px; dialogHeight:266px; center:yes;status:no;scroll:no;resizable:no;"
	var msgURL 	= "../common/tgac_init.jsp?msgID=" + msgID  + "&btnType=" + btnType + "&n1=" + n1 + "&n2=" + n2 + "&n3=" + n3;
	var msg 	= new Array();
	msg[0] 		= msgID ;
	msg[1] 		= btnType;
    var szName = parent.window.showModalDialog (msgURL,msg, style );
    return szName;
}
