function FloatingModule()
{
		this.myie=document.all;
		this.right_edge;//=this.myie&&!window.opera? isiebody().clientWidth-imagewidth: window.innerWidth-imagewidth;
		this.expandState = 0;
		
		
		this.ie = document.all ? 1 : 0;
		this.ns = document.layers ? 1 : 0;
		
		this.master = new Object("element");
		this.master.curLeft =this.right_edge;
		this.master.curTop = 10;
		this.master.gapLeft = 0;
		this.master.gapTop = 0;
		this.master.timer = null;
		this.isleft=1;
		this.myController="";
		this.myFormID="";
}

FloatingModule.prototype.Init=function(moduleid,strWidth,imagewidth,isLeft,myfid,top)
{
		this.isleft=isLeft;
		this.myController="Floating"+moduleid;
		this.myFormID=myfid;
		//alert(this.myFormID);
		this.myie=document.all;
		this.right_edge=this.myie&&!window.opera? this.isiebody().clientWidth-imagewidth: window.innerWidth-imagewidth;
		this.expandState = 0;
		
		
		if( isLeft==1) 
		{
                this.strleft = 0;
                this.strhleft = - strWidth;
         }
         else
         {
                this.strleft = this.right_edge- strWidth;
                this.strhleft = this.right_edge;
           }
       
        var containerwidth= strWidth + imagewidth;
        this.top=top;
		
		document.write("<style type=text/css>#"+this.myFormID+" {WIDTH:" + containerwidth  + "px;LEFT: " + this.strhleft + "px; POSITION: absolute; TOP: 100px; VISIBILITY: visible; Z-INDEX: 999}</style>");
		//alert(this.strhleft);
		this.ie = document.all ? 1 : 0;
		this.ns = document.layers ? 1 : 0;
		
		
		this.master = new Object("element");
		this.master.curLeft =this.right_edge;
		if( isLeft==1) 
		{
			this.master.curLeft =this.strhleft;
		}
		this.master.curTop = this.top;
		this.master.gapLeft = 0;
		this.master.gapTop = 0;
		this.master.timer = null;
		
	
		setInterval(this.myController+'.FixY()', 100);
		this.setPace(this.myFormID, this.strhleft, this.top, 10); 
	}
		
		
	FloatingModule.prototype.moveAlong=function(layerName, paceLeft, paceTop, fromLeft, fromTop)
	{
			clearTimeout(this.master.timer)
			if(this.master.curLeft != fromLeft)
			{
				if((Math.max(this.master.curLeft, fromLeft) - Math.min(this.master.curLeft, fromLeft)) < paceLeft){this.master.curLeft = fromLeft}
				else if(this.master.curLeft < fromLeft){this.master.curLeft = this.master.curLeft + paceLeft}
					else if(this.master.curLeft > fromLeft){this.master.curLeft = this.master.curLeft - paceLeft}
				if(this.ie){document.getElementById(layerName).style.left = this.master.curLeft}
				else{document.getElementById(layerName).style.left = this.master.curLeft + "px"}
			}
			else
			{
			return;
			}
			
			if(this.master.curTop != fromTop)
			{
				if((Math.max(this.master.curTop, fromTop) - Math.min(this.master.curTop, fromTop)) < paceTop){this.master.curTop = fromTop}
				else if(this.master.curTop < fromTop){this.master.curTop = this.master.curTop + paceTop}
					else if(this.master.curTop > fromTop){this.master.curTop = this.master.curTop - paceTop}
				if(ie){document.getElementById(layerName).style.top = this.master.curTop}
				else{document.getElementById(layerName).style.top = this.master.curTop + "px"}
			}
			this.master.timer=setTimeout(this.myController+'.moveAlong("'+layerName+'",'+paceLeft+','+paceTop+','+fromLeft+','+fromTop+')',30)
			//alert(this.myController);
		}

		FloatingModule.prototype.setPace=function(layerName, fromLeft, fromTop, motionSpeed)
		{
			this.master.gapLeft = (Math.max(this.master.curLeft, fromLeft) - Math.min(this.master.curLeft, fromLeft))/motionSpeed
			this.master.gapTop = (Math.max(this.master.curTop, fromTop) - Math.min(this.master.curTop, fromTop))/motionSpeed
			this.moveAlong(layerName, this.master.gapLeft, this.master.gapTop, fromLeft, fromTop)
		}
		
		FloatingModule.prototype.FixY=function(){
			if(this.ie)
			{
				//alert(this.myFormID);
				document.getElementById(this.myFormID).style.top = document.body.scrollTop+this.top;
				//alert(this.myFormID);
				}
			else{document.getElementById(this.myFormID).style.top = document.body.scrollTop+this.top + "px"}
		}
		
		FloatingModule.prototype.isiebody=function(){
			return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
		}
		
		FloatingModule.prototype.expand=function(){
			if(this.expandState == 0){this.setPace(this.myFormID, this.strleft, this.top, 10); 
			this.expandState = 1;}
			else{this.setPace(this.myFormID, this.strhleft, this.top, 10); 
			this.expandState = 0;}
		}
		
		


