﻿	var fotobuecher = new Array();
	
	fotobuecher[0] = new fotobuch(26.95, 24, 16, 10);	// Fotobuch brillant A4 Panorama
	fotobuecher[1] = new fotobuch(24.95, 24, 16, 10);	// Fotobuch brillant Quadratisch 20x20
	
	fotobuecher[2] = new fotobuch(24.95, 24, 4, 2);		// Fotobuch digital A4
	fotobuecher[3] = new fotobuch(22.95, 24, 4, 2);		// Fotobuch digital Quadratisch
	fotobuecher[4] = new fotobuch(19.95, 24, 4, 1.50);	// Fotobuch digital A5 Hardcover
	fotobuecher[5] = new fotobuch(14.95, 24, 4, 1.50);	// Fotobuch digital A5 Softcover
	fotobuecher[6] = new fotobuch(9.95, 16, 4, 1.50);	// Fotobuch digital A5 Doppelt Geklammert
	fotobuecher[7] = new fotobuch(6.95, 16, 4, 1);		// Fotobuch digital A6 Einfach Geklammert
	
	fotobuecher[8] = new fotobuch(49.95, 24, 16, 20);	// Fotobuch brillant A3 Panorama
	fotobuecher[9] = new fotobuch(39.95, 24, 16, 16);	// Fotobuch brillant Quadratisch 30x30
	

// preise 2010 //
	fotobuecher[18] = new fotobuch(26.95, 24, 16, 10);	// Fotobuch brillant A4 Panorama matt 
	fotobuecher[19] = new fotobuch(24.95, 24, 16, 10);	// Fotobuch brillant Quadratisch 20x20 matt
	
	fotobuecher[10] = new fotobuch(24.95, 24, 4, 2);		// Fotobuch digital A4
	fotobuecher[11] = new fotobuch(22.95, 24, 4, 2);		// Fotobuch digital Quadratisch
	fotobuecher[12] = new fotobuch(19.95, 24, 4, 1.50);	// Fotobuch digital A5 Hardcover
	fotobuecher[13] = new fotobuch(14.95, 24, 4, 1.50);	// Fotobuch digital A5 Softcover
	fotobuecher[14] = new fotobuch(9.95, 16, 4, 1.50);	// Fotobuch digital A5 Doppelt Geklammert
	fotobuecher[15] = new fotobuch(6.95, 16, 4, 1);		// Fotobuch digital A6 Einfach Geklammert
	
	fotobuecher[16] = new fotobuch(49.95, 24, 16, 20);	// Fotobuch brillant A4 Panorama matt
	fotobuecher[17] = new fotobuch(39.95, 24, 16, 16);	// Fotobuch brillant Quadratisch 20x20 matt

	fotobuecher[20] = new fotobuch(59.95, 24, 16, 24);	// Fotobuch brillant A3 Panorama glanz
	fotobuecher[21] = new fotobuch(49.95, 24, 16, 20);	// Fotobuch brillant Quadratisch 30x30 glanz
	fotobuecher[22] = new fotobuch(32.95, 24, 16, 12);	// Fotobuch brillant A4 Panorama glanz
	fotobuecher[23] = new fotobuch(29.95, 24, 16, 12);	// Fotobuch brillant Quadratisch 20x20 glanz

	
	
	
	
	
	function recalculate_prices()
	{
		for (var i = 0; i < fotobuecher.length; i++)
		{
			var selectId = "fotobuchSelect" + i.toString();
			var divId = "fotobuchPrice" + i.toString();
			var bookId = i;
			
			var e = document.getElementById(selectId)
			var newValue = e.value;
			recalc_price (divId, bookId, newValue);
		}
	}

	function recalc_price(divId, bookId, newValue)
	{
		var gp = fotobuecher[bookId].grundpreis;
		var gs = fotobuecher[bookId].grundseiten;
		var st = fotobuecher[bookId].steigerung;
		var pst = fotobuecher[bookId].preissteigerung;
		
		var plusPages = newValue - gs;
		var plusPrice = plusPages / st;
		
		var newPrice = gp + (plusPrice * pst);
		var newPriceString = newPrice.toString();
		
		if (Math.floor(newPrice) == newPrice)
		{
			newPriceString += ",-&nbsp;&euro;*";		
		}
		else
		{
			newPriceString = newPriceString.replace(/\./, ",");
			newPriceString += "&nbsp;&euro;*";
		}
	
		var e = document.getElementById(divId);
		e.innerHTML = newPriceString;
		
	}


	function fotobuch(grundpreis, grundseiten, steigerung, preissteigerung)
	{
		this.grundpreis = grundpreis;
		this.grundseiten = grundseiten;
		this.steigerung = steigerung;
		this.preissteigerung = preissteigerung;
	}




















			var klopLayer = "";
			var klopBack = "";

			function hookLayerKlop(layerName, backLayer)
			{
				klopLayer = layerName;
				klopBack = backLayer;
				window.onload = klopOnLoad;
			}

			function hookLayerKlop2(layerName, backLayer)
			{
				klopLayer = layerName;
				klopBack = backLayer;
				window.onload = klopOnLoad2;
			}

			function klopOnLoad()
			{
				showLayer(klopLayer, klopBack);
			}

			function klopOnLoad2()
			{
				showLayerKlop(klopLayer, klopBack);
			}




			function closeLayer(layerName, backLayer)
 			{
				var l = document.getElementById(layerName);
				l.style.visibility = 'hidden';

				var o = document.getElementById(backLayer);
				o.style.visibility = 'hidden';
 			}

 			
  			function showLayer(layerName, backLayer)
 			{
 				var x,y;
				var test1 = document.body.scrollHeight;
				var test2 = document.body.offsetHeight
				var test3 = document.documentElement.clientHeight;
				var c_width1 = document.body.offsetWidth;
				var c_width2 = document.documentElement.clientWidth;

				if (window.pageYOffset)
				{
					var scrollPosition = window.pageYOffset;
				}
				else
				{
					if (document.body.scrollTop)
					{
						var scrollPosition = document.body.scrollTop;
					}
					else
					{
						if (document.documentElement.scrollTop)
						{
							var scrollPosition = document.documentElement.scrollTop;
						}
						else
						{
							var scrollPosition = 0;
						}
					}
				}
				
				if (test1 > test2) // all but Explorer Mac
				{
					x = document.body.scrollWidth;
					y = document.body.scrollHeight;
				}
				else // Explorer Mac;
				     //would also work in Explorer 6 Strict, Mozilla and Safari
				{
					x = document.body.offsetWidth;
					y = document.body.offsetHeight;
				}

				if (test3 > y)
				{
					y = test3;
				}
				
			 			
				y  = y + "px";
				
				c_width1 = c_width1 + "px";
				
				var o = document.getElementById(backLayer);
				o.style.height = y;
				o.style.width = c_width1;
				o.style.visibility = 'visible';
				
				var l = document.getElementById(layerName);
				var h = parseInt(l.offsetHeight);
				var yPos = Math.round((test3 - h ) / 2) + scrollPosition;
				yPos = yPos + "px";
				l.style.top = yPos;
				l.style.visibility = 'visible';

 			}
 
 
 
   			function showLayerKlop(layerName, backLayer)
 			{
 				var x,y;
				var test1 = document.body.scrollHeight;
				var test2 = document.body.offsetHeight
				var test3 = document.documentElement.clientHeight;
				var c_width1 = document.body.offsetWidth;
				var c_width2 = document.documentElement.clientWidth;

				if (window.pageYOffset)
				{
					var scrollPosition = window.pageYOffset;
				}
				else
				{
					if (document.body.scrollTop)
					{
						var scrollPosition = document.body.scrollTop;
					}
					else
					{
						if (document.documentElement.scrollTop)
						{
							var scrollPosition = document.documentElement.scrollTop;
						}
						else
						{
							var scrollPosition = 0;
						}
					}
				}
				
				if (test1 > test2) // all but Explorer Mac
				{
					x = document.body.scrollWidth;
					y = document.body.scrollHeight;
				}
				else // Explorer Mac;
				     //would also work in Explorer 6 Strict, Mozilla and Safari
				{
					x = document.body.offsetWidth;
					y = document.body.offsetHeight;
				}

				if (test3 > y)
				{
					y = test3;
				}
				
			 			
				y  = y + "px";
				
				c_width1 = c_width1 + "px";
				
				var o = document.getElementById(backLayer);
				o.style.height = y;
				//o.style.width = c_width1;
				o.style.visibility = 'visible';
				
				var l = document.getElementById(layerName);
				var h = parseInt(l.offsetHeight);
				var yPos = Math.round((test3 - h ) / 2) + scrollPosition;
				yPos = yPos + "px";
			//	l.style.top = yPos;
				l.style.visibility = 'visible';

 			}

 

function f_scrollTop() 
{
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

