

/**
 * Add commant for Add comment button
 */
function setupAddCommentHtml() {
	//-- show the comments list php include
	$('#commentsList').css("display","block");
	
	//-- append add comment section
	$('#mainContent').append(''+ 
		'<div id="addCommentContent" style="display:none;">' + 
        '  <h4>Add a comment</h4>' +
        '    <form>'+
        '      <div class="title">Your name ::</div><input id="commenterName" maxlength="255" type="text"  />' + 
        '      <div class="title">Your email ::</div><input id="commenterEmail" maxlength="255" type="text" />' + 
        '      <div class="title">Your web ::</div><input id="commenterWeb" maxlength="255" type="text" />' + 
        '      <div class="title">Message ::</div><textarea id="commenterMessage" maxlength="255" class="margin-bottom-smaller" ></textarea>' +
		'	   <div class="title">Are you a human ::</div><div class="inputs"><input type="radio" name="human" value="234wcswe2s1" /> No &nbsp;&nbsp;<input type="radio" name="human" value="q334fewwdww" checked="true" /> Not sure &nbsp;&nbsp;<input type="radio" name="human" value="q43efrwweww1" /> Yes </div>'+
        '      <a id="addComment" class="button">[Add]</a>' + 
        '    </form>' + 
        '</div>' 
	)
	
	
	//-- setup effects:
	var original = $('#addComment').css('color');
	setUpLinkEffects($('#addComment'), function() { 
		var col = 'rgb(17,51,68)';
		$(this).animate({
			'color': col
		},LINK_SPEED_IN);
	},function() { //mouseout
		$(this).animate({
			'color': original
		},LINK_SPEED_OUT);
	});
	
	//-- setup click:	
   	$('#addComment').click(function() { 
		var pageId = $('#pageInfo').attr("pageId");
		pageId = pageId + "";
		
		$('#addComment').css('display','none');
		
		$.ajax({
			type : 'POST',
			url: BASE_REQUEST_URL + 'dynamicPage/addComment',
			cache: false,
			data: {
				commenterMessage: $('#commenterMessage').val(),
				commenterName:  $('#commenterName').val(),
				commenterEmail: $('#commenterEmail').val(),
				commenterWeb: $('#commenterWeb').val(),
				human: $("input:radio[name=human]:checked").val(),
				id: pageId 
			},
			success: function(html) {
				
				if (BrowserDetect.browser == "Explorer"){
					window.location = BASE_URL + currentSection + currentSubSection;
				} else {
					openPage(BASE_URL + currentSection + currentSubSection);
				}
			},
			error: function (request, textStatus, errorThrown) {
				$('#addComment').css('display','block');
				openAlertDialog(request.responseText.toString())
			}
		});
		
		
	  
	});
}

/**
 * Makes the 'Add a Comment' button  show/hide the add comment form
 */
function setupShowAddCommentButton() {
	$('#mainBottom').append('' + 
		'<a class="button" id="showAddComment">[Comment]</a>'
	)
	
	//-- setup effects:
	var originalSize = $('#showAddComment').css('font-size');
	var original = $('#showAddComment').css('color');
	setUpLinkEffects($('#showAddComment'), function() { //mouseover for yellow links, to white
		var col = 'rgb(255,255,255)';
		var targetSize = parseInt(originalSize) + 1;
		$(this).animate({
			'color': col,
			
			'padding-top' : '0px',
			//'font-size' : targetSize + 'px',
		},LINK_SPEED_IN);
	},function() { //mouseout
		$(this).animate({
			'color': original,
			
			//'font-size' : originalSize,
			'padding-top' : '4px',
		},LINK_SPEED_OUT);
	});
	
	$('#showAddComment').click(function() {
		$("#addCommentContent").slideToggle(NORMAL_SPEED);
	});
}
