import mx.data.encoders.Num;
import templateBook.mvctemplate.*
import templateBook.mvc.*
import templateBook.I.*
import flash.display.BitmapData
import templateBook.util.Observable
import templateBook.Configuration
import mx.transitions.Tween
import mx.transitions.easing.*

class templateBook.mvctemplate.SelectBookBtnView extends AbstractTools {
	
var inter                       //handler for setIntervale
var tween1:Tween                //tween
var bcg:MovieClip               //background
var symbol:MovieClip            //icon
	
///////////////////////////////////////////////////////////

function SelectBookBtnView () {
	
}

////////////////////////////////////////////////////////////

public function defaultController (model:Observable):Controller {
  return null;////new LogoController(model)
 }
 
////////////////////////////////////////////////////////////

function onLoad() {
	
	desc_tool = Configuration.TOOL_TIP_SELECT_BOOK;
	onResize()	
	createMaskReflection()
	
	///color bcg
	if(Configuration.BUTTON_SELECT_BOOK_BCG_COLOR!=undefined){
	NewColor.setColor(bcg, Configuration.BUTTON_SELECT_BOOK_BCG_COLOR)
	}
	
	//color symbol
	if(Configuration.BUTTON_SELECT_BOOK_SYMBOL_COLOR!=undefined){
	NewColor.setColor(symbol, Configuration.BUTTON_SELECT_BOOK_SYMBOL_COLOR)
	}
	
     onResize()
 
}

/////////////////////////////////////////////////////////////

function onPress() {
	var m:BookModel = BookModel(this.getModel())
	//m.fla.loadBook("xml/book2.xml");
	//m.fla.onChangedBook("book2/1",true)
	m.show_list_book();
}

/////////////////////////////////////////////////////////////

function onResize() {
	var m:BookModel = BookModel(this.getModel())
	if(m.change_positions_book()==false){
	this._x = 26 + Configuration.CHAPTER_TITLE_WIDTH;
	this._y = m.__height - 48
	}
	
}

////////////////////////////////////////////////////////////

function onFaceBook() {
	var m:BookModel = BookModel(this.getModel())
	
	if(m.date_books.firstChild.lastChild.childNodes.length>1){
	clearInterval(inter);
	inter = setInterval(this, 'shov', 1300);
	}
}

////////////////////////////////////////////////////////////

function shov() {
	clearInterval(inter);
	_visible = true	
	_alpha = 0
	tween1.stop()
	tween1 = new Tween(this, '_alpha', Strong.easeInOut, 0, 100, 1, true);
}

////////////////////////////////////////////////////////////////

}

