<!--
	var productID = "";
	var isStandard = true;
	var xmlDoc = null;
	var lastFunc = "";
	var catFile = "";
	var intv;

	/* Define constants */
	var READY_STATE_UNINITIALIZED = 0;
	var READY_STATE_LOADING       = 1;
	var READY_STATE_LOADED        = 2;
	var READY_STATE_INTERACTIVE   = 3;
	var READY_STATE_COMPLETED     = 4;

	function getXmlDoc(func, fileName)
	{
		var funcName = getObjectName(func);
		if (funcName != null)
		{
			if (lastFunc != funcName) xmlDoc = null;
			lastFunc = funcName;
		}
		
		if (xmlDoc != null) 
		{
			func();
			return;
		}
	
		if (document.implementation && document.implementation.createDocument)
		{
			xmlDoc = document.implementation.createDocument("", "", null);
			xmlDoc.async = false;
			xmlDoc.onload = func;
		}
		else if (window.ActiveXObject)
		{
			xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc.async = false;
			xmlDoc.onreadystatechange = function() { if (xmlDoc.readyState == READY_STATE_COMPLETED) func(); } 
			isStandard = false;
	 	}
		else return;

		xmlDoc.load(fileName);
	}
	
	function getObjectName(obj)
	{
		if (document.implementation && document.implementation.createDocument)
		{
			return obj.name.toString();
		}
		else
		{
			var tmp = obj.toString();
 			return tmp.substring(tmp.indexOf(' ') + 1,tmp.indexOf('('));			
		}
		
		return null;
	}

	function fillCombo()
	{
		var xPath = "";
		var node = null;
		var combo = document.getElementById('comboProdotti');

		if (combo.options.length > 0) combo.removeChild(combo.firstChild);

		xPath = "/products/element/modelName";
		node = getXmlNode(xPath, true);

		if (node == null) return;

		if (isStandard)
		{
			var thisElement = node.iterateNext();

			while (thisElement) {
				combo.appendChild(createOption(thisElement.textContent, thisElement.textContent));
				thisElement = node.iterateNext();
			}
		}
		else
		{
			for (i = 0; i < node.length; i++)
				combo.appendChild(createOption(node[i].firstChild.nodeValue, node[i].firstChild.nodeValue));
		}
	}
	
	function createOption(value, text)
	{
		var option = document.createElement('option');

		option.value = text;
      	option.innerText = text;
		option.text = text;
		
		return option;
	}

	function fillProduct()
	{
		var xPath = "";
		var value = "";
		var node = null;

		if (productID == "")
			productID = document.getElementById('comboProdotti').options[document.getElementById('comboProdotti').selectedIndex].value;

		if (isStandard)
		{
			xPath = "element";
			node = xmlDoc.getElementsByTagName(xPath)[document.getElementById('comboProdotti').selectedIndex];
		}
		else
		{
			xPath = "/products/element[modelName='" + productID + "']";
			node = getXmlNode(xPath, false);
		}

		if (node == null) return;
		
		document.title = "Cofani Abruzzo: Prodotti » " + catDocTitle + " » " + productID;

		for (j = 0; j < node.childNodes.length; j++)
		{
			if (node.childNodes[j].nodeType != 1) continue;

			if (node.childNodes[j].childNodes.length == 0)
				document.getElementById(node.childNodes[j].nodeName).style.visibility = "hidden";

			else
			{
				value = node.childNodes[j].firstChild.nodeValue; 
				var listaCol = document.getElementById('listaColori');
				
			    if (listaCol != null)
				 	listaCol.style.display = "none"; 

				switch(node.childNodes[j].nodeName)
				{
					case 'producer':
						var path = "images/";
						document.getElementById('picture').alt = value;
						document.getElementById(node.childNodes[j].nodeName).src = path + value + ".gif";
						//document.getElementById(node.childNodes[j].nodeName).src = path + "spacer.gif";
						break;

					case 'picture':
						var path = "images/prodotti/" + document.getElementById('picture').alt + "/";
						document.getElementById(node.childNodes[j].nodeName).src = path + value;
						break;

					case 'colors': 
					   /* var colorDiv = document.createElement('div');
						colorDiv.id = "colors";
						colorDiv.innerHTML = "<br />Disponibile in:<br />";
						listaCol.appendChild(colorDiv);   */
						
						listaCol.style.display = "inline"; 
						
						var colorSpan = document.getElementById(node.childNodes[j].nodeName);
						colorSpan.innerHTML = "";
						colorSpan.appendChild(document.createElement('ul')); 
						
						for (i = 0; i < node.childNodes[j].childNodes.length; i++)
						{
							if (node.childNodes[j].childNodes[i].nodeType != 1) continue;

							var x = node.childNodes[j].childNodes[i].firstChild.nodeValue;

							var pathImg = x.replace(' ', '_').replace(/'/g, '');
							pathImg = "images/" + pathImg + ".jpg";

							var anchorLink = "";
							var noLink = node.childNodes[j].childNodes[i].getAttribute("noLink");
							
							if (!noLink) 								
								anchorLink = pathImg;
								
							createAnchorNode(x, anchorLink, x, colorSpan); 
							colorSpan.appendChild(document.createElement('br'));   
						}      
						
						//colorDiv.innerHTML += "<br /><br />Cliccare qui per maggiori dettagli sulle <a href=\"essenze-cofani-urne.html\" onmouseover=\"window.status='Essenze'; return true;\" onmouseout=\"window.status=''; return true;\" title=\"Essenze\">essenze</a>.";
						break;

					default:
						if (value != "") 
						{
							re = /\\n/gi;
							value = value.replace(re, "<br>");

							var el = document.getElementById(node.childNodes[j].nodeName);
							el.style.visibility = "visible";
							el.innerHTML = value;
						}
						else
							document.getElementById(node.childNodes[j].nodeName).style.visibility = "hidden";
						break;
				}
			}
		}
		
		productID = "";
	}
	
	function createAnchorNode(anchorText, anchorLink, descr, parentNode)
	{
		if (anchorLink == "") { parentNode.appendChild(document.createTextNode(anchorText)); }
		else
		{       
			var anchorTag = document.createElement('a');
			anchorTag.href = "#"; 
			anchorTag.setAttribute('onmouseover', 'window.status=\'' + descr.replace(/'/g, '') + '\'; return true;');
			anchorTag.setAttribute('onmouseout', 'window.status=\'\'; return true;'); 
			anchorTag.setAttribute('rel', 'lightbox');
			anchorTag.setAttribute('onclick', 'jQuery.slimbox("' + anchorLink + '")');
			anchorTag.appendChild(document.createTextNode(anchorText));
			parentNode.appendChild(anchorTag); 
		}
	}	

	function getXmlNode(xPath, multi)
	{
		var result = null;

		if (isStandard)
		{
			if (multi)
				result = xmlDoc.evaluate(xPath, xmlDoc, null, XPathResult.ANY_TYPE, null); // returns collection of nodes
			else
				result = xmlDoc.evaluate(xPath, xmlDoc, null, XPathResult.ANY_TYPE, null).selectSingleNode; //returns a single node
		}
		else
		{
			if (multi)
				result = xmlDoc.selectNodes(xPath); // returns collection of nodes
			else
				result = xmlDoc.selectSingleNode(xPath); //returns a single node
		}

		return result;
	}
-->