$(function(){
	var bd = $('body');

	// Expanded blocks initialisation
	var expBlocks = $('.expblock', bd);

	expBlocks.each( function(i){
		var _that = $(this);

		/*var expControl = _that.find('.i_toggle'),
			expBody = _that.find('.expbody')*/
		var expControl = _that.children('.h_toggle'),
			expBody = _that.children('.expbody');

		//console.log(expControl);

		// Collapse all blocks with no class=expanded on init
		if( !_that.hasClass('expanded') ) {
			expControl.removeClass('ico-minus').addClass('ico-plus');

			expBody.hide();
			_that.expand = false;
		} else {
			_that.expand = true;
		}

		expControl.click( function(){
			if( _that.expand ){
				_that.expand = false;
				expBody.slideUp('fast');
				$(this).removeClass('ico-minus').addClass('ico-plus');
			} else {
				_that.expand = true;
				expBody.slideDown('fast');
				$(this).removeClass('ico-plus').addClass('ico-minus');
			}

			return false;
		});

	});


	$('table .img a').hover(function(){
		$(this).addClass('hover');
	}, function(){
		$(this).removeClass('hover');
	});
});

