

document.write(unescape("%3Cscript src='js/jquery.tabSlideOut.v1.3.js' type='text/javascript'%3E%3C/script%3E"));

if (typeof infoDialog != 'function') {
  document.write(unescape("%3Cscript src='js/helper.js' type='text/javascript'%3E%3C/script%3E"));
}

$(document).ready(function() {

	if ( (typeof include == "undefined" || !include)
		&& (typeof suppressFeedbackForm == "undefined")) {
  
  
  var feedback_label = "<b>" + lang__email + "</b><br><br><br><b>" + lang__message + "</b>";
  var feedback_mail_visible = "block";
  var feedback_message_padding_top = "8";
	var textarea_height = 100;
  
  if (typeof LOGGEDIN != 'undefined' && LOGGEDIN == "1") {
    feedback_label               = "<b>" + lang__message + ":</b>";
    feedback_mail_visible        = "none";
    feedback_message_padding_top = "15";
		textarea_height = 130;
  }
  
  var divString = '<div id="slide-out-div" class="slide-out-div">'+
                    '<div class="handle" style="cursor:  pointer;"  onmouseover="$(this).css(\'background\',\'url(images/feedback_over.png)\');" onmouseout="$(this).css(\'background\',\'url(images/feedback_raw.png)\');" >Content</div>'+
                    '<div id="slide-out-div-html" style="background-color:#ccc;border:1px solid black;color:black;width:340px;">'+

                      '<div style="padding:10px;background-color:#166eae;color:#ffffff;text-align:center;font-size:16px;font-weight:bold">' + lang__feedback_form_header + '</div>'+
                      '<br>'+
                      '<div style="padding-left:10px;padding-right:10px;padding-bottom:10px;color:black;">'+

                        '<div id="feedback_label" style=" width:70px;padding-left:12px;padding-top:'+feedback_message_padding_top+'px;height:120px;display:block;float: left;margin-top:12px;">'+feedback_label+'</div><br>'+

                        '<input id="feedback_email" style="margin-right:10px;width:220px;display:'+feedback_mail_visible+';#width:210px;">'+

                        '<textarea tabindex=10000 id="content_feedback" style="width:220px;height:' + textarea_height + 'px;margin-top:10px;margin-right:10px;font-size:12px;#width:210px;"></textarea>'+

	"<div style='margin-left: 132px; margin-top: 10px; padding: 5px;'>" +
	"<a id='feedback_submit_button' class='button' href='#' onclick='sendFeedbackForm(); return false;'>"+

	"<span style='' class='lbutton blueButtonBackground'></span>"+
	"<span tabindex=10001 style='font-size: 14px; font-weight: bold;' class='button blueButtonBackground'>" + lang__feedback_form_submit_button + "</span>"+
	"<span class='rbutton blueButtonBackground'></span>"+

	"</a></div>"+"<div style='clear: both'></div>" +
                      '</div>'+
                    '</div>'+
                  '</div>';
  
                  
  
  // Force infoDialogExistence                  
  if (document.getElementById('infoDialog') == 'undefined') {
    $('body').append('<div id="infoDialog"    style="display:none;z-index:100" title=""></div>');
  }

                  
                  
                  
                  
  $('body').append(divString);
	$('#feedback_submit_button').children().andSelf().keydown(function(e) { // Make pressing enter on the submit button work
																if (e.keyCode == 13) {
																	e.stopImmediatePropagation();
																	$('#feedback_submit_button').click();
																	return false;
																}
															});

  var topPos = (($(window).height()/2)-90) + "px";

	if ($('#dashboard').length > 0) {

		$(function(){ 
				$('.slide-out-div').tabSlideOut({
						tabHandle: '.handle',                     //class of the element that will become your tab
						pathToTabImage: 'images/feedback_raw.png', //path to the image for the tab //Optionally can be set using css
						imageHeight: '28px',                     //height of tab image           //Optionally can be set using css
						imageWidth: '120px',                       //width of tab image            //Optionally can be set using css
						tabLocation: 'right',                      //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: '20px',                          //position from the top/ use if tabLocation is left or right
						leftPos: '0px',                          //position from left/ use if tabLocation is bottom or top
						fixedPosition: true                      //options: true makes it stick(fixed position) on scroll
				});
		
		});

	} else {
  
		$(function(){ 
				$('.slide-out-div').tabSlideOut({
						tabHandle: '.handle',                     //class of the element that will become your tab
						pathToTabImage: 'images/feedback_raw.png', //path to the image for the tab //Optionally can be set using css
						imageHeight: '120px',                     //height of tab image           //Optionally can be set using css
						imageWidth: '28px',                       //width of tab image            //Optionally can be set using css
						tabLocation: 'right',                      //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: topPos,                          //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
				});
		
		});
  
	}
  
	}
  
});

function sendFeedbackForm() {
	if ($('#dashboard').length > 0) {
					$.prompt(lang__feedback_form_infodialog_text_after_submit, {
								"buttons": {'OK': true},
								"zIndex": 1000000,
								"prefix": 'jqi2', // if you change this (jqi2), change it in errorAddDomain as well!
								"show": "dropIn"

					});

	} else {
		infoDialog(lang__feedback_form_infodialog_title_after_submit, lang__feedback_form_infodialog_text_after_submit);
	}
  
	$.ajax({
	  url: API_URL+"/save_feedback.php?email="+$('#feedback_email').val()+"&message="+$('#content_feedback').val()+"&ref="+document.location.href,
	  cache: false,
	  dataType :"text"
	});					
  
  
}

