$(document).ready(function() {

	$("a#single_image").fancybox();
	
	/* 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=lightbox[raum]]").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>';
		}*/
	});
		
	$("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'
	});
	$("#hidden_link2").fancybox({
		'width'				: 600,
		'height'			: 520,
        '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.all").fancybox({
		'width'				: '90%',
		'height'			: '90%',
        '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]').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, div.line').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;
function importXML(file, art){
if (window.ActiveXObject)
        {
        xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async=false;
        xmlDoc.load(file);
        //getmessage();
			if(art==1){
					getmessageBox();
			}
			else{
					getmessage();
			}
        }
      else if (document.implementation && document.implementation.createDocument)
        {
        xmlDoc=document.implementation.createDocument("","",null);
        xmlDoc.load(file);
			if(art==1){
				xmlDoc.onload=getmessageBox;
			}
			else{
				xmlDoc.onload=getmessage;
			}
        }
      else
        {
        alert('Script wird nicht unterstuetzt');
        }
}
function getmessage(xml, dnamed){
	var bild;
	var writ="";
	var i= 0;
	//alert(xml+"----"+dnamed);
$(xml).find("item").each(function()
  {
	 bild =  $(this).find("imagelink").text();
	 writ += "<a href=\""+bild+"\" rel=\"slide"+dnamed+"\" id=\""+bild+"\" target=\"_blank\" title=\"\"></a>";
	i++;
  });
	var slideName = "slide"+dnamed;
	var gg = "a[rel="+slideName+"]";
	document.getElementById(slideName).innerHTML = writ;
	//alert(document.getElementById(slideName));
$(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"> Bild ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</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' ></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('hiddenc'); 
	j1.href = m_href; 
	j1.title = titel;
	//alert(m_href+"   "+titel+"   "+  j1);
	//alert(m_href+"---"+titel+"----"+id);
	var ff = "#hiddenc";
	$(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'); 
	*/
	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';
	}
}
