/**
 * Description 	: À¯´ÏÅ©·Î QuickMenu
 */
$(document).ready(function() {
	if( $('#quickMenu') ) {
		var b_height, b_width;
		if( $("table").width() > 1000 ) {
			b_width = -80;
			b_height = 170;
		} else if( $("table").width() > 950 ) {
			b_width = -40;
			b_height = 110;
		} else {
			b_width = -55;
			b_height = 110;
		}
		
		height = $(document.body).scrollTop() + b_height; 
		$("#quickMenu").css({top:height, right:b_width, display:'block'});      
		
		var currentPosition = parseInt($("#quickMenu").css("top"));
		
		$(window).scroll(function() {
		    var position = $(window).scrollTop();
		    if( position < b_height)
		    	position = b_height;
		    $("#quickMenu").stop().animate({"top":position+"px"},1000);
		});

	}

	$('.img_menu').mouseover(function() {
		$(this).attr('src',$(this).attr('src').replace('off','on'));
	}).mouseout(function(){
		$(this).attr('src',$(this).attr('src').replace('on','off'));
	});	
});


function initQuickMenu(){
/* »ç±â¹æÁö·¹ÀÌ¾î open */
	if( document.cookie.indexOf("divSagi=done") < 0 && document.getElementById('divSagi')!=null ){      
		document.getElementById('divSagi').style.visibility = "visible";
	}
/* »ç±â¹æÁö·¹ÀÌ¾î open */

	return;
    var obj = document.getElementById("quickMenu");
    var bodyTable = document.getElementById('bodyTable');
    obj.style.top = bodyTable.offsetTop + 170;
	var bodyWidth = parseInt(bodyTable.width);
	
	if (bodyWidth > 900)
		obj.style.right = -40 + "px";
	else if(bodyWidth > 850)
		obj.style.right = -80 + "px";
	else
		obj.style.right = -55 + "px";
	moveQuickMenu();
}

function moveQuickMenu()
{
	var timer;
	var activeSpeed = 200; // ¿òÁ÷ÀÓÀ» °¨ÁöÇÏ´Â ¼Óµµ (¼ýÀÚ°¡ Å¬¼ö·Ï ´Ê°Ô ¾Ë¾ÆÂ÷¸²)
	var scrollSpeed = 10; // ½ºÅ©·ÑµÇ´Â ¼Óµµ (Å¬¼ö·Ï ´Ê°Ô ¿òÁ÷ÀÓ)
	var menuGap = 170;

	var stPoint, edPoint, refreshTimer;
	var quickMenu = document.getElementById('quickMenu');

	stPoint = parseInt(quickMenu.style.top);
	edPoint = document.body.scrollTop;
	if (edPoint < menuGap) edPoint = menuGap;

	refreshTimer = activeSpeed;

	if ( stPoint != edPoint ) {
		scrollAmount = Math.ceil( Math.abs( edPoint - stPoint ) / 15 );
		quickMenu.style.top = parseInt(quickMenu.style.top) + ( ( edPoint<stPoint ) ? -scrollAmount : scrollAmount );
		refreshTimer = scrollSpeed;
		}

	timer = setTimeout ("moveQuickMenu();", refreshTimer);
}

/* iframe heigth */
function iframeHeight(obj_id) {
	try {
		document.getElementById(obj_id).height = 100;
		var the_height = document.getElementById(obj_id).contentWindow.document.body.scrollHeight;
		if( the_height < 1000 ) the_height="1100";
		document.getElementById(obj_id).height = the_height;
	} catch(e) {}
}

