package modules.tabela 
{

	import flash.display.MovieClip;
	import modules.menu.*;

		import flash.display.MovieClip;
	import flash.events.Event;
	import classes.matuto.model.Model;
	import classes.matuto.loaders.*;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import genericos.*;
	import flash.net.*;
	import modules.noticias.Noticias;
		//Matuto
	import classes.fl.motion.easing.*;
	import classes.greensock.*;
	import classes.matuto.core.*;
	import classes.matuto.core.module.*;
	import classes.matuto.events.*;
	import classes.matuto.interfaces.*;
	import classes.matuto.model.*;
	import classes.matuto.mtween.textinho.*;
	import classes.matuto.ui.*;
	import classes.matuto.utils.display.*;
	import classes.matuto.utils.model.*;	
	import modules.home.*;
	import modules.menu.*;
	
	public class TabelaItem extends Button
	{
		
		private var open:Boolean = false;

		
		public function TabelaItem() 
		{
			super();
			
			_mask.scaleY = 0;
			
			disableButton();
			enableButton2(_c);

		}
		
		public function setModel(value:Object)
		{
			
			_titulo.text = getParams.xml.col1;
			
			
			if (getParams.xml.col2)
			{
				_descricao.text = getParams.xml.col2;
			}
			else {
			
					_descricao.text = "Nao possui descricao";
			
			}
			
			
		}
		
		public override function over() :void
		{
			
			//TweenMax.to(_mais._m,.3,{tint:0x6FA725,ease:Exponential.easeInOut});
			//TweenMax.to(_mais._b,.3,{tint:0xFFFFFF,ease:Exponential.easeInOut});
		}
		
		public override function out() :void
		{
			if (enabled) 
			{	
				//TweenMax.to(_mais._b,.3,{tint:null,ease:Exponential.easeInOut});
				//TweenMax.to(_mais._m,.3,{tint:null,ease:Exponential.easeInOut});
			}
		}
		
		override public function set enabled(value:Boolean):void 
		{			
			super.enabled = value;
			
			if (value)out();
			else over();
		}
				
		public override function click() :void
		{
			if (!open)
			{
				
				open = true;
				TweenMax.to(_mask, .3, { overwrite:true,scaleY:1, ease:Exponential.easeInOut } );
				dispatchEvent(new Event(Event.OPEN));
				
				TweenMax.to(_bg,.3,{tint:0x0174CF,ease:Exponential.easeInOut});
				TweenMax.to(_titulo,.3,{tint:0xFFFFFF,ease:Exponential.easeInOut});
				TweenMax.to(_mais._b,.3,{tint:0xFFFFFF,ease:Exponential.easeInOut});
				TweenMax.to(_mais._s,.3,{tint:0x0174CF,ease:Exponential.easeInOut});
				TweenMax.to(_mais,.3,{rotation:90,ease:Exponential.easeInOut});
					
			}else {
				
				open = false;
				TweenMax.to(_mask, .3, {overwrite:true,scaleY:0, ease:Exponential.easeInOut } );
				dispatchEvent(new Event(Event.CLOSE));
				
				TweenMax.to(_bg,.3,{tint:null,ease:Exponential.easeInOut});
				TweenMax.to(_titulo,.3,{tint:null,ease:Exponential.easeInOut});
				TweenMax.to(_mais._b,.3,{tint:null,ease:Exponential.easeInOut});
				TweenMax.to(_mais._s, .3, { tint:null, ease:Exponential.easeInOut } );
				TweenMax.to(_mais,.3,{rotation:0,ease:Exponential.easeInOut});

				
			}
			
			dispatchEvent(new Event(Event.SELECT));
			
		}
		
	}//END CLASS

}