/*
 * Page Script for the Home page.
 */
Seed.Page.Home = Class.create(Seed.Page.GenericPage, {

	initialize: function($super, data){
		$super(data);
		Seed.debug(this.data);		
		
		//make random books equal height
		this.checkBookHeights();
		Event.observe(window, "resize", this.checkBookHeights);
	},
	
	/*
	 * Make the description paragraphs inside each random book equal in height
	 */
	checkBookHeights: function(){
		var books = $$(".random_book");
		var maxHeight = 0;
		
		books.each(function(book){
			var p = book.down("p.random_book_description");

			p.style.height = ""; //reset the height
			
			if(p.offsetHeight > maxHeight){
				maxHeight = p.offsetHeight;
			}
		});
		
		books.each(function(book){
			var p = book.down("p.random_book_description");
			p.style.height = maxHeight+5 + "px";
		});
	}	
});
