/* 메인페이지용 메뉴 스크립트 Start */
function depthNaviMain2011(menuCd) {
	jqr("#depth1").children().each(function(e) {
		var curMenuCd = jqr(this).attr("name");
		var menuObj = document.getElementById("navi_main_"+curMenuCd);
		var subObj = "depth2-"+curMenuCd;
		if (menuCd == curMenuCd) {
			menuObj.src="/www/resource/images/main2011/nav_main_"+curMenuCd+"_on.gif";
			showHideLayers(subObj,'','show');
		}
		else {
			menuObj.src="/www/resource/images/main2011/nav_main_"+curMenuCd+".gif";
			showHideLayers(subObj,'','hide');
		}
	});
}


function returnNaviMain2011(menuCd) {
	jqr("#depth1").children().each(function(e) {
		var curMenuCd = jqr(this).attr("name");
		var menuObj = document.getElementById("navi_main_"+curMenuCd);
		var subObj = "depth2-"+curMenuCd;
		if (menuCd == curMenuCd) {
			menuObj.src="/www/resource/images/main2011/nav_main_"+menuCd+".gif";
			showHideLayers(subObj,'','hide');
		}
	});
}
/* 메인페이지용 메뉴 스크립트 End */

function depthNavi(menuCd) {
	jqr("#depth1").children().each(function(e) {
		var curMenuCd = jqr(this).attr("name");
		var menuObj = document.getElementById("navi_main_"+curMenuCd);
		var subObj = "depth2-"+curMenuCd;
		if (menuCd == curMenuCd) {
			menuObj.src="/www/resource/images/common/menu/nav_main_"+curMenuCd+"_on.gif";
			showHideLayers(subObj,'','show');
		}
		else {
			menuObj.src="/www/resource/images/common/menu/nav_main_"+curMenuCd+".gif";
			showHideLayers(subObj,'','hide');
		}
	});
}


function returnNavi(menuCd) {
	jqr("#depth1").children().each(function(e) {
		var curMenuCd = jqr(this).attr("name");
		var menuObj = document.getElementById("navi_main_"+curMenuCd);
		var subObj = "depth2-"+curMenuCd;
		if (menuCd == curMenuCd) {
			menuObj.src="/www/resource/images/common/menu/nav_main_"+menuCd+".gif";
			showHideLayers(subObj,'','hide');
		}
	});
}

function depth2Navi(menuNum) {
	for (var i=1; i<10; i++) {
		var subObj = "depth2-"+i;
		if(i == menuNum) {
			showHideLayers(subObj,'','show');
		}
	}
}

function return2Navi(menuNum) {
	for (var i=1; i<10; i++) {
		var subObj = "depth2-"+i;
		if(i == menuNum) {
			showHideLayers(subObj,'','hide');
		}
	}
}

function depthENavi(menuNum) {
	for (var i=1; i<10; i++) {
		var subObj = "depth2-"+i;
		if(i == menuNum) {
			document.getElementById("navi_main"+i).src="/english/resource/images/common/nav_main"+i+"_on.gif";
			showHideLayers(subObj,'','show');
		} else {
			if(document.getElementById("navi_main"+i) != null) {
				document.getElementById("navi_main"+i).src="/english/resource/images/common/nav_main"+i+".gif";
				showHideLayers(subObj,'','hide');
			}
		}
	}
}

function returnENavi(menuNum) {
	for (var i=1; i<10; i++) {
		var subObj = "depth2-"+i;
		if(i == menuNum) {
			document.getElementById("navi_main"+i).src="/english/resource/images/common/nav_main"+i+".gif";
			showHideLayers(subObj,'','hide');
		}
	}
}

function depthNaviMain(menuNum) {
	for (var i=1; i<10; i++) {
		var subObj = "depth2-"+i;
		if(i == menuNum) {
			document.getElementById("navi_main"+i).src="/www/resource/images/common/menu/nav_main"+i+"_on.gif";
			showHideLayers(subObj,'','show');
		} else {
			if(document.getElementById("navi_main"+i) != null) {
				document.getElementById("navi_main"+i).src="/www/resource/images/common/menu/nav_main"+i+".gif";
				showHideLayers(subObj,'','hide');
			}
		}
	}
}

function returnNaviMain(menuNum) {
	for (var i=1; i<10; i++) {
		var subObj = "depth2-"+i;
		if(i == menuNum) {
			document.getElementById("navi_main"+i).src="/www/resource/images/common/menu/nav_main"+i+".gif";
			showHideLayers(subObj,'','hide');
		}
	}
}

function setOn(category,subpair) {
	document.getElementById("navi_main"+category+"-"+subpair).src="/www/resource/images/common/nav_main"+category+"-"+subpair+"_on.gif";
}

function setOut(category,subpair) {
	document.getElementById("navi_main"+category+"-"+subpair).src="/www/resource/images/common/nav_main"+category+"-"+subpair+".gif";
}

function quickNavi() {
	if(E('quickmenu').style.display=='inline') {
		E('quickswitch').childNodes[0].title="퀵메뉴 보이기";
		E('quickmenu').style.display='none';
		E('quickbutton').src='/www/resource/images/common/button/btn_navi-quick.gif';
		E('tail').style.width='21px';
	} else {
		E('tail').style.width='124px';
		E('quickbutton').src='/www/resource/images/common/button/btn_navi-quick_on.gif';
		E('quickmenu').style.display='inline';
		E('quickswitch').childNodes[0].title="퀵메뉴 감추기";
	}
}

function pzonLoad() {
	E('popup_off').style.display='none';
	E('popup_on').style.display='block';
	setTimeout('pzonCtrl()',1000*8);
}

function pzonCtrl() {
	E('popup_on').style.display='none';
	E('popup_off').style.display='block';
}

function popZone() {
	if(E('popup_on').style.display=='block') {
		E('popup_on').style.display='none';
		E('popup_off').style.display='block';
	}
	else {
		E('popup_off').style.display='none';
		E('popup_on').style.display='block';
	}
}

function showBx(id) {
	var bx = document.getElementById(id);
	if (bx.style.display == 'block') {
		bx.style.display='none';
	} else {
		bx.style.display='block';
	}
}

function toggleStyle(id) {
	var obj = document.getElementById(id);
	if(obj) {
		if(obj.style.display == '')
			obj.style.display = 'none';
		else
			obj.style.display = '';
	}
}

function toggleClass(id) {
	var obj = document.getElementById(id);
	if(obj) {
		if(obj.className == 'cover')
			obj.className = 'view';
		else
			obj.className = 'cover';
	}
}

function firstChild(Elid,Etn,Num) {
	if(Num=="") {
		Num=0;
	}
	liEl = dEI(Elid).getElementsByTagName(Etn);
	if (liEl.item(Num)) {
		liEl.item(Num).className += " first-child";
	}
}

/*20100122 수정됨
function setCookie(name, value, expire) {
	document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire));//고쳐야함
}
*/
function setCookie( name, value, expire )  {
	var todayDate = new Date(); 
	todayDate.setDate( todayDate.getDate() + expiredays ); 
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
}
function getCookie(name) {
	var search = name + "=";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1)
			end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		}
	}
}
function memory(cookieValue) {
	var today = new Date();
	var expires = new Date();
	expires.setTime(today.getTime() + 5000); //\\test\\
//	expires.setTime(today.getTime() + 1000*60*60*24);
	setCookie("divpopup", cookieValue, expires);
}

function autoPlayMuz() {
	top.frames['frame_blk'].location='/bgmuz.php';
}
function autoPauseMuz() {
	top.frames[0].document.getElementById("mplayer").pause();;
}
function autoCtrlMuz() {
	top.frames[0].document.getElementById("mplayer").play();;
}
/*
function playMedia(fileName) {
	jqr('player').Filename = fileName;
	jqr('player').play();
}
*/
function preloadImages() {
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function swapImgRestore() {
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function findObj(n, d) {
  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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() {
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);

function showHideLayers() {
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=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 showNoneLayers() {
  var i,p,v,obj,args=showNoneLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}
/*
function bluring() {
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;

var myAnchors=document.all.tags("A");
function allblur() {
	for (i=0;i<myAnchors.length;i++) {
		myAnchors[i].onfocus=new Function("myAnchors["+i+"].blur()");
	}
}
*/
var Hana = 'greatego@hotmail.com';

function msmsgs() {
	try {
		www2deacom.classid='clsid:B69003B3-C55E-4B48-836C-BC5946FC3B28';
	}
	catch(e) {
		return;
	}
}
function msmsgsSend(name) {
	msmsgs();
	if(www2deacom.MyStatus==1) {
		www2deacom.SignIn(0,'','');
	}
	else {
		www2deacom.InstantMessage(name);
	}
}
function msmsgsAdd(name) {
	msmsgs();
	if(www2deacom.MyStatus==1) {
		www2deacom.SignIn(0,'','');
	}
	else {
		www2deacom.AddContact(0,name);
	}
}
//	document.write('<object id="www2deacom" class="hide"></object>');

function ovrView(obj) {
	document.getElementById(obj).style.display = "block";
	
}

function outView(obj) {
	document.getElementById(obj).style.display = "none";
	
}

function ovrMenuImg(id, did, img) {
	var obj = document.getElementById(id);
	obj.src = img;
	
	if(did != null) {
		if(document.getElementById(did)) {
			document.getElementById(did).className = "show";
			document.getElementById(did).style.display = "block";
		}
	}
}

function outMenuImg(id, did, img) {
	var obj = document.getElementById(id);
	obj.src = img;
	
	if(did != null) {
		if(document.getElementById(did)) {
			document.getElementById(did).className = "none";
			document.getElementById(did).style.display = "none";
		}
	}
}

var font_size = 100;

function jsZoom(param,id)
{
    
    if(document.getElementById(id).style.fontSize==null||document.getElementById(id).style.fontSize=="") font_size = 100;

    if(param=="in")
        font_size = font_size + 20;
    else
        font_size = font_size - 20;

    if (font_size > 200) {
		alert("최대크기입니다.");
		font_size = 200;
	}      

    if(font_size < 60){
		alert("최소크기입니다.");
		font_size = 60;
	} 
     
    document.getElementById(id).style.fontSize = font_size +"%";   
}

function jsZoomM(param)
{
    
    if(document.getElementById('main').style.fontSize==null||document.getElementById('main').style.fontSize=="") font_size = 100;

    if(param=="in")
        font_size = font_size + 20;
    else
        font_size = font_size - 20;

    if (font_size > 200) {
		alert("최대크기입니다.");
		font_size = 200;
	}      

    if(font_size < 60){
		alert("최소크기입니다.");
		font_size = 60;
	} 
     
    document.getElementById('main').style.fontSize = font_size +"%";   
}


/* 롤링  */
var targetRolling = "";
function jsRollingInit(targetId, direction, gap, dealy, pause) {
		
	if(direction == null) direction = 3;
	if(gap == null) gap = 1;
	if(dealy == null) dealy = 3;
	if(pause == null) pause = 1000;
		
	targetRolling = new js_rolling(document.getElementById(targetId));
	targetRolling.set_direction(direction);
	targetRolling.move_gap = gap;	//움직이는 픽셀단위
	targetRolling.time_dealy = dealy; //움직이는 타임딜레이
	targetRolling.time_dealy_pause = pause;//하나의 대상이 새로 시작할 때 멈추는 시간, 0 이면 적용 안함
	targetRolling.mouseover_pause = false; //마우스 오버시에도 안멈춘다.
	targetRolling.start();
		
}

var bannerRolling = "";
function jsRollingBanner(targetId, direction, gap, dealy, pause) {
		
	if(direction == null) direction = 3;
	if(gap == null) gap = 1;
	if(dealy == null) dealy = 3;
	if(pause == null) pause = 1000;
		
	bannerRolling = new js_rolling(document.getElementById(targetId));
	bannerRolling.set_direction(direction);
	bannerRolling.move_gap = gap;	//움직이는 픽셀단위
	bannerRolling.time_dealy = dealy; //움직이는 타임딜레이
	bannerRolling.time_dealy_pause = pause;//하나의 대상이 새로 시작할 때 멈추는 시간, 0 이면 적용 안함
	bannerRolling.mouseover_pause = false; //마우스 오버시에도 안멈춘다.
	bannerRolling.start();
		
}

/* tab 변경 */
function tabChange(obj, num, tabId, total) {
    
  	for (i=1; i <= total; i++)    {
    
	  	if (i == num)    {
	    	document.getElementById(obj+i).className = 'show';
	        document.getElementById(tabId+i).className = 'focus';
	    } else {
	        document.getElementById(obj+i).className = 'none';
	        document.getElementById(tabId+i).className = '';
	    }
	}
}

function tabChange02(obj,num,imgId,total) {
    for (i=1; i<=total; i++)    {
        //var imgIds = document.getElementById(imgId+i);
        //var imgSrc = imgIds.getAttribute("src");
        if (i==num)    {
            document.getElementById(obj+i).style.display = '';
            //imgIds.setAttribute("src",imgSrc.replace("_or","_on"));
        }
        else {
            document.getElementById(obj+i).style.display = 'none';
            //imgIds.setAttribute("src",imgSrc.replace("_on","_or"));
        }
    }
}

/* 공통 베너 및 팝업 존 오픈 */
function openBannerPopupzone(target, revUrl) {
    	
	var url = '';

   	if(revUrl.indexOf("http://") == -1) {
    	url = "http://"+revUrl;
    } else {
        url = revUrl;
	}
    window.open(url, target, "");
}


/* 공연정보 통합검색 */
function jsTotalSearch() {
	if(document.totalSearchForm.elements["search_val_v"].value.length < 1) {
		alert("검색어를 두자 이상 입력해 주세요.");
		return false;
	}
	
	document.totalSearchForm.action = "/www/playinfo/play_guide/play_info/play_monthinfo/playInfo/playInfoSearch.do";
	document.totalSearchForm.submit();
}

//----------------------- 화면확대축소 ----------------------------
var nowZoom = 100; // 현재비율
var maxZoom = 200; // 최대비율
var minZoom = 100; // 최소비율(현재와 같아야 함)
var increaseNum = 10; // 증/감 비율

//화면 키운다.
function zoomIn() {
	if (nowZoom < maxZoom) {
		nowZoom += increaseNum; 
	} else {
		return;
	}

	document.getElementById('dobody').style.zoom = nowZoom + "%";
//	document.body.style.zoom = nowZoom + "%";
}

//화면 줄인다.
function zoomOut() {
	if (nowZoom > minZoom) {
		nowZoom -= increaseNum;
	} else {
		return;
	}

	document.getElementById('dobody').style.zoom = nowZoom + "%";
//	document.body.style.zoom = nowZoom + "%";
}

//화면 줄인다.
function zoomRenew() {
	nowZoom = minZoom;
	document.getElementById('dobody').style.zoom = nowZoom + "%";
//	document.body.style.zoom = minZoom + "%";
}

