$(document).ready(function() {
	$(".tab").hide();
	$("#news").show();
	$(".active_tab div").show();
	$(".main_link div img").click(function(){
		$(".sub_links_wrapper").hide();
		$(this).next().show();
	});
	$(".main_link a").click(function() {
		var title = $(this).attr('title');
		var link_name ="#" + title;
		$("#content_wrapper").show();
		if(title!="store"){$(".tab").hide();}
		if($(this).attr('title')=="photos"){$("#content_wrapper").hide();}
		if(title!="store"){$(link_name).fadeIn(); $("div").removeClass("active_tab");}
		if(title=="news" || title=="shows" || title=="epk"){$("#home_button").addClass("active_tab");}
		if(title=="bio"){$("#bio_button").addClass("active_tab");}
		if(title=="discography" || title=="video" || title=="photo"){$("#media_button").addClass("active_tab");}
		if(title=="peers" || title=="social_media"){$("#links_button").addClass("active_tab");}
		if(title=="contact"){$("#contact_button").addClass("active_tab");}
	});
	$('#dialog').dialog({ autoOpen: false });		
	$("#videos a").click(function() {
		$('#dialog').dialog('option', 'title', $(this).attr("title"));
		$('#dialog').dialog("option", "minWidth", 670);
		$('#dialog').dialog("option", "minHeight", 400);
		$('#dialog').html($(this).next().html());
		$('#dialog').dialog("open");
	});
	$('div.song a').click(function() {
		$('#dialog').dialog('option', 'title', $(this).text());
		$('#dialog').dialog("option", "minWidth", 400);
		$('#dialog').dialog("option", "minHeight", 450);
		$('#dialog').html($(this).next("div").html());
		$('#dialog').dialog("open");
	});
	$('#photos_wrapper').cycle({
		    fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		    cleartype: $.support.opacity,
		    pause: true
	});
});
$(function(){
	$('#photo_nav_prev')
		.bind('click',function(event) {
			$('#photos_wrapper').cycle('next'); 
		});
	$('#photo_nav_next')
		.bind('click',function(event) {
			$('#photos_wrapper').cycle('prev');
		});
});
Cufon.replace('.photos_caption'); // This transforms the caption text for each photo in to its own image so we can use the Prestina font.
Cufon.replace('.sub_link');
