
	function FancyTab()
	{
	    this.x = 0;
	    this.y = 0;
		this.width = 0;
		this.height = 0;
		this.position = "relative";
		this.name = "";
		this.index = 0;
		this.borderwidth = 0;
		this.inactiveleftimage = "";
		this.inactivemiddleimage = "";
		this.inactiverightimage = "";
		this.activeleftimage = "";
		this.activemiddleimage = "";
		this.activerightimage = "";
		this.isactive = 0;
		this.fontcolor = "#000000";
		this.font = "Arial";
		this.fontsize = 10;
		this.text = "";
		this.parentDiv = 'myDiv';
	}
	
	FancyTab.prototype.BuildMe = function(){

		var txt = document.createElement("div");
		this.htmlelement = txt;
		document.getElementById(this.parentDiv).appendChild(txt);
		this.PaintMe();
	}
	
	FancyTab.prototype.PaintMe = function()
	{
		var divText;
		divText = "<div id='Line" + this.index + "' ";
		divText += "onclick='myArray[" + this.index + "].OnClick();' ";
		divText += "onMouseOver=\"this.style.filter='alpha(opacity=100)'; this.style.opacity='1';\" onMouseOut=\"this.style.filter='alpha(opacity=75)'; this.style.opacity='.75';\"";
		divText += "style=\"";
		divText += "cursor:pointer;"
		divText += "position:" + this.position + ";";
		divText += "left:" + this.x + ";";
		divText += "top:" + this.y + ";";
		
		if(this.width>0){
			divText += "width:" + this.width + ";";
		}
		if(this.height>0){
			divText += "height:" + this.height + ";";
		}
		divText += "float:left;filter:alpha(opacity=75);-moz-opacity:.75;opacity:.75;";
		divText += "\">";

		divText += this.BuildTab();
		divText += "<div style=\"position:absolute;width:" + this.width + ";text-align:center;font-family:" + this.font + ";color:" + this.fontcolor + ";font-size:" + this.fontsize + ";top:" + ((this.height/2) - (this.fontsize/2)) + ";\">" + this.text + "</div>";
		divText += "</div>";
		
		this.htmlelement.innerHTML = divText;
	}
	
	
	FancyTab.prototype.BuildTab = function()
	{
	
		if (typeof document.body.style.maxHeight != "undefined") {
		} else {
			this.inactiveleftimage = this.inactiveleftimage.replace(".png",".gif");
			this.inactivemiddleimage = this.inactivemiddleimage.replace(".png",".gif");
			this.inactiverightimage = this.inactiverightimage.replace(".png",".gif");
			this.activeleftimage = this.activeleftimage.replace(".png",".gif");
			this.activemiddleimage = this.activemiddleimage.replace(".png",".gif");
			this.activerightimage = this.activerightimage.replace(".png",".gif");
		}
		
		var buildhtml;
		var borderwidthdiff;
		var tempborderwidth;
		var useleft;
		var usemiddle;
		var useright;
		
		if(this.isactive==0){
			useleft = this.inactiveleftimage;
			usemiddle = this.inactivemiddleimage;
			useright = this.inactiverightimage;
		} else {
			useleft = this.activeleftimage;
			usemiddle = this.activemiddleimage;
			useright = this.activerightimage;
		}
		
		buildhtml = "";
		
		tempborderwidth = this.borderwidth;

		borderwidthdiff = this.width - (this.borderwidth*2);
		if(borderwidthdiff<0){
			tempborderwidth = this.borderwidth + (borderwidthdiff/2);
		}
		
		//Top Row
		buildhtml+= "<div style=\"position:absolute; left:0px; top:0px; width:"+tempborderwidth+"px; height:"+this.height+"px; background-image:url("+useleft+"); background-repeat: repeat-x; \"></div>";
		if(borderwidthdiff>0){
			buildhtml+= "<div style=\"position:absolute; left:"+tempborderwidth+"px; top:0px; width:"+borderwidthdiff+"px; height:"+this.height+"px; background-image:url("+usemiddle+"); background-repeat: repeat-x; \"></div>";
		}
		buildhtml+= "<div style=\"position:absolute; left:"+(this.width-tempborderwidth)+"px; top:0px; width:"+tempborderwidth+"px; height:"+this.height+"px; background-image:url("+useright+"); background-repeat: repeat-x; \"></div>";

		return buildhtml;
	}
	
	FancyTab.prototype.OnClick = function(){
		if(this.isactive==0){
			this.isactive=1;
			this.PaintMe();
			eventHandler(this.name,"click");
		}
	}
	
	FancyTab.prototype.SetActive = function(iActive){
		if(this.isactive!=iActive){
			this.isactive=iActive;
			this.PaintMe();
		}
	}
	
	

