// 관련사이트  바로가기
// 공지사항 , 이벤트 관련 레이서 보이기
function Show_Layer(obj,total,num) {
		for (i=1;i<total+1;i++) {
			document.getElementById(obj.name + i).style.display = "none";
		}
		document.getElementById(obj.name + num).style.display = "block";
}	

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function popupOpen(url,frameName,option) {
	window.open(url,frameName,option);
}

//상단 메뉴관련 레이어
var layerArray = new Array();

function openSubMenu(seq) {
	closeAllMenu();
	if($("MsMenu"+seq).style.display == 'none') {
		$("MsMenu"+seq).style.display = 'block';
	} else {
		$("MsMenu"+seq).style.display = 'none';
	} 
}

function closeAllMenu() {
	for(var i=0;i<layerArray.length;i++) {
		if($("MsMenu"+layerArray[i]).style.display == 'block') {
			$("MsMenu"+layerArray[i]).style.display = 'none';
		}
	}
}

//팝업관련 스크립트

function viewPopup(popupName,pNum) {
	closePopup();
	
	if($(popupName).style.display == 'none') {
		$(popupName).style.display = 'block';
		document.getElementById("popNum"+pNum).src="/img/main/no0"+pNum+"_on.gif";
	} else {
		$(popupName).style.display = 'none';
	} 
}
function closePopup() {
	for(var i=1;i<=15;i++){
		if(document.getElementById("popupZone"+i) != null){
			document.getElementById("popupZone"+i).style.display = 'none';
			document.getElementById("popNum"+i).src="/img/main/no0"+i+"_off.gif";
		}
	}
}  	

var popupZoneShowCheck=false;

//팝업존 자동구동
var popupZoneIndex = 1;

function popupZoneShow(){
	if(popupZoneShowCheck){
		viewPopup("popupZone"+popupZoneIndex,popupZoneIndex);
	}
		popupZoneIndex++;
		if(popupZoneIndex>popupzonelistsize){popupZoneIndex=1;}
		setTimeout( "popupZoneShow()" , 2000 );
}


//윈도우 로드후 실행해야할것들
function init(){
	// 레이어 상하 이동
	var divSwap = new swapDiv('MainCenter');
	divSwap.mode = 1;
	divSwap.step = 10;
	divSwap.interval = 15;
	divSwap.init();
	
	//즐겨찾기
	setFavor();
	
	//팝업존
	popupZoneShow();
	
}


//png파일
function setPng24(obj) {
	obj.width=obj.height="1";
	obj.className=obj.className.replace(/\bpng24\b/i,"");
	obj.style.filter= "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');";
	obj.src=""; 
	return "";
}
