// JavaScript Document


$(document).ready(function(){	
						
	// prevent double click on submit buttons
	$('form').submit(function(){
		$(':submit', this).attr('disabled', 'disabled');
		$(':submit', this).click(function() {  
			return false;  
		});  
	});
	
	// show submit button if "agreeToTerms" is checked
	$('#agreeToTerms').click( function() {
		if($(this).is(':checked')) {
			//$('#save-comment-button').css('display','block');
			$('#save-comment-button').fadeTo(200, 1);
		} else {
			$('#save-comment-button').fadeTo(100, 0.01);
		}
	});
	
	// hide submit button 
	//$('#save-comment-button').hide();
	
	$('#save-comment-button').fadeTo(100, 0.01);
	
	// stop the enter button submissions
	$('input').keydown(function(e){
	  if (e.keyCode == 13) {
			$(this).parents('form').submit();
			return false;
	  }
	});
	 
	$('.replyToComment').click(function() {
		$('#cpid').val( $(this).attr('rel') );	
	});
	

});
