// JavaScript Document


    $(function()			   
    {
        var slide = $('.slide-out-div').tabSlideOut({
            tabHandle: '.handle',                     //class of the element that will become your tab
            pathToTabImage: 'images/feedbacktab.gif', //path to the image for the tab //Optionally can be set using css
            imageHeight: '122px',                     //height of tab image           //Optionally can be set using css
            imageWidth: '40px',                       //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: 'hover',                          //options: 'click' or 'hover', action to trigger animation
            topPos: '200px',                          //position from the top/ use if tabLocation is left or right
            leftPos: '20px',                          //position from left/ use if tabLocation is bottom or top
            fixedPosition: true                      //options: true makes it stick(fixed position) on scroll
        });
	
		$('#feedback_button').click(function()
		{  
			  var email = $("input#feedback_email").val();
			  var message = $("textarea#feedback_message").val();
			  var response_message = "Vielen Dank !"
	   		  var error_mail = "Bitte geben Sie Ihre eMail-Adresse ein !";
			  var error_nachricht = "Bitte geben Sie eine Nachricht ein !";
			  
			  if ( email.length == 0  || email.indexOf("@") == -1 )
			  {
				  $('#form-wrap').html("<p><font color='#b3091a'>" + error_mail +"</font></p>")
				  .hide()
				  .fadeIn(500)
				  .animate({opacity: 1.0}, 1000)
				  .fadeOut("slow");
				  return false;
			  }
			  
			  if (email.indexOf("@") == -1 )
			  {
				  $('#form-wrap').html("<p><font color='#b3091a'>" + error_mail_valid +"</font></p>")
				  .hide()
				  .fadeIn(500)
				  .animate({opacity: 1.0}, 1000)
				  .fadeOut("slow");
				  return false;
			  }
			  if ( message.length == 0 )
			  {
				  $('#form-wrap').html("<p><font color='#b3091a'>" + error_nachricht +"</font></p>")
				  .hide()
				  .fadeIn(500)
				  .animate({opacity: 1.0}, 1000)
				  .fadeOut("slow");
				  return false;
			  }
	
			  var dataString = 'email=' + email + '&message=' + message;
	   
			  $.ajax
			  ({
				type: "POST",
				url: "ajax/send_feedback.php",
				data: dataString,
				success: function() 
				{
				  $('#form-wrap').html("<p><font color='#1167c8'>" + response_message +"</font></p>")
				//  $('#response-message').html("<p><font color='#1167c8'>" + response_message +"</font></p>")
				  .hide()
				  .fadeIn(500)
				  .animate({opacity: 1.0}, 1000)
				  .fadeOut("slow");
				  
				  $("input#feedback_email").val("");
				  $("textarea#feedback_message").val("");
/*				  .fadeIn(0, function(){
					  $('.slide-out-div')
					  .animate({left:'-' + (feedbackTab.containerWidth + feedbackTab.tabWidth)}, 
					  (feedbackTab.speed))
					  .removeClass('open');
				  })*/
				}
			  });
			 // slide.slideOut();
			  return false;
   		});
    });


