function toEnable()
{
	tot = window.setTimeout(function(){
		$("#clone").remove();
		},2000)
}

function toDisable()
{
	window.clearTimeout(tot);
}


var win= null;
	function NewWindow(mypage,myname,w,h,scroll)
	{
	  var winl = 100;
	  var wint = 80;
	  var settings  ='height='+h+',';
	      settings +='width='+w+',';
	      settings +='top='+wint+',';
	      settings +='left='+winl+',';
	      settings +='scrollbars='+scroll+',';
	      settings +='status=yes,';
	      settings +='resizable=yes';

	  win=window.open(mypage,myname,settings);
	  if(navigator.appName=='Netscape')
		{
		popup.focus()
		}
	}
	


$(document).ready(function(){
	
	var lbc = {
		fixedNavigation:true,
		txtImage: 'Bild',
		txtOf: 'von',
		imageLoading:images.loading,
		imageBtnPrev:images.prev,
		imageBtnNext:images.next,
		imageBtnClose:images.close,
		imageBlank:images.blank
	};
	
	$("div#newsPopup").draggable({delay:"0.4"})
		.children("a.newsPopupClose").click(function(){
			$(this).parents("div#newsPopup").hide();
		});
	$("div#newsPopup .fading").innerfade({
		containerheight: 380,
		timeout:5000,
		speed:2000
	});
	
	tot = null;


	$('.gallery a').lightBox(lbc);
	
	$('.lightbox1').lightBox(lbc);
	$('.lightbox2').lightBox(lbc);
	$('.lightbox3').lightBox(lbc);
	$('.lightbox4').lightBox(lbc);
	$('.lightbox5').lightBox(lbc);
	$('.lightbox6').lightBox(lbc);
	
	$(".box3 > a")
		.mouseover(function(){
			toDisable();
			$("#clone").remove();
			$(this)
				.next("div")
				.clone()
					.hide()
					.attr("id","clone")
					.css("position","absolute")
					.css("top",$(this).offset().top)
					.css("left",$(this).offset().left+$(this).outerWidth())
					.appendTo("body")
					.mouseover(toDisable)
					.mouseout(toEnable)
					.show()
		})
		.mouseout(toEnable)
		.eq(0)
			.click(function(e){
				e.preventDefault();
				e.stopPropagation();
			});
			
	$(".box2 > a")
		.mouseover(function(){
			toDisable();
			$("#clone").remove();
			$(this)
				.next("div")
				.clone()
					.hide()
					.attr("id","clone")
					.css("position","absolute")
					.css("top",$(this).offset().top)
					.css("left",$(this).offset().left-$(this).outerWidth(1))
					.appendTo("body")
					.mouseover(toDisable)
					.mouseout(toEnable)
					.show()
		})
		.mouseout(toEnable)
		.eq(6)
			.click(function(e){
				e.preventDefault();
				e.stopPropagation();
			});		
		
	$(".slideshow")
		.innerfade({
			containerheight: 258,
			timeout:5000,
			speed:"slow"
		});

	
	
	

		
	if($(".linkgen").length > 0)
	{
		jdata = false;
		
		$.get('index.php?id_page=1786&tpl=json&getrooms=1', function(data)
		{
		  	eval("jdata = "+data+";");
		  
			$(".linkgen > area")
				.each(function(i,elem)
				{
					$(this).attr("href","index.php?id_page=1786&pdf="+$(this).attr("alt"));
					$(this).attr("target","_blank");
				
					text = $(this).attr("alt")+' ('+jdata[$(this).attr("alt")]+' Zimmer)';
					
					
					$(this).attr("title",text);
					$(this).attr("alt",text);
				})		  
		});
	}	
});





