//이미지 클릭시 테두리 없애기 설정
document.onfocusin=bluring;
function bluring(){   
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG"|| event.srcElement.tagName=="map")
		document.body.focus();   
}   

function setPng24(obj) {
	obj.width=obj.height=1;
	obj.className=obj.className.replace(/\bpng24\b/i,'');
	obj.style.filter =
	"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
	obj.src='';
	return '';
}

function MM_showHideLayers() { //v9.0

	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) 
	with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
	if (obj.style) { 	obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
	login_view(login_window);              //로그인창 보이기
}

//로그인창 띄우기
function pop_login() {
	if (mem_lev == 0) {		//비로그인 경우
		document.getElementById("login_area").style.width=document.body.clientWidth;
		document.getElementById("login_area").style.height=document.body.clientHeight;	
		document.getElementById("login_area").style.display="block";
		document.getElementById("login_window").style.left=(document.body.clientWidth-406)/2;
		document.getElementById("login_window").style.top=(document.body.clientHeight-260)/2;
		document.getElementById("login_window").style.display="block";
	}
}


//로그인창 닫기
function close_login() {	
	clear_box();
	document.getElementById("login_area").style.display="none";
	document.getElementById("login_window").style.display="none";
}

////////검색 탭
function left_tab(a){
	
	var Search = document.getElementById("left_TopMenu01");
	var bunge = document.getElementById("left_TopMenu02");	
	
	if (a =='Search'){
		bunge.style.display="none";			
		Search.style.display="block";						
	}		
	else
	{
		Search.style.display="none";	
		bunge.style.display="block";	
	}

	// 검색결과 iFrame 높이 재조정
	search_sizeset();
}

function left_tab2(Tabtype){
	
	var Keyword = document.getElementById("left_TopMenu01");
	var bunge = document.getElementById("left_TopMenu02");
	//var DongSearch = document.getElementById("left_TopMenu03");
	
	if (Tabtype =='bunge') {
		searchlist_view();
		bunge.style.display="block";
		Keyword.style.display="none";
		//DongSearch.style.display = "none";
	}		
	else if (Tabtype == 'Search')
	{
		searchlist_view();
		bunge.style.display="none";
		Keyword.style.display="block";
		//DongSearch.style.display = "none";
	}
	else
	{
		searchlist_view();
		//Dongsearchlist_view();
		Keyword.style.display="none";	
		bunge.style.display="none";
		//DongSearch.style.display = "block";
	}
	search_sizeset();
}

/////////공지사항 탭_2
function notice_tab2(tabname){
 
 	var nostyle = document.getElementById("notice2");
	var censtyle = document.getElementById("center2");
	var faqstyle = document.getElementById("faq2");
	
	if (tabname == 'notice'){	
		faqstyle.style.display = 'none';
		censtyle.style.display = 'none';	
		nostyle.style.display = 'block';		
	}
	else if (tabname == 'center')
	{
		faqstyle.style.display = 'none';
		nostyle.style.display = 'none';		
		censtyle.style.display = 'block';
	}	
	else if (tabname == 'faq')
	{
		nostyle.style.display = 'none';		
		censtyle.style.display = 'none';
		faqstyle.style.display = 'block';
	}	
}

// 로그인창 위치설정(화면 가운데)
	function login_view(divname){
		divname.style.left=(document.body.clientWidth/2) - (divname.offsetWidth/2);
		divname.style.top=(document.body.clientHeight/2) - (divname.offsetHeight/2);
	}
	
	// 로그인창 배경설정(위치, 사이즈)
	function log_sizeset(divname){
		divname.style.width = document.body.clientWidth;						
		divname.style.height = document.body.clientHeight;		
		divname.style.left = 0;
		divname.style.top = 0;		
		
		if (divname.style.display=="block")	{
			divname.style.display = "none";
		}
		else{
			divname.style.display = "block";
		}
	}

	//지도 왼쪽으로 확대(검색창 숨기기)
	var s_hide = -1;																																																//검색탭 초기값
	var m_wide = 206;																																															//지도탭 초기값
	var menu_wide = 0;																																														//메뉴길이 증가 초기값
	var altitude_wide = 217;																																											//나침반 초기값

	function DB_check1() {																																											//동시보기일때 창크기 확대
		Map_state = 'wide';
		if(Map_style == 'DB') {
			map_sizeset();
			search_hide();
		}
		else {
			search_hide();
		}
	}

	function search_hide() {

		search_area.style.left = s_hide;																																			//검색탭 이동
		//tab_page.style.left = s_hide;																																				//하단 공지탭 이동			
		mainMenuBar.style.width = document.body.clientWidth - 217 + menu_wide;				//메뉴 길이 증가
		rightmap_area.style.left = m_wide;																																	//지도탭 이동
		//bottom_area.style.left = m_wide;																																	//회사소개탭 이동
		altitude_layer.style.left = altitude_wide;
		
		s_hide = s_hide - 9;
		m_wide = m_wide - 9;
		menu_wide = menu_wide + 9;
		altitude_wide = altitude_wide - 9;

		if(s_hide <= -210) {			
			s_hide = -1; 
			m_wide = 206;			
			menu_wide = 0;
			altitude_wide = 217;
			search_in.style.display = 'block';
			search_out.style.display = 'none';		
			return;
		}
		setTimeout("search_hide()", 0);				
	}

	//지도 왼쪽으로 확대 취소(검색창 보이기)
	var s_show = -207;
	var m_narrow = -1;
	var menu_narrow =0;
	var altitude_narrow = 10;

	function DB_check2() {																																														//동시보기 일때 창크기 축소
		Map_state = 'narrow';
		if(Map_style == 'DB') {
			DBmap_sizeset();
			search_show();																																																	//동시보기 창조절은 search_show이동이 끝난 후 축소
		}
		else 
		{
			//map_sizeset();
			search_show();
		}
	}

	function search_show() {
		search_area.style.left = s_show;																																	    //검색탭 이동
		//tab_page.style.left = s_show;																																					//하단공지탭 이동
		mainMenuBar.style.width = document.body.clientWidth -10 + menu_narrow;					//메뉴길이 감소
		rightmap_area.style.left = m_narrow;																																//지도탭 이동
		//bottom_area.style.left = m_narrow;																																	//회사소개탭 이동
		altitude_layer.style.left = altitude_narrow;

		s_show = s_show + 9;
		m_narrow = m_narrow + 9;
		menu_narrow = menu_narrow - 9;
		altitude_narrow = altitude_narrow + 9;
		if(s_show >= 3) {
			s_show = -207;
			m_narrow = -1;
			menu_narrow= 0;
			altitude_narrow = 10;
			search_out.style.display = 'block';
			search_in.style.display = 'none';			
			return;			
		}
		setTimeout("search_show()", 0);		
	}

	//지도 윗쪽으로 확대(배너 숨기기)
	var map_plus = 0;	
	var search_plus = 0;

	function banner_hide() {		
		rightmap_area.style.top = 65 - map_plus;
		search_area.style.top = 65 - search_plus;
		map_area.style.top =144 - map_plus;
		level_area.style.top = 137 - map_plus;
		
		map_plus = map_plus + 3;
		search_plus = search_plus + 3;

		if(map_plus >= 65) {
			map_plus = 0;
			search_plus = 0;
			map_up.style.display = 'none';
			map_down.style.display = 'block';			
			return;			
		}
		setTimeout("banner_hide()", 0);				
	}

	//지도 아랫쪽으로 축소(배너 보이기)
	var map_minus = 0;
	var search_minus = 0;
	function banner_show() {
		rightmap_area.style.top = map_minus;
		search_area.style.top = search_minus;
		map_area.style.top = 80 + map_minus;
		level_area.style.top = 73+ map_minus;

		map_minus = map_minus + 3;
		search_minus = search_minus + 3;
		if(map_minus >= 67) {
			map_minus = 0;
			search_minus = 0;			
			map_down.style.display = 'none';
			map_up.style.display = 'block';
			return;			
		}
		setTimeout("banner_show()", 0);				
	}


//페이지 로드 되거나 사이즈 조절시 실행 시작

	//리로딩시 필요한 함수 실행
	function page_ready() {
		search_sizeset();		
		menu_sizeset();
		map_sizeset();
		widebt_locset();
		upbt_locset();
		//---- iframe 시 배너제거 검색/맵 top 위치 조정
		if (visit_frm) //변수 값 체크
		{
			div_top_pos();
		}
	}
	
	//---- iframe 시 배너제거 div 위치조정 upbt 버튼 제거 
	function div_top_pos() {
		document.getElementById("search_area").style.top = 0;
		document.getElementById("rightmap_area").style.top = 0;
		map_up.style.display = "none";
		map_down.style.display = "none";
		level_area.style.top = 80;
		map_area.style.top = 85;
	}

	//왼쪽 검색창 사이즈 조절
	function search_sizeset() {
		
		var SList = document.getElementById("SearchList");
		var tabGubun = document.getElementById("left_TopMenu01");	//키워드검색 Tab

		SList.style.width = 207;

		if(tabGubun.style.display != 'none') {		//키워드 검색시
			SList.style.height = document.body.clientHeight - 210;
		}
		else {	//번지 검색시
			SList.style.height = document.body.clientHeight - 290;
		}
	}


	//메인 메뉴 사이즈 조절
	function menu_sizeset() {
		var wth;

		if(Map_state == 'wide'){
			mainMenuBar.style.width = document.body.clientWidth-11;
		}
		else {
			if(document.body.clientWidth > 218) {
				wth = document.body.clientWidth - 218;
			}		
			mainMenuBar.style.width = wth;		
		}
	}

	//지도창 사이즈 조절(동시보기 아닐때...)
	function map_sizeset() {

		var wth = document.body.clientWidth;
		map_viewer.style.width = wth;

		if(document.body.clientHeight > 60) {
			hth = document.body.clientHeight - 60;
			map_viewer.style.height = hth;
		}			
		map_viewer.style.background = "#FFFFFF";
		map_loading.style.width = document.body.clientWidth - 207;
		map_loading.style.height = document.body.clientHeight - 130;
	}

	//지도창 사이즈 조절(동시보기 일때...)
	function DBmap_sizeset() {
		var wth = document.body.clientWidth - 208;
		map_viewer.style.width = wth;
	}

	//지도창 확대/축소버튼 위치 설정(LEFT)
	function widebt_locset() {
		var hth = (document.body.clientHeight - 157)/2 - (search_out.offsetHeight/2)
		search_out.style.top = hth;
		search_in.style.top = hth;
	}

	//지도창 확대/축소버튼 위치 설정(LEFT)
	function upbt_locset() {
		var hth = (document.body.clientWidth)/2 - (search_out.offsetHeight/2)
		map_up.style.left = hth;
		map_down.style.left = hth;
	}

	//페이지 로드 되거나 사이즈 조절시 실행 끝

function fnOpenPop(f, t, w, h){
	var iMyWidth;
	var iMyHeight;

	width = (window.screen.width-w)/2
	if(width<0)width=0;
	iMyWidth = width; 
	height = (window.screen.height-h)/2;
	if(height<0)height=0;
	iMyHeight = height; 

	var OpenPop = window.open(f,t, 
	"resizable=no,  scrollbars=yes, left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",width=" + w + ", height=" + h);
	OpenPop.focus();
	return;
}


/**
	HTML 개체용 유틸리티 함수
**/
function GetObjectTop(obj)
{
	if (obj.offsetParent == document.body)
		return obj.offsetTop;
	else
		return obj.offsetTop + GetObjectTop(obj.offsetParent);
}

function GetObjectLeft(obj)
{
	if (obj.offsetParent == document.body)
		return obj.offsetLeft;
	else
		return obj.offsetLeft + GetObjectLeft(obj.offsetParent);
}

//검색결과 창 보이기
function searchlist_view() {	
	CorpRegFrame = document.getElementById("Corp_Window");
	CorpRegFrame.style.display="none";
	BookmarkFrame = document.getElementById("Bookmark_Window");
	BookmarkFrame.style.display="none";
	//DongListFrame = document.getElementById("DongName_Window");
	//DongListFrame.style.display="none";
	if (!visit_frm){
		adappFrame = document.getElementById("LeftBanner_Link");
		adappFrame.style.display="none";	
	}
	SearchListFrame = document.getElementById("SearchList_Window");
	SearchListFrame.style.display="block";	
}

//function Dongsearchlist_view() {	
//	CorpRegFrame = document.getElementById("Corp_Window");
//	CorpRegFrame.style.display="none";
//	BookmarkFrame = document.getElementById("Bookmark_Window");
//	BookmarkFrame.style.display="none";
//	SearchListFrame = document.getElementById("SearchList_Window");
//	SearchListFrame.style.display="none";
//	DongListFrame = document.getElementById("DongName_Window");
//	DongListFrame.style.display="block";
//}