//대교 및 브랜드 전체공통 (GNB 부분)
$(document).ready(function(){

	//대교 로고옆 브랜드 전체보기 (이미지 롤오버)
	$('#head p.brand img').hover(
		function(){ this.src=this.src.replace('.gif','_on.gif'); },	
		function(){ this.src=this.src.replace('_on.gif','.gif'); }	
	);
	//대교 로고옆 브랜드 전체보기 (이미지 온오프)
	$('#head p.brand').toggle(function(){
			$(this).find('img').addClass('up');
			var thisImg = $('#head p.brand img.up');
			var thisImgSrc = thisImg.attr('src');
			thisImg.attr('src', thisImgSrc.replace('btn_brand_sites_on.gif', 'btn_brand_sites_on_up_on.gif'));
			$('#top_layer').show();
		}, function(){
			$(this).find('img').removeClass('up');
			var thisImg = $('#head p.brand img');
			var thisImgSrc = thisImg.attr('src');
			thisImg.attr('src', thisImgSrc.replace('btn_brand_sites_on_up_on.gif', 'btn_brand_sites_on.gif'));
			$('#top_layer').hide();
	});

	//풋터
	$('#brand_link').click(function(){
	    if(!document.getElementById("brandSiteLayer")) {
	        $("#footer_brand").load("/Include/brandSiteLayer.html");
	    }
		$('#footer_brand').show();
		$('#footer_site').hide();
		 return false;
	});

	$('#site_link').click(function(){
	    if(!document.getElementById("footerSiteLayer")) {
	        $("#footer_site").load("/Include/footerSiteLayer.html");
	    }
		$('#footer_brand').hide();
		$('#footer_site').show();
		 return false;
	});

	$('div.footer_link p.close a').click(function(){
		$('div.footer_link').hide();
		 return false;
	});

	$('div.site_link img').hover(
		function(){
			this.src=this.src.replace('_off','_on');
		},	
		function(){
			this.src=this.src.replace('_on','_off');
		}	
	);

	$('div.footer_link ul li img').hover(
		function(){
			this.src=this.src.replace('_off','_on');
		},	
		function(){
			this.src=this.src.replace('_on','_off');
		}	
	);

	//롤오버 공통
	$('img.rollover').hover(
		function(){ this.src=this.src.replace('_off','_on'); },	
		function(){ this.src=this.src.replace('_on','_off'); }	
	);


/* 모달팝업 스타일 */
var maskLayer = '<div id="mask"></div>'
			  + '<iframe src="/blanks.aspx" id="maskIframe" style="display:none;z-index:95;filter: alpha(opacity=0);position:absolute;left:0;top:0;" frameborder="0"></iframe>';
$(maskLayer).appendTo('body'); //검은색 반투명 막영역 넣기

//대교파인더
	$('#head li.menu5 a').click(function(){
		$('#finder_wrap').show();
		wrapWindowByMask();
		return false;
	});

	$('#finder_wrap .btn').click(function(){
		$('#maskIframe').hide();
		$('#finder_wrap').hide();
		$('#mask').hide();
	});


/* 사이트맵 닫기버튼 */
$('<div id="sitemap_btn"><a href="#"><img src="/share/img/common/btn_sitemap_off.gif" alt="사이트맵 닫기" /></a></div>').appendTo('#sitemap_flash'); //검은색 반투명 막영역 넣기
//사이트전체보기
	$('#head li.menu4 a').click(function(){
		$('#sitemap_flash').css('display','block');
		wrapWindowByMask();
		return false;
	});
	$('#mask').click(function () {  
		    $('#maskIframe').hide();
			$(this).hide();  
		    $('#sitemap_flash').css('display','none');
			$('#finder_wrap').hide();			
		return false;
	}); 
	$('#sitemap_flash #sitemap_btn').click(function(){
		$('#maskIframe').hide();
		$('#sitemap_flash').css('display','none');
		$('#mask').hide();
		
	});
	$('#sitemap_btn img').hover(
		function(){ this.src=this.src.replace('_off','_on'); },	
		function(){ this.src=this.src.replace('_on','_off'); }	
	);

});


/* 공통 함수 */
//검은색 반투명막
function wrapWindowByMask(){
        //화면의 높이와 너비를 구한다.
        var maskHeight = $(document).height();  
        var maskWidth = $(window).width();  
      
        //마스크의 높이와 너비를 화면 것으로 만들어 전체 화면을 채운다.        
		$('#mask').css({'width':"100%",'height':maskHeight});
		$('#maskIframe').css({'width':"100%",'height':maskHeight});
        $('#maskIframe').show();
        //애니메이션 효과
        $('#mask').fadeTo("slow",0.6);    
}
//플래시 창닫기
/*
	function closeClick() {
		$('#sitemap_flash').css('display','none');
		$('#mask').hide();
		return false;
	}
*/
	function finderClick() {
		$('#maskIframe').hide();
		$('#finder_wrap').hide();
		$('#mask').hide();		
		return false;
	}

//TOP버튼
function goTop() { $(window).scrollTop(0,0); }


//대교닷컴 개별 스크립트
$(document).ready(function(){

	//교육국&센터 찾기
	$('ul.city_list li img').hover(
		function(){ this.src=this.src.replace('_off','_on'); },	
		function(){ this.src=this.src.replace('_on','_off'); }	
	);

	$('ul.city_list li input.type-image').hover(
		function(){ this.src=this.src.replace('_off','_on'); },	
		function(){ this.src=this.src.replace('_on','_off'); }		
	);

	$('div.buy_system div.visit dl').hover(
		function(){
			$('div.buy_system div.visit dl').addClass('on');
		},	
		function(){
			$('div.buy_system div.visit dl').removeClass('on');
		}	
	);
	$('div.buy_system div.tel dl').hover(
		function(){
			$('div.buy_system div.tel dl').addClass('on');
		},	
		function(){
			$('div.buy_system div.tel dl').removeClass('on');
		}	
	);


	//대교닷컴 서브메인 오른쪽 영역롤오버
	$('div.aside_cont div.news div').hover(
	function() {
		$('div.aside_cont div.news div').addClass('rollover');
	}, function() {
		$('div.aside_cont div.news div').removeClass('rollover');
	});
	$('div.aside_cont div.history div').hover(
	function() {
		$('div.aside_cont div.history div').addClass('rollover');
	}, function() {
		$('div.aside_cont div.history div').removeClass('rollover');
	});
	$('div.aside_cont div.faq div').hover(
	function() {
		$('div.aside_cont div.faq div').addClass('rollover');
	}, function() {
		$('div.aside_cont div.faq div').removeClass('rollover');
	});
	$('div.aside_cont div.purchase div').hover(
	function() {
		$('div.aside_cont div.purchase div').addClass('rollover');
	}, function() {
		$('div.aside_cont div.purchase div').removeClass('rollover');
	});
	$('div.aside_cont div.customer_talk div').hover(
	function() {
		$('div.aside_cont div.customer_talk div').addClass('rollover');
	}, function() {
		$('div.aside_cont div.customer_talk div').removeClass('rollover');
	});
	$('#customer div.news2 div').hover(
	function() {
		$('#customer div.news2 div').addClass('rollover');
	}, function() {
		$('#customer div.news2 div').removeClass('rollover');
	});
	$('#mypage div.news2 div').hover(
	function() {
		$('#mypage div.news2 div').addClass('rollover');
	}, function() {
		$('#mypage div.news2 div').removeClass('rollover');
	});

	//RP 영역 롤오버
	$('#secondary div.advice div').hover(
	function() {
		$('#secondary div.advice div').addClass('rollover');
	}, function() {
		$('#secondary div.advice div').removeClass('rollover');
	});
	$('#secondary div.focus_faq div').hover(
	function() {
		$('#secondary div.focus_faq div').addClass('rollover');
	}, function() {
		$('#secondary div.focus_faq div').removeClass('rollover');
	});
	$('#secondary div.my_info div').hover(
	function() {
		$('#secondary div.my_info div').addClass('rollover');
	}, function() {
		$('#secondary div.my_info div').removeClass('rollover');
	});

	$('#secondary div.zoomin div').hover(
	function() {
		$('#secondary div.zoomin div').addClass('rollover');
	}, function() {
		$('#secondary div.zoomin div').removeClass('rollover');
	});
	$('#secondary div.edu_center div').hover(
	function() {
		$('#secondary div.edu_center div').addClass('rollover');
	}, function() {
		$('#secondary div.edu_center div').removeClass('rollover');
	});


	//고객센터 메인 레이어
	$('div.ccms_cont div.layer_pop').hide();
	$('div.ccms_cont div.ccms h3 img').hover(
	function() {
		this.src=this.src.replace('_off','_on');
		$('div.ccms_cont div.layer_pop').show();
	}, function() {
		this.src=this.src.replace('_on','_off');
		$('div.ccms_cont div.layer_pop').hide();
	});

});

//메인화면 플래시 높이값
function mainFn(num) {
	$('#main_body object').height(760);
 }
 function informationFn(num) {
 	$('#main_body object').height(1000);
 }
 function storyFn(num) {
 	$('#main_body object').height(900);
 }

/* Tab Content */
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", "_off.gif");
				} else {
					currentmenu.className = currentmenu.className.replace("on", "");
				}
			}

			this.targetEl.style.display = "block";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace("_off.gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}


//컨텐츠 슬라이드

//brand

