//http://weblog.dajim.co.kr/ekape/hanbiro.js : ´ÙÁü À¥·Î±× js
document.write('<script type="text/javascript" src="http://weblog.dajim.co.kr/ekape/hanbiro.js"></script>');

//GNB images mouseover 

function menuOn(imgEl) {
	
	imgEl.onmouseout = function() {
		imgEl.src = imgEl.src.replace("_on.gif", ".gif");
	}
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}




/* µî°¡¼Ó °è»ê ¾Ë°í¸®Áò */
function speedCalculate(result,targetResult,speedPercent) {
	if(result>targetResult) {
		check = (((targetResult - result) * speedPercent) < -1) ? true : false;
	} else {
		check = (((targetResult - result) * speedPercent) > 1) ? true : false;
	}
	if(result==targetResult) {
		return targetResult;
	} else {
		if(check) {
			result += (targetResult - result) * speedPercent;
		} else {
			result = ((targetResult - result)>0) ? result+1 : result-1;
		}
		return parseInt(result);
	}
}

function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

function quickScrolling() {

	var quickTimer;
	if(!document.getElementById('quick')) return false;

	var targetElement = document.getElementById('quick');
	targetElement = targetElement.getElementsByTagName('div')[0];

	function runScroll() {
		
		var currentTop;
		if(quickTimer) clearInterval(quickTimer);

		quickTimer = setInterval(function() {

			var limitSize = parseInt(getDocHeight(),10) -800;
			
			if(targetElement.style.top == '') currentTop = 0;
			else currentTop = parseInt(targetElement.style.top,10);

			var scollCheck = parseInt(document.documentElement.scrollTop,10);

			if(scollCheck >  limitSize ) scollCheck = limitSize;

			moveImage(currentTop,scollCheck,0.3);

			if(currentTop == scollCheck) clearInterval(quickTimer);

		},20)		

	}

	function moveImage(result,targetResult,speedPercent) {

		var targetTop = speedCalculate(result,targetResult,speedPercent);
		targetElement.style.top =  targetTop + "px";
	}

	window.onscroll = runScroll;
	
}

function addLoadEvent(func) { 

  var oldonload = window.onload; 
  if (typeof window.onload != 'function') { 

	window.onload = func; 
  } else {

    window.onload = function() { 
      oldonload(); 

      func(); 
    }
   }
}


addLoadEvent(quickScrolling);


function select_reaction()
{
	var url = document.getElementById("select_reaction_target").value
	if(url !="")
	{
	location.href= url;
	}
}


function fnClipBoard(txt){
	var str = document.getElementById(txt).href;
	window.clipboardData.setData("Text",str);
	alert("Å¬¸³º¸µå¿¡ º¹»çµÇ¾ú½À´Ï´Ù.");
}

/*[20101112] ie6.css ³»¿ë È®ÀÎÇØº¸¼¼¿ä.
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 menuObjOn(objEl) {
 var imgEl = objEl.getElementsByTagName('img')[0];

 objEl.onmouseout = function() {
  imgEl.src = imgEl.src.replace("_on.gif", ".gif");
 }
 objEl.onblur = function() {
  imgEl.src = imgEl.src.replace("_on.gif", ".gif");
 }
 if(imgEl.src.indexOf("_on.gif") < 0) {
  imgEl.src = imgEl.src.replace(".gif", "_on.gif");
 }
}
