/* Check if a javascript variable has been defined */
function isdefined( variable)
{
    return (typeof(window[variable]) == "undefined")?  false: true;
}

if(!isdefined('isRunningIE6OrBelow'))
		var isRunningIE6OrBelow = false;
		
$(document).ready(function(){

	if(isRunningIE6OrBelow == false)
	{
		var menubar = $("#menubar");
		var menubar_list = menubar.children("ul");
		var selectedOption = ((menubar_list.attr('class')).split('-'))[1]; //get the name of the option selected
		if (selectedOption.length > 0) {
			var menubar_list_selecteditem_a = menubar_list.children("li." + selectedOption).children('a');
			menubar_list_selecteditem_a.addClass('selected');
		}
	}
	
	$("span.more a").click(function(){
		href = $(this).attr('href');
		if((href == null) || (href == ""))
		{
			div = $(this).parents("div").get(0); //get immediate parent div
			$(this).parent().hide();
			hidden = $(div).find(".hidden");
			hidden.fadeIn(700);
			return false;
		}
	})
})

$(document).ready(function(){
	$("a.video").each(function(){ //convert all video links into colorbox embed videos
		var vid = $(this).attr('href');
		var title = $(this).attr('title');
		$(this).colorbox({href: BASE_URL + "scripts/video.php?vid=" + vid,
						  title: title,
						  current : "video {current} of {total} | "
						});
	})
	
	$("a.audio").each(function(){ //convert all audio links into colorbox embed videos
		var vid = $(this).attr('href');
		var title = $(this).attr('title');
		$(this).colorbox({href: BASE_URL + "scripts/video.php?vid=" + vid,
						  title: title,
						  current : "track {current} of {total} | "
						});
	})
	
})





