function Essentials()
{
	var self 		 = this;
	this.id 		 ="cmdController";
	this.element	 = "td";
	this.special     = Array();
	/*this.classOver 	 = "td_hover";
	this.classOut  	 = "";
	this.classActive = "td_hover";*/
	this.classOver 	 = "cmdDayTop-05.jpg";
	this.classOut  	 = "cmdDayTop.jpg";
	this.classActive = "cmdDayTop-05.jpg";
	this.indexActive = -1;
	this.controllers =null;
	this.colorOver="";
	this.colorOut="";
	this.title     ="";
	this.titleData   = Array();
	this.ini=function()
	{
		try
		{
			if(self.title!="")
				self.title = document.getElementById(self.title);
			
			self.controllers = document.getElementById(self.id).getElementsByTagName(self.element)
			for(var i=0;i<self.controllers.length;i++)
			{
				self.controllers[i].index=i;
				self.controllers[i].activeclick = false;
				
				self.controllers[i].classOver 	 = self.classOver;
				self.controllers[i].classOut  	 = self.classOut;
				self.controllers[i].classActive  = self.classActive;
				
				
				self.controllers[i].tmp2 = Object;
				self.controllers[i].tmp2 = document.createElement("DIV");
				self.controllers[i].tmp2.style.background="url(/images/"+self.classActive+")";
				
				self.controllers[i].tmp3 = Object;
				self.controllers[i].tmp3 = document.createElement("DIV");
				self.controllers[i].tmp3.style.background="url(/images/"+self.classOver+")";
				self.controllers[i].tmp4 = Object;
				self.controllers[i].tmp4 = document.createElement("DIV");
				self.controllers[i].tmp4.style.background="url(/images/"+self.classOut+")";
				
				//self.controllers[i].Title =
				
				for(var j=0;j<self.special.length;j++)
				{
					if(self.special[j].index == i)
					{
						self.controllers[i].classOver 	= self.special[j].classOver;
						self.controllers[i].classOut 	= self.special[j].classOut;
						self.controllers[i].classActive = self.special[j].classActive;
						
						self.controllers[i].tmp2 = Object;
						self.controllers[i].tmp2 = document.createElement("DIV");
						self.controllers[i].tmp2.style.background="url(/images/"+self.special[j].classActive+")";
						
						self.controllers[i].tmp3 = Object;
						self.controllers[i].tmp3 = document.createElement("DIV");
						self.controllers[i].tmp3.style.background="url(/images/"+self.special[j].classOver+")";
						self.controllers[i].tmp4 = Object;
						self.controllers[i].tmp4 = document.createElement("DIV");
						self.controllers[i].tmp4.style.background="url(/images/"+self.special[j].classOut+")";
					}
				}
				Container.DOM.AddEventListener(self.controllers[i],"click",function()
				{
					for(var j=0;j<self.controllers.length;j++)
					{
						if(self.controllers[j].activeclick)
						{
							self.controllers[j].activeclick = false;
							self.controllers[j].style.background=self.controllers[j].tmp4.style.background;
						}
					}
					ele=Container.DOM.GetCurrentElementFireEvent(arguments[0])
					/*//alert(arguments.length);
					ele.activeclick = true;
					Container.DOM.SetClass(ele,ele.classActive);*/
					
					ele.style.background=ele.tmp2.style.background;
					ele.activeclick = true;
				})
				this.controllers[i].onmouseover=function()
				{
					this.style.background=this.tmp3.style.background;
					if(self.colorOver!=null)
					this.style.color=self.colorOver;
					//Container.DOM.SetClass(this,this.classOver);
					self.setTitle(this.index)
				}
				this.controllers[i].onmouseout=function()
				{
					if(this.activeclick==false)
						this.style.background=this.tmp4.style.background;
					//Container.DOM.SetClass(this,this.classOut);
					if(self.colorOut!=null)
					this.style.color=self.colorOut;
					if (self.title != "" || self.title != null)
						self.title.innerHTML = ""
				}
			}
		}catch(e){}
	}
	this.setDefault=function(__index)
	{
		try{
			var ele = self.controllers[__index];
			ele.activeclick = true;
			ele.style.background=ele.tmp2.style.background;
			//Container.DOM.SetClass(ele,ele.classActive);
		}catch(e){ }
	}
	this.setTitle = function(__index)
	{
		try
		{
			if (self.title != "" || self.title != null)
			{
				self.title.innerHTML ="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time frame";// self.titleData[__index]
				self.controllers[__index].title = self.titleData[__index]
			}
		}catch(e){}
	}
}
/*function iniEssentialsCMD()
{
	var cmdController = new Essentials();
	cmdController.ini();
	for(i=1;i<=21;i++)
	{
		var cmdDay = new Essentials();
		cmdDay.id="cmdDay:"+i;
		cmdDay.classOut="middle";
		cmdDay.classOver="middle_hover";
		cmdDay.classActive="middle_hover";
		cmdDay.special =[{index:0,classOver:"left_hover",classOut:"left",classActive:"left_hover"},{index:4,classOver:"right_hover",classOut:"right",classActive:"right_hover"}];
		cmdDay.ini()
	}
}
XBrowserAddEvent(window,"load",iniEssentialsCMD);*/
