;(function($){

    var bodyBackground = 'body2.jpg';

	$(document).ready(function(){

		// Add a class 'last' to the lat paragraph in a news item (to remove the margin-bottom)
		$('div.news-item-content').find('p:last').addClass('last');

		// Cufon font replacement
		Cufon.replace('h1,h3,.grid .title, div#navigation ul li a, h4');

		// Auto clear search field
		$('#search input')
			.data('default', $('#search input').val() )
			.focus(function(){
				if ( $(this).data('default') == $(this).val() ) {
					$(this).val('');
				}
			})
			.blur(function(){
				if ( $(this).val() == '' ) {
					$(this).val($(this).data('default'));
				}
			});


		/* Background image
		if ( jQuery.browser.msie ) {

			$('body').css('background', 'url(/wp-content/themes/clean/images/backgrounds/body.jpg) no-repeat fixed center top');

		} else {

			var $img = $('<img/>')
				.attr('src', '/wp-content/themes/clean/images/backgrounds/' + bodyBackground)
				.load(function(){


					$(this)
						.css({
							position: 'fixed',
							zIndex: '-10',
							left: 0,
							top: 0,
							width: $(window).width(),
							height: $(window).height(),
							opacity: 0
						})
						.appendTo('body')
						.animate({opacity: 1}, 400);
				});

			$(window).resize(function(){
				$img.css({
					width: $(window).width(),
					height: $(window).height()
				});
			})
		}*/

	});

})(jQuery);
