﻿/********************************************************************
 *
 * Mouse 이벤트 관련 함수
 *
 *******************************************************************/
var oldx = 0;
var oldy = 0;
var bDrag = false;
function fnMouseDown(obj)	{
    if( obj.style.display == "block" || obj.style.display == "" )	{
        bDrag = true;
        oldx = window.event.x;
        oldy = window.event.y;
        obj.setCapture();

        var wleft = obj.style.left;
        var wtop  = obj.style.top;
    }
}
function fnMouseMove(obj)	{
    if( bDrag )	{
        var newx = window.event.x
        var newy = window.event.y
        var wleft = obj.style.left;
        var wtop  = obj.style.top;
        obj.style.left = parseInt(wleft) + (newx - oldx);
        obj.style.top  = parseInt(wtop) + (newy - oldy);
        oldx = window.event.x;
        oldy = window.event.y;
    }
}
function fnMouseUp(obj)	{
    if( bDrag )	{
        obj.releaseCapture();
        bDrag = false;
        oldx = 0;
        oldy = 0;
    }
}
// 클릭한 객체 위치에서 레이어 보임/숨김
var G_MS_TIME;
function actLayerToggle(obj) {
    var _tmpo = document.all[obj];
    
    // 화면의 가운데 레이어 띄우기 위함. 윗줄의 코드는 모두 무시됨 -_-
    var clientWidth = document.body.clientWidth;
    var clientHeight= document.body.clientHeight;
    var objWidth = _tmpo.style.width;
    var objHeight= _tmpo.style.height;

    objWidth = objWidth.replace("px","");
    objHeight = objHeight.replace("px","");

	//_tmpo.style.posLeft=clientWidth / 4;
	//_tmpo.style.posTop=clientHeight / 5;
    _tmpo.style.posLeft=(clientWidth-objWidth)/4 + 20;
    _tmpo.style.posTop=(clientHeight-objHeight)/5;
    _tmpo.style.display = "";
}
function actLayer_MSOVER() {
    window.clearTimeout(G_MS_TIME);
}
function actLayer_MSOUT(obj) {
    G_MS_TIME=window.setTimeout(obj.id+".style.display='none';", 10);
}