var language;			// Aktuelle Sprachevar box_id_act;		// Die aktuelle gesamte Infoboxvar request_act;		// Der aktuelle/laufende Requestvar request_act_structure; // Der aktelle/laufende Request der sec. Navivar box_height;			// Die aktuelle Höhe der Infoboxvar infobox_last;		// Die zuletzt geldadene Infobox (Level2-abhängig, da jedes <li> eine Infobox als Children hat)var infobox_act;		// Die aktuelle Infobox (Level2-abhängig, da jedes <li> eine Infobox als Children hat)var infobox_structure;var loading_anim_act;	// Die aktuelle Ladeanimation (Level2-abhängig, da jedes <li> eine Infobox als Children hat)var product_button;		// Der "zum Produkt"-Button, der zur aktuellen Infobox gehört.var product_id;			// Der Link zum aktuellen Produktvar last_content;		// Der Inhalt des aktuellen Produktsvar last_structure;var act_id;var product;			// Produkt oder Produktseitevar loading = false;	// Ladestatusvar loading_structure = false; // Ladestatus der sec. Navivar path_to_images = "http://www.oase-livingwater.com/wg/preview/data/templates/set_classic/images/";/** * Ajax.Request.abort * extend the prototype.js Ajax.Request object so that it supports an abort method * Thanks to Steven Pothoven for this solution */Ajax.Request.prototype.abort = function() {    // prevent and state change callbacks from being issued    this.transport.onreadystatechange = Prototype.emptyFunction;    // abort the XHR    this.transport.abort();    // update the request counter    Ajax.activeRequestCount--;};//	Navipunkte ein- und ausblendenfunction NaviToggle( myitem , myclass , mytag ) {var elements = document.getElementsByTagName(mytag);for (var i=0; i<elements.length; i++)    {		var myelement = elements[i];			    if ((myelement.className == myclass) && (myelement.getAttribute("id") == myitem))        {        	if (myelement.style.display == "none")				{					myelement.style.display = "block";					document.getElementById(myitem + "_button").style.backgroundImage = "url(" + path_to_images + "arrow_navi_down_select-trans.png)";					document.getElementById(myitem + "_button").style.backgroundColor = "#cce5ff";				}						else				{					myelement.style.display = "none";					document.getElementById(myitem + "_button").style.backgroundImage = "url(" + path_to_images + "arrow_navi_down-trans.png)"					document.getElementById(myitem + "_button").style.backgroundColor = "";				}		}				else if (myelement.className == myclass)			{				myelement.style.display = "none";			}    }var buttons = document.getElementsByTagName("div");for (var i=0; i<buttons.length; i++)    {   	var button = buttons[i];	var button_id = button.getAttribute("id");	    if (button_id != null)        {			if ((button_id.match("_button")) != null)				{					if (button_id != (myitem + "_button"))						{							document.getElementById(button_id).style.backgroundImage = "url(" + path_to_images + "arrow_navi_down-trans.png)";							document.getElementById(button_id).style.backgroundColor = "";						}				}		}	}}// Ajax - Produktinfos in die erw. Navigation ladenfunction updateProductPage(new_id , new_link , lid)	{				if ("product_left_" + new_id != infobox_act)			{					product = false;	// Produktseite								// Den letzten Menüpunkt deaktivieren				selectButton(false);								// Alle Aufklappmenüs des vorherigen Fensters schließen				// NaviToggle( "blank" , "category_content" , "ul" );								// Gib die Höhe der Infobox frei				fixBoxHeight(false);																if (last_content && loading == false)					{						document.getElementById("product_update_" + new_id).innerHTML = "";					}									if (last_content)					{						document.getElementById(infobox_structure).innerHTML = "";												document.getElementById(loading_anim_structure_act).style.display = "block";						document.getElementById(loading_anim_structure_act).style.opacity = 1;					}									// Daten aktualisieren				language = lid;				infobox_act = "product_update_" + new_id;				infobox_structure = "product_left_" + new_id;				loading_anim_act = "loading_anim_img_" + new_id;				loading_anim_structure_act = "loading_anim_structure_img_" + new_id;				product_button = "goto_product_" + new_id;				box_id_last = box_id_act;				box_id_act = "navi_product_" + new_id;				act_id = new_id;				product_id = new_link;												// Button und Inhalt ist von Grund auf nicht sichtbar				document.getElementById(product_button).style.display = "none";				document.getElementById(loading_anim_act).style.display = "";				document.getElementById(loading_anim_structure_act).style.display = "";								// Lösche den noch aktuellen Ladevorgang, wenn es einen gibt				if (request_act)					{						request_act.abort();					}								if (request_act_structure)					{						request_act_structure.abort();					}								hideProduct();				hideStructure();			}	}function updateProduct(new_id , new_link)	{		product = true;	// Produkt selbst				box_id_last = box_id_act;				// Den alten Menüpunkt deaktivieren		selectButton(false);				product_id = new_link;		act_id = new_id;				// Den neuen Menüpunkt aktivieren		selectButton(true);				if (request_act)			{				request_act.abort();			}				if (loading == false)			{				if (document.getElementById(infobox_act).style.opacity == "")					{						hideProduct();					}				else					{						hideProduct();					}			}		else			{				getProduct();			}	}function getStructure()	{				// URL checken, falls kein www. dabei ist		product_id = editURL(product_id);				request_act_structure = new Ajax.Request(product_id + "&mtid=109&tid=91&cache_custom=nav_structure",			{				method:'get',				onSuccess: function(transport)					{						var response = transport.responseText || "";												document.getElementById(infobox_structure).innerHTML = response;	// Schreibe die Daten in die Infobox												last_structure = response;																		request_act_structure = null;												showStructure(); // Erst zeigen wenn sich die Seite aufgebaut hat					}			});	}function getProduct()	{				// URL checken, falls kein www. dabei ist		product_id = editURL(product_id);				request_act = new Ajax.Request(product_id + "&mtid=109&tid=88&cache_custom=nav_content",			{				method:'get',				onSuccess: function(transport)					{						var response = transport.responseText || "";												fixBoxHeight(true);												response = stripTag(response , "ul");						response = stripTag(response , "li");						response = stripTag(response , "strong");						response = stripTag(response , "b");						response = stripTag(response , "i");												document.getElementById(infobox_act).innerHTML = response;	// Schreibe die Daten in die Infobox												last_content = response;												request_act = null;												showProduct(); // Erst zeigen wenn sich die Seite aufgebaut hat					}			});	}function hideStructure()	{		loading_structure = true;				new Effect.Opacity(infobox_structure, { from: 1, to: 0, duration: 0.2 }); // Inhalt ausblenden				getStructure();	}function hideProduct()	{		loading = true;				if (box_id_act == box_id_last)	// Neue Box = Inhalt verschwindet / Alte Box = Inhalt blendet sanft aus			{				new Effect.Opacity(infobox_act, { from: 1, to: 0, duration: 0.2 }); // Inhalt ausblenden			}			else			{				document.getElementById(infobox_act).style.opacity = 0;			}				new Effect.Opacity(product_button, { from: 1, to: 0, duration: 0.2 });	// Button ausblenden		document.getElementById(product_button).style.display = 'none';				new Effect.Opacity(loading_anim_act, { from: 0, to: 1, duration: 0.2 });;				last_content = "";				getProduct();	}function showStructure()	{		NaviToggle( "blank" , "category_content" , "ul" );		new Effect.Opacity(infobox_structure, { from: 0, to: 1, duration: 0.2 }); // Inhalt einblenden		new Effect.Opacity(loading_anim_structure_act, { from: 1, to: 0, duration: 0.2 });		t = setTimeout("document.getElementById(loading_anim_structure_act).style.display = 'none'",200);	}function showProduct()	{				new Effect.Opacity(infobox_act, { from: 0, to: 1, duration: 0.2 }); // Inhalt einblenden				showButton();		new Effect.Opacity(loading_anim_act, { from: 1, to: 0, duration: 0.2 });				fixBoxHeight(false);				loading = false;	}function selectButton(option)	{		if (option == true)	// Button aktivieren			{				document.getElementById("modell_" + act_id).style.backgroundColor = "#d9ecff";			}					else	// Button deaktivieren			{				if (document.getElementById("modell_" + act_id))					{						document.getElementById("modell_" + act_id).style.backgroundColor = "";					}			}	}function fixBoxHeight(option)	{		if (option == true)	// Höhe der Infobox auslesen und anhalten			{				box_height = (document.getElementById(box_id_act).clientHeight - 26);				document.getElementById(box_id_act).style.height = box_height + "px";			}				else if (option == false && box_id_act)	// Höhe der Infobox an den neuen Inhalt anpassen			{				document.getElementById(box_id_act).style.height = "";			}	}// Zur Vermeidung von Sicherheitswarnungen/-blockaden seitens der Browser (http://url.de darf von http://www.url.de nicht laden)function editURL(strURL)	{		if (document.URL.match("www.") != "www.")			{				strURL = strURL.replace(/www./,"");			}		return strURL;	}function stripTag(strContent , strTag)	{		strTag1 = "<" + strTag + ">";		strTag2 = "</" + strTag + ">";				//alert("Tag1: " + strTag1 + " / Tag:" + strTag2);		//alert(strContent);				for (i=0 ; strContent.match(strTag1) ; i++)			{				strContent = strContent.replace(strTag1,"");				strContent = strContent.replace(strTag2,"");				//alert(strContent);			}		return strContent;	}function showButton()	{		var button_label;		var label_type;				if (product == true)			{				label_type = "product_" + language;			}		else			{				label_type = "page_" + language;			}				switch(label_type)			{				case "product_": button_label = "Produktdetails"; break;		// Keine Sprache gefunden, dann DE				case "product_1": button_label = "Produktdetails"; break;		// DE				case "product_2": button_label = "Product Details"; break;		// INT				case "product_3": button_label = "D&eacute;tails sur le produit"; break;	// FR				case "product_4": button_label = "Product Details"; break;		// NL				case "product_6": button_label = "Detalles del producto"; break;	// ES				case "product_19": button_label = "Product Details"; break;		// USA								case "page_": button_label = "Zur &Uuml;bersicht"; break;		// Keine Sprache gefunden, dann DE				case "page_1": button_label = "Zur &Uuml;bersicht"; break;		// DE				case "page_2": button_label = "Product overview"; break;		// INT				case "page_3": button_label = "Pr&eacute;sentation des produits"; break;			// FR				case "page_4": button_label = "Productoverzicht"; break;			// NL				case "page_6": button_label = "Lista de productos"; break;		// ES				case "page_19": button_label = "Go to overview"; break;			// USA			}					document.getElementById(product_button).href = product_id;			document.getElementById(product_button).innerHTML = button_label;			new Effect.Opacity(product_button, { from: 0, to: 1, duration: 0.2 });	// Button ausblenden			document.getElementById(product_button).style.display = '';	}
