// Bildwechsel
function bildwechsel(id, src, title)
{
	$('#'+id).attr('src', src).attr('title', title).attr('alt', title);
}

function slideshow(id)
{
	$(document).ready(function()
	{	
		$('span.slideshow').overlay(
		{
			expose:
			{ 
		        color: '#000000', 
		        loadSpeed: 'slow',
		        closeSpeed: 'slow',
		        opacity: 0.7 
		    },
	
			closeOnClick: true,
			speed: 'fast'			
		
		});
	
	});
}

// Box ein- oder ausblenden
function box_visibility(bool)
{

	if(bool == 1)	{ $('#box').fadeIn('slow'); }
	else			{ $('#box').fadeOut('slow'); }
	
   // Resize Bug
   $(document).ready(function() { resize(); });
}


function url_encode(link)
{
	return str_replace("%20", "+", encodeURIComponent(link));
}

function str_replace(search, replace, subject)
{
	return subject.split(search).join(replace);
}

// Größenveränderung des Fensters überwachen
$(document).ready(function() { resize(); });
$(document).resize(function() { resize(); });
$(window).resize(function() { resize(); });

function resize()
{
	if($(window).height() < $(document).height())
	{
		$('#framework').css('height', $(document).height());
	}
	
	else
	{
		$('#framework').css('height', '100%');
	}
	
	if($(window).width() < 1100)
	{
		$('#framework').css('width', 1100);
		$('#box').css('margin-left', 0).css('left', 227);
		
	}
	
	else
	{
		$('#framework').css('width', '100%');
		$('#box').css('margin-left', -323).css('left', '50%');
	}
}

// in_der_flasche.html Div-Wechsel
var _cur = 'infotext';
var _curStat = 'hidden';

function flaschendaten()
{
	
	$('area').hide();
	
	$('area').mouseover(function()
	{
		
		
			
		if(_cur != this.id)
		{
		
			$('.' + _cur).stop(true, true).fadeOut(250);
			_cur = this.id;
			$('.' + _cur).stop(true, true).delay(250).fadeIn();
		}
	});
	
	if( $('.flasche li a').hasClass('active') == true )
	{ 
		if(_curStat != 'visible')
		{
			$('.infotext').hide().fadeIn();
		} 
		    			
		_curStat = 'visible';
		_cur = 'infotext';
	}

}

// interne Scrollbar
function scroll()
{
	$(function()
	{
		$('#scrollpane').jScrollPane(
		{
			showArrows:true,
			scrollbarWidth: 7,
			reinitialiseOnImageLoad: true,
			scrollbarMargin: 15
		});
	});
}
