function lightMyFireLuguru(myBoxArray, myBoxGallery, position)
{
	myBox = document.getElementById('lightMyFire_box');
	myBg = document.getElementById('lightMyFire_bg');

	if(typeof(myBoxArray) != 'undefined')
	{
		var position = parseInt(position);
		var myBoxGallery = parseInt(myBoxGallery);

		preloadImages2(myBoxArray, myBoxGallery, position);
		myBg.style.display = "";

		// Höhe und Breite anpassen
		myBoxWidth = parseInt(myBoxArray[myBoxGallery][position][1]);
		myBoxHeight = parseInt(myBoxArray[myBoxGallery][position][2])+30;

		myBox.style.width = myBoxWidth+"px";
		myBox.style.height = myBoxHeight+"px";

		myMarginLeft = Math.round(myBoxArray[myBoxGallery][position][1]/2);
		myMarginTop = Math.round(myBoxArray[myBoxGallery][position][2]/2);

		myBox.style.marginTop = "-"+myMarginTop+"px";
		myBox.style.marginLeft = "-"+myMarginLeft+"px";

		myBoxInhalt = "<div style=\"position: absolute; width: 32px; height: 32px; left: 50%; top: 50%; margin-left: -16px; margin-top: -16px;\"><img src=\"images/loading.gif\"></img></div>";
		myBox.innerHTML = myBoxInhalt;
		Effect.Appear('lightMyFire_box');
    }

	else if(myBox.style.display == "")
	{
		myBg.style.display = "none";

		myBox.style.display = "none";
		myBox.innerHTML = "";
	}
}

function preloadImages2(myBoxArray, myBoxGallery, position)
{
	load_img = new Image();
	load_img.src = myBoxArray[myBoxGallery][position][0];

	load_img2 = new Image();
	load_img2.src = "images/closeBox.gif";

	timerid = setInterval("replace_img2(load_img, myBoxArray, '"+myBoxGallery+"', '"+position+"')", 1000);
}

function replace_img2(load_img, myBoxArray, myBoxGallery, position)
{
    if(load_img.complete)
	{
		var position = parseInt(position);
		var myBoxGallery = parseInt(myBoxGallery);

		clearInterval(timerid);
		myBox = document.getElementById('lightMyFire_box');

		var myBoxInhalt = "<div id=\"fadeMyBox\" style=\"display: none\">";
			// Inhalt aufbereiten
			myBoxInhalt += "<a href=\"javascript:;\" onclick=\"javascript: lightMyFireLuguru();\" title=\"close\"><img src=\"\" name=\"bild01\" id=\"bild01\" border=\"0\" width=\"100%\" height=\"100%\"></img></a>";
			myBoxInhalt += "<div style=\"position: absolute; left: 0px; top: 0px;\"><a href=\"javascript: lightMyFire();\" title=\"close\"><img src=\"images/closeBox.gif\" border=\"0\"></img></a></div>";

			myBoxInhalt += "<div style=\"position: absolute; left: 0px; bottom: 0px; background-color: #ffffff; width: 100%; height: 30px;\">";
				// Weiter Button
				myBoxInhalt += "<div style=\"float: right; margin-top: 7px;\">&nbsp;&nbsp;</div>";

				if(position < myBoxArray[myBoxGallery].length-1)
				{
					positionNext = position+1;
					myBoxInhalt += "<div style=\"float: right; margin-top: 7px;\"><a href=\"javascript: lightMyFireLuguru(myBoxArray, "+myBoxGallery+", "+positionNext+");\"><img src=\"images/arrow-right.gif\" border=\"0\"></img></a></div>";
				}
				// Zurück Button
				if(position >= 1)
				{
					positionBack = position-1;
					myBoxInhalt += "<div style=\"float: right; margin-top: 7px;\"><a href=\"javascript: lightMyFireLuguru(myBoxArray, "+myBoxGallery+", "+positionBack+");\"><img src=\"images/arrow-left.gif\" border=\"0\"></img></a></div>";
				}
			myBoxInhalt += "<div style=\"clear: both\"></div></div>";
		myBoxInhalt += "</div>";

		myBox.innerHTML = myBoxInhalt;
		document['bild01'].src = load_img.src;

		Effect.Appear('fadeMyBox');
    }
}











function lightMyFire(imgPath, imgWidth, imgHeight)
{
	myBox = document.getElementById('lightMyFire_box');
	myBg = document.getElementById('lightMyFire_bg');

	if(myBox.style.display == "none")
	{
		preloadImages1(imgPath);
		myBg.style.display = "";

		// Höhe und Breite anpassen
		myBox.style.width = imgWidth+"px";
		myBox.style.height = imgHeight+"px";

		myMarginTop = Math.round(imgHeight/2);
		myMarginLeft = Math.round(imgWidth/2);
		myBox.style.marginTop = "-"+myMarginTop+"px";
		myBox.style.marginLeft = "-"+myMarginLeft+"px";

		var myBoxInhalt = "<div style=\"position: absolute; width: 32px; height: 32px; left: 50%; top: 50%; margin-left: -16px; margin-top: -16px;\"><img src=\"images/loading.gif\"></img></div>";
		myBox.innerHTML = myBoxInhalt;

		Effect.Appear('lightMyFire_box');
    }

	else if(myBox.style.display == "")
	{
		myBg.style.display = "none";

		myBox.style.display = "none";
		myBox.innerHTML = "";
	}
}

function preloadImages1(imgPath)
{
	load_img = new Image();
	load_img.src = imgPath;

	load_img2 = new Image();
	load_img2.src = "images/closeBox.gif";

	timerid = setInterval("replace_img1(load_img)", 1000);
}

function replace_img1(load_img)
{
    if(load_img.complete)
	{
		clearInterval(timerid);
		myBox = document.getElementById('lightMyFire_box');

		var myBoxInhalt = "<div id=\"fadeMyBox\" style=\"display: none\">";
		myBoxInhalt += "<a href=\"javascript:;\" onclick=\"javascript: lightMyFire();\" title=\"close\"><img src=\"\" id=\"bild01\" name=\"bild01\" border=\"0\" width=\"100%\" height=\"100%\"></a></img>";
		myBoxInhalt += "<div style=\"position: absolute; left: 0px; top: 0px;\"><a href=\"javascript:;\" onclick=\"lightMyFire();\"><img src=\"images/closeBox.gif\" border=\"0\"></img></a></div>";
		myBoxInhalt += "</div>";

		myBox.innerHTML = myBoxInhalt;
		document['bild01'].src = load_img.src;

		Effect.Appear('fadeMyBox');
    }
}