/**
 * jQuery for Your Comments form animation
 * 
 * Shawn Buzzell, Feb 2008
 *   
 * Minor update by Martin Olson to add client side validation
 */

/* *** Activate Form *** */		
$(document).ready(function(){
	$("a#closeComment").hide();
	/*$("a#postComment").hide();*/
	
	// block blank submissions
	$('#formComment').click(function(){
	if($('[name="commentBody"]').val() == "Respond with your own comments here.") {
			alert("You must enter a comment to continue");
			return false;
		}
	});
	
	$("a#postComment").click(function () {				
		$("a#postComment").hide();				
		$("#slider").show().animate( { left:"132" + 'px'}, 600);
		$("a#closeComment").show();
		return false;
	});
	
	$("a#closeComment").click(function () {				
		$("a#closeComment").hide();				
		$("#slider").animate( { left:"-506" + 'px'}, 600);
		$("a#postComment").show();				
		return false;
	});
	
	if ("#moduleComments_long") {			
		$("a#postComment").click(function () {							
			$("a#postComment").hide();				
			$("#slider").show().animate( { left:"132" + 'px'}, 600);
			$("a#closeComment").show();
			return false;
		});
		
		$("a#closeComment").click(function () {			
			//var formWidth = $("#formClosed").width(("#formClosed").width());
			//alert(formWidth);		
			$("a#closeComment").hide();				
			//$("#slider").animate( { left:"-" + formWidth + 'px'}, 600, "easeInExpo");
			$("#slider").animate( { left:"-683" + 'px'}, 600);
			$("a#postComment").show();				
			return false;
		});
	}

});

