var J = jQuery.noConflict();

J(document).ready(function($){
	if ( $.cookie('showDragInfoInFuture') != 'false' ) {
		var x = 0;
		var y = 0;

		var screen_center_x = 0;
		var screen_center_y = 0;

		var max_offset_x = 150;
		var max_offset_y = 250;

		/** Berechne Position der DragInfo **/
		if (parseInt(navigator.appVersion)>3) {
		 if (navigator.appName=="Netscape") {
			screen_center_x = window.innerWidth / 2;
			screen_center_y = window.innerHeight / 2;
		 }
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
			screen_center_x = document.body.offsetWidth / 2;
			screen_center_y = document.body.offsetHeight / 2;
		 }
		}
		x = screen_center_x + ((Math.random() * (2*max_offset_x)) - max_offset_x);
		y = screen_center_y + ((Math.random() * (2*max_offset_y)) - max_offset_y);

		$("div#draginfo").css("top", y + "px");
		$("div#draginfo").css("left", x + "px");

		$("div#draginfo").draggable();
		$("div#draginfo").show();

		$("div#draginfo").mouseover(function(){
			$(this).css('cursor','move');
		});

		$("div#draginfo").mouseout(function(){
			$(this).css('cursor','default');
		});

		$("div#draginfo_close a").click(function(e){
			$("div#draginfo").draggable("disable");
			$("div#draginfo").hide();

			/* Per Cookie speichern, dass Draginfo nicht mehr gezeigt werden soll */
			$.cookie('showDragInfoInFuture', 'false');

			e.preventDefault();
		});
	}
});
