	
// Ari 2/4/2009

jQuery.prototype.isEmpty = function() {
	return (this.html().length == 0);
}

hideProgressIndicator = function (responseText, textStatus, XMLHttpRequest) {
  $('#progressIndicator').hide();
}

displayViaAjax = function(id, url) {
	$('#'+id).after('<div id="progressIndicator"><img src="http://www.thirteen.org/images/progress2.gif"></div>');
	$('#'+id).load(url, {}, hideProgressIndicator);	
}

displayTagsSelector = function() {
	if ($('#fragment-4').isEmpty())
		displayViaAjax('fragment-4','/wnet/wideangle/tag-selector/?component=true');
}

//

	$(document).ready(function() {

		// for the browse navs
		$('ul.rightnav-list ul').hide();
		//$('ul.rightnav-list ul:first').show();
		$('#rightnavlist li.item_parent a').click(
			function() {
				var checkElement = $(this).next();
				if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
					checkElement.slideUp('normal');
					checkElement.parent().removeClass('browse_selected');
					return false;
				}
				if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
					checkElement.slideDown('normal');
					checkElement.parent().addClass('browse_selected');
					return false;
				}
			}
		);

		// for the inside this episode menu
		$('ul.inside_episode_subcat').hide();
		$('ul.inside_episode_subcat_expand').show();
		$('a.inside_episode_subcat').toggle(
			function() {
				$(this).next().show();
			},
			function() {
				$(this).next().hide();
			}
		);
		$('#tabednav > ul').tabs({ selected: 0 });
	});
	
	
	
	
	
	sfHover = function() {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	if (window.attachEvent) window.attachEvent("onload", sfHover);
	
	
	
	
function display(id) {
			if (document.getElementById(id).style.display == 'block') {
				document.getElementById(id).style.display = 'none';
			} else {
				document.getElementById(id).style.display = 'block';
			}
				return false;
		}		