
function changeImagesArray(array) {
var preloadFlag = true;
	if (preloadFlag == true) {
		var d = document; var img;
		for (i=0;i<array.length;i+=2) {
			img = null; var n = array[i];
			if (d.images) {
				if (d.layers) {img = findElement(n,0);}
				else {img = d.images[n];}
			}
			if (!img && d.getElementById) {img = d.getElementById(n);}
			if (!img && d.getElementsByName) {
				var elms = d.getElementsByName(n);
				if (elms) {
					for (j=0;j<elms.length;j++) {
						if (elms[j].src) {img = elms[j]; break;}
					}
				}
			}
			if (img) {img.src = array[i+1];}
		}
	}
}
function changeImages() {
	changeImagesArray(changeImages.arguments);
}
function toggleImages() {
	for (var i=0; i<toggleImages.arguments.length; i+=2) {
		if (selected == toggleImages.arguments[i])
			changeImagesArray(toggleImages.arguments[i+1]);
	}
}


//-- Vorladen ---------------------------------------------
// Example:
// simPrel( '01.gif', '02.gif' ); 
function simPrel()
{ 
  var args = simPrel.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
	//alert(args[i]);
  }
}

//-- PopUp Center ---------------------------------------------
function WindowImagePopUp(zimage,alt) 
{
	// Bild laden
	o_img = new Image();
	o_img.src = zimage;
	
	// Bilddaten noch nicht vorhanden. Durch alert Zeit holen.
	if(o_img.width<20)
		alert("Bild laden?");

	// Bilddaten holen
	var imageWidth=o_img.width;
	var imageHeight=o_img.height;

	if(imageWidth<20 || imageHeight<20)
	{
		// Bildgröße noch nicht vorhanden, standart Bildgröße verwenden.
		imageWidth=400;
		imageHeight=400;		
	}
	
	var szTmp='';
	// Bild größer als Srceen -> Scrollbalken hinzu
	if((screen.width<imageWidth || screen.height<imageHeight))
	{
		szTmp='resizable=yes,scrollbars=yes,';
		if(screen.width<imageWidth)
			szTmp=szTmp+'width='+(screen.width-10)+',';
		else
			szTmp=szTmp+'width='+(imageWidth+16)+',';
		if(screen.height<imageHeight)	
			szTmp=szTmp+'height='+(screen.height-60)+',';
		else
			szTmp=szTmp+'height='+imageHeight+',';
	}
	else
		szTmp='width='+imageWidth+',height='+imageHeight+',';
	
	// Center-Position		
	var posLeft=L(imageWidth);
	if(posLeft<0)
		posLeft=0;
	var posTop=T(imageHeight);
	if(posTop<0)
		posTop=0;
	//window.status=posLeft+" :Left / Top: "+posTop;

	newWindow=window.open("","newWindow",""+szTmp+"left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>');
	newWindow.document.write('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
	newWindow.document.write(alt);
	newWindow.document.write('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
	newWindow.document.write('</title>');
	newWindow.document.write('<link href="../CSS/popup.css" rel="stylesheet" type="text/css">');
	newWindow.document.write('<body onBlur="self.close()" onClick="self.close()" >');
	newWindow.document.write('<img src='+zimage+' width='+imageWidth+' height='+imageHeight+' alt="close" >');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
	
	o_img.width=0;
	o_img.height=0;
}

function L(n)
{
	return ((screen.width/2)-(n/2)-15);
}

function T(n)
{
	return ((screen.height/2)-(n/2));
}
//-- Ende PopUp Center  ---------------------------------------------------------------