$(document).ready(function() {

	if (!$.browser.msie)
	{
		$("pre").hide();
	}
	$("a[href$=.mp3]").addClass("mp3Link");
	$("a[href$=.ogg]").addClass("oggLink");
	$("#player").removeClass("hidden");
	$("#jsRequired").hide();
	$("#mixDetails h3:not(#sm h3)").wrapInner("<a href=\"#\" class=\"toggler\">");
	$("#mixDetails h3 a").each(function(){
		$(this).html("Show/hide tracklisting for " + $(this).parent().parent().parent().find("span:first").text() + "<b> +</b>");
	});
	$("#newest .toggler").toggle(function(){
		$(this).parent().next().slideDown("fast");
		$(this).find("b").text(" -");
	},function(){
		$(this).parent().next().slideUp("fast");
		$(this).find("b").text(" +");
	});
	$("#newest>li>span").each(function(){
		$(this).addClass("mixTitle");
	})
	$("#older a:not(a.noTL)").each(function(){
		$(this).after(" | <a href=\"#\" class=\"toggler\" title=\"View tracklisting for " + $(this).text() + "\">Show/Hide tracklisting</a><div><pre></pre></div>");
		$(this).next().next().find("pre").load("/tracklistings/" + $(this).attr("href").replace(/mixes\//,"").replace(/mp3\//,"").replace(/\.mp3/,".txt"));
	});
	$("#older pre").hide();
	$("#older a.toggler").each(function(){
		$(this).toggle(function(){
			$(this).parent().find("pre").slideDown("fast");
		},function(){		
			$(this).parent().find("pre").slideUp("fast");
		});
	});
	var safariMob = false;
	if (($.browser.safari)&&(navigator.userAgent.toLowerCase().indexOf("mobile")!=-1))
	{
		safariMob = true;
	}
	if (safariMob)
	{
		$("ul#newest a.mp3Link").text("Play this mix now")
		$("#mixDetails>h2").text("Play these mixes now directly on your iPhone/Touch")
	}


});

