
$(document).ready(function() {

	$('.readmore').click(function(){
		var id = $(this).attr('id');
		$('#content_'+id+'').show();
		$(this).hide();
		$(this).next().show();
	});

	$('.readless').click(function(){
		var id = $(this).attr('id');
		$('#content_'+id+'').hide();
		$(this).hide();
		$(this).prev().show();
	});	
	
	// profile
	$(".profile a, a.popup").fancybox({
		'titlePosition'		: 'inside',
		'overlayOpacity'	: 0.6,
		'overlayColor'		: '#000000'
	});
	
	// autoclear
	$('.autoclear').each(function(){
		$(this).data('contents',$(this).val());
	}).focus(function(){
		if ($(this).val() == $(this).data('contents')) $(this).val('');
		$('input, textarea').removeClass('error');
	}).blur(function(){
		if ($(this).val() == '') $(this).val($(this).data('contents'));
	});
	
});

function share(platform, title, url)
{
	switch(platform)
	{
		case 'twitter':
			window.open('http://twitter.com/home?status='+encodeURIComponent(title+' '+url),'twitter');		
			break;

		case 'facebook':
			window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(url),'sharer','toolbar=0,status=0,width=626,height=436');		
			break;
		
		case 'hyves':
			window.open('http://www.hyves-share.nl/button/respect/?hc_hint=1&url='+encodeURIComponent(url)+'','hyves');		
			break;
		
		case 'email':
			document.location = 'mailto:?subject=dansateliers.nl&body='+url;
			break;
	}
}
