_id=function(_id){return document.getElementById(_id);};

//Clicks
$('#radio').click(function(){
	showPlayingTracks();
});


function header (menu) {
	
	_id('section').style.backgroundImage = 'url(img/header_'+menu+'.png)';
	$('#section').show('fast');

}

function prepareWebsite() {

	$('#header').fadeIn(200,function() {
		$('#claim').fadeIn(200,function() {
			$('#mainMenu').fadeIn(200,function() {
				$('#website').fadeIn(1000, function() {
					$('#footer').fadeIn(200);
				});
			});
		});
	});
}


function fadeScreen(status) {
	if (status=='on') {
		$('#fadeScreen').fadeIn('fast');
	}else{
		$('#fadeScreen').fadeOut('fast');
		$("#radio").animate({ 
		        marginTop: "0px",
		      }, 650, 'linear' );
	}
}
function clearPopups() {
	fadeScreen('off');
}
function headerOff() {
		_id('section').style.backgroundImage = 'url(img/header_off.png)';
		_id('section').style.display = 'none';
	
}

function zoomLens(numb) {
	_id(numb).style.backgroundImage = 'url(img/zoom_bn.png)';
}
function zoomLensOut(numb) {
	_id(numb).style.backgroundImage = 'none';
}

function draftOn(number) {
	_id('draft').style.backgroundImage = 'url(img/draft'+number+'.png)';
	//_id('draft').style.display = 'block';
}
function draftOff() {
	$('#draft').fadeOut(5000, function() {
		_id('draft').style.backgroundImage = 'url(img/header_off.png)';
	});
	
	
}

function submitForm() {
  document.contact.submit();
}

function addTweet() {$('#tweetcontainer').slideUp('fast', function() {	$('#addtweet').fadeOut('fast', function() {		$('#managetweet').fadeIn('fast');	});	
	});

	
}
function showPhoto(numb) {
	
	_id('fadeScreen').innerHTML = '<div id="photoPopup"><img src="showcase_previews/'+numb+'_big.stars" border="0" alt="" />';
	fadeScreen('on');
	
}
function showPhoto2(numb) {
	var imgheight = getImgHeight('photos/'+numb+'_big.stars');
	if (imgheight==0) imgheight=640;
	_id('fadeScreen').innerHTML = '<div id="photoPopup"><img src="photos/'+numb+'_big.stars" border="0" alt="" />';
	_id('photoPopup').style.height = imgheight+'px';
	_id('photoPopup').style.marginTop = '-'+imgheight/2+'px';	
	fadeScreen('on');
		
}

function showPlayingTracks() {
	$("#radio").animate({ 
	        marginTop: "-60px",
	      }, 800, 'linear' );
	
	$.get('includes/recent_tracks.php', function(data) {
		_id('fadeScreen').innerHTML = '<div id="radioPopup"></div>';
		_id('radioPopup').innerHTML = data;
		fadeScreen('on');
	});
}

function getImgHeight(imgSrc)
{
var newImg = new Image();
newImg.src = imgSrc;
return newImg.height;

}
