var J = jQuery.noConflict();

J(document).ready(function($){
	var x = 0;
	var y = 0;
	
	var screen_center_x = 0;
	var screen_center_y = 0;
	
	var max_offset_x = 250;
	var max_offset_y = 350;
	
	/** 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();
	
	if ($.cookie('showDragInfoInFuture') != 'false' ) {
		/* $("div#draginfo").css("display","block"); */
		$("div#draginfo").show();
	}
	
	$("div#draginfo").mouseover(function(){
		$(this).css('cursor','move');
	});
	
	$("div#draginfo").mouseout(function(){
		$(this).css('cursor','default');
	});
	
	$("div#draginfo-close").click(function(){
		closedraginfo();
	});
});

function closedraginfo() {
	J.cookie('showDragInfoInFuture', 'false', {path: '/'});
	
	/* J("div#draginfo").css("display","none"); */
	$("div#draginfo").hide('fast');
}


function openGallery() {
	jQuery("a[rel^='lightbox']").first().trigger(jQuery.Event("click")); 
}

function openGalleryItem(index) {
	jQuery("a[rel^='lightbox']").eq(index).trigger(jQuery.Event("click")); 
}
