$(document).ready(function(){



$(function(){
    $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 650);
                return false;
            }
        }
    });
});


if (!(jQuery.browser.msie && jQuery.browser.version < 9)) {

	function update()
	{
		$('.page').css({minHeight : 'auto'});
		$('.page').css({height : 'auto'});
		$('.page').css({minHeight : $(window).height()+50});

		$('.page-content').each(function()
		{
			if ($(this).parent().height() > $(this).outerHeight())
			{
				$(this).css({top : $(this).parent().height()/2 - ($(this).outerHeight())/2-25});
			}
			else
			{
					$(this).css({top : 0});
			}
		});
		$('.slide').each(function(){
			$(this).css({float: 'left', width: $(this).parent().parent().width()});
		});
		
	}

	$(window).resize(update);
	update();
}
else
{
/*
IE < 9
*/
}


	$('#live').click(function(e){
		e.preventDefault();
		$('#live').before('<div id="plupper"><a id="plupper-close" href="#">Schnellkontakt schließen</a><iframe id="plupper-iframe"src="http://www.plupper.com/widget?p=vanbittern@plupper.com" /></div>');
		$('#plupper').hide();
		$('#plupper-iframe').load(function(){
			$('#plupper').fadeIn(500);
		});
		$('#plupper-close').click(function(e){
			$('#plupper').remove();
		});
	});

	
	$('.slide').css({float: 'left'});
	$('.slides-container').each(function(){
		$(this).width($('.slide', this).length+'00%');
	});
	
	$('.slide-link').click(function(e){
		e.preventDefault();
		
		$('.slides-container').animate({marginLeft:'-100%'}, 450);
		$($(this).attr('href')).parent().css;
		
		
	});

	
	$('a.impressum-link').click(function()
	{
		$('#impressum').slideDown();
		$('a.impressum-link').slideUp();
		window.setTimeout(update, 300);
	});
});

