// file: /app/webroot/js/common.js

// when the document is ready
$(document).ready(function(){
	// stripe all the tables in the application
	$('table.stripe tr:even').addClass('altrow');
});

// add event handler to familles select form input
$('.famille_select').change(function(){
	// get the value of the selected option
	var type = $(this).find('option:selected').text();

	// log the type for testing purposes
	console.log( type );

	// if the type is a tv show
	if(type == "Electriques") {
		// fadein the form inputs
		$('.electrique_hide').parent().fadeIn();
	} else {
		// fade out and hide the form inputs
		$('.electrique_hide').parent().fadeOut();
	}
});

// get value of selected famille
var current_type = $('.famille_select option:selected').text();

// if the selected option is not 'TV Show' then hide the tv options
if(current_type != "Electriques") {
	// hide the tv elements from form
	$('.electrique_hide').parent().hide();
}

