
///// ZonnInOut ////////////////////////////////////////////////////////////////////////////// 
 var nowZoom = 100; // 현재비율
 var maxZoom = 200; // 최대비율
 var minZoom = 80; // 최소비율(현재와 같아야 함)
 var valueZoom = 10;

 // +, - 키를 입력하면 화면 확대, 축소를 한다.
 document.onkeypress = getKey;

 function getKey(keyStroke) {
  isNetscape = (document.layers);
  eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
  which = String.fromCharCode(eventChooser).toLowerCase();
  which2 = eventChooser;

  var el = event.srcElement;

  if ((el.tagName != "INPUT") && (el.tagName != "TEXTAREA")) {
   if (which == "+") {
    zoomIn();
   } else if (which == "-") {
    zoomOut();
   }
  }
 }

        //화면 키운다.
 function zoomIn() {
  if (nowZoom < maxZoom) {
   nowZoom += valueZoom; // 10%씩 커진다.
  } else {
   return;
  }

  document.body.style.zoom = nowZoom + "%";
 }
 
 //화면 줄인다.
 function zoomOut() {
  if (nowZoom > minZoom) {
   nowZoom -= valueZoom; // 10%씩 작아진다.
  } else {
   return;
  }

  document.body.style.zoom = nowZoom + "%";
 }


	function basicZoom(){
		var currZoom = "100%" ;
		document.body.style.zoom = currZoom ;
	}

var temp_subject_txt;
var temp_class;
var temp_class2;

var browser = getBrowser();

function list_contents_on(parent_obj,subject_txt) {
	var this_child = parent_obj.childNodes['1'];
	var this_child2 = parent_obj.childNodes['1'].childNodes['1'];
	temp_subject_txt = this_child2.innerHTML;
	temp_class = parent_obj.className;
	temp_class2 = this_child2.className;

	parent_obj.className='list_contents_div_on';
	this_child.className='list_contents_div_bottom_on';
	this_child2.className='list_contents_div_bottom_in_on';
	this_child2.innerHTML=subject_txt;
}

function list_contents_off(parent_obj) {
	var this_child = parent_obj.childNodes['1'];
	var this_child2 = parent_obj.childNodes['1'].childNodes['1'];

	parent_obj.className=temp_class;
	this_child.className='list_contents_div_bottom_off';
	this_child2.className=temp_class2;
	this_child2.innerHTML=temp_subject_txt;
}


function getBrowser() // 브라우져 체크 - 1 이 IE, 2가 FF
{
    var tempdocument = window.document;

    if (tempdocument.all && tempdocument.getelementbyid) // 인터넷 익스플로러 5.x
    { 
        return 1;
    }
    else if (tempdocument.all && !tempdocument.getelementbyid) // 인터넷 익스플로러 4.x
    { 
        return 1;
    }
    else if (tempdocument.getelementbyid && !tempdocument.all) // 넷스케이프 6
    { 
        return 2;
    }
    else if (tempdocument.layers) // 넷스케이프 4.x
    {     
        return 2;
    }
}


// 게시물 삭제시 예 아니오 확인한다. - /admin/list.html -> delete.php
function message_confirm(msg,url) {
	if(confirm(msg)) {
		location.href = url;
	} else {
		return false;
	}
}


function search_category_popup(obj) {
	window.open ('/admin/news/category_search.html','category_popup','toolbar=0, location=0, status=0, menubar=0, scrollbars=1, resizable=1, top=0, left=0, width=420, height=300');
}

function search_category_fill(category_num,category,category2) {
	opener.signform.i_category.value = category_num;
	opener.signform.c_category.value = category;
	opener.signform.c_category2.value = category2;
	window.close();
}

//게시물 작성시 공백 확인
function checkIt(form) {

   if(!form.c_subject.value) {
      alert('제목을 입력하세요!');
      form.c_subject.focus();
      return;
   }

   if(form.i_menu.selectedIndex == '0') {
      alert('메뉴를 선택하세요.');
      form.i_menu.focus();
      return;
   }

   if(form.i_category.value == '' || form.i_category.value == '0') {
      alert('카테고리를 입력하세요.');
      form.i_category.focus();
      return;
   }

   form.submit();
}


//게시물 작성시 공백 확인
function check_comment(form) {

	if(!form.c_name.value) {
		alert('이름을 입력하세요!');
		form.c_name.focus();
		return;
	}


	if(!form.c_passwd.value) {
		alert('비밀번호를 입력하세요!');
		form.c_passwd.focus();
		return;
	}
	
	form.submit();
}


//게시물 작성시 공백 확인
function check_comment_mod(form) {

	if(!form.c_passwd.value) {
		alert('비밀번호를 입력하세요!');
		form.c_passwd.focus();
		return;
	}
	
	form.submit();
}

function swap_comment_mod(div_id) {
	var temp = document.getElementById(div_id).style.display;
	if(temp == 'none' || temp == '') {
		document.getElementById(div_id).style.display = 'block';
	} else if(temp == 'block') {
		document.getElementById(div_id).style.display = 'none';
	}
}

function swap_comment_del(div_id) {
	var temp = document.getElementById(div_id).style.display;
	if(temp == 'none' || temp == '') {
		document.getElementById(div_id).style.display = 'block';
	} else if(temp == 'block') {
		document.getElementById(div_id).style.display = 'none';
	}
}


/*---------------------------- 이미지 오버랩 ------------------------------*/


var tid_list = new Array();
var interval_t = 10000;

function fade(imgs, tid_num){ // 이미지 오버랩 체인지

	var browser = getBrowser();
	
	if(browser == 1) { // IE
		var count = imgs.firstChild.firstChild.filters.alpha.opacity;
	} else {
		var count = imgs.firstChild.firstChild.style.opacity;
		if(count == '') count = 1;
		count = count*100;
	}

	//alert(count);
	//count--;
	count = count-5;

	var opacity = count;
	imgs.firstChild.firstChild.style.filter = 'alpha(opacity='+opacity+')';
	imgs.firstChild.firstChild.style.opacity = opacity/100;
	imgs.firstChild.firstChild.style.MozOpacity = opacity/100;
	
	var opacity2 = 100 - count;
	if(imgs.id != imgs.parentNode.lastChild.id) { // 마지막 이미지가 아닐 경우 바로 다음 이미지와 겹치기
		imgs.nextSibling.firstChild.firstChild.style.filter = 'alpha(opacity='+opacity2+')';
		imgs.nextSibling.firstChild.firstChild.style.opacity = opacity2/100;
		imgs.nextSibling.firstChild.firstChild.style.MozOpacity = opacity2/100;

		//alert(imgs.id+" "+imgs.nextSibling.id);

	} else { // 마지막 이미지일 경우 제일 처음 이미지와 겹치기
		imgs.parentNode.firstChild.firstChild.firstChild.style.filter = 'alpha(opacity='+opacity2+')';
		imgs.parentNode.firstChild.firstChild.firstChild.style.opacity = opacity2/100;
		imgs.parentNode.firstChild.firstChild.firstChild.style.MozOpacity = opacity2/100;

		//alert(imgs.id+" "+imgs.parentNode.firstChild.id);
	}

	if (count == 0) {
		clearInterval(tid_list[tid_num]);
		//clearInterval(tid);
		if(imgs.id != imgs.parentNode.lastChild.id) { // 마지막 이미지가 아닐 경우 현재 이미지를 바로 다음 이미지로 체인지
			imgs = imgs.nextSibling;
		} else {  // 마지막 이미지일 경우 현재 이미지를 제일 처음 이미지로 체인지
			imgs = imgs.parentNode.firstChild;
		}
		tid_list[tid_num] = setTimeout(function(){fade(imgs,tid_num);}, interval_t);
		//tid = setTimeout(function(){fade(imgs,tid_num);}, 2000);
	} else {
		tid_list[tid_num] = setTimeout(function(){fade(imgs,tid_num);}, 50);
		//tid = setTimeout(function(){fade(imgs,tid_num);}, 1000);
	}
}


function show_sub_menu(num) {
	switch (num)	{
	case 1 :
	document.getElementById('top_menu_fashion').style.visibility = 'visible';
	focus(document.getElementById('top_menu_fashion'));
	break;

	case 9 :
	document.getElementById('top_menu_culture').style.visibility = 'visible';
	break;
	}
}

function hide_sub_menu(num) {
	switch (num)	{
	case 1 :
	document.getElementById('top_menu_fashion').style.visibility = 'hidden';
	break;

	case 9 :
	document.getElementById('top_menu_culture').style.visibility = 'hidden';
	break;
	}
}

/*---------------------------- //이미지 오버랩 ------------------------------*/