
var O3Tip = Class.create();

O3Tip.prototype = {
	
	initialize : function(labeltext, src_element){
		this.labeltext = labeltext;
		this.src_element = src_element;
	},
	
	create : function() {
		if(!this.___tipcontainer){
			this.___tipcontainer = document.createElement('DIV');
			this.___tipcontainer.id = 'lan_tooltip';
			$(this.___tipcontainer).setStyle({
				position: 'absolute',
				whiteSpace: 'nowrap',
				zIndex: 10,
				height: '27px',
				display: 'block'
			});
			
			document.body.appendChild(this.___tipcontainer);
			leftSide = document.createElement('DIV');
			$(leftSide).setStyle({
				width: '13px',
				height: '27px',
				backgroundImage: 'url('+jsPath + 'images/lan_leftbg.png)'
			
			});
			this.___tipcontainer.appendChild(leftSide);
			
			middle = document.createElement('DIV');
			middle.className = '';
			$(middle).setStyle({
				whiteSpace: 'nowrap',
				height: '27px',
				backgroundImage: 'url('+jsPath + 'images/lan_bg.png)',
				backgroundRepeat: 'repeat-x'
			});
			middle.innerHTML = this.labeltext;
			this.___tipcontainer.appendChild(middle);
			
			rightSide = document.createElement('DIV');
			$(rightSide).setStyle({
				width: '13px',
				height: '27px',
				backgroundImage: 'url('+jsPath + 'images/lan_rightbg.png)'
			});
			this.___tipcontainer.appendChild(rightSide);
			
			this.setPosition();
		}
	},
	
	setPosition : function(newX, newY) {
		if(!newX){
			var contDim = $(this.___tipcontainer).getDimensions();
			var thisLeft = -((contDim.width/2)-4);
			Position.clone(this.src_element, this.___tipcontainer, {setWidth : false, setHeight : false, offsetTop : -30, offsetLeft : thisLeft });
		} else {
			$(this.___tipcontainer).setStyle({
				left: newX+'px', 
				top: newY+'px'
			});
		}
	},
	
	destroy : function() {
		$(this.___tipcontainer).remove();
	}
}