$(document).ready(function() {
		
	if($("a[rel=fancy_group]").length>0){
		$("a[rel=fancy_group]").fancybox({
	
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Bild ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			}
	
		});	
	}

	$('#search').click(function () {
		$('#suche').slideToggle('slow');
	});
	
	$('.buchung').click(function () {
		var pid = "b_parent_"+this.id.substring(2,this.id.length);
		var fromAngebot = document.getElementById(pid).title;
		var thisHost = $(location).attr('host');
		if(fromAngebot!=null && fromAngebot!="undefined"){
			$.ajax({
			  type: "GET",
			  url: "http://"+thisHost+"/_conf/system/setFromAngebot.jsp?fromAngebot="+fromAngebot,
			  async: false,
			  success: function(){
			  	//alert("fertig "+pid+" "+fromAngebot);
			  },
			  error: function(){
			  	//alert("fehler");
			  }			  
			});		
		}
	});
	
});
