// JavaScript Document
$(document).ready(function() {
	Cufon.replace('#headtitle, #subtitle, #menulist li a, .greyblock .cont h1, .redblock span, .largeblock h1, .fullblock h1, .artist h2, .artist span, .downloads a, .gallery .title',{'fontFamily':'GoldenGate-Gothic', hover:true});
	
	$('a[rel=external]').attr('target','_blank');
	
	$('#menulist li:last').css({'padding':'0px'});
	
	if($('#sponsors').length > 0){
		setInterval(changeSponsors,4000);
	}
	
	$('p.readMore').bind('click', function(){
		
		$('div.moreInfo').slideUp('fast', function(){
			$(this).css('display', 'none');
			$(this).parent('.artist').find('p.readMore').show();
			//$(this).parent('.artist').css('background','none');
		});		
		
		$(this).hide();
		
		$(this).parent().parent('.artist').find('.moreInfo').slideDown('fast', function(){
			$(this).css('display', 'block');
			//$(this).parent('.artist').css('background','#ffffff');
		});		
	})
	
	$('p.closeMore').bind('click', function(){
		$(this).parent('div.moreInfo').slideUp('fast', function(){
			$(this).css('display', 'none');
			//$(this).parent('.artist').css('background','none');
		});		
		$(this).parent('div.moreInfo').parent('.artist').find('p.readMore').show();
	});
				
	$(".gallery a").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:3000, autoplay_slideshow: false});
	
	
	$('.cycle').cycle({
		
			fx: 'fade',
			speed: '2000',	
			timeout: '5000',
			
		});
	
	/* SOCIAL SHARELINKS */
	var pathname = window.location.pathname;
	var facebookURL = "http://www.facebook.com/sharer.php?u=http://www.melkrock.com"+encodeURI(pathname)+"&t=MELKROCK 2011 - Tielt";
	var twitterURL = "http://twitter.com/?status=MELKROCK 2011 Tielt - http://www.melkrock.com"+pathname;
	
	$('.facebook').attr('href',facebookURL);
	$('.twitter').attr('href',encodeURI(twitterURL));
	
});

/*--------------------------------------------------------------------------*/
function changeSponsors(){
	var leftPos = $('.sponsors').position().left;
	$('.sponsors').animate({'left':leftPos-251}, 1000, function() {
		var first = $('.sponsors a:first');
		
		$('.sponsors').append(first);
		$('.sponsors').css('left','0px');
	});
}
