var currentImage = 1;
function nextImage(maxImages) {
	var nextImage;
	if(maxImages > currentImage) {
		nextImage = currentImage + 1;		
	} else {
		nextImage = 1;
	}
	
	if(nextImage != currentImage) {

		if(nextImage == maxImages) {
			$('#link_next').hide();
			$('#link_next_end').show();
		}			

		$('#image_' + currentImage).fadeOut(1000);
		$('#image_' + nextImage).fadeIn(1500);
		
		if(currentImage == 1) {
			$('#link_prev').fadeIn();
		}
	
	}
	
	currentImage = nextImage;
}

function prevImage(maxImages) {
	var nextImage;
	if(currentImage > 1) {
		nextImage = currentImage - 1;		
	} else {
		nextImage = maxImages;
	}
		
	if(nextImage != currentImage) {
		$('#image_' + currentImage).fadeOut(1000);
		$('#image_' + nextImage).fadeIn(1500);
		
		if(currentImage == maxImages) {
			$('#link_next').show();
			$('#link_next_end').hide();
		}			

		if(nextImage == 1) {
			$('#link_prev').fadeOut();
		}		
		
	}
	
	currentImage = nextImage;
}

function projectShowInfo() {
	$('#info_small').slideUp('fast', function() {
		$('#info_big').slideDown('fast');
	});
}

function projectHideInfo() {
	$('#info_big').slideUp('fast', function() {
		$('#info_small').slideDown('fast');
	});
}

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
function setContent() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentElement = document.getElementById('page');
			var contentHeight = contentElement.offsetHeight;
			if (windowHeight - contentHeight > 0) {
				contentElement.style.position = 'relative';
				contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
			}
			else {
				contentElement.style.position = 'static';
			}
		}
	}
}
/*window.onload = function() {
	map = new GMap2(document.getElementById("map"));
	geocoder = new GClientGeocoder();
	geocoder.setBaseCountryCode("de");
	map.setUIToDefault();
	map.setCenter(new GLatLng(37.4419, -122.1419), 13);

	//setContent();
}*/
window.onresize = function() {
	//setContent();
}		
