
function showScreenShot(obj) {
	if(obj.href && objBody) {
		var arrayPageSize = getPageSize();

		var divP = document.createElement('div');
		divP.onclick = function() { hideElement('divPreview'); hideElement('divTable'); }
		divP.setAttribute('id', 'divPreview');
		divP.style.visibility = 'visible';
		divP.style.display = 'block';
		divP.style.position = 'absolute';
		divP.style.opacity = 0.9;
		divP.style.filter = 'alpha(opacity=90)';
		divP.style.MozOpacity = 0.9;
		divP.style.KhtmlOpacity = 0.9;
		divP.style.backgroundColor = '#000000';
		divP.style.left = '0px';
		divP.style.top = '0px';
		divP.style.width = arrayPageSize[2];
		divP.style.height = arrayPageSize[1];
		divP.style.textAlign = 'center';
		divP.style.verticalAlign = 'middle';
		divP.style.zIndex = 1;
		divP.style.backgroundColor = '#000000';

		objBody.insertBefore(divP, objBody.firstChild);

		var divT = document.createElement('div');
		divT.pageWidth = arrayPageSize[0];
		divT.onclick = function() { hideElement('divPreview'); hideElement('divTable'); }
		divT.setAttribute('id', 'divTable');
		divT.setAttribute('align', 'center');
		divT.setAttribute('valign', 'middle');
		divT.style.visibility = 'visible';
		divT.style.display = 'block';
		divT.style.position = 'absolute';
		divT.style.left = '0px';
		divT.style.top = objBody.scrollTop + 40;
		divT.style.width = 0;
		divT.style.height = 0;
		divT.style.overflow = 'hidden';
		divT.style.zIndex = 2;
		divT.style.textAlign = 'center';
		divT.style.verticalAlign = 'middle';
		divT.style.border = '0px';

		var imgP = document.createElement('img');
		imgP.setAttribute('src', '/images/loading.gif');
		imgP.setAttribute('border', 0);
		imgP.setAttribute('bgcolor', '#FFFFFF');
		imgP.style.backgroundColor = '#FFFFFF';

		var imgT = document.createElement('img');
		imgT.setAttribute('src', obj.href);
		imgT.setAttribute('border', 0);
		imgT.onload = function() { window.setTimeout( function() { moveDivToImg(imgP, imgT, divT); }, 1); }

		divT.appendChild(imgT);

		divT.appendChild(imgP);

		objBody.insertBefore(divT, objBody.firstChild);

		// window.setTimeout( function() { moveDivToImg(imgP, imgT, divT); }, 1);
		window.setTimeout( function() { newResize(); }, 1);
	}

	return false;
}

function moveDivToImg(obj0, obj1, obj2) {
	if(obj1.height && obj2.style.height) {
		obj2.style.width = parseInt(obj1.width);
		obj2.style.left = (parseInt(obj2.pageWidth) - parseInt(obj2.style.width)) / 2;

		if(parseInt(obj1.height) > parseInt(obj2.style.height)) {
			var dif = parseInt(obj1.height) - parseInt(obj2.style.height);
			var add = parseInt(parseInt(dif) / 10);
			if(add <= 0) add = 1;

			obj2.style.height = parseInt(obj2.style.height) + parseInt(add);

			window.setTimeout( function() { moveDivToImg(obj0, obj1, obj2); }, 1);
		} else {
			obj2.style.height = parseInt(obj1.height);
			if(obj0 != false) obj2.removeChild(obj0);
		}
	}
}

function hideElement(elem) {
	var obj = document.getElementById(elem);
	if(obj && objBody) {
		objBody.removeChild(obj);
	}
}

function delay(){
	opacity += 0.02;
	myA.style.filter = 'alpha(opacity='+(opacity*100)+')';
	myA.style.MozOpacity = opacity;
	myA.style.KhtmlOpacity = opacity;
	myA.style.opacity = opacity;

	if(opacity < 0.5) window.setTimeout('delay()', 1);
}

function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth - 18;
		yScroll = window.innerHeight + window.scrollMaxY - 18;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {
		windowWidth = self.innerWidth - 18;
		windowHeight = self.innerHeight - 18;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	var pageWidth, pageHeight;

	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	var arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
	return arrayPageSize;
}

function newResize() {
	var arrayPageSize = getPageSize();
	var obj1 = document.getElementById('divPreview');
	if(obj1) {
		obj1.style.width = arrayPageSize[2];
		obj1.style.height = arrayPageSize[1];
	}

	var obj2 = document.getElementById('divTable');
	if(obj2) {
		if(arrayPageSize[3] > parseInt(obj2.style.height)) {
			obj2.style.top = objBody.scrollTop + 40;
		}
		obj2.style.left = (parseInt(arrayPageSize[0]) - parseInt(obj2.style.width)) / 2;
	}

	if(obj1 && obj2) {
		window.setTimeout('newResize()', 1);
	}
}

function videoWindow(file) {
	var strReturn = '';

	strReturn = strReturn + '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="800" height="600" id="Mein Video 2" align="middle">';
	strReturn = strReturn + '<param name="allowScriptAccess" value="sameDomain" />';
	strReturn = strReturn + '<param name="allowFullScreen" value="true" />';
	strReturn = strReturn + '<param name="movie" value="player.swf?filename='+file+'" />';
	strReturn = strReturn + '<param name="loop" value="false" />';
	strReturn = strReturn + '<param name="menu" value="false" />';
	strReturn = strReturn + '<param name="quality" value="high" />';
	strReturn = strReturn + '<param name="wmode" value="opaque" />';
	strReturn = strReturn + '<param name="bgcolor" value="#ffffff" />';
	strReturn = strReturn + '<embed src="player.swf?filename='+file+'" loop="false" menu="false" quality="high" wmode="opaque" bgcolor="#ffffff" width="640" height="422" name="Mein Video 2" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_de" />';
	strReturn = strReturn + '</object>';

	return strReturn;
}

function showVideo(obj) {
	if(obj.href && objBody) {
		var arrayPageSize = getPageSize();

		var divP = document.createElement('div');
		divP.onclick = function() { hideElement('divPreview'); hideElement('divTable'); }
		divP.setAttribute('id', 'divPreview');
		divP.style.visibility = 'visible';
		divP.style.display = 'block';
		divP.style.position = 'absolute';
		divP.style.opacity = 0.9;
		divP.style.filter = 'alpha(opacity=90)';
		divP.style.MozOpacity = 0.9;
		divP.style.KhtmlOpacity = 0.9;
		divP.style.backgroundColor = '#000000';
		divP.style.left = '0px';
		divP.style.top = '0px';
		divP.style.width = arrayPageSize[2];
		divP.style.height = arrayPageSize[1];
		divP.style.textAlign = 'center';
		divP.style.verticalAlign = 'middle';
		divP.style.zIndex = 1;
		divP.style.backgroundColor = '#000000';

		objBody.insertBefore(divP, objBody.firstChild);

		var divT = document.createElement('div');
		divT.pageWidth = arrayPageSize[0];
		divT.setAttribute('id', 'divTable');
		divT.setAttribute('align', 'center');
		divT.setAttribute('valign', 'middle');
		divT.style.visibility = 'visible';
		divT.style.display = 'block';
		divT.style.position = 'absolute';
		divT.style.left = (arrayPageSize[2] - 640) / 2;
		divT.style.top = objBody.scrollTop + 40;
		divT.style.width = 640;
		divT.style.height = 422;
		divT.style.overflow = 'hidden';
		divT.style.zIndex = 2;
		divT.style.textAlign = 'center';
		divT.style.verticalAlign = 'middle';
		divT.style.border = '0px';
		divT.innerHTML = videoWindow(obj.href);
		// alert(divT.innerHTML);

		objBody.insertBefore(divT, objBody.firstChild);

		window.setTimeout( function() { newResize(); }, 1);
	}

	return false;
}

if(window.onresize) {
	window.onresize = newResize;
}

var objBody;
window.onload = function () { objBody = document.getElementById('body'); }

