﻿// flashWrite(파일경로, 가로, 세로[, 변수][,배경색][,윈도우모드])
function flashWrite(url,w,h,vars,bg,win){
	
	var id=url.split("/")[url.split("/").length-1].split(".")[0]; //id는 파일명으로 설정
	if(vars==null) vars='';
	if(bg==null) bg='#FFFFFF';
	if(win==null) win='transparent';

	function BrowserCheck() {
	appname = navigator.appName;
	useragent = navigator.userAgent;
	 if(appname == "Microsoft Internet Explorer") appname = "IE";
	 IE55 = (useragent.indexOf('MSIE 5.5')>0);  //5.5 버전
	 IE6 = (useragent.indexOf('MSIE 6')>0);     //6.0 버전

	 if(appname=="IE" && IE55 || IE6) vars = 'ieVer=6'; //익스플로러이면서 5.5 or 6.0 버전이면...
	 else vars= 'ieVer=7';
	}
	//onload=BrowserCheck;

	// 플래시 코드 정의
	var flashStr= "	<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'";
		flashStr+="			codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'";
		flashStr+="			width='"+w+"'";
		flashStr+="			height='"+h+"'";
		flashStr+="			id='"+id+"'";
		flashStr+="			align='middle'>";

		flashStr+="		<param name='allowFullScreen' value='true' />";
		flashStr+="		<param name='allowScriptAccess' value='always' />";
		flashStr+="		<param name='movie' value='"+url+"' />";
		flashStr+="		<param name='FlashVars' value='"+vars+"' />";
		flashStr+="		<param name='wmode' value='"+win+"' />";
		flashStr+="		<param name='menu' value='false' />";
		flashStr+="		<param name='quality' value='high' />";
		flashStr+="		<param name='bgcolor' value='"+bg+"' />";
		flashStr+="		<param name='base' value='.' />";
		
	
	
		flashStr+="		<embed base ='.' src='"+url+"'";
//		flashStr+="		<embed src='"+url+"'";
		flashStr+="		       flashVars='"+vars+"'";
		flashStr+="		       wmode='"+win+"'";
		flashStr+="		       menu='false'";
		flashStr+="		       quality='high'";
		flashStr+="		       bgcolor='"+bg+"'";
		flashStr+="		       width='"+w+"'";
		flashStr+="		       height='"+h+"'";
		flashStr+="		       name='"+id+"'";
		flashStr+="		       align='middle'";
		flashStr+="		       allowScriptAccess='always'";
		flashStr+="		       allowFullScreen='true'";
		flashStr+="		       type='application/x-shockwave-flash'";
		flashStr+="		       pluginspage='http://www.macromedia.com/go/getflashplayer' />";
		flashStr+=" </object>";

	// 플래시 코드 출력
	document.write(flashStr);
}

$(document).ready(function(){
  InitializeStaticMenu();

  $(".thumb_active").click(function() {
    $(".thumb_active").removeClass("active");
    $(this).addClass("active");
  });

});

$(function() {
	$(".question a").click(function(){
		$(".answer").hide();
		$(this).parent().parent().parent().children(".answer").fadeIn("slow")
	});
});

// 우측 날개 스크롤 시작
var stmnRIGHT = 0; // 오른쪽 여백 (메뉴가 오른쪽에서 지정된 음수값 픽셀만큼 떨어진 곳에 보여집니다)
var stmnGAP1 = 0; // 위쪽 여백 (메뉴가 위에서 10픽셀 떨어진 곳에 보여집니다)
var stmnGAP2 = 0; // 스크롤시 브라우저 위쪽과 떨어지는 거리
var stmnBASE = 0; // 스크롤 시작위치
var stmnActivateSpeed = 10;
var stmnScrollSpeed = 10;
var stmnTimer;

function RefreshStaticMenu() {
  var stmnStartPoint, stmnEndPoint;

  stmnStartPoint = parseInt(document.getElementById('STATICMENU').style.top, 10);
  stmnEndPoint = Math.max(document.documentElement.scrollTop, document.body.scrollTop) + stmnGAP2;
  if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

  if (stmnStartPoint != stmnEndPoint) {
    stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
    document.getElementById('STATICMENU').style.top = parseInt(document.getElementById('STATICMENU').style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount ) + 'px';
    stmnRefreshTimer = stmnScrollSpeed;
  }

  stmnTimer = setTimeout("RefreshStaticMenu();", stmnActivateSpeed);
}

function InitializeStaticMenu() {
	if( document.getElementById('STATICMENU') )
	{
		document.getElementById('STATICMENU').style.top = document.body.scrollTop + stmnBASE + 'px';
		RefreshStaticMenu();
	}
}
// 우측 날개 스크롤 끝~

$(document).ready(function(){
	$(".best_items_09").accessNews({ newsSpeed: "normal" ,opt: 135});
	depthHover($(".footer_banner_slide .item img"));
});


function right_show_01()
{
	$(".right_trip_02").hide();
	$(".right_trip_01").show();
}
function right_show_02()
{
	$(".right_trip_01").hide();
	$(".right_trip_02").show();
}




function depthHover(obj)
{

	$(obj).hover(
	function(){
		off = $(this).attr("src");
		x = off.split(".");
		on = ".." + x[1] + x[2] + "_on." + x[3];
		$(this).attr("src",on);
	},
	function(){
		$(this).attr("src",off);
	}
	);

}


	$(document).ready(function(){
		snb = $(".first_depth");

		/*if(snb1 != 0){
			obj = $("li#depth_"+snb1+"");
			obj.addClass("active");
			menuTitle1 = obj.find("a.snb_title img")[0];
			$(menuTitle1).attr("src",mmHover($(menuTitle1).attr("src"))).addClass("fix");
			menuTitle2 = obj.find("ul li a img:eq("+(snb2-1)+")").addClass("fix");
			$(menuTitle2).attr("src",mmHover($(menuTitle2).attr("src")));
		}*/


		$(".first_depth a img").hover(
		function(){
			if(!$(this).hasClass("fix")){
				$(this).attr("src",mmHover($(this).attr("src")));
			}
		},
		function(){
			if(!$(this).hasClass("fix")){
				$(this).attr("src",mmHover($(this).attr("src")));
			}
		}
		);

		$(".first_depth a.snb_title").click(
			function(){
				$(".first_depth").removeClass("active");
				$(this).parent().addClass("active");
			}
		);
	});

 function mmHover(obj)
 {

  res ="";
  bbb="";
  if(obj != undefined){
   aaa = obj.split("/");

   tmp = aaa[aaa.length-1].split(".");

   if(obj.substr(obj.length-7, 3) == "_on"){
    res = tmp[0].substring(0,tmp[0].length-3) + "." + tmp[1];
   }else{
    res = tmp[0]+"_on."+tmp[1];
   }

   for(var i=0; i<aaa.length-1; i++){
    bbb += aaa[i]+"/";
   }
   return bbb+res;
  }

 }

//추가, 달력영역 텍스트 고정 함수
function textZoom()
{
	$(".contents *").addClass("font_zoom_in");
	$(".contents *").removeClass("font_zoom_out");


	if($("iframe.xxxx").attr("src") != null)
	{
		iframe_name.textZoom();
	}
	else if($(".book_in_select *") != null)
	{
		$(".book_in_select *").removeClass("font_zoom_in");
		$(".book_in_select *").removeClass("font_zoom_out");
	}

}
function textSmall()
{
	$(".contents *").addClass("font_zoom_out");
	$(".contents *").removeClass("font_zoom_in");
	if($("iframe.xxxx").attr("src") != null)
	{
		iframe_name.textSmall();
	}
	else if($(".book_in_select *") != null)
	{
		$(".book_in_select *").removeClass("font_zoom_in");
		$(".book_in_select *").removeClass("font_zoom_out");
	}

}
function textOriginal()
{
	$(".contents *").removeClass("font_zoom_in");
	$(".contents *").removeClass("font_zoom_out");
	if($("iframe.xxxx").attr("src") != null)
	{
		iframe_name.textOriginal();
	}
}


//빈방찾기 함수
function left_empty_room_01()
{
	document.getElementById("left_empty_room_01").style.display = "none";
	document.getElementById("left_empty_room_02").style.display = "block";
}

function left_empty_room_02()
{
	document.getElementById("left_empty_room_01").style.display = "block";
	document.getElementById("left_empty_room_02").style.display = "none";
}

// 땡큐예약/관광정보/여행스케치 좌측메뉴 연동 //////////////////////////////////////////////////////
	$(document).ready(function(){
		snb = $(".first_depthPrgm");

/*		if(snb1 != 0){
			obj = $("li#depth_"+snb1+"");
			obj.addClass("active");
			menuTitle1 = obj.find("a.snb_title img")[0];
			$(menuTitle1).attr("src",mmHover($(menuTitle1).attr("src"))).addClass("fix");;
			menuTitle2 = obj.find("ul li a img:eq("+(snb2-1)+")").addClass("fix");
			$(menuTitle2).attr("src",mmHover($(menuTitle2).attr("src")));
		}
*/
		/*
		$(".first_depth a img").hover(
		function(){
			if(!$(this).hasClass("fix")){
				$(this).attr("src",mmHover($(this).attr("src")));
			}
		},
		function(){
			if(!$(this).hasClass("fix")){
				$(this).attr("src",mmHover($(this).attr("src")));
			}
		}
		);
		*/
		
		$(".first_depthPrgm a.snb_title").click(
			function(){
				$(".first_depthPrgm").removeClass("active");
				$(this).parent().addClass("active");
			}
		);
	});

 // 땡큐예약/관광정보/여행스케치 좌측메뉴 연동 //////////////////////////////////////////////////////
function sbar(st) { st.style.backgroundColor = '#dfefff'; }
function cbar(st) { st.style.backgroundColor = ''; }


// 왼쪽메뉴 자바스크립트 - 추가 : 091231 성백준 //

var persistmenu="yes" 
var persisttype="sitewide" 

if (document.getElementById){ 
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
    if(document.getElementById){
    var el = document.getElementById(obj);
    var ar = document.getElementById("masterdiv").getElementsByTagName("span"); 
        if(el.style.display != "block"){ 
            for (var i=0; i<ar.length; i++){
                if (ar[i].className=="submenu") 
                ar[i].style.display = "none";
            }
            el.style.display = "block";
        }else{
            el.style.display = "none";
        }
    }
}

function get_cookie(Name) { 
    var search = Name + "="
    var returnvalue = "";
    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;
        returnvalue=unescape(document.cookie.substring(offset, end))
    }
}
return returnvalue;
}

function onloadfunction(){
    if (persistmenu=="yes"){
    var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
    var cookievalue=get_cookie(cookiename)
    if (cookievalue!="")
        document.getElementById(cookievalue).style.display="block"
    }
}

function savemenustate(){
    var inc=1, blockid=""
    while (document.getElementById("sub"+inc)){
    if (document.getElementById("sub"+inc).style.display=="block"){
        blockid="sub"+inc
    break
    }
    inc++
}
    var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
    var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
    document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
    window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
    window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
    window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate
