/* 	Phatpad Javascript
		Last updated 2 July 2009
		Updated by Nathen Street

		Dependent on JQuery Javascript library
*/


					
jQuery(document).ready(function($) {


	// clears the search form on focus
		$("#s").focus(function() {
			if( this.value == this.defaultValue ) {
				this.value = "";
			}
		}).blur(function() {
			if( !this.value.length ) {
				this.value = this.defaultValue;
			}
		});
		
		// if single page view, resize the page elements
		if ($('.galleryArea')) {
			
			var galleryHeight = $('.galleryArea').height();
			var postHeight = $('#singlePost').height();

			if (galleryHeight > postHeight) {
				$('#singlePost').css({height: (galleryHeight) + 'px' });
			}
		}
		
		// AJAX Portfolio loader
		if ($('.ajaxLoad')) {
			$('.ajaxLoad').bind('click', function(event) {
				event.preventDefault();
				var postID = $(this).attr('id');
				$.get("http://phatpad.com.au/ajax-php", {postID: postID}, function(data) {
					$('#portfolioDetail').empty();
					$('#portfolioDetail').fadeIn('fast').html(data);
				});
			});
		}
		
});


