/* Img RollOver */
function imageOver_bak(imgEl) {
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}
function imageOut_bak(imgEl) {
	imgEl.src = imgEl.src.replace("_on.gif", ".gif");
}


function imageOver(imgEl) {
	if( imgEl.src.indexOf( '_on') == -1)
		imgEl.src = imgEl.src.replace('.gif', '_on.gif');
}
function imageOut(imgEl) {
	if( imgEl.src.indexOf( '_on') > -1)
		imgEl.src = imgEl.src.replace('_on', '');
}



/* FamilySite View */
var FamilyStatus = 1;
function FamiySiteView(){	
	if (FamilyStatus == 1) { 
		document.getElementById('familysite').style.display = "";    //레이어 감추기
		FamilyStatus = 0;
	} else {
		document.getElementById('familysite').style.display = "none";    //레이어 보이기
		//document.getElementById('familysite').style.display = "none";    //레이어 보이기
		FamilyStatus = 1;
	}
}

/* searchView */
var status = 1;
function searchView(){	
	if (status == 1) { 
		document.getElementById('selectList').style.display = "";    //레이어 감추기
		status = 0;
	} else {
		document.getElementById('selectList').style.display = "none";    //레이어 보이기
		//document.getElementById('familysite').style.display = "none";    //레이어 보이기
		status = 1;
	}
}


$(function() {
//tab ON OFF  - 최근게시물
	var tablist = $(".scroller ul");
	var tabtitlist = $(".scroller h2 a");
	function tabreset(){
		imgOff(tabtitlist);
	}
	function tabreset2(){
		imgOff(tabtitlist2);
	}
	$(tabtitlist).each(function(){
		$(this).bind('mouseover keyup' , function()	{
			tabreset();
			imgOn($(this));
			$(this).parent().siblings().removeClass("on");
			$(this).parent().next().addClass("on");
		});
	});
	

	function imgOn(item){
		var image = item.children("img");
		var imgsrc = $(image).attr("src"); 
		if (imgsrc)
		var on = imgsrc.replace(/.gif/,"_on.gif");
		$(image).attr("src",on);
	}
	function imgOff(item){
		var image = item.children("img");
		for(i=0;i<image.length;i++){
			var imgsrc = $(image[i]).attr("src"); 
			var off = imgsrc.replace(/_on.gif/,".gif");
			$(image[i]).attr("src",off);
		}
	}
});





//quick
function initMoving(target, position, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = position;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;

	if (typeof(window.pageYOffset) == "number") {
		obj.getTop = function() {
			return window.pageYOffset;
		};
	} else if (typeof(document.documentElement.scrollTop) == "number") {
		obj.getTop = function() {
			return document.documentElement.scrollTop;
		};
	} else {
		obj.getTop = function() {
			return 0;
		};
	}

	if (self.innerHeight) {
		obj.getHeight = function() {
			return self.innerHeight;
		};
	} else if(document.documentElement.clientHeight) {
		obj.getHeight = function() {
			return document.documentElement.clientHeight;
		};
	} else {
		obj.getHeight = function() {
			return 500;
		};
	}

	obj.move = setInterval(function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		}

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit;
		if (pos < obj.topLimit)
			pos = obj.topLimit;

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 30);
}
//quick end


//faq
/* Faq Toggle View */
function FaqView(tabContainer) { 
  var tabContainer=document.getElementById(tabContainer); 
  var triggers = tabContainer.getElementsByTagName("a"); 
  for(i = 0; i < triggers.length; i++) { 
    if (triggers.item(i).href.split("#")[1]) 
    triggers.item(i).targetEl = document.getElementById(triggers.item(i).href.split("#")[1]); 
    if (!triggers.item(i).targetEl) 
    continue; 
    triggers.item(i).targetEl.style.display = "none"; 
    triggers.item(i).className=""; 
    triggers.item(i).onclick = function () { 
      if (tabContainer.current == this) { 
        this.targetEl.style.display = "none"; 
        this.className=""; 
        tabContainer.current = null; 
      } else { 
        if (tabContainer.current) { 
        tabContainer.current.targetEl.style.display = "none"; 
        tabContainer.current.className=""; 
      } 
      this.targetEl.style.display = "block"; 
      this.className="on"; 
      tabContainer.current = this; 
    } 
    return false; 
    } ;
  } 
} 

//map
function divTab(index){
	for(i=1; i<8; i++){
		if(i==index){
		document.getElementById("dTab"+i).style.display="block";
		}else{
		document.getElementById("dTab"+i).style.display="none";
		}
	}
}

//event banner

//subway

function fncClick( obj ){
    var fm  = document.frm;
    var img = fm.menu;
    for( var i=0; i<img.length; i++ )
    {
	if( img[i] === obj )
        {
		if( img[i].src.indexOf('_on') == -1 )
            {
			img[i].src = img[i].src.replace('.png','_on.png');
			
            }
		}
        else
        {
		img[i].src = img[i].src.replace('_on','');
        }
	}
}




