$(document).ready(function() {

	/* Using custom settings */
	
	$("a#inline").fancybox({
		'hideOnContentClick': true
	});

	$("a.group").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'overlayOpacity': .8,
		'overlayColor': '#000',
		'titlePosition':'inside'
	});
	$("a.illu").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'overlayOpacity': .8,
		'overlayColor': '#000',
		'titlePosition':'inside'
	});
	
		$("a[rel=li]").fancybox({
		'speedIn'		:	800, 
		'speedOut'		:	800, 
		'overlayShow'	:	true,
		'overlayOpacity': .8,
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">'+title+' <span class="bildn">Bild ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span></span>';
		}
	});
	
$("a[rel=lightboxslide]").fancybox({
		'speedIn'		:	800, 
		'speedOut'		:	800, 
		'overlayShow'	:	true,
		'overlayOpacity': .8,
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">'+title+' Bild ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
		}
	});
	
	$("a[rel=lightbox]").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'overlayOpacity': .8,
		'titlePosition' 	: 'over'
	});

	$("a.thickbox").fancybox({
		'width'				: '98%',
		'height'			: '98%',
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayOpacity': .8,
		'overlayColor': '#000',
		'centerOnScroll': true,
		'type'				: 'iframe'
	});
		$("a.thickboxrechner").fancybox({
		'width'				: 740,
		'height'			: 520,
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayOpacity': .8,
		'overlayColor': '#000',
		'centerOnScroll': true,
		'type'				: 'iframe'
	});
$("a.video").fancybox({
		'width'				: 500,
		'height'			: 420,
        'autoScale'     	: true,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'overlayOpacity': .8,
		'overlayColor': '#000',
		'centerOnScroll': true,
		'type'				: 'iframe'
	});
$("a.video2").fancybox({
		'width'				: 650,
		'height'			: 360,
        'autoScale'     	: true,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'overlayOpacity': .8,
		'overlayColor': '#000',
		'centerOnScroll': true,
		'type'				: 'iframe'
	});

$("a.nr").fancybox({
		'width'				: 740,
		'height'			: 320,
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayOpacity': .8,
		'overlayColor': '#000',
		'centerOnScroll': true,
		'type'				: 'iframe'
	});
	$("a.sofort").fancybox({
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayOpacity': .8,
		'overlayColor': '#000',
		'centerOnScroll': true,
		'titleShow':false,
		'type'				: 'iframe'
	});

		$("a.thickboxM").fancybox({
		'width'				: 680,
		'height'			: 500,
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayOpacity': .8,
		'overlayColor': '#000',
		'centerOnScroll': true,
		'type'				: 'iframe'
	});
	
	$("a.amazon").fancybox({
		'width'				: 750,
		'height'			: 600,
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayOpacity': .8,
		'overlayColor': '#000',
		'centerOnScroll': true,
		'type'				: 'iframe'
	});
	$("a.thickbox2").fancybox({
		'width'				: '75%',
		'height'			: '75%',
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayOpacity': .8,
		'centerOnScroll': true,
		'overlayColor': '#000',
		'type'				: 'iframe'
	});
	
	$("a.overlay-flash").fancybox({ 
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'overlayOpacity': .8,
		'overlayColor': '#000',
		'titlePosition':'inside'
}); 


	
});



$(document).ready(function() {
	$('a[href*=#holder],a[href*=#map]').bind("click", function(event) {
		event.preventDefault();
		var ziel = $(this).attr("href");

		$('html,body').animate({
			scrollTop: $(ziel).offset().top
		}, 500 , function (){location.hash = ziel;});
});


	$('a[href*=#artenp]').bind("click", function(event) {
		event.preventDefault();
		var ziel = $(this).attr("href");

		$('html,body').animate({
			scrollTop: $(ziel).offset().top
		}, 500 , function (){location.hash = ziel;});
});
	
$('div.hdiv, div.buch, .bs p, .down').hover(function() {
  		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
});	


	$('a[href*=#grab]').bind("click", function(event) {
		event.preventDefault();
		var ziel = $(this).attr("href");

		$('html,body').animate({
			scrollTop: $(ziel).offset().top
		}, 500 , function (){location.hash = ziel;});
});
return false;
});

var xmlDoc;
var fil = null;
var i = 0;
var writ;
//var d_name;


function getmessage(xml, dnamed){
	var bild;
	var title;
	var writ="";
	var i= 0;
$(xml).find("item").each(function()
  {
	 title =  $(this).find("title").text();
	 bild =  $(this).find("imagelink").text();
	 writ += "<a href=\""+bild+"\" rel=\"slide"+dnamed+"\" id=\""+bild+"\" target=\"_blank\" title=\""+title+"\"></a>";
	i++;
  });
	var slideName = "slide"+dnamed;
	var gg = "a[rel="+slideName+"]";
	//alert(writ);
	document.getElementById(slideName).innerHTML = writ;
$(gg).fancybox({
		'speedIn'		:	800, 
		'speedOut'		:	800, 
		'overlayShow'	:	true,
		'overlayOpacity': .8,
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    //return '<span id="fancybox-title-over">'+title+' Bild ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
			return '<span id="fancybox-title-over">'+title+ '<span style="font-size:80%;color:#333;margin-left:10px;"> Bild ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span></span>';
		}
	});
}

function getmessageBox(){
	var anzahl;
	var bild;
	var tit;
	var writ="";
						
	anzahl = xmlDoc.getElementsByTagName("item").length;
	while (i < anzahl){
		bild = xmlDoc.getElementsByTagName("bild")[i].childNodes[0].nodeValue;
		tit = xmlDoc.getElementsByTagName("title")[i].childNodes[0].nodeValue;
		writ += "<a href='images/gr/"+bild+".jpg' rel='lightbox_slide' id='"+bild+"' title='"+tit+"' target='_blank' >dddddd</a>";
		i++;
	}
		document.getElementById("slideBox").innerHTML = writ;
		$("a[rel=lightbox_slide]").fancybox({
		'speedIn'		:	800, 
		'speedOut'		:	800, 
		'overlayShow'	:	true,
		'overlayOpacity': .8,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">'+title+' Bild ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
		}
	});
}

function callFancy(m_href,titel) { 
	//var j1 = document.getElementById(id); 
	//j1.href = m_href; 
	//j1.title = titel;
	//alert(m_href+"   "+titel+"   "+  id);	
	/*alert(m_href+" "+titel+" "+ id);
	var ff = "#"+id;
	$(ff).fancybox(	{
				  		'speedIn'		:	800, 
		'speedOut'		:	800, 
		'overlayShow'	:	true,
		'overlayOpacity': .8,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none', 
		'titlePosition' 	: 'over','titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">'+title+' Bild ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
		}
	}).trigger('click'); */
	//alert(m_href);
	
	var j1 = document.getElementById(m_href); 
	//j1.href = m_href; 
	//j1.title = titel;
	$(j1).trigger('click'); 
} 

function sb(nr){

	var did = "#"+nr;
	$(did).trigger('click'); 
	}
var sit;
function setNav(nid){
	sit = nid;
	document.getElementById(nid).className = 'top_parent_n';
}
function in_n(nid) {
  document.getElementById(nid).className = 'top_parent_n';
}
function out_n(nid) {
	if(sit==nid){
		  document.getElementById(nid).className = 'top_parent_n';
	}
	else{
	  document.getElementById(nid).className = 'top_parent';
	}
}
