	$(document).ready(function() {
		
		//페이스북 meta tag를 위해 본문의 내용을 보냄
		var description_str = $("h3:first").text();
		
		if(!description_str){
			description_str = $("p:first").text();
		}
		if(!description_str){
			description_str = $("h4:first").text();
		}

		if (description_str.length > 50){
			description_str = trim(description_str.substring(0,50)) + "..";
		}
		
		//alert(description_str)
		$("meta[property=og:description]").attr('content', description_str);
		
		
		var current_id = jQuery.trim($('body').attr('id'));

		//왼쪽 메뉴 현재 메뉴 표시 + 로케이션 값 생성
		if(current_id) {
			//로케이션 값 생성
			if(current_id.substring(6,8) != "00"){
				var parant_id = current_id.substring(0,6) + "00";
			}
			if(current_id.substring(4,8) != "0000"){
				var grand_id = current_id.substring(0,4) + "0000";
				var grand_id2 = current_id.substring(0,4) + "0100";
			}

			//Home 생성
			var location = "<a href='/"+ category_name+ "/main.asp' >Home</a>";
			var Cookies_location_last = category_kr_name + ">Home";
			
			//메인이 아닐경우
			if(current_id.substring(1,8) != "0000000"){

				//최상위 로케이션
				if(grand_id){
					var grand_name = $(".firstleftbar").attr('name');
					var grand_url = $('#' + grand_id2 + "> a").attr('href');
					var grand_location = " > <a href='" + grand_url + "' >" + grand_name + "</a>";
				}

				//중간 로케이션
				if(parant_id){
					$('.firstleftbar > li#'  + parant_id).addClass('current');

					var parant_name = $('#' + parant_id).attr('name');
					var parant_url = $('#' + parant_id + "> a").attr('href');
					//alert(parant_name + parant_url);
					var parant_location = " > <a href='" + parant_url + "' >" + parant_name + "</a>";
				}else{
					var parant_location = ""
				}

				//현재 로케이션
				if(current_id){
					$('.firstleftbar li > ul > li#' + current_id).addClass('current');
					$('.firstleftbar > li#' + current_id).addClass('current');

					var current_name = $('#' + current_id).attr('name');
					//var current_url = $('#' + current_id + "> a").attr('href');
					//var current_location = " > <a href='" + current_url + "' >" + current_name + "</a>";
				}

				//grand_name이 없는 경우..
				if(!grand_name){
					var grand_location = "";
				}

				location = location + grand_location + parant_location + " > " + current_name;
				Cookies_location_last =   category_kr_name + ">" + current_name;
				//글자 자르기
				if (Cookies_location_last.length > 15){
					Cookies_location_last = trim(Cookies_location_last.substring(0,14)) + "..";
					//alert(Cookies_location_last.length);
				}
			}
	
			//방문 로그 히스토리 쿠키 가져오기
			var Cookies_location_01 = getCookieCommon("Cookies_location_01");
			var Cookies_location_02 = getCookieCommon("Cookies_location_02");
			var Cookies_location_03 = getCookieCommon("Cookies_location_03");
			var Cookies_location_04 = getCookieCommon("Cookies_location_04");
			var Cookies_location_05 = getCookieCommon("Cookies_location_05");
	
			var Cookies_url_01 = getCookieCommon("Cookies_url_01");
			var Cookies_url_02 = getCookieCommon("Cookies_url_02");
			var Cookies_url_03 = getCookieCommon("Cookies_url_03");
			var Cookies_url_04 = getCookieCommon("Cookies_url_04");
			var Cookies_url_05 = getCookieCommon("Cookies_url_05");
			
			//현재 위치가 저장된 위치와 비교해서 새롭게 바뀌었으면.. 다시 저장
			if(Cookies_location_last != Cookies_location_01 && Cookies_location_last != Cookies_location_02 && Cookies_location_last != Cookies_location_03 && Cookies_location_last != Cookies_location_04 && Cookies_location_last != Cookies_location_05){
				
				setCookieCommon("Cookies_location_01",Cookies_location_last,"30");							//쿠키명, 쿠키값, 저장날짜
				setCookieCommon("Cookies_location_02",Cookies_location_01,"30");
				setCookieCommon("Cookies_location_03",Cookies_location_02,"30");
				setCookieCommon("Cookies_location_04",Cookies_location_03,"30");
				setCookieCommon("Cookies_location_05",Cookies_location_04,"30");
				
				setCookieCommon("Cookies_url_01",GetCurHost + GetCurPath + GetCurString,"30");		//SSL적용을 위한 절대주소 저장
				setCookieCommon("Cookies_url_02",Cookies_url_01,"30");
				setCookieCommon("Cookies_url_03",Cookies_url_02,"30");
				setCookieCommon("Cookies_url_04",Cookies_url_03,"30");
				setCookieCommon("Cookies_url_05",Cookies_url_04,"30");
			}

			//메인이 아닐경우 - 저장된 히스토리가 있으면 보이게 한다
			if(current_id.substring(1,8) != "0000000"){			
				if (Cookies_location_01){
					$('#Cookies_history_01').html("<a href='"+Cookies_url_01+"' shape='rect' >" +Cookies_location_01+"</a>");
				}
				if(Cookies_location_02){
					$('#Cookies_history_02').show();
					$('#Cookies_history_02').html("<a href='"+Cookies_url_02+"' shape='rect' >" +Cookies_location_02+"</a>");
				}
				if(Cookies_location_03){
					$('#Cookies_history_03').show();
					$('#Cookies_history_03').html("<a href='"+Cookies_url_03+"' shape='rect' >" +Cookies_location_03+"</a>");
				}
				if(Cookies_location_04){
					$('#Cookies_history_04').show();
					$('#Cookies_history_04').html("<a href='"+Cookies_url_04+"' shape='rect' >" +Cookies_location_04+"</a>");
				}
				if(Cookies_location_05){
					$('#Cookies_history_05').show();
					$('#Cookies_history_05').html("<a href='"+Cookies_url_05+"' shape='rect' >" +Cookies_location_05+"</a>");
				}
			}
	
			//로케이션 생성
			$('#qNav').html(location);
			
		}
			
		//메인 메뉴
		$("#Main_menu > #mNavi_body").superfish({
			pathClass:  'current'
		});

		//레프트 메뉴(접힘 펼침 작동) - 사용안함
		//$(".firstleftbar").superfish({
		//	pathClass:  'current'
		//});

		//탑메뉴 로딩시 윗쪽 이동
		$('#rMenu_unicef').animate({top: "-74px"},500);
		$('#rMenu_donate').delay(100).animate({top: "-74px"},500);
		$('#rMenu_shop').delay(150).animate({top: "-74px"},500);
		$('#rMenu_awoo').delay(200).animate({top: "-74px"},500);
		$('#rMenu_crc').delay(250).animate({top: "-74px"},500);


		//전체메뉴 닫기버튼 생성
		$('#totalmenu_layer > #mNavi_body').append('<li class="close"><img src="/img2010/common/showall_close.gif" alt="닫기" style="cursor:pointer" onClick="javascript:totalMenu_close();"/></li>');

	});

	//탑메뉴 마우스 오버
	function downupMove(divid) {
		$('#' + divid).animate({top: "-64px"},100);
		$('#' + divid).animate({top: "-74px"},100);
	}

	//전체 메뉴
	function totalMenu_view(){
		var menu_width = 960		//전체메뉴 가로사이즈
		var page_width = (window.innerWidth || self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth);		//브라우저의 현재 가로 가이즈
		var left_space = (page_width- menu_width)/2;
	
		if(menu_width >= page_width) left_space = 0;
		document.getElementById('totalmenu_layer').style.left = left_space + "px";
		
		$('#totalmenu_layer').show();
		$('#SLB_film').show();
	}

	function totalMenu_close(){
		$('#totalmenu_layer').hide();
		$('#SLB_film').hide();
	}

	// 연락처 창 뛰우기
	function contact_view(){
		var html =  "/common/inc/contact.asp";
		SLB( html, 'iframe', 520, 405,  false, true );
	}

	//아우 상세보기 창 뛰우기
	function Awoo_Detail(Did, reUrl){
		var html =  "/common/awoo/popup_detail.asp?Did=" + Did +"&reUrl=" + reUrl ;
		SLB( html, 'iframe', 480, 526,  false, true );
	}

	//본문 탭 공통 (보여줄 탭 넘버, 전체 탭 넘버)
	function tab_content(num, cnt) {
		$("#print_tab_no").attr('name', num);
		$("#print_tab_all").attr('name', cnt);

		for (var i = 1;i < cnt +1 ;i++ ) {
			if (i == num) {
				$('#tab'+i).addClass('active');
				$('#content'+i).show();
				$('#side'+i).show();
				//$('#side'+i).html(swf_str[i - 1]);
			}
			else {
				$('#tab'+i).removeClass('active');
				$('#content'+i).hide();
				$('#side'+i).hide();
				//$('#side'+i).html('');
			}
		}
	}

	//본문 탭 공통 (보여줄 탭 넘버, 전체 탭 넘버)
	function tab_content_swf(num, cnt) {
		$("#print_tab_no").attr('name', num);
		$("#print_tab_all").attr('name', cnt);

		for (var i = 1;i < cnt +1 ;i++ ) {
			if (i == num) {
				$('#tab'+i).addClass('active');
				$('#content'+i).show();
				$('#side'+i).show();
				$('#side'+i).html(swf_str[i - 1]);
			}
			else {
				$('#tab'+i).removeClass('active');
				$('#content'+i).hide();
				$('#side'+i).hide();
				$('#side'+i).html('');
			}
		}
	}
		
	//오른쪽 SNS/방문기록 탭
	function tab_menu(num) {
		for (var i = 1;i < 3 ;i++ ) {
			if (i == num) {
				$("#sns" +i).show();
				$("#share" +i).show();
				$("#log" +i).show();
			}
			else {
				$("#sns" +i).hide();
				$("#share" +i).hide();
				$("#log" +i).hide();
			}
		}
	}
