/// JavaScript Document
/// by frizbee.be

	$(document).ready(function(){
		
			/// activate fancybox for pictures
				
				$("a[rel=lightbox]").fancybox({
					'type'				: 'image',
					'padding'			: 10,
					'autoScale'			: true,
					'cyclic'			: true,
					'overlayOpacity'	: 0.7,
					'overlayColor'		: '#000000',
					'transitionIn'		: 'fade',
					'transitionOut'		: 'fade',
					'titlePosition' 	: 'inside',
					'titleShow'			: true,
					'resize'			: 'Auto'
				});
		
		/// activate click on chat button
			
			$('#chat-middle a').click(
				function()
				{
					window.open(request_prefix() + '_third_party/plugoo/index.php','beologicchat','width=290,height=320,scrollbars=no,toolbar=no,location=no,menubar=no,directories=no');
				}
			);
			
		/// get the request prefix from the hidden input field in the footer
			
			function request_prefix()
			{
				return $('#request_prefix').val();
			}
			
		/// validate the contact when submitting
			
			$('.contactform, .userform').validate({
				errorLabelContainer: $("#javascriptmessage"),
				wrapper: 'p'
			});
		
		/// activate datatable on faq
			
			$('#faq_table').dataTable({
				'sDom': '<"faqtable_top"fp>rt<"faqtable_bottom"i>',
				'sPaginationType': 'two_button',
				'iDisplayLength': 6,
				'bSort': false,
				'bStateSave': true,
				'oLanguage': {
					'sSearch': '',
					'sInfo': '_START_ - _END_ / _TOTAL_',
					'sInfoFiltered': '',
					'sZeroRecords': ''
				}
			});
			
		/// activate tooltip
			
			var newTextBoxDiv = $(document.createElement('div')).attr("id", 'tooltip');
			$('body').append(newTextBoxDiv);
			$('#tooltip').html("");
			$('#tooltip').hide();
			
			$('.showhovertext').click(function(event)
			{
				if($(this).attr('href') == '') return false;
			});
			
			$('.showhovertext').mousemove(function(e)
			{
				if($(this).attr('alt'))
				{
					$("#tooltip").html($(this).attr('alt'));
					$("#tooltip").show();
					$("#tooltip").css({
					top: (e.pageY + 10) + "px",
					left: (e.pageX + 10) + "px"
					});
				}
			});
		
			$('.showhovertext').mouseout(function(e)
			{
				$("#tooltip").hide();
			});
			
	});
