function setCookie( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setHours( todayDate.getHours() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function getCookie( name )
{
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
				endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
			break;
	}
	return "";
}

var wx = 0 ;
var wy = 0 ;
drag = 0 ;
move = 0 ;
window.document.onmousemove = mouseMove ;
window.document.onmousedown = mouseDown ;
window.document.onmouseup = mouseUp ;
window.document.ondragstart = mouseStop ;

function mouseUp() { 
	if (move) { 
		dragObj.style.zIndex -= 100 ;
		move = 0 ;
	}
} 

function mouseDown() { 
	if (drag) { 
		clickleft = window.event.x - parseInt(dragObj.style.left) ;
		clicktop = window.event.y - parseInt(dragObj.style.top) ;
		dragObj.style.zIndex += 100 ;
		move = 1 ;
	} 
} 

function mouseMove() { 
	if (move) { 
		dragObj.style.left = window.event.x - clickleft ;
		dragObj.style.top = window.event.y - clicktop ;
	} 
} 

function mouseStop() { 
	window.event.returnValue = false ;
} 

function Show(divid) { 
	divid.style.left=document.body.clientWidth / 2 - divid.clientWidth / 2 + wx;
	divid.style.top=document.body.clientHeight / 2 - divid.clientHeight / 2 + wy;
	wx += 30;
	wy += 30;
	divid.style.visibility = "visible"; 
} 

function Hide(divid) { 
	divid.style.visibility = "hidden"; 
} 

function popupwin(name, divid) { 
	if ( getCookie(name) != "done" )
	{  
		Show(divid);
	}
}

function closewin(name, divid) 
{ 
	setCookie(name, "done" , 12); // 12시간 쿠키적용 
	Hide(divid);
}
