/*-----------------------------------------------------------------------------------------------------
	Behaviors for the Cooliris Wall
-------------------------------------------------------------------------------------------------------
	This file contains the behaviors for the Cooliris wall (as seen on the Show Hub):
	- Filter shows by genre

	This file has no js dependencies outside of the jQuery core file.
-----------------------------------------------------------------------------------------------------*/

jQuery(document).ready(function() {
	var cooliris = {
		onEmbedInitialized : function() {
	    cooliris.embed.setCallbacks({
        select: onItemSelected
	    });
		}
	};

	//filter shows by genre
	jQuery('#cool_iris .filters a').click(function(){
		coolIrisFilter(this);
	});


});//closes ready function
//---------------------------------------------------------------------------------------------------------


function coolIrisFilter(thisFilter){
	var genreID = thisFilter.hash.substring(1);

	cooliris.embed.setFeedURL('showrss.html?genre=' + thisFilter.hash.substring(1));

	jQuery('#cool_iris .filters a.selected').removeClass('selected');

	jQuery(thisFilter).addClass('selected');
	return false;
}

/*if we ever need a callback, this is the place for it*/
function onItemSelected(item) {
    // item is deselected
    if (item == null) {
      // item deselected
    } else {
      // item is selected
    }
}
