/*
 * Copyright 2000-2008 namics ag. All rights reserved.
 */

/**
 * TV.Basic class.
 * 
 * @author Remo Brunschwiler, namics ag
 */

TV.Basic = function() {
	this.bindBasicEvents();
};

/* ==========================================================
 * Binds the hide and show event to the genre chooser
 * ==========================================================
 */
TV.Basic.prototype.chooseGenres = function() {
	TV.$('#genre_toggle').toggle(function () {
		TV.$(this).removeClass('passive').addClass('active');
		TV.$('#genre_hidden').show();	
	},
	function() {
		TV.$(this).removeClass('active').addClass('passive');
		TV.$('#genre_hidden').hide();
	});
};

/* ==========================================================
 * Binds the click event to the search button
 * ==========================================================
 */
TV.Basic.prototype.submitSearch = function(){
	var $submitSearch = TV.$('#submitSearch');
	$submitSearch.bind('click', function() {
		TV.$('#searchform').get(0).submit();
	});
};

/* ==========================================================
 * Binds the events
 * ==========================================================
 */
TV.Basic.prototype.bindBasicEvents = function () {
	var that = this;
	TV.$(document).ready(function () {
		that.chooseGenres();
		that.submitSearch();
	});
};
