function addComment(scene){
	var comment = $('newComment').value;
	var par = 'action=add&scene=' + scene + '&comment=' + escape(comment);

	if( comment == "" ){
		alert("Unable to add your comment since it contains no text.");
		return;
	}
        
	var ajax = new Ajax.Request( '/ajax/comment.php', {
                                    method: 'post',
                                    parameters: par,
                                    onLoading: function(request) {},
                                    onComplete: function(request) {
                                        
                                        Element.hide("newCommentContainer");
                                        Element.show("thankYouContainer");
                                                                                    
                                    },
                                    onFailure: function(request){} 
		} 
	);
        
}

function rateComment( member, scene, rating ){
        var par         = 'action=rate&member=' + member + '&scene=' + scene + '&rating=' + rating;
        var bump_rating = $(member).innerHTML;
                
        //window.location = "includes/comment_action.php?" + par;
        var ajax = new Ajax.Request( '/ajax/comment_action.php', {
                                    method: 'post',
                                    parameters: par,
                                    onLoading: function(request) {},
                                    onComplete: function(request) {
                                        try {
	                                        var new_rating = parseInt(bump_rating) + parseInt(rating);
	                                        if( parseInt(request.responseText) > 0 ){
	                                            $(member).innerHTML = new_rating;
	                                            if( new_rating < 0 ) {
	                                                $(member).className = "neg";
	                                            } else {
	                                               	$(member).className = "pos";
	                                            }
												//alert(request.responseText);
	                                        }
											else if( parseInt(request.responseText) < 0 ){
	                                            alert("You have already rated this comment.");
												//alert(request.responseText);
											}
											else {
	                                            alert("You have already rated this comment.");
												//alert(request.responseText);
	                                        }
                                        } catch (e) {alert('err');}
                                    },
                                    onFailure: function(request){} 
                                } 
                            );
        
    }
    
