var zXml={useActiveX:(typeof ActiveXObject!="undefined"),useDom:document.implementation&&document.implementation.createDocument,useXmlHttp:(typeof XMLHttpRequest!="undefined")};zXml.ARR_XMLHTTP_VERS=["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp","Microsoft.XmlHttp"];zXml.ARR_DOM_VERS=["MSXML2.DOMDocument.5.0","MSXML2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","Microsoft.XmlDom"];;function zXmlHttp(){}zXmlHttp.createRequest=function(){if(zXml.useXmlHttp){return new XMLHttpRequest();}else if(zXml.useActiveX){if(!zXml.XMLHTTP_VER){for(var i=0;i<zXml.ARR_XMLHTTP_VERS.length;i++){try{new ActiveXObject(zXml.ARR_XMLHTTP_VERS[i]);zXml.XMLHTTP_VER=zXml.ARR_XMLHTTP_VERS[i];break;}catch(oError){;}}}if(zXml.XMLHTTP_VER){return new ActiveXObject(zXml.XMLHTTP_VER);}else{throw new Error("Could not create XML HTTP Request.");}}else{throw new Error("Your browser doesn't support an XML HTTP Request.");}};zXmlHttp.isSupported=function(){return zXml.useXmlHttp||zXml.useActiveX;};function zXmlDom(){}zXmlDom.createDocument=function(){if(zXml.useDom){var oXmlDom=document.implementation.createDocument("","",null);oXmlDom.parseError={valueOf:function(){return this.errorCode;},toString:function(){return this.errorCode.toString()}};oXmlDom.__initError__();oXmlDom.addEventListener("load",function(){this.__checkForErrors__();this.__changeReadyState__(4);},false);return oXmlDom;;}else if(zXml.useActiveX){if(!zXml.DOM_VER){for(var i=0;i<zXml.ARR_DOM_VERS.length;i++){try{new ActiveXObject(zXml.ARR_DOM_VERS[i]);zXml.DOM_VER=zXml.ARR_DOM_VERS[i];break;}catch(oError){;}}}if(zXml.DOM_VER){return new ActiveXObject(zXml.DOM_VER);}else{throw new Error("Could not create XML DOM document.");}}else{throw new Error("Your browser doesn't support an XML DOM document.");}};zXmlDom.isSupported=function(){return zXml.useDom||zXml.useActiveX;};var oMozDocument=null;if(typeof XMLDocument!="undefined"){oMozDocument=XMLDocument;}else if(typeof Document!="undefined"){oMozDocument=Document;}if(oMozDocument&&!window.opera){oMozDocument.prototype.readyState=0;oMozDocument.prototype.onreadystatechange=null;oMozDocument.prototype.__changeReadyState__=function(iReadyState){this.readyState=iReadyState;if(typeof this.onreadystatechange=="function"){this.onreadystatechange();}};oMozDocument.prototype.__initError__=function(){this.parseError.errorCode=0;this.parseError.filepos=-1;this.parseError.line=-1;this.parseError.linepos=-1;this.parseError.reason=null;this.parseError.srcText=null;this.parseError.url=null;};oMozDocument.prototype.__checkForErrors__=function(){if(this.documentElement.tagName=="parsererror"){var reError=/>([\s\S]*?)Location:([\s\S]*?)Line Number(\d+),Column(\d+):<sourcetext>([\s\S]*?)(?:\-*\^)/;reError.test(this.xml);this.parseError.errorCode=-999999;this.parseError.reason=RegExp.$1;this.parseError.url=RegExp.$2;this.parseError.line=parseInt(RegExp.$3);this.parseError.linepos=parseInt(RegExp.$4);this.parseError.srcText=RegExp.$5;}};oMozDocument.prototype.loadXML=function(sXml){this.__initError__();this.__changeReadyState__(1);var oParser=new DOMParser();var oXmlDom=oParser.parseFromString(sXml,"text/xml");while(this.firstChild){this.removeChild(this.firstChild);}for(var i=0;i<oXmlDom.childNodes.length;i++){var oNewNode=this.importNode(oXmlDom.childNodes[i],true);this.appendChild(oNewNode);}this.__checkForErrors__();this.__changeReadyState__(4);};oMozDocument.prototype.__load__=oMozDocument.prototype.load;oMozDocument.prototype.load=function(sURL){this.__initError__();this.__changeReadyState__(1);this.__load__(sURL);};Node.prototype.__defineGetter__("xml",function(){var oSerializer=new XMLSerializer();return oSerializer.serializeToString(this,"text/xml");});Node.prototype.__defineGetter__("text",function(){var sText="";for(var i=0;i<this.childNodes.length;i++){if(this.childNodes[i].hasChildNodes()){sText+=this.childNodes[i].text;}else{sText+=this.childNodes[i].nodeValue;}}return sText;});}function zXslt(){}zXslt.transformToText=function(oXml,oXslt){if(typeof XSLTProcessor!="undefined"){var oProcessor=new XSLTProcessor();oProcessor.importStylesheet(oXslt);var oResultDom=oProcessor.transformToDocument(oXml);var sResult=oResultDom.xml;if(sResult.indexOf("<transformiix:result")>-1){sResult=sResult.substring(sResult.indexOf(">")+1,sResult.lastIndexOf("<"));}return sResult;;}else if(zXml.useActiveX){return oXml.transformNode(oXslt);}else{throw new Error("No XSLT engine found.");}};function zXPath(){}zXPath.selectNodes=function(oRefNode,sXPath,sXmlNs){if(typeof XPathEvaluator!="undefined"){oXmlNs=oXmlNs||{};var nsResolver=function(sPrefix){return oXmlNs[sPrefix];};var oEvaluator=new XPathEvaluator();var oResult=oEvaluator.evaluate(sXPath,oRefNode,nsResolver,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);var aNodes=new Array;if(oResult!=null){var oElement=oResult.iterateNext();while(oElement){aNodes.push(oElement);oElement=oResult.iterateNext();}}return aNodes;}else if(zXml.useActiveX){if(oXmlNs){var sXmlNs="";for(var sProp in oXmlNs){sXmlNs+="xmlns:"+sProp+"="+oXmlNs[sProp]+" ";}oRefNode.ownerDocument.setProperty("SelectionNamespaces",sXmlNs);};return oRefNode.selectNodes(sXPath);}else{throw new Error("No XPath engine found.");}};zXPath.selectSingleNode=function(oRefNode,sXPath,oXmlNs){if(typeof XPathEvaluator!="undefined"){;oXmlNs=oXmlNs||{};var nsResolver=function(sPrefix){return oXmlNs[sPrefix];};var oEvaluator=new XPathEvaluator();var oResult=oEvaluator.evaluate(sXPath,oRefNode,nsResolver,XPathResult.FIRST_ORDERED_NODE_TYPE,null);if(oResult!=null){return oResult.singleNodeValue;}else{return null;};}else if(zXML.useActiveX){if(oXmlNs){var sXmlNs="";for(var sProp in oXmlNs){sXmlNs+="xmlns:"+sProp+"="+oXmlNs[sProp]+" ";}oRefNode.ownerDocument.setProperty("SelectionNamespaces",sXmlNs);};return oRefNode.selectSingleNode(sXPath);}else{throw new Error("No XPath engine found.");}};function zXMLSerializer(){}zXMLSerializer.prototype.serializeToString=function(oNode){var sXml="";switch(oNode.nodeType){case 1:sXml="<"+oNode.tagName;for(var i=0;i<oNode.attributes.length;i++){sXml+=" "+oNode.attributes[i].name+"=\""+oNode.attributes[i].value+"\"";}sXml+=">";for(var i=0;i<oNode.childNodes.length;i++){sXml+=this.serializeToString(oNode.childNodes[i]);}sXml+="</"+oNode.tagName+">";break;case 3:sXml=oNode.nodeValue;break;case 4:sXml="<![CDATA["+oNode.nodeValue+"]]>";break;case 7:sXml="<?"+oNode.nodevalue+"?>";break;case 8:sXml="<!--"+oNode.nodevalue+"-->";break;case 9:for(var i=0;i<oNode.childNodes.length;i++){sXml+=this.serializeToString(oNode.childNodes[i]);}break;};return sXml;};

function sendRequest(divName,flagacc,otherDiv,formAction) {
			
            var oForm = document.forms[0];
            var sBody = getRequestBody(oForm);
            var oXmlHttp = zXmlHttp.createRequest();
            oXmlHttp.open("post", formAction, true);
            oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            
            oXmlHttp.onreadystatechange = function () {
                if (oXmlHttp.readyState == 4) {
                    if (oXmlHttp.status == 200) {
                        saveResult(oXmlHttp.responseText,divName,flagacc,otherDiv);
                    } else {
                        saveResult("An error occurred: " + oXmlHttp.statusText,divName,flagacc,otherDiv);
                    }
                }            
            };
            
            oXmlHttp.send(sBody); 
           
        }
        
        function getRequestBody(oForm) {
            var aParams = new Array();
            
            for (var i=0 ; i < oForm.elements.length; i++) {
                var sParam = encodeURIComponent(oForm.elements[i].name);
                sParam += "=";
                sParam += encodeURIComponent(oForm.elements[i].value);
                aParams.push(sParam);
            } 
            
            return aParams.join("&");        
        }
        
        function saveResult(sMessage,divName,flagacc,otherDiv) {
            var divStatus = document.getElementById(divName);
           
            if(flagacc == "y")
            divStatus.innerHTML += "" + sMessage;
            else
            divStatus.innerHTML = "" + sMessage;
            
            var divOther = document.getElementById(otherDiv);
            if(divOther)
            	divOther.innerHTML = "";
           
        }
      
      function getRequest(divName,variabili,pagina,flagacc,otherDiv) {
            
            var oXmlHttp = zXmlHttp.createRequest();
            oXmlHttp.open("get", pagina + "?" + variabili, true);
            
            oXmlHttp.onreadystatechange = function () {
            	
                if (oXmlHttp.readyState == 4) {
                    if (oXmlHttp.status == 200) {
                        saveResult(oXmlHttp.responseText,divName,flagacc);
                    } else {
                        saveResult("An error occurred: " + oXmlHttp.statusText,divName,flagacc,otherDiv); //statusText is not always accurate
                    }
                }            
            };
            oXmlHttp.send(null);
        }
       
        
       function linkgen(link1,link2,link3,link4,link5,link6,link7,link8)
       {
       		
       		if(link1 == "0")
       		{
       			document.getElementById('primo').src="img/home.jpg";
            }
            else if (link1 == "1")
            {
            	document.getElementById('primo').src="img/home.jpg";
            	document.getElementById('cittas').style.display="none";
            }
            if(link2 == "0")
       		{
       			document.getElementById('secondo').src="img/societa.jpg";
       			document.getElementById('secondo').style.top="0px";
       			
            }
            else if (link2 == "1")
            {
            	document.getElementById('secondo').src="img/societa_on.jpg";
            	document.getElementById('secondo').style.top="3px";
            	document.getElementById('cittas').style.display="none";
            }
            if(link3 == "0")
       		{
       			document.getElementById('terzo').src="img/storia.jpg";
       			document.getElementById('terzo').style.top="0px";
            }
            else if (link3 == "1")
            {
            	document.getElementById('terzo').src="img/storia_on.jpg";
            	document.getElementById('terzo').style.top="3px";
            	document.getElementById('cittas').style.display="none";
				
            }
              if (link4 == "0")
            {
            	document.getElementById('quarto').src="img/coppa_speranze.jpg";
            	document.getElementById('quarto').style.top="0px";
            }
             else if (link4 == "1")
            {
            	document.getElementById('quarto').src="img/coppa_speranze_fiat_on.jpg";
            	document.getElementById('quarto').style.top="3px";
            	
            }
              if (link5 == "0")
            {
            	document.getElementById('quinto').src="img/cross_del_sud.jpg";
            	document.getElementById('quinto').style.top="0px";
            }
             else if (link5 == "1")
            {
            	document.getElementById('quinto').src="img/cross_del_sud_on.jpg";
            	document.getElementById('quinto').style.top="3px";
            	document.getElementById('cittas').style.display="none";
            }
              if (link6 == "0")
            {
            	document.getElementById('sesto').src="img/corrifiat.jpg";
            	document.getElementById('sesto').style.top="0px";
            }
             else if (link6 == "1")
            {
            	document.getElementById('sesto').src="img/corrifiat_on.jpg";
            	document.getElementById('sesto').style.top="3px";
            	document.getElementById('cittas').style.display="none";
            }
              if (link7 == "0")
            {
            	document.getElementById('settimo').src="img/trofeo_sata.jpg";
            	document.getElementById('settimo').style.top="0px";
            }
             else if (link7 == "1")
            {
            	document.getElementById('settimo').src="img/trofeo_sata_on.jpg";
            	document.getElementById('settimo').style.top="3px";
            	document.getElementById('cittas').style.display="none";
            }
              if (link8 == "0")
            {
            	document.getElementById('ottavo').src="img/altre_attivita.jpg";
				document.getElementById('ottavo').style.top="0px";
            }
             else if (link8 == "1")
            {
            	document.getElementById('ottavo').src="img/altre_attivita_on.jpg";
				document.getElementById('ottavo').style.top="3px";
            	document.getElementById('cittas').style.display="none";
            }
       }
  function linkgen2(link1,link2,link3,link4,link5,link6,link7)
       {
       		
       		if(link1 == "0")
       		{
       			document.getElementById('primoa').src="img/operativita.jpg";
            }
            else if (link1 == "1")
            {
            	document.getElementById('primoa').src="img/operativita_on.jpg";
            }
            if(link2 == "0")
       		{
       			document.getElementById('secondoa').src="img/organigramma.jpg";
            }
            else if (link2 == "1")
            {
            	document.getElementById('secondoa').src="img/organigramma_on.jpg";
            }
            if(link3 == "0")
       		{
       			document.getElementById('terzoa').src="img/sponsor.jpg";
            }
            else if (link3 == "1")
            {
            	document.getElementById('terzoa').src="img/sponsor_on.jpg";
            }
              if (link4 == "0")
            {
            	document.getElementById('quartoa').src="img/marketing.jpg";
            }
             else if (link4 == "1")
            {
            	document.getElementById('quartoa').src="img/marketing_on.jpg";
            }
              if (link5 == "0")
            {
            	document.getElementById('quintoa').src="img/palmares.jpg";
            }
             else if (link5 == "1")
            {
            	document.getElementById('quintoa').src="img/palmares_on.jpg";
            }
              if (link6 == "0")
            {
            	document.getElementById('sestoa').src="img/contatti.jpg";
            }
             else if (link6 == "1")
            {
            	document.getElementById('sestoa').src="img/contatti_on.jpg";
            }
              if (link7 == "0")
            {
            	document.getElementById('settimoa').src="img/41esimo_parallelo.jpg";
            }
             else if (link7 == "1")
            {
            	document.getElementById('settimoa').src="img/41esimo_parallelo_on.jpg";
            }
       }
         function linkgen3(link1,link2,link3,link4,link5,link6,link7,link8, link9) {
       		
       		if(link1 == "0"){
       			document.getElementById('primob').src="img/citta/cassino.jpg";
       			document.getElementById('primob').style.top="0px";
       			document.getElementById('cittas').style.display="inline";
          } else if (link1 == "1"){
            document.getElementById('primob').src="img/citta/cassino_on.jpg";
            document.getElementById('primob').style.top="3px";
            document.getElementById('cittas').style.display="inline";
          }
          if(link2 == "0"){
       			document.getElementById('secondob').src="img/citta/lanciano.jpg";
       			document.getElementById('secondob').style.top="0px";
       			document.getElementById('cittas').style.display="inline";
          } else if (link2 == "1") {
            document.getElementById('secondob').src="img/citta/lanciano_on.jpg";
            document.getElementById('secondob').style.top="3px";
            document.getElementById('cittas').style.display="inline";
          } 
          if(link3 == "0") {
       			document.getElementById('terzob').src="img/citta/melfi.jpg";
       			document.getElementById('terzob').style.top="0px";
       			document.getElementById('cittas').style.display="inline";
          } else if (link3 == "1"){
            document.getElementById('terzob').src="img/citta/melfi_on.jpg";
            document.getElementById('terzob').style.top="3px";
            document.getElementById('cittas').style.display="inline";
          }
          if(link4 == "0"){
       			document.getElementById('quartob').src="img/citta/modena.gif";
       			document.getElementById('quartob').style.top="0px";
       			document.getElementById('cittas').style.display="inline";
          } else if (link4 == "1"){
            document.getElementById('quartob').src="img/citta/modena_on.gif";
            document.getElementById('quartob').style.top="3px";
            document.getElementById('cittas').style.display="inline";
          }
          if (link5 == "0"){
            document.getElementById('quintob').src="img/citta/pomigliano.jpg";
            document.getElementById('quintob').style.top="0px";
            document.getElementById('cittas').style.display="inline";
          } else if (link5 == "1"){
            document.getElementById('quintob').src="img/citta/pomigliano_on.jpg";
            document.getElementById('quintob').style.top="3px";
            document.getElementById('cittas').style.display="inline";
          }
          if (link6 == "0"){
            document.getElementById('sestob').src="img/citta/termini.jpg";
            document.getElementById('sestob').style.top="0px";
            document.getElementById('cittas').style.display="inline";
          } else if (link6 == "1"){
            document.getElementById('sestob').src="img/citta/termini_on.jpg";
            document.getElementById('sestob').style.top="3px";
            document.getElementById('cittas').style.display="inline";
          }
          if (link7 == "0"){
            document.getElementById('settimob').src="img/citta/termoli.jpg";
            document.getElementById('settimob').style.top="0px";
            document.getElementById('cittas').style.display="inline";
          } else if (link7 == "1"){
            document.getElementById('settimob').src="img/citta/termoli_on.jpg";
            document.getElementById('settimob').style.top="3px";
            document.getElementById('cittas').style.display="inline";
          }
          if (link8 == "0"){
            document.getElementById('ottavob').src="img/citta/sulmona.gif";
            document.getElementById('ottavob').style.top="0px";
            document.getElementById('cittas').style.display="inline";
          } else if (link8 == "1"){
            document.getElementById('ottavob').src="img/citta/sulmona_on.gif";
            document.getElementById('ottavob').style.top="3px";
            document.getElementById('cittas').style.display="inline";
          }
          if (link9 == "0"){
            document.getElementById('nonob').src="img/citta/finalissima.jpg";
            document.getElementById('nonob').style.top="0px";
            document.getElementById('cittas').style.display="inline";
          } else if (link9 == "1")    {
            document.getElementById('nonob').src="img/citta/finalissima_on.jpg";
            document.getElementById('nonob').style.top="3px";
            document.getElementById('cittas').style.display="inline";
          }
       }
       
       function linkgen4(link1,link2,link3,link4)
       {
       		
       		if(link1 == "0")
       		{
       			document.getElementById('primoc').src="img/risultati.jpg";
            }
            else if (link1 == "1")
            {
            	document.getElementById('primoc').src="img/risultati_on.jpg";
            }
            if(link2 == "0")
       		{
       			document.getElementById('secondoc').src="img/galleria.jpg";
            }
            else if (link2 == "1")
            {
            	document.getElementById('secondoc').src="img/galleria_on.jpg";
            }
            if(link3 == "0")
       		{
       			document.getElementById('terzoc').src="img/info.jpg";
            }
            else if (link3 == "1")
            {
            	document.getElementById('terzoc').src="img/info_on.jpg";
            }
			 if(link4 == "0")
       		{
       			document.getElementById('quartoc').src="img/videoS.jpg";
            }
            else if (link4 == "1")
            {
            	document.getElementById('quartoc').src="img/videoS_on.jpg";
            }
          
            
            
        }
        function linkgen5(link1,link2,link3,link4,link5,link6,link7,link8)
       {
       		
       		if(link1 == "0")
       		{
       			document.getElementById('primod').src="img/risultatic.jpg";
            }
            else if (link1 == "1")
            {
            	document.getElementById('primod').src="img/risultatic_on.jpg";
            }
            if(link2 == "0")
       		{
       			document.getElementById('secondod').src="img/galleria_fotografica.jpg";
            }
            else if (link2 == "1")
            {
            	document.getElementById('secondod').src="img/galleria_fotografica_on.jpg";
            }
            if(link3 == "0")
       		{
       			document.getElementById('terzod').src="img/infoc.jpg";
            }
            else if (link3 == "1")
            {
            	document.getElementById('terzod').src="img/infoc_on.jpg";
            }
              if (link4 == "0")
            {
            	document.getElementById('quartod').src="img/sponsor.jpg";
            }
             else if (link4 == "1")
            {
            	document.getElementById('quartod').src="img/sponsor_on.jpg";
            }
             if(link5 == "0")
       		{
       			document.getElementById('quintod').src="img/albo_doro.jpg";
            }
            else if (link5 == "1")
            {
            	document.getElementById('quintod').src="img/albo_doro_on.jpg";
            }
            if(link6 == "0")
       		{
       			document.getElementById('sestod').src="img/memorial_paone.jpg";
            }
            else if (link6 == "1")
            {
            	document.getElementById('sestod').src="img/memorial_paone_on.jpg";
            }
              if (link7 == "0")
            {
            	document.getElementById('settimod').src="img/memorial_sideri.jpg";
            }
             else if (link7 == "1")
            {
            	document.getElementById('settimod').src="img/memorial_sideri_on.jpg";
            }
			    if (link8 == "0")
            {
            	document.getElementById('ottavod').src="img/video.jpg";
            }
             else if (link8 == "1")
            {
            	document.getElementById('ottavod').src="img/video_on.jpg";
            }
            
        }
         function linkgen6(link1,link2,link3,link4,link5,link6,link7,sponsor)
       {
       		
       		if(link1 == "0")
       		{
       			document.getElementById('primod').src="img/risultatic.jpg";
            }
            else if (link1 == "1")
            {
            	document.getElementById('primod').src="img/risultatic_on.jpg";
            }
            if(link2 == "0")
       		{
       			document.getElementById('secondod').src="img/galleria_fotografica.jpg";
            }
            else if (link2 == "1")
            {
            	document.getElementById('secondod').src="img/galleria_fotografica_on.jpg";
            }
            if(link3 == "0")
       		{
       			document.getElementById('terzod').src="img/infoc.jpg";
            }
            else if (link3 == "1")
            {
            	document.getElementById('terzod').src="img/infoc_on.jpg";
            }
			if(link4 == "0")
       		{
       			document.getElementById('quartod').src="img/video.jpg";
            }
            else if (link4 == "1")
            {
            	document.getElementById('quartod').src="img/video_on.jpg";
            }
            
            if(sponsor=="si")
            {
				  if (link5 == "0")
				{
					document.getElementById('quintod').src="img/sponsor.jpg";
				}
				 else if (link5 == "1")
				{
					document.getElementById('quintod').src="img/sponsor_on.jpg";
				}
            }
           
            
        }
        
       function toggleVisibility(divName){
         var me = document.getElementById(divName);
		if (me.style.visibility=="hidden"){
			me.style.visibility="visible";
			}
		else {
			me.style.visibility="hidden";
			}
		}
		
		function visibilita(a) {
			if (a == "0") {
			document.getElementById('animazio').style.display = 'none';
			}
			else if (a == "1") {
			document.getElementById('animazio').style.display = 'inline';
			} 
		}




