function moveDiv(divElement, autoClose)
{
	var mainObject = divElement;
	var movableObject = mainObject;
	var xRelative, yRelative;
	var moveFlag = false;
	var persistent = true;

	this.object = movableObject;

	var cpos = unescape(getCookie("DIV_POS_"+movableObject.id)).split("/");
	cpos = cpos[0].split(":");

	if(autoClose){
		persistent = false;
	}

	this.setMovableObject = function(divElement){
		movableObject = divElement;
		if(!is_ie || is_opera){
			this.object = movableObject;
		}
		else{
			object = movableObject;
		}
		if(getCookie("DIV_POS_"+movableObject.id)){
			cpos = unescape(getCookie("DIV_POS_"+movableObject.id)).split("/");
			if(cpos[1] == 1 && persistent){
				movableObject.style.display = 'block';
			}
			else{
				movableObject.style.display = 'none';
			}
			cpos = cpos[0].split(":");
			movableObject.style.left = cpos[0];
			movableObject.style.top = cpos[1];
		}
	}

	this.showMovable = function(innerObject, htmlText){
		if(innerObject && htmlText){
			innerObject.innerHTML = htmlText;
		}
		var now = new Date();
		setCookie("DIV_POS_"+movableObject.id, movableObject.style.left+":"+movableObject.style.top+"/"+1, now.getFullYear() + 2, 01, 01, '', document.domain);
		movableObject.style.display = 'block';
	}

	this.addBeforeHTML = function(innerObject, htmlText){
		innerObject.innerHTML = htmlText + innerObject.innerHTML;
	}

	this.isOpen = function(){
		cpos = unescape(getCookie("DIV_POS_"+movableObject.id)).split("/");
		if(cpos[1] == 1){
			return true;
		}
		else{
			return false;
		}
	}

	this.hideMovable = function(divElement){
		var now = new Date();
		setCookie("DIV_POS_"+movableObject.id, movableObject.style.left+":"+movableObject.style.top+"/"+0, now.getFullYear() + 2, 01, 01, '', document.domain);
		movableObject.style.display = 'none';
	}

	var topLimit = function(clientY, yRelative){
		if (is_ie || is_opera){
			return (clientY - yRelative) > document.body.scrollTop;
		}
		else{
			return (clientY - yRelative) > window.scrollY;
		}
	}

	var bottomLimit = function(clientY, yRelative, height){
		if (is_ie || is_opera){
			return (clientY - yRelative + height) < document.body.clientHeight + document.body.scrollTop;
		}
		else{
			return (clientY - yRelative + height) < window.innerHeight + window.scrollY;
		}
	}

	var leftLimit = function(clientX, xRelative){
		if (is_ie || is_opera){
			return (clientX - xRelative) > document.body.scrollLeft;
		}
		else{
			return (clientX - xRelative) > window.scrollX;
		}
	}

	var rightLimit = function(clientX, xRelative, width){
		if (is_ie || is_opera){
			return (clientX - xRelative + width) < document.body.clientWidth + document.body.scrollLeft;
		}
		else{
			return (clientX - xRelative + width) < window.innerWidth + window.scrollX;
		}
	}

	var handleMouseDown = function(e){
		//var xRelative = e.clientX - parseInt(movableObject.style.left);
		//var yRelative = e.clientY - parseInt(movableObject.style.top);
		xRelative = e.clientX - parseInt(movableObject.offsetLeft);
		yRelative = e.clientY - parseInt(movableObject.offsetTop);
		moveFlag = true;
		if (!is_ie || is_opera){
			e.preventDefault();
		}
		else{
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
	}

	var handleMouseUp = function(e){
		moveFlag = false;
	}

	var handleMouseMove = function(e){
		if (moveFlag == true){
			if(leftLimit(e.clientX, xRelative) && rightLimit(e.clientX, xRelative, parseInt(movableObject.offsetWidth+20))){
				movableObject.style.left = e.clientX - xRelative + 'px';
			}
			if(topLimit(e.clientY, yRelative) && bottomLimit(e.clientY, yRelative, parseInt(movableObject.offsetHeight+30))){
				movableObject.style.top = e.clientY - yRelative + 'px';
			}

			setCookie("DIV_POS_"+movableObject.id, movableObject.style.left+":"+movableObject.style.top+"/"+((movableObject.style.display=='none' || !persistent)?0:1), 2020, 01, 01, '', document.domain);

			if (!is_ie || is_opera){
				e.preventDefault();
			}
			else{
				window.event.cancelBubble = true;
				window.event.returnValue = false;
			}
		}
	}

	if(is_gecko){
		mainObject.addEventListener("mousedown", handleMouseDown, true);
		document.addEventListener("mouseup", handleMouseUp, true);
		document.addEventListener("mousemove", handleMouseMove, true);
	}
	else{
		mainObject.attachEvent("onmousedown", handleMouseDown);
		document.attachEvent("onmouseup", handleMouseUp);
		document.attachEvent("onmousemove", handleMouseMove);
	}
}