﻿/*즐겨찾기시작*/
var favoriteurl = 'http://guide.gyeongju.go.kr/index.jsp';
var favoritetitle = '경주문화관광';
function addfavorites() {
   if (document.all) {
      window.external.AddFavorite(favoriteurl,favoritetitle)
   }
}
/*즐겨찾기끝*/

/*새창시작*/
function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}



/*새창시작*/
function scraps()
{
	window.open("/detail_view/Scraps.jsp","new","width=300px,height=200px,top=100px,left=100px");
}

function review_del()
{
	window.open("/include/Review_del.jsp","new","width=300px,height=200px,top=100px,left=100px");
}

function reply_del()
{
	window.open("/include/Reply_del.jsp","new","width=300px,height=200px,top=100px,left=100px");
}

function detail_photo()
{
	window.open("/detail_view/Detail_photo.jsp","new","width=820px,height=595px,top=100px,left=100px");
}

function detail_vr()
{
	window.open("/detail_view/Detail_vr.jsp","new","width=700px,height=507px,top=100px,left=100px");
}

function detail_play()
{
	window.open("/detail_view/Detail_play.jsp","new","width=370px,height=360px,top=100px,left=100px");
}

function detail_play_k()
{
	window.open("/05_multimedia/Detail_play_k.jsp","new","width=370px,height=360px,top=100px,left=100px");
}

function detail_play_e()
{
	window.open("/05_multimedia/Detail_play_e.jsp","new","width=370px,height=360px,top=100px,left=100px");
}

function detail_play_j()
{
	window.open("/05_multimedia/Detail_play_j.jsp","new","width=370px,height=360px,top=100px,left=100px");
}

function detail_play_c()
{
	window.open("/05_multimedia/Detail_play_c.jsp","new","width=370px,height=360px,top=100px,left=100px");
}

function detail_mp3()
{
	window.open("/detail_view/Detail_mp3.jsp","new","width=370px,height=142px,top=100px,left=100px");
}
/*새창끝*/





/*셀렉트새창시작*/
function changeURL(url) {
if (url != "") window.open(url);
}
/*셀렉트새창끝*/





/*게시판탭시작*/
function board_showHideLayers() { //v6.0
  var i,p,v,obj,args=board_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=='block')?'block':(v=='none')?'none':v; }
    obj.display=v; }
}


function board(o, no, noOff) {
	images_on = new Array("/img/main/tab_today_on.gif","/img/main/tab_festival_on.gif");
	images_off = new Array("/img/main/tab_today_off.gif","/img/main/tab_festival_off.gif");
	images = new Array("tab_today_on","tab_festival_on");

//alert("SRC::"+document.getElementById("board_tab").src);

	for(i=0;i < images.length;i++) {
		if(images[i]==o) {
			///document.board_tab1.src = images_on[i];
			document.getElementById("board_tab"+no).src = images_on[i];
			eval(images[i]).style.display="block";
		}else {
			document.getElementById("board_tab"+noOff).src = images_off[i];
			eval(images[i]).style.display="none";
		}
	}
}

function board1(o) {
	images_on = new Array("/images/board_tab01.gif","/images/board_tab02.gif","/images/board_tab03.gif","/images/board_tab04.gif");
	images = new Array("board_tab01","board_tab02","board_tab03","board_tab04");

//alert("SRC::"+document.getElementById("board_tab").src);

	for(i=0;i < images.length;i++) {
		if(images[i]==o) {
			///document.board_tab1.src = images_on[i];
			document.getElementById("board_tab").src = images_on[i];
			eval(images[i]).style.display="block";
		}else {
			eval(images[i]).style.display="none";
		}
	}
}

/*게시판탭끝*/





/*인기Search어탭시작*/
function tag(o) {
	images_on = new Array("/images/tag_tab01.gif","/images/tag_tab02.gif");
	images = new Array("tag_tab01","tag_tab02");

//alert("SRC::"+document.getElementById("tag_tab").src);

	for(i=0;i < images.length;i++) {
		if(images[i]==o) {
			///document.tag_tab1.src = images_on[i];
			document.getElementById("tag_tab").src = images_on[i];
			eval(images[i]).style.display="block";
		}else {
			eval(images[i]).style.display="none";
		}
	}
}
/*인기Search어탭끝*/





/*서브왼쪽메뉴시작*/
function menuOver() {
	this.src = this.src.replace("off.gif", "on.gif");
	
}
function menuOut() {
	this.src = this.src.replace("on.gif", "off.gif");
}


function initSubmenu(depth1, depth2, depth3) {
	selectDepth1 = "menu" + depth1 + "-" + depth2;
	selectDepth2 = "menu" + depth1 + "-" + depth2 + "-" + depth3;
	
	if(eval(depth2)<=9) depth2 = "0"+depth2;
	if(eval(depth3)<=9) depth3 = "0"+depth3;
	var aNum=depth2+depth3;
	
	nav = document.getElementById("leftmu");
	menuEl = nav.getElementsByTagName("li");
	
	for(i = 0; i < menuEl.length; i++) {
	   
	   
		if (menuEl.item(i).id == selectDepth1 || menuEl.item(i).id == selectDepth2  ) {
			menuEl.item(i).getElementsByTagName("img").item(0).src = menuEl.item(i).getElementsByTagName("img").item(0).src.replace("off.gif", "on.gif");
		} else {
		   
		   if ( menuEl.item(i).id.length > 7 && menuEl.item(i).id.substring(0,7) != selectDepth1) {
				menuEl.item(i).style.display = 'none';
			}
			
		}
	}
	
}
/*서브왼쪽메뉴끝*/


/*탑버튼시작*/
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function FloatDiv(id, sx, sy)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
	var px = document.layers ? "" : "px";
	window[id + "_obj"] = el;
	if(d.layers)el.style=el;
	el.cx = el.sx = sx;el.cy = el.sy = sy;
	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};

	el.floatIt=function()
	{
		var pX, pY;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth : 
		document.documentElement && document.documentElement.clientWidth ? 
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? 
		document.documentElement.scrollTop : document.body.scrollTop;
		if(this.sy<0) 
		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? 
		document.documentElement.clientHeight : document.body.clientHeight;
		this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/5;
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.floatIt()", 40);
	}
	return el;
}
//사용법: 움직일 객체 다음에 아래코드 삽입
//JSFX_FloatDiv("wing", 880,143).floatIt();
/*탑버튼끝*/





/*VR시작*/
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; }
}
/*VR끝*/





/*동영상시작*/
function funcPlay(){
if( document.winplayer.PlayState != 2 ){
document.winplayer.Play();
//MM_swapImage('imgPlay1','','/{TEMPLATE}/Main/Images/Btn_play.gif',1);
//MM_swapImage('imgPAUSE','','/{TEMPLATE}/Main/Images/Btn_once.gif',1);
//MM_swapImage('imgSTOP','','/{TEMPLATE}/Main/Images/Btn_stop.gif',1);
}
}
function funcPause(){
if( document.winplayer.PlayState == 2 ){
document.winplayer.Pause();
//MM_swapImage('imgPlay1','','/{TEMPLATE}/Main/Images/Btn_play.gif',1);
//MM_swapImage('imgPAUSE','','/{TEMPLATE}/Main/Images/Btn_once.gif',1);
//MM_swapImage('imgSTOP','','/{TEMPLATE}/Main/Images/Btn_stop.gif',1);
}
}
function funcStop(){
//MM_swapImage('imgSTOP','','/{TEMPLATE}/Main/Images/Btn_stop.gif',1);
//MM_swapImage('imgPlay1','','/{TEMPLATE}/Main/Images/Btn_play.gif',1);
//MM_swapImage('imgPAUSE','','/{TEMPLATE}/Main/Images/Btn_once.gif',1);
document.winplayer.Stop();
}
/*동영상끝*/


/*폼 입력값 체크 */

function checkValue(){
	
   if(document.getElementById('usr_id').value=="" ){alert("회원아이디를 입력하세요");document.getElementById('usr_id').focus();return false;}
	else if(document.getElementById('usr_pw').value=="" ){alert("회원비밀번호를 입력하세요");document.getElementById('usr_pw').focus();return false;}
//	else if(!isAlphaNumeric(document.getElementById('usr_id').value)){
//		alert("아이디에 특수문자는 사용할수 없습니다. 영,숫자 조합만 가능합니다");
//		document.getElementById('usr_id').focus();
//		return false;
//	}else if(!isAlphaNumeric(document.getElementById('usr_pw').value)){
//		alert("비밀번호에에 특수문자는 사용할수 없습니다. 영,숫자 조합만 가능합니다");
//		document.getElementById('usr_pw').focus();
//		return false;	
//	}
   else{		
	   return true;
	}
	
}

/* 폼 입력값 체크 끝 */


/*게시판 스크립트 체크*/

function checkAll(args) {
   	var objF = document.forms.enform;
   	var i =0;
   	
   	while (i < objF.elements.length) {
   		if (objF.elements[i].name == args)
   			objF.elements[i].checked = !objF.elements[i].checked;
   		i++;
   	}
   }
   
   function chk_submit(form) {
   	var i =0;
   	var args = 0;
   	while (i < form.length) {
   		if (form.elements[i].name == 'c_id') {
   			if (form.elements[i].checked)
   				args =+ 1;
   		}
   
   		i++;
   	}
   	
   	if (args > 0) {
   	   form.p.value="Adelete";
   	   form.action="<%=PrcFile%>";
   		form.submit();
   	}
   	else {
   		
   			alert('선택오류...\n--------------------------\n글번호를 선택해 주십시오.');
   		
   		
   	}
   }


	function chk_seek(frm) {
		if (!frm.ssubject.checked && !frm.swriter.checked && !frm.scontent.checked) {
			alert('Search값 체크...\nSearch을 원하는 필드를 선택해 주세요');
			return false;
		}
		else {
			if (frm.seek.value == "") {
				alert('Search값 입력...\nSearch을 원하는 단어를 입력 주세요');
				frm.seek.focus();
				return false;
			}
			return true;
		}
	}
	
	function goPage(p,subj,swriter,scontent,seek){
	   location.href="?start="+p+"&amp;swriter="+swriter+"&amp;ssubject="+subj+"&amp;scontent="+scontent+"&amp;seek="+seek;
	}

/*게시판 사용 스크립트*/