floatBox=function(id,y){
	if(typeof(id)!='object'){
		id=$(id);
	};
	switch(y){
		case 'fromTop':
			id.setStyle({'top':id.offsetHeight*(-1)-10+'px'});
			id.setStyle({'left':Math.round(document.viewport.getDimensions().width/2-id.offsetWidth/2)+'px'});
			this.startY=document.viewport.getDimensions().height/2-id.offsetHeight/2;
		break;
	};
	this.ns=(navigator.appName.indexOf("Netscape")!=-1);
	this.d=document;
	this.o=this.ftlObj(id);
	this.start();
};
floatBox.prototype={
	status:0,
	ftlObj:function(id){
		var el=id;
		if(this.d.layers){ el.style=el; }
		el.y=this.startY;
		return Element.extend(el);
	},
	move:function(){
		if(typeof(window.pageYOffset)=='number'){ pY = window.pageYOffset; }
		else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){ pY=document.body.scrollTop; }
		else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){ pY=document.documentElement.scrollTop; }
		else{ pY=1; }
		this.o.y+=(pY+this.startY-this.o.y)/8;
		this.o.setStyle({'top':Math.round(this.o.y)+'px'});
	},
	stop:function(){ if(this.pE){ this.pE.stop(); } },
	start:function(){ this.pE=new PeriodicalExecuter(this.move.bind(this), (1/100)); } 
}
messageBox=function(pref){
	this.pref=pref;
	if(this.pref.length==0){
		this.pref='mBox';
	};
	if($(this.pref)){
		this.mBox=$(this.pref);
		this.clear();
	}
	else{
		this.cLayout();
	};
}
messageBox.prototype={
	pref:'mBox',
	cLayout:function(){
		this.mBox=new Element('div',{id:this.pref});
		this.con=new Element('div',{id:this.pref+'Cont'});
		this.mBox.insert(this.con);
		var a=new Element('div',{id:this.pref+'Bg'});
		this.mBox.insert(a);
		var b=new Element('img',{id:this.pref+'ContBg',src:'/public/img/common/logInBoxBg.png'});
		var c=new Element('div',{id:this.pref+'Container'});
		this.con.insert(b);
		this.con.insert(c);
		var d=new Element('div',{id:this.pref+'SubBox'});
		this.closeBtn=new Element('input',{id:this.pref+'CloseBtn',type:'button'});
		this.closeBtn.addClassName('closeBtn');
		d.insert(this.closeBtn);
		c.insert(d);
		this.titleBox=new Element('div',{id:this.pref+'Title'});
		c.insert(this.titleBox);
		c.insert(new Element('div',{style:'clear:both;'}));
		this.bodyBox = new Element('div',{id:this.pref+'Body'})
		c.insert(this.bodyBox);
		$$('body')[0].insert(this.mBox);
		this.closeBtn.observe('click',this.hide.bind(this));
	},
	clear:function(){
		this.titleBox.update('');
		this.bodyBox.update('');
	},
	setTitle:function(text){
		this.titleBox.update(text);
	},
	setBody:function(text){
		this.bodyBox.update(text);
	},
	show:function(){
		var arr=pageSize();	
		this.mBox.setStyle({'width':arr[0]+'px','height':arr[1]+'px','display':'block','visibility':'visible'});
		this.fB=new floatBox(this.con,'fromTop');
	},
	hide:function(){
		this.mBox.remove();
	},
	startLoading:function(){
		setLoaderBackground(this.bodyBox,1);
	},
	clearLoading:function(){
		clearLoaderBackground(this.bodyBox);
	}
}