$(document).ready(function() {												 
	// Handle the main image on dynamic loads as well as reseting the floating box
	$(document).ajaxComplete(function(request, settings) {
	  // Recheck collapsible fieldsets
		$('fieldset.collapsible > legend').each(function() {
		  var fieldset = $(this.parentNode);
		  // Expand if there are errors inside
		  if ($('input.error, textarea.error, select.error', fieldset).size() > 0) {
		    fieldset.removeClass('collapsed');
		  }
		
		  // Turn the legend into a clickable link and wrap the contents of the fieldset
		  // in a div for easier animation
		  var text = this.innerHTML;
		  $(this).empty().append($('<a href="#">'+ text +'</a>').click(function() {
		    var fieldset = $(this).parents('fieldset:first')[0];
		    // Don't animate multiple times
		    if (!fieldset.animating) {
		      fieldset.animating = true;
		      Drupal.toggleFieldset(fieldset);
		    }
		    return false;
		  })).after($('<div class="fieldset-wrapper"></div>').append(fieldset.children(':not(legend)')));
		});
	});
});

function launch_window(url, w, h) {
	window.open(url,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes, width="+w+", height="+h);
}

function launch_imeem(){
	window.open('/sites/wbrnashville/imeem_player.html','AudioPlayer','height=300,width=300,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes');
}