

;(function(a){a.fn.fullscreenr=function(b){if(b.height===undefined)alert("Please supply the background image height, default values will now be used. These may be very inaccurate.");if(b.width===undefined)alert("Please supply the background image width, default values will now be used. These may be very inaccurate.");if(b.bgID===undefined)alert("Please supply the background image ID, default #bgimg will now be used.");var c={width:1280,height:1024,bgID:"bgimg"};var b=a.extend({},c,b);a(document).ready(function(){a(b.bgID).fullscreenrResizer(b)});a(window).bind("resize",function(){a(b.bgID).fullscreenrResizer(b)});return this};a.fn.fullscreenrResizer=function(b){var c=b.height/b.width;var d=a(window).width();var e=a(window).height();var f=a("html").hasClass("no-canvas")&&window.Pixastic?25:0;if(e/d>c){a(this).height(e+f);a(this).width(e/c+f)}else{a(this).width(d+f);a(this).height(d*c+f)}a(this).css("left",(d-a(this).width())/2);a(this).css("top",(e-a(this).height())/2);if(d<1153){a("#missionstatement").css("margin-left",2)}else{a("#missionstatement").css("margin-left",157)}return this}})(jQuery)

var FullscreenrOptions = {  width: 1360, height: 765, bgID: '#bgimg' }; // You need to specify the size of your background image here (could be done automatically by some PHP code)

$(document).ready(function(){

	//Disable right mouse click
	$(document)[0].oncontextmenu = function() {return false;}

	// Detect if there is a broken DivX plugin
	// Giving the DivX extension time to set up
	setTimeout(function() {
		try {
			$("body").append("<div></div>");
		} catch (e) {
			alert("(EN) There is an error in your DivX Web Player Addon. Please update it with the following url:\n(DE) Es existiert ein Problem mit Ihrem DivX Web Player Addon. Wir bitten Sie, dieses unter folgendem Link zu aktualisieren:\n(IT) Esiste un problem con l'addon DivX Web Player. Si prega di aggiornare con il seguente link:\n\nhttp://www.divx.com");
		}
	}, 2000);

	// This will activate the full screen background!
	jQuery.fn.fullscreenr(FullscreenrOptions);

	$('a#pdf').click(function(){
		
		$.ajax({
			type: "POST",
			url: "ajax/pdf-toevoegen.php",
			data: { 
				pdf: $(this).attr('name')
			},
			success: function(data){

				if( !data.exists )
				{
					var pos = $('#pdf-icon-small').position();

					var gotoX 			= pos.left;
					var gotoY 			= pos.top;

					var newImageWidth 	= 8;
					var newImageHeight	= 10;

					$("a#pdf img")
					.clone()
					.prependTo("#container")
					.css({'position' : 'absolute', 'top' : 104, 'left' : 787})
					.animate({left: gotoX, top: gotoY, width: newImageWidth, height: newImageHeight}, 1200, function() {
						$(this).remove();
						var count = parseInt( $('#pdf-counter').html() );
						$('#pdf-counter').html( count + 1 );
					});
				}
				else
				{
					$('#container').append('<div id="pdf-already-exists"><span>' + data.message + '</span></div>');
					$('#pdf-already-exists').animate({width: 155}, 600, function(){
						setTimeout("closePdfExists()",3000);
					});
				}
			}
		});

		return false;
	});

});

function closePdfExists()
{
	$('#pdf-already-exists').animate({width: 0}, 600, function(){
		$('#pdf-already-exists').remove();
	});
}
