// #######################################################################################
// 작 성 자 : 권오준
// 작성일자 : 2011/10/18
// 기    능 : 팝업/레이어 창 오픈관련 함수 모음
// 작업이력 :
// #######################################################################################

//****************************************************************************************
// 레이어 팝업 열기
//****************************************************************************************
function fGoMapOpen(e, top, gubun)
{
	var POPUP = eval("POPUP1_" + e)
	var POPUP1 = eval("POPUP_" + e)
	

	POPUP.style.display = ''
	POPUP1.style.display = ''

	FixLayer(e, top, gubun);
}

//****************************************************************************************
// 레이어 팝업 닫기
//****************************************************************************************
function fGoMapClose(e)
{
	var POPUP = eval("POPUP1_" + e)
	var POPUP1 = eval("POPUP_" + e)

	POPUP.style.display = 'none'
	POPUP1.style.display = 'none'


}

//****************************************************************************************
// 레이어 고정하기
//****************************************************************************************
function FixLayer(e, top , gubun) {

	var xMax = document.body.clientWidth;
	var yMax = document.body.clientHeight;



	var xOffset;

	if (gubun=="1")
	{
		//xOffset= (xMax)/2-930;
		xOffset= 20;	
	} else {
		//xOffset= (xMax)/2-930;
		xOffset= 20;
	}

	var yOffset = (yMax)/20; 
	var divMenu = eval("document.all.POPUP1_" + e).style;
	var divMenu2 = eval("document.all.POPUP_" + e).style;
	
	divMenu.left = xOffset;
	divMenu.top = top;

	divMenu2.left = xOffset;
	divMenu2.top = top;

}
//****************************************************************************************
// TOP MENU 플래쉬 동적이동
// 우측 이벤트 팝업 위치 및 크기 동적으로 변경하기
//****************************************************************************************
function glTopLayerOpen()
{
	//alert(1);
	document.getElementById("TopNavi").height = 510
	document.getElementById("TopNavi").style.position = "absolute";
	document.getElementById("header").style.height = "510";

}

function glTopLayerClose()
{
	document.getElementById("TopNavi").height = 88
	document.getElementById("header").style.height = "88";

}
//****************************************************************************************
// 팝업이미지창열기.
//****************************************************************************************
function fGoZoomImg(argIMG_URL,argIMG_WIDHT,argIMG_HEIGHT)
{
	var sORG_WIDTH
	var sORG_HEIGHT
	var sWIDTH
	var sHEIGHT
	var sIS_SCROLL
	
	sWIDTH = 0;
	sHEIGHT = 0;
	sORG_WIDTH = argIMG_WIDHT * 1;
	sORG_HEIGHT = argIMG_HEIGHT * 1;
	sIS_SCROLL = "no";
	
	if (window.screen.width + 10 < sORG_WIDTH + 158) {
		sWIDTH = window.screen.width - 10
		sIS_SCROLL = "yes";
	}else{
		sWIDTH = sORG_WIDTH + 153
	}
	
//	alert(sIS_SCROLL);
//	alert(window.screen.width + 10);
//	alert(sORG_WIDTH);
//	alert(sWIDTH);

	if (window.screen.height + 10 < sORG_HEIGHT + 293) {
		sHEIGHT = window.screen.height - 30
		sIS_SCROLL = "yes";
	}else{
		sHEIGHT = sORG_HEIGHT + 293
	}

//	alert(sIS_SCROLL);
//	alert(window.screen.height);
//	alert(sORG_HEIGHT);
//	alert(sHEIGHT);

	var Zoom_Win = window.open('/public/popup.asp?hIMG_URL=' + argIMG_URL + '&hIMG_WIDTH=' + argIMG_WIDHT + '&hIMG_HEIGHT=' + argIMG_HEIGHT, 'Zoom', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + sIS_SCROLL + ',resizable=no,left=0,top=0,width=' + sWIDTH + ',height=' + sHEIGHT);
	Zoom_Win.focus();
}

//****************************************************************************************
// 새창띄우기
//****************************************************************************************
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//****************************************************************************************
// 팝업 - 팝업창 화면중앙 오픈
//****************************************************************************************
var win = null; 
function NewWindow(mypage,myname,w,h,scroll)
{ 
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; 
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0; 
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable' ;
	//win = window.open(mypage,myname,settings) 
	window.open(mypage,myname,settings) ;
} 
//****************************************************************************************
// 팝업 - 모달창
//****************************************************************************************
function MM_openModal(theURL, obj, features) {
	window.showModalDialog(theURL, obj, features);
}

//팝업창 열기
function PopupOpen(strUrl,strWindowName,strWidth,strHeight) {
    var strWindowFeatures = "width="+strWidth+",height="+strHeight;
    var strWindowPopup = window.open(strUrl,strWindowName,strWindowFeatures);
}


