bookView = {
	createMainDivs: function(){
		if(!this.created){
			this.topContainer = document.body;
			this.overlay = new Element('div', {'id':'overlay', 'styles':{'opacity':.9}}).inject(this.topContainer);
			this.book = new Element('div', {'id':'book'}).inject(this.topContainer);
			this.moduleFrame = new IFrame({'scrolling':'auto','frameborder':'0', 'allowTransparency':'true'}).inject(this.book);
			//this.overlay.onclick = this.close.bind(bookView);
			this.addFX(500);
			this.created=true;
		}
	},
	
	addFX: function(length){
		this.overlay.effect = new Fx.Morph(this.overlay, {duration: length, transition: Fx.Transitions.Sine.easeIn});
		this.book.effect = new Fx.Morph(this.book, {duration: length, transition: Fx.Transitions.Sine.easeIn});
	},
	
	resetStyles: function(){
		this.windowDimentions = document.window.getSize();
		this.windowSize = document.window.getScrollSize();
		this.windowScrolled =  document.window.getScroll();
		this.book.width = this.book.getStyle('width').toInt();
		this.overlay.effect.start({'display':'block','width':this.windowSize.x+'px','height':this.windowSize.y+'px','opacity':'1'});
		this.book.setStyles({'display':'block','top':this.windowScrolled.y+20+'px','left':(this.windowSize.x-this.book.width)/2+'px',opacity: '0'});
		this.book.effect.start({opacity: '1'});
	},
	
	viewFrame: function(frameSource){
		this.createMainDivs();
		this.resetStyles();
		this.switchSelects('off');
		this.moduleFrame.src = frameSource;
	},
	
	close: function(){
		this.book.effect.start({'opacity':'0'});
		this.overlay.effect.start({'opacity':'0'});
		this.shutdown.delay(500,bookView);
	},
	
	shutdown: function(){
		this.switchSelects('on');
		this.overlay.style.display = this.book.style.display = 'none';
	},
	
	switchSelects: function(state){
		$$('select').each(function(select){
			if(!select.getProperty('orig')){
				select.setProperty('orig',select.getStyle('visibility'));
			}
			t=select.getProperty('orig');
			select.style.visibility = (state=='on') ? t : 'hidden';
		});		
	}
};


