$(document).ready(function(){
    $('.slide-out-div').tabSlideOut({
            tabHandle: '.handle',                     //class of the element that will become your tab
            pathToTabImage: BASE_URL+ 'images/feedback.png', //path to the image for the tab //Optionally can be set using css
            imageHeight: '99px',                     //height of tab image           //Optionally can be set using css
            imageWidth: '45px',                       //width of tab image            //Optionally can be set using css
            tabLocation: 'left',                      //side of screen where tab lives, top, right, bottom, or left
            speed: 300,                               //speed of animation
            action: 'click',                          //options: 'click' or 'hover', action to trigger animation
            topPos: '184px',                          //position from the top/ use if tabLocation is left or right
            leftPos: '20px',                          //position from left/ use if tabLocation is bottom or top
            fixedPosition: false                      //options: true makes it stick(fixed position) on scroll
        });

    $("#submit_feedback").click(function(){
		$(".error_r").hide();
		var hasError = false;

		var subjectVal = $("#TopicTitle").val();
		if(subjectVal == '') {
			$("#TopicTitle").after('<span class="error_r">You forgot to enter the subject.</span>');
			hasError = true;
		}
		
		var emailVal = $("#TopicEmail").val();
		if(emailVal == '') {
			$("#TopicEmail").after('<span class="error_r">You forgot to enter the email address.</span>');
			hasError = true;
		}
		
		var messageVal = $("#TopicBody").val();
		if(messageVal == '') {
			$("#TopicBody").after('<span class="error_r">You forgot to enter the message.</span>');
			hasError = true;
		}

		if(hasError == false) {
			$(this).hide();
			$(".feedback_load").append('<img src="'+BASE_URL+'facebox/loading.gif" alt="Loading" id="loading" />');
			var current_pageVal = $('#current_page').val();
			$.post(BASE_URL+"feedback/slidefeedback",
   				{ subject: subjectVal, message: messageVal, current_page: current_pageVal },
   					function(data){
						$(".myformx").slideUp("normal", function() {
							$(".myformx").before('<h3>Success</h3><p>Thank you for the feedback.</p>');
						});
   					}
				 );
		}

		return false;
	});

});
