<!--

    var iLangID; var sUrl; var xmlConf; var vDocumentUrl = ""; var vDoc = ""; var vDocUrl = ""; var iCurrentLevel = 0; var iNextLevel = 0;
        //Included in system javascript engine ...
        function processConfReqChange() {
            // only if req shows "complete"
            if (xmlConf.readyState == 4) {
                // only if "OK"
                if (xmlConf.status == 200) {
                    // ...processing statements go here...
                } else {
                    alert("There was a problem retrieving the XML data:\n" + xmlConf.statusText);
                }
            }
        }
        
        /*function loadXMLConf() {
            var sXMLFile = arguments[0];
            
            if (window.ActiveXObject) {
                xmlConf = new ActiveXObject("Microsoft.XMLDOM");
                xmlConf.async = false;
                xmlConf.load( sXMLFile );
            }
            else if (document.implementation && document.implementation.createDocument) {
                xmlConf = document.implementation.createDocument("", "", null);

                var xmlhttp = new XMLHttpRequest();
                xmlhttp.onreadystatechange = processReqChange;
                xmlhttp.open("GET", sXMLFile, false);
                xmlhttp.send(null); 	//xmldoc

                xmlConf = xmlhttp.responseXML;

            }

            loadMenuConf( arguments[1], arguments[2] );

        }*/
        function loadXMLConf() {
            var sXMLFile = arguments[0];
            //alert(sXMLFile);
            var oCtrl = arguments[1];
		    if (window.XMLHttpRequest) {
			    xmlConf = new XMLHttpRequest();
			    xmlConf.onreadystatechange = processConfReqChange;
			    xmlConf.open("GET", sXMLFile, false);
			    xmlConf.send(null);		//xmldoc
		    }
		    else if (window.ActiveXObject) {
			    xmlConf = new ActiveXObject("Msxml2.XMLHTTP");
			    if (xmlConf) {
				    xmlConf.onreadystatechange = processConfReqChange;
				    xmlConf.open("GET", sXMLFile, false);
				    xmlConf.send();
			    }
		    }
            xmlConf = xmlConf.responseText;
            vDocumentUrl = arguments[2];
            
            //alert(arguments[0]);
            vDoc = arguments[0] + "&te=st";
            vDocUrl = vDoc.split("&"); vDoc = vDocUrl[0]; //alert(vDoc);
            
            //Remove controls after this
            var sCtrl = oCtrl.id;
            var iCtrl = sCtrl.replace("idConf",""); iCurrentLevel = Math.abs(parseInt(iCtrl)); iNextLevel = Math.abs(parseInt(iCtrl)+1);
            var oCtrl = document.getElementById("idXMLConf");
            i = 10
            do {
                if (document.getElementById("idConf" + i)) {
                    oCtrl.removeChild(document.getElementById("idConf" + i));
                }
                i--;
            }
            while (i >= iNextLevel)
            //alert(iCtrl);
            loadMenuConf( arguments[0] );
        }
        
        function loadMenuConf() {
            var sHTML = "";
            var myNodeList = xmlConf.split(";");

            var oCtrl = document.getElementById("idXMLConf");

            if (myNodeList.length > 0) {
                var oInput = document.createElement("select");
                //oInput.onchange = new Function("if (this.value!=0){loadXMLConf('docs/configurator.xml'," + Math.abs(arguments[0] + 1) + ", this.value);}");
                //alert(iCurrentLevel)
                switch (iCurrentLevel) {
                    case 1: 
                        oInput.onchange = new Function("if (this.value!=0){ if (this.value.lastIndexOf('oi=')>-1) {document.location.href = 'tuotehaku.asp?' + vDocumentUrl + this.value + '&reID=1';} else {loadXMLConf( vDoc + '&level=3&id=' + this.value, this, vDocumentUrl);}}");
                        break;
                    case 2:
                        oInput.onchange = new Function("if (this.value!=0){ if (this.value.lastIndexOf('oi=')>-1) {document.location.href = 'tuotehaku.asp?' + vDocumentUrl + this.value + '&reID=1';} else {loadXMLConf( vDoc + '&level=4&id=' + this.value, this, vDocumentUrl);}}");
                        break;
                    case 3:
                        oInput.onchange = new Function("if (this.value!=0){ if (this.value.lastIndexOf('oi=')>-1) {document.location.href = 'tuotehaku.asp?' + vDocumentUrl + this.value + '&reID=1';} else {loadXMLConf( vDoc + '&level=5&id=' + this.value, this, vDocumentUrl);}}");
                        break;
                    case 4:
                        oInput.onchange = new Function("if (this.value!=0){ if (this.value.lastIndexOf('oi=')>-1) {document.location.href = 'tuotehaku.asp?' + vDocumentUrl + this.value + '&reID=1';} else {loadXMLConf( vDoc + '&level=6&id=' + this.value, this, vDocumentUrl);}}");
                        break;
                    case 5:
                        oInput.onchange = new Function("if (this.value!=0){ if (this.value.lastIndexOf('oi=')>-1) {document.location.href = 'tuotehaku.asp?' + vDocumentUrl + this.value + '&reID=1';} else {loadXMLConf( vDoc + '&level=7&id=' + this.value, this, vDocumentUrl);}}");
                        break;
                    case 6:
                    default: break;
                }
                //oInput.onchange = new Function("alert('tuotehaku.asp?' + vDoc + this.value + '&reID=1')");
                //alert("idConf"+arguments[1])
                oInput.setAttribute("id","idConf"+(iNextLevel));
                if (document.all) {
                    oInput.setAttribute("className", "configurator");
                }
                else {
                    oInput.setAttribute("class", "configurator");
                }
                oInput.style.marginRight = "4px";
                oInput.style.float = "left"; var bLast = false;
                
                var sOption = "";
                sOption = myNodeList[0].split("\n")
                oInput.options[oInput.options.length] = new Option(sOption[0] + " -->", 0);
                
                for (i = 0; i < myNodeList.length; i++) {
                    //Setting top level
                    if ( myNodeList[i] != "") {
                        var oItem = myNodeList[i].split("|"); 
                        var sItemValue = oItem[0];
                        if ( i == 0) {
                            sItemValue = sItemValue.replace("\n","");
                            sItemValue = sItemValue.replace("&nbsp;","");
                            sItemValue = sItemValue.replace(sOption[0],"");
                        }

                        var bSel = false; //if (Math.abs(vValue[x]) == Math.abs(document.getElementById("idMaaID").value)) {bSel = true;}
                        oInput.options[oInput.options.length] = new Option( oItem[1], sItemValue, bSel);
                        //if (bSel) { oInput.selectedIndex = (x + 1); }
                    }
                }

                oCtrl.appendChild(oInput);
                
            }
        }
    
//-->
