$(document).ready(function(){
	
	$('.show_items').click( function() {
		$(this).hide();
		$(this).parent().parent().parent().parent().parent().children('.hidden_story').fadeIn();	
		return false;
	});
	
	$('.a_more_images').click(function () {
		$(this).hide();
		$(this).parent().parent().children('.hidden_story').fadeIn();
		return false;
	});
	
	$('.video_link').click(function(e){
		e.preventDefault();
		var video = ($(this).attr('rel'));
		getFlashMovie("vid_player").playVideo(video, true, true);
		$('html, body').animate({scrollTop:0}, 'fast');

	});
	
	$('.song_link').click( function (){
		var target = $(this).attr('rel');
		$('.active_song').fadeOut(function(){
			$(this).removeClass('active_song');
			$('div .' + target).addClass('active_song').fadeIn();
			$('div .' + target).children().fadeIn();
		});		
		console.log(target);
		return false;
	});
	
	$('body#lyrics #col2 div').hide();
	$('.active_song').show();
	
	$('.active_song div').show();
	$('body').append('<div id="drag_me"><a href="djkls.php" id="a_alt">alt</a></div><div id="droppable"><p></p></div>');
	
	$("#drag_me").draggable({ axis: 'x', revert: 'invalid', start: function() { $(this).css('z-index', '1000') }, stop: function() {
		if (parseInt($(this).css('left')) < 0) {
			$(this).css('z-index', '1');
		};
		}
	 });
	
	$("#droppable").droppable({tolerance: 'touch'});
	
	// Adjust the video menu item 1px in firefox
	if ($.browser.safari || $.browser.chrome) {
		$("#drag_me").css('top' , '485px');
	 }
	
});

function startmic(){
	showstatic();
	setTimeout('getFlashMovie("staticswf").startMic()',1000);
}

function showstatic(){
	//alert("big");
	$('#static').css("width", "100%");
	$('#static').css("height", "98%");
}

function hidestatic(){
	//alert("small");
	$('#static').css("width", "100px");
	$('#static').css("height", "100px");
}

function hittop(){
	document.location.href = "lyricsalt.php";
}


jQuery.fn.log = function (msg) {
    console.log("%s: %o", msg, this);
    return this;
};

var active = "";

function playerReady(vidstring){
	setTimeout("loadFirstMovie(vidstring)",1500);
}

function loadFirstMovie(vidstring){
		getFlashMovie("vid_player").playVideo(vidstring, true, true);
}
	
function getFlashMovie(movieName) {
	movieName = swfobject.getObjectById(movieName);
	return movieName;
}

var playing = "";

function stopAll(exclude){
	var old = playing;
	playing = exclude;
	getFlashMovie(old).stopit();
}
