function pngAlpha() {

	if( navigator.appVersion.indexOf('MSIE 6.0') > 0 ) {

		var picId = 0;
		
		var overlayimage = 'bilder/spacer.png';

		while( picId < document.images.length ) {
	
			//Bildtyp ermitteln
			var ext = document.images[picId].src;
			ext = ext.substring(ext.length-3,ext.length);
			ext = ext.toLowerCase();

			if( ext == 'png' ) {

				var src = document.images[picId].src;
				var height = document.images[picId].height;
				var width = document.images[picId].width;

				document.images[picId].src = overlayimage;
				document.images[picId].height = height;
				document.images[picId].width = width;
				document.images[picId].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
	
			}

			++picId;
	
		}

	}
	
}

window.onload = pngAlpha;

box = {

	object: null,
	type: null,
	zIndex: 1,
	offsetX: 0,
	offsetY: 0,
	screenW: 0,
	screenH: 0,
	cursorX: 0,
	cursorY: 0,
	isIE: navigator.appName.indexOf("Explorer") != -1 ? true : false,
	fadeInStep: 20,
	fadeOutStep: 20,
	fadeTimers: new Array(),
	show: function (o) {
	
		document.getElementById(o).style.display = '';
		
	},
	hide: function (o) {
	
		document.getElementById(o).style.display = 'none';
	
	},
	fade: function(d, o) {

		clearTimeout(box.fadeTimers[o]);
		
		box.object = document.getElementById(o);
		
		if( box.object.style.display ) box.object.style.display = '';
		
		start = d == 'in' ? 0 : 100;
	
		opacity = box.isIE ? ( box.object.filters.length ? box.object.filters.alpha.opacity : start ) : ( Math.round(100 * box.object.style.opacity) ? Math.round(100 * box.object.style.opacity) : start );
		
		d == 'in' ? opacity += box.fadeInStep : opacity -= box.fadeOutStep;
		
		if( opacity < 1 ) opacity = 0;
		if( opacity > 100 ) opacity = 100;
		
		box.isIE ? box.object.style.filter = 'alpha(opacity='+opacity+')' : box.object.style.opacity = opacity/100;
		
		if( d == 'in' && opacity >= 100 ) {
		
			box.object = null;
			
			return;
			
		}
		else if( d == 'out' && opacity < 1 ) {
		
			box.object.style.display = 'none';
		
			box.object = null;
			
			return;
			
		}
		else box.fadeTimers[o] = setTimeout("box.fade('"+d+"', '"+o+"')", 20);


	},
	onTop: function(o) {

		box.object = document.getElementById(o);
		box.object.style.zIndex = box.zIndex;

		box.zIndex++;

	},
	enableSelection: function() {

		box.isIE ? document.onselectstart = new Function ('return true') : document.onmousedown = new Function ('return true');

	},
	disableSelection: function() {

		box.isIE ? document.onselectstart = new Function ('return false') : document.onmousedown = new Function ('return false');

	},
	move: function(o) {
	
		box.object = document.getElementById(o);
		box.disableSelection();
		box.type = 'move';
		
		box.offsetX = box.cursorX - box.object.offsetLeft + box.object.scrollLeft;
		box.offsetY = box.cursorY - box.object.offsetTop + box.object.scrollTop;
		
		//box.screenW = document.body.offsetWidth - box.object.offsetWidth;
		//box.screenH = document.body.offsetHeight - box.object.offsetHeight;

	},
	drag: function(o) {
	
		box.object = document.getElementById(o);
		box.disableSelection();
		box.onTop(o);
		box.type = 'drag';
		box.offsetX = box.cursorX - box.object.offsetLeft;
		box.offsetY = box.cursorY - box.object.offsetTop;
		box.screenW = document.body.offsetWidth - box.object.offsetWidth;
		box.screenH = document.body.offsetHeight - box.object.offsetHeight;

	},
	resize: function(o) {
	
		box.object = document.getElementById(o);
		box.disableSelection();
		box.onTop(o);
		box.type = 'resize';
		box.offsetX = box.cursorX - box.object.offsetWidth;
		box.offsetY = box.cursorY - box.object.offsetHeight;
		box.screenW = document.body.offsetWidth - ( ( box.object.offsetWidth + box.object.offsetLeft ) -  box.cursorX );
		box.screenH = document.body.offsetHeight - ( ( box.object.offsetHeight + box.object.offsetTop ) - box.cursorY );

	},
	capturePosition: function(e) {
	
		if( box.isIE ) e = window.event;
		
		box.cursorX = e.clientX;
		box.cursorY = e.clientY;
		
		if( box.type == 'drag' ) {

			if( box.cursorX - box.offsetX <= box.screenW ) box.object.style.left = ( box.cursorX - box.offsetX < 0 ? '0' : box.cursorX - box.offsetX ) + 'px';
			if( box.cursorY - box.offsetY <= box.screenH ) box.object.style.top = ( box.cursorY - box.offsetY < 0 ? '0' : box.cursorY - box.offsetY ) + 'px';

		}
		else if( box.type == 'resize' ) {

			if( box.cursorX <= box.screenW ) box.object.style.width = ( box.cursorX - box.offsetX < 100 ? '100' : box.cursorX - box.offsetX ) + 'px';
			if( box.cursorY <= box.screenH ) box.object.style.height = ( box.cursorY - box.offsetY < 100 ? '100' : box.cursorY - box.offsetY ) + 'px';
		
		}
		else if( box.type == 'move' ) {
			
			box.object.scrollLeft = box.offsetX - ( box.cursorX - box.object.offsetLeft );
			box.object.scrollTop = box.offsetY - ( box.cursorY - box.object.offsetTop );

		}
		
	},
	drop: function() {
	
		box.object = null;
		box.type = null;
		box.enableSelection();
		
	}
	
}

document.onmousemove = box.capturePosition;
document.onmouseup = box.drop;
/*
wmtt = null;

document.onmousemove = updateWMTT;

function updateWMTT(e) {

	if( e ) {
	
		offsexX = window.pageXOffset;
		offsetY = window.pageYOffset;
		
	}
	else {
		
		offsexX = document.documentElement.scrollLeft;
		offsetY = document.documentElement.scrollTop;
		
		e = window.event;
		
	}
		
	x = e.clientX + offsexX + 20 - ( document.body.offsetWidth - 950 )/2;
	y = e.clientY + offsetY + 30;
	
	if( wmtt != null ) {
		
		wmtt.style.left = x + "px";
		wmtt.style.top = y + "px";
		
	}
	
}

function showWMTT(id) {
	wmtt = document.getElementById(id); //
	wmtt.style.display = "block";
	
	box.fade('in', id);
}

function hideWMTT(id) {
	
	box.fade('out', id);
	
	wmtt.style.display = "none";
}
*/
