Text.Inherits(Shape);
function Text(name){
	if(typeof(name) == "undefined"){
		name = "Text";
	}
	
	this.Inherits(Shape, name);
	
	this.fFamily = "verdana";
	this.fWeight = "normal";
	this.fSize = 10;
	this.fColor = "#454545";
}

Text.prototype.draw = function(text, left, top){
	switch(getBrowser()){
		case "Explorer":{
			var vmlText = document.createElement("v:rect");
			vmlText.style.position = "relative";
			vmlText.style.left = left + "px";
			vmlText.style.top = top + "px";
			vmlText.style.zIndex = 2;
			
			var textBox = document.createElement("v:textbox");
			textBox.style.fontFamily = this.fFamily;
			textBox.style.fontSize = this.fSize;
			textBox.style.fontWeight = this.fWeight;
			textBox.style.color = this.fColor;
			textBox.innerHTML = text;
			
			vmlText.appendChild(textBox);
			this.text = vmlText;
			break;
		}default:{
			var svgText = document.createElementNS('http://www.w3.org/2000/svg', "text");
			svgText.setAttributeNS(null, "x", left);
			svgText.setAttributeNS(null, "y", top);
			svgText.setAttributeNS(null, "fill", this.fColor);
			svgText.setAttributeNS(null, "font-family", this.fFamily);
			svgText.setAttributeNS(null, "font-size", this.fSize);
			svgText.appendChild(document.createTextNode(text));
			this.text = svgText;
			break;
		}
	}
	return this.text;
}
