<!--

var HideMenuTimer;

navlayer= new Array();
navlayer[0]="menu00";
navlayer[1]="menu01";
navlayer[2]="menu02";
navlayer[3]="menu03";
navlayer[4]="menu04";
navlayer[5]="menu05";
navlayer[6]="menu06";
navlayer[7]="menu07";

function OW_hideLayerDelay(obj)
{
	HideMenuTimer = setTimeout("OW_hideLayer('"+obj+"')", 500);
}

function OW_hideNavLayers() { 
	OW_clearDelay();
	for (i=0; i<navlayer.length;i++)
	  	{
	  		if (MM_findObj(navlayer[i])!=null)
	  		{
	  			otherobj=MM_findObj(navlayer[i]);
	  			if (otherobj.style) 
	    			{ 
	    				otherobj=otherobj.style;
	    			}
    				otherobj.visibility="hidden";
			}
	  	} 
}

function OW_clearDelay()
{
	if (HideMenuTimer) clearTimeout(HideMenuTimer);
	HideMenuTimer = null;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function OW_showLayer(obj) { 
    if ((objloc=MM_findObj(obj))!=null) 
  	{ 
      		if (objloc.style) 
    			{ 
    				objloc=objloc.style;
    			}
    		objloc.visibility="visible";
    }
}

function OW_hideLayer(obj) { 
    if ((objloc=MM_findObj(obj))!=null) 
  	{ 
      		if (objloc.style) 
    			{ 
    				objloc=objloc.style;
    			}
    		objloc.visibility="hidden";
    }
}

var picture_galleries = new Array();
var interval = null;
var fading = false;

function startSlideshow( gallery_id ) {
	if (interval) {
		window.clearInterval( interval );
		interval = null;
		$('gallery_'+gallery_id+'_btn_start').innerHTML = 'Slideshow starten';
	} else {
		interval = window.setInterval('galleryNext(\''+gallery_id+'\', true)', 5000);
		window.setTimeout("galleryNext( '"+gallery_id+"', true);", 2000);

		$('gallery_'+gallery_id+'_btn_start').innerHTML = 'Slideshow stoppen';
	}
}

function galleryNext( gallery_id, automatic ) {

	if (fading) return;
	
	gallery_id = parseInt(gallery_id);
	
	if (interval && !automatic) {
		window.clearInterval( interval );
		interval = null;
		$('gallery_'+gallery_id+'_btn_start').innerHTML = 'Slideshow starten';
	}
	
	var all_pics = $('gallery_'+gallery_id+'_pic_container').childElements();

	picture_galleries[gallery_id].current_pic++;
	if (automatic) {
		if ( (picture_galleries[gallery_id].current_pic) > picture_galleries[gallery_id].total_pics ) {
			picture_galleries[gallery_id].current_pic = 1;
			$('gallery_'+gallery_id+'_btn_prev').hide();
			$('gallery_'+gallery_id+'_btn_next').show();
			var pic_current_ref = all_pics[picture_galleries[gallery_id].total_pics-1];
			var pic_to_load_ref = all_pics[picture_galleries[gallery_id].current_pic-1];
		} else {
			var pic_current_ref = all_pics[picture_galleries[gallery_id].current_pic-2];
			var pic_to_load_ref = all_pics[picture_galleries[gallery_id].current_pic-1];
		}
	} else {
		if ( (picture_galleries[gallery_id].current_pic) > picture_galleries[gallery_id].total_pics ) {
			picture_galleries[gallery_id].current_pic--;
			return;
		}
		var pic_current_ref = all_pics[picture_galleries[gallery_id].current_pic-2];
		var pic_to_load_ref = all_pics[picture_galleries[gallery_id].current_pic-1];
	}

	// Check if next picture was already loaded, else wait until it is
	if (!pic_to_load_ref.down('img').loaded) {
		$('gallery_'+gallery_id+'_indicator').show();
		window.setTimeout('galleryNext(\''+gallery_id+'\')',100);
		return;
	}

	$('gallery_'+gallery_id+'_indicator').hide();
	
	pic_to_load_ref.setOpacity(0);
	pic_to_load_ref.setStyle({visibility:'visible'});
	
	$('gallery_'+gallery_id+'_pagecounter').innerHTML = picture_galleries[gallery_id].current_pic;
	
	if (picture_galleries[gallery_id].current_pic!=1) {
		$('gallery_'+gallery_id+'_btn_prev').show();
	}
	
	if (picture_galleries[gallery_id].current_pic==picture_galleries[gallery_id].total_pics) {
		$('gallery_'+gallery_id+'_btn_next').hide();
	}
	
	crossFade( pic_current_ref, pic_to_load_ref, .5 );

}

function galleryPrevious( gallery_id ) {
	
	if (fading) return;
	
	if (interval) {
		window.clearInterval( interval );
		interval = null;
	}

	var all_pics = $('gallery_'+gallery_id+'_pic_container').childElements();
	
	if ( (picture_galleries[gallery_id].current_pic-1) < 1 )
		return;
		
	picture_galleries[gallery_id].current_pic--;
	$('gallery_'+gallery_id+'_pagecounter').innerHTML = picture_galleries[gallery_id].current_pic;
	
	$('gallery_'+gallery_id+'_btn_next').show();
	
	if (picture_galleries[gallery_id].current_pic==1) {
		$('gallery_'+gallery_id+'_btn_prev').hide();
	}
	
	var pic_current_ref = all_pics[picture_galleries[gallery_id].current_pic];
	var pic_to_load_ref = all_pics[picture_galleries[gallery_id].current_pic-1];

	crossFade( pic_current_ref, pic_to_load_ref, .5 );
	
}

function crossFade( current_element, next_element, duration ) {
	
	if (!duration) duration = 1;
	
	fading = true;
	
	Effect.Fade( current_element, { duration:duration, from:1.0, to:0.0 } );
	Effect.Appear( next_element, { duration:duration, from:0.0, to:1.0, afterFinish:function(){fading=false;} } );
	
}

window.onload = function() {
	if (navigator.appVersion.indexOf('MSIE 6')!=-1) {
		document.body.className = 'ie6';
	}
	if (navigator.appVersion.indexOf('MSIE 7')!=-1) {
		document.body.className = 'ie7';
	}
	if (navigator.appVersion.indexOf('AppleWebKit')!=-1) {
		document.body.className = 'safari';
	}
}
//-->