/*** G-STYLE ***/
/*** 
	Author: Goran,
	Date: 1.6.2011,
	Description: Toggles each table row with description which has unique ID to represent its row, appends/removes classes and changes border of a parent
	Important: This click function work wither in tables or in divs. Use it with caution!
***/
	
$(document).ready(function() {	
	$('[class^=toggle-item]').hide();
	
	$('[class^=item]').click(function() {
		var $this = $(this);
		var x = $this.attr("class");
		$('.toggle-' + x).slideToggle("slow");
		
		var parent = $this.parent().parent();
		var chan = parent.children('td.chan');
		var prog = parent.children('.prog');
		
		
		if (chan.hasClass('bolded') || prog.hasClass('bolded')) {
			chan.removeClass('bolded');
			prog.removeClass('bolded');
			if (chan.length) prog.css({'border-bottom':'1px solid gray'});
		}
		else {
			chan.addClass('bolded');
			prog.addClass('bolded');
			if (chan.length) prog.css({'border-bottom':'1px solid transparent'});
		}

		return false;
	});
});
