var Trace = {
	css : "trace_div",
	id : "trace_div_id",
	paddingLeft : -25,
	paddingTop : 0,
	capa : null,
	topinicial : 0,
	height : 20,
	align : "right",
	valign : "top",
	init : function(){
		var o = Trace;		
		o.capa = document.createElement("div");
		o.capa.className = o.css;
		o.capa.style.position = "absolute";
		o.capa.style.display = "none";
		o.capa.id = o.id;
		o.capa.style.height = o.height + "px";
		document.body.appendChild(o.capa);
		var nav = Fujar.Utils.nav();
		var ypos = o.paddingTop;
		if(o.valign == "bottom"){
			var nav = Fujar.Utils.nav();
			ypos = (nav.h - o.height) + o.paddingTop;
		}
		o.topinicial = ypos;
		Fujar.Utils.addEvent(window,'scroll',function(e){ o.setScroll() });
		Fujar.Utils.addEvent(window,'resize',function(e){ o.setScroll() });
	},
	
	show : function(msg){
		var o = Trace;
		if(o.capa == null) o.init();
		o.capa.innerHTML = msg;
		o.capa.style.display = "block";
		o.capa.style.left = o.getXpos() + 'px';
		o.setScroll();
	},
	
	set : function(msg){
		o.capa.innerHTML = msg;
	},
	
	append : function(msg){
		o.capa.innerHTML += msg;
	},
	
	hide : function(){
		var o = Trace;
		if(o.capa == null) o.init();
		o.capa.style.display = "none";
	},
	
	getXpos : function(){
		var o = Trace;
		var xpos = o.paddingLeft;
		var nav = Fujar.Utils.nav();
		if(o.align == "right"){
			xpos = nav.w - o.capa.offsetWidth + o.paddingLeft;
		}else if(o.align == "center"){
			xpos = (nav.w /2) - (o.capa.offsetWidth/2) + o.paddingLeft;
		}
		return xpos;
	},
	
	getScrollY : function(){
		return Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	},
	
	setScroll : function(){
		var o = Trace;
		if(o.capa.style.display == "block"){
			var ypos = o.getScrollY() + o.topinicial;
			o.capa.style.top = ypos + 'px';
		}
	}

}