// count files
host = window.location.hostname;
if (host == 'localhost') {
	localhost = true;
	rootPath = 'http://localhost:8888/Forum%20Landschaft/deutsch/html/';
} else {
	localhost = false;
	rootPath = 'http://www.forumlandschaft.ch/';
}

// Titelbild laden
function titelbild() {
	if (headimage) {
		
		// Spezielle seiten
		if (headimage == 'kontakt') {
			$('<img>').attr('src', rootPath+'_img/titelbilder/kontakt.png').appendTo('#titelbild div');
		} else {
			imagecontainer = $('<ul>').appendTo('#titelbild div');
			for (var i = 1; i <= allimages; i++){
				imgContainer = $('<li>').css('z-index', 100-i).appendTo(imagecontainer);
				
				$('<img>').attr('src', rootPath+'_img/titelbilder/titelbild-'+i+'.jpg').appendTo(imgContainer);
			};
		};
	} else {
		$('#titelbild').css('display', 'none');
	};
};

function titelbildMove() {
	stepWidth = $('#titelbild ul li').width();
	
	if (currentImg < allimages) {
		currentImg++;
	} else {
		currentImg = 1;
	}
	
	nextStep = (stepWidth*currentImg)-stepWidth;
		
	$('#titelbild ul').animate({
		left: -nextStep
	}, longTime);
	
};


function titelbildFade() {
	$('#titelbild').css('height', '180px');
	if (currentImg < allimages) {
		currentImg++;
		eq = currentImg -2;
	} else {
		currentImg = 1;
		eq = 0;
		
		$('#titelbild div ul li').css('display', 'block');
	}
		
	$('#titelbild div ul li:eq('+ eq +')').fadeOut(longTime);
};
