
//check browser
var isie=(/msie/i).test(navigator.userAgent); //ie
var isie6=(/msie 6/i).test(navigator.userAgent); //ie 6
var isie7=(/msie 7/i).test(navigator.userAgent); //ie 7
var isie8=(/msie 8/i).test(navigator.userAgent); //ie 8
var isie9=(/msie 9/i).test(navigator.userAgent); //ie 9
var isfirefox=(/firefox/i).test(navigator.userAgent); //firefox
var isapple=(/applewebkit/i).test(navigator.userAgent); //safari,chrome
var isopera=(/opera/i).test(navigator.userAgent); //opera
var isios=(/(ipod|iphone|ipad)/i).test(navigator.userAgent);//ios
var isipad=(/(ipad)/i).test(navigator.userAgent);//ipad
var isandroid=(/android/i).test(navigator.userAgent);//android
if(isie7 || isie8 || isie9) isie6=false;
if(isie9) isie=false;

// IE6 PNG Load
if (isie6) {
	DD_belatedPNG.fix ( "img " );
}

// RollOver
function imageOver(imgs) {
	imgs.src = imgs.src.replace("off.gif", "on.gif");
}
function imageOut(imgs) {
	imgs.src = imgs.src.replace("on.gif", "off.gif");
//  onmouseover="imageOver(this);" onmouseout="imageOut(this);"
} 

// IE6 background fix
try{
	document.execCommand('BackgroundImageCache',false,true);
}
catch(e){}

// popup
function popupOpen(url,w,h,type){
	window.open(url ,  "openWin", "width="+w+",height="+h+",top=30,left=100,resizable=no,scrollbars="+type) ;
}

// flash Laod
function flash(src, w, h, swfid) {
	swf_html = '';
	swf_html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + w + '" height="' + h + '" id="' + swfid + '">';
	swf_html += '<param name="allowScriptAccess" value="sameDomain">';
	swf_html += '<param name="movie" value="' + src + '">';
	swf_html += '<param name="quality" value="high">';
	swf_html += '<param name="bgcolor" value="#FFFFFF">';
	swf_html += '<PARAM NAME="wmode" VALUE="transparent">';
	swf_html += '<PARAM NAME="base" VALUE=".">';
	swf_html += '<embed base="." src="' + src + '" quality="high" bgcolor="#FFFFFF" width="' + w + '" height="' + h + '" name="' + swfid + '" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
	swf_html += '</object>';
	document.write(swf_html);
}

// jQuery Load
(function($){
	$(document).ready(function(){
		// leyout dom setting for ie6
		if(isie6){$('#contents, #leftmenu').css('height','350px');}

		//quick
		if ($('#contents').length > 0){
			var options = { 'speed' : 500, // 스피드
			'initTop': 87 ,  // 기본 top 위치
			'alwaysTop' : false, // 항상고정 true , false 이동
			'default_x' : '#contents'  //레어아웃이 가운데 정렬 일때 레이어가 붙는 아이디값
		   }
		   $('#quick').Floater(options);
		};
		
		if ($('#top_Section').length > 0){
			var options = { 'speed' : 500, // 스피드
			'initTop': 120 ,  // 기본 top 위치
			'alwaysTop' : false, // 항상고정 true , false 이동
			'default_x' : '#top_Section'  //레어아웃이 가운데 정렬 일때 레이어가 붙는 아이디값
		   }
		   $('#main_quick').Floater(options);
		};
		

		// GNB Controls
		if($('#gnb > li.on').length > 0){
			var onli = $('#gnb > li.on > a > img').attr('src');
			$('#gnb > li.on > a > img').attr('src',onli.replace('off.gif','on.gif'));
			$('#gnb > li.on > span').css('display','block')
			
			if($('#gnb > li.on ol li.on').length > 0){
				var onlis = $('#gnb li.on ol li.on a img').attr('src');
				$('#gnb li.on ol li.on a img').attr('src',onlis.replace('off.gif','on.gif'));
			}
		}
		$('#gnb li:not(.on) img').mouseover(function(){
			var filename = $(this).attr('src');
			$(this).attr('src',filename.replace('off.gif','on.gif'));
		});
		$('#gnb li:not(.on) img').mouseout(function(){
			var filename = $(this).attr('src');
			$(this).attr('src',filename.replace('on.gif','off.gif'));
		});
		$('#gnb li').mouseover(function(){
			$('#gnb li ol').css('display','none');
			$('#gnb li span').css('display','none');
			$(this).find('ol').css('display','block')
			$(this).find('span').css('display','block')
		});

		// LNB Controls
		/* 2011-06-03 15:00 수정 */
		if($('#lnbList').length){
			$('#lnbList li.on ol').css('display','block');

			if($('#lnbList > li.on').length > 0){
				var lnbonli = $('#lnbList > li.on > img').attr('src');
				$('#lnbList > li.on > img').attr('src',lnbonli.replace('off.gif','on.gif'));
				
				if($('#lnbList > li.on ol li.on').length > 0){
					var lnbonlis = $('#lnbList li.on ol li.on a img').attr('src');
					$('#lnbList li.on ol li.on a img').attr('src',lnbonlis.replace('off.gif','on.gif'));
				}
			}

			$('#lnbList > li > img').click(function(){
				$('#lnbList li ol').css('display','none');
				$(this).siblings('ol').css('display','block');
				
			});

			$('#lnbList li:not(.on) img').mouseover(function(){
				var lnbname = $(this).attr('src');
				$(this).attr('src',lnbname.replace('off.gif','on.gif'));
			});
			$('#lnbList li:not(.on) img').mouseout(function(){
				var lnbname = $(this).attr('src');
				$(this).attr('src',lnbname.replace('on.gif','off.gif'));
			});
		}

		$('a.goLink img').mouseover(function(){
			var goLink = $(this).attr('src');
			$(this).attr('src',goLink.replace('off.gif','on.gif'));
		});
		$('a.goLink img').mouseout(function(){
			var goLink = $(this).attr('src');
			$(this).attr('src',goLink.replace('on.gif','off.gif'));
		});


		/* select */
		$('.tb_list_type1 tbody tr:first-child td').css('border-top','1px solid #4A4545');
		$('.tb_list_type1 tbody tr:first-child th').css('border-top','1px solid #4A4545');
		$('.address ul li:first-child').css({background:'none',padding:'0'});
		$('#util ol li:first-child').css({background:'none',padding:'0'});
		$('.no_reservation li:first-child').css({background:'none',padding:'0'});
		$('.yes_reservation li:first-child').css({background:'none',padding:'0'});

		$('#lnb ul li:last').css({border:'none'});
	});
})(jQuery);
