﻿var xpos = 0;
var ypos = 0;
var tpos = 0;

function bildwechsel() {
	var $alt = $('#hg img.hoben');
	var $neu = $alt.next().length ? $alt.next() : $('#hg img:first');
	$alt.addClass('hmitte');
	$alt.removeClass('hoben');
	$neu.css({opacity: 0.0});
	$neu.css({top: ypos});
	$neu.css({left: xpos});
	$neu.addClass('hoben');
	$neu.animate({opacity: 1.0}, 2000, function() {
			$alt.removeClass('hmitte');
			$alt.css({left: 5000});
	});
}
function set_hg(start) {
	hgh = screen.availHeight;
	if(document.body.clientHeight){
		hgh = document.body.clientHeight;
	}
	if(window.innerHeight){
		hgh = window.innerHeight;
	}
	if(document.documentElement.clientHeight){
		hgh = document.documentElement.clientHeight;
	}
	tpos = Math.max(0,(hgh-800)/2);
	$('.hoben').css({left: xpos});
	$('.hoben').css({top: ypos});
	$('#innen').css({'margin-top': 0});
	$('#innen').css({top: tpos});
	if(start==1){
		setInterval( "bildwechsel()", 7000 );
	}
}
$(document).ready(function() {
	set_hg(1);
	var api = $('#content').jScrollPane(
		{
			verticalDragMinHeight: 18,
			verticalDragMaxHeight: 18,
			horizontalDragMinWidth: 18,
			horizontalDragMaxWidth: 18,
			//autoReinitialise: true
		}
	).data('jsp');
	if(api.getIsScrollableV()==true)
		window.setTimeout(function(){api.reinitialise()}, 1000);
});
$(window).resize(function() {
	set_hg(0);
});

