// document.write('<style type="text/css">body{display:none}</style>');
// jQuery(function($) { $('body').css('display','block'); });

document.write('<style type="text/css">.hideable{display:none}</style>');

$(function(){

// call masonry plugin at load then again after a delay
	// wrap it in a function so we can execute it on '.boxes':
	function callmasonry() { $('.boxes').masonry(); } /*for masonry 0.4 & jquery 1.3.2*/
	// function callmasonry() { $('.boxes').masonry({ columnWidth: 245 }); } /*for masonry 1.0.1 & jquery 1.4.1*/
	
	callmasonry();
	setTimeout(callmasonry,1000);
	
	// $('.boxes').masonry();
	
	$('.boxbody p').defuscate();
	
// admin bar hiding
	$('#adminbar.hideable').css({ opacity:0, 'display':'block' });
	$('#adminbar.hideable').hover(
		function(){ $(this).stop().animate({opacity:1}, 300); },
		function(){ $(this).stop().animate({opacity:0}, 300); }
		);

/// menu fading
	$('#nav li, #icons li, .feed')
		.removeClass('csshover') // this class is hooked into for the css rollover
		.find('a')
		.removeClass('csshover')
		.append('<span class="jhover" />') // this span should have the same bg as the :hover state in the css
		.each(function() {
			var $span = $('> span.jhover', this).css('opacity', 0);
			$(this).hover(
				function () { $span.stop().fadeTo(200, 1); }, // on hover
			 	function () { $span.stop().fadeTo(400, 0); } // off hover
				);
		});
	
// mailing list add form
	
	// change the text on focus/blur
	var currtext = $('form.mailinglist input').val(); // grab default value of the input box
	$('form.mailinglist input.error').css({ color:'#D42669' }); // make text red if error (was #A11764)
	$('form.mailinglist input')
		.focus(function() {
			if ($(this).val() == currtext) { $(this).css({color:'#666'}).val(''); } // if default empty it, reset colour
			})
		.blur(function() {
			if ($(this).val() == '') { $(this).val(currtext); // if empty, set to default
			if ($(this).attr('class') == 'error') { $(this).css({ color:'#D42669' }); } // make text red if error
			}
		});
	

})