jQuery(document).ready(function($) {
	//Configuration Options
		var max_width = 640; 	//Sets the max width, in pixels, for every image
		var selector = '.post-box p img'; 	//Sets the syntax for finding the images.  Defaults to all images.
					//For images inside of a particular element (id="abc") or class (class="abc"),
					//use '.abc img' or '#abc img' respectively.  Don't leave off the img tag!!!
		//End configuration options.  You don't need to change anything below here.
		$(selector).each(function(){
			var width = $(this).width();
			var height = $(this).height();
			if (width > max_width) {
				//Set variables	for manipulation
				var ratio = (height / width );
				var new_width = max_width;
				var new_height = (new_width * ratio);
				//Shrink the image and add link to full-sized image
				$(this).height(new_height).width(new_width);
			} //ends if statement
		} //ends each function
		);
	//sets the easing parameter
	jQuery.easing.def = "easeOutSine";
	//this toggles the home page side navigation.
	$(".hidden").hide();
	$("a.dropdown").click(function() {
		$(this).next().slideToggle(250);
		return false;	
	});
	//this is for the tabs
	$("#what-we-offer").hide();
	$("#jessi-lambert").hide();
	$("#paul-bryant").hide();
	$("#stephen-devries").hide();
	$("a.tab").click(function () {  
		// switch all tabs off  
		$(".active").removeClass("active");  
		// switch this tab on  
		$(this).addClass("active");  
		// slide all elements with the class 'content' up  
	    $(".content").hide();  
		// Now figure out what the 'title' attribute value is and find the element with that id.  Then slide that down.  
			var content_show = $(this).attr("title");
			$("#"+content_show).show();  
			return false;
		});
	//comment forms
	$(".comment-hide").css('display', 'none');
	$("#view-comments").click(function() {
		$("#comments-list li").css('display', 'block');
		$("#leave-comment").css('display', 'block');
		$("#comments-reply").css('display', 'none');
		$(this).css('display', 'none');
		return false;
	});
	$("#leave-comment").click(function() {
		$("#comments-list li").css('display', 'none');
		$("#leave-comment").css('display', 'none');
		$("#comments-reply").css('display', 'block');
		$("#view-comments").css('display', 'block');
		$(this).css('display', 'none');
		return false;
	});
	//trying to stop the jumping
	var gallerylink = $(".newest-gallery");
	$("#newest-gallery img").hide();gallerylink.hide();
	$("#newest-gallery img").fadeIn('10000', function() {
		gallerylink.fadeIn('100000');
	});
	//clears input fields
	$("input,textarea").focus(function() {
		$(this).removeClass("error");
		var inputValue = $(this).val();
		$(this).val("");
		$(this).blur(function() {
			var newValue = $(this).val()
			if(newValue == ""){
				$(this).val(inputValue);
			}else{
				$(this).val(newValue);
			}
		});
	});
	//contact form on the contact page
	$('#referrer').change(function() {
		var value = $(this).val();
		var active = $('#if-'+value+'-ref');
		if (value == 'other'){$(active).fadeIn('slow');}else{$('#if-other-ref').hide()};
	});
	$('#eventtype').change(function() {
		$('#if-wedding,#if-portrait,#if-other').hide();
		var value = $(this).val();
		var active = $('#if-'+value);
		$(active).fadeIn('slow');
	});
});