// Globale Variable für die Funktion calculateWindow():
var fensterbreite, fensterhoehe, fensterscrollx, fensterscrolly, dokumenthoehe, dokumentbreite;

/****	
		Erläuterung: Calculate the window and change the position from the item
		Verknüpfungen von: frame,fielupload.php
		Verknüpfungen zu: -
		Objekte: -
		Variablen: fensterbreite, fensterhoehe, fensterscrollx, fensterscrolly
****/

function calculateWindow()
{
	// Fensterhoehe und -breite bestimmen:
	if (self.innerHeight) // all except Explorer
	{
		fensterbreite = self.innerWidth;
		fensterhoehe = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		fensterbreite = document.documentElement.clientWidth;
		fensterhoehe = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		fensterbreite = document.body.clientWidth;
		fensterhoehe = document.body.clientHeight;
	}
	
	//Scrollposition bestimmen:
	if (self.pageYOffset) // all except Explorer
	{
		fensterscrollx = self.pageXOffset;
		fensterscrolly = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		fensterscrollx = document.documentElement.scrollLeft;
		fensterscrolly = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		fensterscrollx = document.body.scrollLeft;
		fensterscrolly = document.body.scrollTop;
	}

	// Dokumenthoehe und -breite bestimmen:
	if (document.body.offsetHeight) // all except Explorer
	{
		dokumentbreite = document.body.offsetWidth;
		dokumenthoehe = document.body.offsetHeight;
	}
	else if (document.documentElement && document.documentElement.scrollHeight)
		// Explorer 6 Strict
	{
		dokumentbreite = document.documentElement.scrollWidth;
		dokumenthoehe = document.documentElement.scrollHeight;
	}
	else if (document.body) // all other Explorers
	{
		dokumentbreite = document.body.scrollWidth;
		dokumenthoehe = document.body.scrollHeight;
	}
	
	dokumenthoehe = Math.max(fensterhoehe, dokumenthoehe);
}

/****	
		Erläuterung: Controls glider with a play and stop button. It's only for the automatic function. 
		Verknüpfungen von: -
		Verknüpfungen zu: -
		Objekte: -
		Variablen: -
****/

automatic = true;

function stopSlide() {
	stopTimeout();
	my_glider.stop();
	html = '<a href="#" onclick="startSlide(); return false;">';
	html += '<img src="tl_files/images/landing/playSlide.png" title="播放">';
	html += '</a>';
	document.getElementById( "controlSlide" ).innerHTML = html;
	automatic = false;
}

function startSlide() {
	stopTimeout();
	my_glider.start();
	html = '<a href="#" onclick="stopSlide();return false;">';
	html += '<img src="tl_files/images/landing/stopSlide.png" title="停止">';
	html += '</a>';
	document.getElementById( "controlSlide" ).innerHTML = html;
	automatic = true;
}

/****	
		Erläuterung: Stops the automatic function for 10 sec. 
		Verknüpfungen von: -
		Verknüpfungen zu: -
		Objekte: -
		Variablen: -
****/

var varTime;

function startTimeout() {
	if (automatic == true) {
		my_glider.stop();
		stopTimeout();
		varTime = window.setTimeout("my_glider.start()", 10000);
	}
}

function stopTimeout() {
	window.clearTimeout( varTime );
}

$(document).ready(function(){
	$("a[rel^='prettyPhoto'], a[rel^='lightbox']").prettyPhoto();
});
