
var fixedObject=new Object();

fixedObject=function(element, left, top, alignX, alignY, size){
	var self=this;
	this.element=element;			/******고정 시킬 요소******/
	this.left=left;					/******left값******/
	this.top=top;					/******top값******/
	this.alignX=alignX;				/******사이트 가로 중앙 정렬 여부******/
	this.alignY=alignY;				/******사이트 세로 중앙 정렬 여부******/
	this.size=size;					/******사이트의 가로 혹은 세로 크기******/

	this.element.style.zIndex="10";

	if(navigator.userAgent.lastIndexOf("MSIE 6.0")>0 && navigator.userAgent.lastIndexOf("MSIE 6.0")<=81){
		this.element.style.position="absolute";
		this.element.style.setExpression("top", "offsetParent.scrollTop+"+this.top+"+'px'");
		this.element.style.setExpression("left", "offsetParent.scrollLeft+"+this.left+"+'px'");
		/******IE6에서고정하기******/
	}else{
		this.element.style.position="fixed";
		this.element.style.top=this.top+"px";
		this.element.style.left=this.left+"px";
		/******IE6 외에서 고정하기******/
	}

	if(this.alignX || this.alignY){
		this.resize();
		this.windowResize=bindAsListener(this.resize, this);
		addListener(window, "resize", this.windowResize);
	}
	/******가로(혹은 세로) 중앙 정렬시 창 크기 조절에 따른 위치 지정******/

	this.on();
}

fixedObject.prototype={
	on:function(){
		if(navigator.userAgent.lastIndexOf("MSIE 6.0")>0 && navigator.userAgent.lastIndexOf("MSIE 6.0")<=81){
			this.element.style.setExpression("top", "offsetParent.scrollTop+"+this.top+"+'px'");
			this.element.style.setExpression("left", "offsetParent.scrollLeft+"+this.left+"+'px'");
		}else{
			this.element.style.position="fixed";
			this.element.style.top=this.top+"px";
			this.element.style.left=this.left+"px";
		}
	},

	off:function(){
		if(navigator.userAgent.lastIndexOf("MSIE 6.0")>=0 && navigator.userAgent.lastIndexOf("MSIE 6.0")<=81){
			this.element.style.setExpression("top", this.top+"+'px'");
			this.element.style.setExpression("left", this.left+"+'px'");
		}else{
			this.element.style.position="absolute";
			this.element.style.top=this.top+"px";
			this.element.style.left=this.left+"px";
		}
	},

	display:function(){
		this.element.style.display="block";
	},

	hidden:function(){
		this.element.style.display="none";
	},

	resize:function(){
		if(this.alignX){
			this.element.style.left=((document.documentElement.clientWidth-this.size)+Math.abs(document.documentElement.clientWidth-this.size))/4+this.left+"px";
		}

		if(this.alignY){
			this.element.style.top=((document.documentElement.clientHeight-this.size)+Math.abs(document.documentElement.clientHeight-this.size))/4+this.top+"px";
		}
	}
}