﻿function AddComment_Click() {
    // Validate the fields
    if ($F('frmPoster') == null || $F('frmPoster') == '') {
        Element.setStyle('frmPoster', {backgroundColor: '#ffcccc'});
    }
    if ($F('frmComment') == null || $F('frmComment') == '') {
        Element.setStyle('frmComment', {backgroundColor: '#ffcccc'});
    }
    
    // Redirect if fields validated
    if ( ($F('frmPoster') != null && $F('frmPoster') != '') && ($F('frmComment') != null && $F('frmComment') != '') ) {
        Modalbox.show('Comment-ThankYou.aspx', { 
		    title: 'Comment has been submited',
		    method: 'post',
		    params: Form.serialize('AddCommentForm')
	    });
    }     
}

