jQuery(document).ready(function($){
	$('div.org .details').hide();

	$('div.org p.show a').click(function(){
		$(this).parent().fadeOut();
		org = $(this).parents('.org');
		org.children('.details').slideDown();
		return false;
	});

	$('div.org a.hide').click(function(){
		org = $(this).parents('.org');
		org.children('.details').slideUp();
		org.find('.show').fadeIn();
		return false;
	});

});


// JavaScript Document
function swap( thumb ) {
	var detailImage = document.getElementById( 'galleryDetail' );
	//http://www.brookspainting.com/images/gallerythumb <- remove thsese 53 chars
	var thumbSrc = thumb.childNodes[0].src
	if( thumbSrc.substring( 7,10 ) == 'www' ) {
		var imageName = thumbSrc.substring(50);
	} else {
		var imageName = thumbSrc.substring(46);
	}
	
	detailImage.src = 'images/gallerydetail/' + imageName;
	return detailImage.src;
}

function checkform( form ) {
	errors = "";
	if( form.name.value == "" ) {
		errors += "Please enter your name\n";	
	}
	if( form.email.value == "") {
		errors += "Please enter your email address\n";
	}
	if( form.phone.value == "") {
		errors += "Please enter your phone number\n";
	}
	if( form.description.value == "" ) {
		errors += "Please enter a brief description of your painting needs\n";
	}
	
	if( errors != "" ) {
		alert(errors);
		return false;
	}
	return true;
}
