   		function mainSearch(searchURL,searchText ) 
			{			
			  var activate = false;
			  var formName = 'mainSearch_form';
			  
			  document.forms[formName].elements["index-query"].value = document.forms[formName].elements["indexquery"].value;
			  if(activate == false && document.forms[formName].elements["index-query"].value==searchText )
			  {
				over(this,'alert',-150,20);
				activate = true;
			  }
			  else if (document.forms[formName].elements["index-query"].value == "")
			  {
				over(this,'alert',-150,20);
				activate = true;
			  }
			  else if (document.forms[formName].elements["index-query"].value!=searchText)
			  {
				document.location.href = searchURL+'?index-query=' + encodeUTF8(document.forms[formName].elements["index-query"].value);
			  }
			  else if (activate == true)
			  {
				document.location.href = searchURL+'?index-query=' + encodeUTF8(document.forms[formName].elements["index-query"].value);
			  }
			}


   		function googleAn(curUrl,paramPageUrl){
   		
   			if(curUrl.indexOf("utm_source") == -1){
   					if(curUrl.charAt(curUrl.length-1)=="#"){
							curUrl = curUrl.substring(0, curUrl.length-1);
					}
					if(curUrl.indexOf("?") == -1){
							var a_in = curUrl.indexOf("web/");
							curUrl_temp = curUrl.substring(a_in+4);	
							var str = curUrl_temp.split("/");
							curUrl = curUrl + "?utm_source="+paramPageUrl+"&utm_medium=" + str[0];
					}else{
							var a_in = curUrl.indexOf("web/");
							curUrl_temp = curUrl.substring(a_in+4);	
							var str = curUrl_temp.split("/");
							curUrl = curUrl + "&utm_source="+paramPageUrl+"&utm_medium=" + str[0];
					}
   			
   			}else{
   					var a = 0;
   					if(curUrl.indexOf("?utm_source")!=-1){
						a = curUrl.indexOf("?utm_source=");
					}else{
						a = curUrl.indexOf("&utm_source=");
					}
					var b = curUrl.indexOf("&utm_medium=");
					var temp = curUrl.substring(0, a+12);
					var temp1 = curUrl.substring(b, curUrl.length);
					curUrl = temp + paramPageUrl + temp1;
					
   			}
   			return curUrl;
   		}
   	
   		function switchStite(x,paramPageUrl){
			
   			var curUrl = document.location.href;
   			//alert(curUrl);
   			//alert(x);
   			
			//change sites on abraham/production
			if(curUrl.indexOf("abraham")==-1){
							//labs
							if (curUrl.indexOf("pirellilabs.com")!=-1 && x=='it'){
				   				curUrl = curUrl.replace("pirellilabs.com","pirellilabs.it");
				   				curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("pirellilabs.it")!=-1 && x=='en'){
									curUrl = curUrl.replace("pirellilabs.it","pirellilabs.com");
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}

							//broadband
							if (curUrl.indexOf("pirellibroadband.com")!=-1 && x=='it'){
				   				curUrl = curUrl.replace("pirellibroadband.com","it.pirellibroadband.com");
				   				curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("it.pirellibroadband.com")!=-1 && x=='en'){
									curUrl = curUrl.replace("it.pirellibroadband.com","pirellibroadband.com");
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}

							//ambiente
							if (curUrl.indexOf("pirelliambiente.com")!=-1 && x=='it'){
				   				curUrl = curUrl.replace("pirelliambiente.com","it.pirelliambiente.com");
				   				curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("it.pirelliambiente.com")!=-1 && x=='en'){
									curUrl = curUrl.replace("it.pirelliambiente.com","pirelliambiente.com");
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}
							
							//ecotechnology 
							if (curUrl.indexOf("pirelliecotechnology.com")!=-1 && x=='it'){
				   				curUrl = curUrl.replace("pirelliecotechnology.com","it.pirelliecotechnology.com");
				   				curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("it.pirelliecotechnology.com")!=-1 && x=='en'){
									curUrl = curUrl.replace("it.pirelliecotechnology.com","pirelliecotechnology.com");
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}

							//pgt-photonics 
							if (curUrl.indexOf("pgt-photonics.com")!=-1 && x=='it'){
				   				curUrl = curUrl.replace("pgt-photonics.com","it.pgt-photonics.com");
				   				curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("it.pgt-photonics.com")!=-1 && x=='en'){
									curUrl = curUrl.replace("it.pgt-photonics.com","pgt-photonics.com");
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}
							
							//corporate
							if (curUrl.indexOf("pirelli.com")!=-1 && x=='it'){
				   				curUrl = curUrl.replace("pirelli.com","it.pirelli.com");
								if(curUrl.indexOf("press_dettaglio.page")==-1){
					   				curUrl = curUrl.replace("en_IT","it_IT");
								}
				   				curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("it.pirelli.com")!=-1 && x=='en'){
									curUrl = curUrl.replace("it.pirelli.com","pirelli.com");
									if(curUrl.indexOf("press_dettaglio.page")==-1){
					   					curUrl = curUrl.replace("it_IT","en_IT");
									}
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}
				
							//nl.be->be.fr
							if (curUrl.indexOf("nl.pirelli.be")!=-1 && x=='fr'){
				   					curUrl = curUrl.replace("nl.pirelli.be","pirelli.be");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("pirelli.be")!=-1 && x=='nl'){
									curUrl = curUrl.replace("pirelli.be","nl.pirelli.be");
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}
							
							//ca.en->ca.fr
							if (curUrl.indexOf("pirelli.ca")!=-1 && x=='fr'){
				   					curUrl = curUrl.replace("pirelli.ca","fr.pirelli.ca");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("fr.pirelli.ca")!=-1 && x=='en'){
									curUrl = curUrl.replace("fr.pirelli.ca","pirelli.ca");
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}
							
							//ch.de->ch.fr
							if (curUrl.indexOf("pirelli.ch")!=-1 && x=='fr' && curUrl.indexOf("it")==-1 &&  curUrl.indexOf("fr")==-1){
				   					curUrl = curUrl.replace("pirelli.ch","fr.pirelli.ch");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("fr.pirelli.ch")!=-1 && x=='de'){
									curUrl = curUrl.replace("fr.pirelli.ch","pirelli.ch");
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}
							
							//ch.de->ch.it
							if (curUrl.indexOf("pirelli.ch")!=-1 && x=='it' && curUrl.indexOf("it")==-1 &&  curUrl.indexOf("fr")==-1){
				   					curUrl = curUrl.replace("pirelli.ch","it.pirelli.ch");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("it.pirelli.ch")!=-1 && x=='de'){
									curUrl = curUrl.replace("it.pirelli.ch","pirelli.ch");
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}
							
							//ch.fr->ch.it
							if (curUrl.indexOf("fr.pirelli.ch")!=-1 && x=='it'){
									curUrl = curUrl.replace("fr.pirelli.ch","it.pirelli.ch");
									curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("it.pirelli.ch")!=-1 && x=='fr'){
									curUrl = curUrl.replace("it.pirelli.ch","fr.pirelli.ch");
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}
							
							//cn.CN->cn.EN
							if (curUrl.indexOf("www.pirelli.com.cn")!=-1 && x=='en'){
				   					curUrl = curUrl.replace("www.pirelli.com.cn","en.pirelli.com.cn");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
							}else{
								if (curUrl.indexOf("en.pirelli.com.cn")!=-1 && x=='zh'){
									curUrl = curUrl.replace("en.pirelli.com.cn","www.pirelli.com.cn");
									curUrl = googleAn(curUrl,paramPageUrl);;
								}
							}
				}else{
								//change sites  on lisa
								//labs
								if (curUrl.indexOf("pirellilabs.com.svil.abraham.pirelli.com")!=-1 && x=='it'){
				   					curUrl = curUrl.replace("pirellilabs.com.svil.abraham.pirelli.com","pirellilabs.it.svil.abraham.pirelli.com");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
									}else{
									if (curUrl.indexOf("pirellilabs.it.svil.abraham.pirelli.com")!=-1 && x=='en'){
										curUrl = curUrl.replace("pirellilabs.it.svil.abraham.pirelli.com","pirellilabs.com.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								//broadband
								if (curUrl.indexOf("pirellibroadband.com.svil.abraham.pirelli.com")!=-1 && x=='it'){
				   					curUrl = curUrl.replace("pirellibroadband.com.svil.abraham.pirelli.com","pirellibroadband.it.svil.abraham.pirelli.com");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
									}else{
									if (curUrl.indexOf("pirellibroadband.it.svil.abraham.pirelli.com")!=-1 && x=='en'){
										curUrl = curUrl.replace("pirellibroadband.it.svil.abraham.pirelli.com","pirellibroadband.com.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}

								//ambiente
								if (curUrl.indexOf("pirelliambiente.com.svil.abraham.pirelli.com")!=-1 && x=='it'){
				   					curUrl = curUrl.replace("pirelliambiente.com.svil.abraham.pirelli.com","pirelliambiente.it.svil.abraham.pirelli.com");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
									}else{
									if (curUrl.indexOf("pirelliambiente.it.svil.abraham.pirelli.com")!=-1 && x=='en'){
										curUrl = curUrl.replace("pirelliambiente.it.svil.abraham.pirelli.com","pirelliambiente.com.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								//ecotechnology  
								if (curUrl.indexOf("pirelliecotechnology.com.svil.abraham.pirelli.com")!=-1 && x=='it'){
				   					curUrl = curUrl.replace("pirelliecotechnology.com.svil.abraham.pirelli.com","pirelliecotechnology.it.svil.abraham.pirelli.com");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
									}else{
									if (curUrl.indexOf("pirelliecotechnology.it.svil.abraham.pirelli.com")!=-1 && x=='en'){
										curUrl = curUrl.replace("pirelliecotechnology.it.svil.abraham.pirelli.com","pirelliecotechnology.com.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}

								//pgt-photonics  
								if (curUrl.indexOf("pgt-photonics.com.svil.abraham.pirelli.com")!=-1 && x=='it'){
				   					curUrl = curUrl.replace("pgt-photonics.com.svil.abraham.pirelli.com","pgt-photonics.it.svil.abraham.pirelli.com");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
									}else{
									if (curUrl.indexOf("pgt-photonics.it.svil.abraham.pirelli.com")!=-1 && x=='en'){
										curUrl = curUrl.replace("pgt-photonics.it.svil.abraham.pirelli.com","pgt-photonics.com.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
					   			//corporate
					   			if (curUrl.indexOf("pirelli.com.svil.abraham.pirelli.com")!=-1 && x=='it'){
					   					//alert('first if');
										curUrl = curUrl.replace("pirelli.com.svil.abraham.pirelli.com","pirelli.it.svil.abraham.pirelli.com");
										if(curUrl.indexOf("press_dettaglio.page")==-1){
					   						curUrl = curUrl.replace("en_IT","it_IT");
										}
										curUrl = googleAn(curUrl,paramPageUrl);;
										
								}else{
									if (curUrl.indexOf("pirelli.it.svil.abraham.pirelli.com")!=-1 && x=='en'){
										//alert('2 if');
										curUrl = curUrl.replace("pirelli.it.svil.abraham.pirelli.com","pirelli.com.svil.abraham.pirelli.com");
										if(curUrl.indexOf("press_dettaglio.page")==-1){
					   						curUrl = curUrl.replace("it_IT","en_IT");
										}
										curUrl = googleAn(curUrl,paramPageUrl);;
										
									}
								}
								//nl.be->be.fr
								if (curUrl.indexOf("nl.be.pirelli.svil.abraham.pirelli.com")!=-1 && x=='fr'){
					   					//alert('first if');
										curUrl = curUrl.replace("nl.be.pirelli.svil.abraham.pirelli.com","be.pirelli.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("be.pirelli.svil.abraham.pirelli.com")!=-1 && x=='nl'){
										//alert('2 if');
										curUrl = curUrl.replace("be.pirelli.svil.abraham.pirelli.com","nl.be.pirelli.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
								//ca.en->ca.fr
								if (curUrl.indexOf("en.ca.pirelli.svil.abraham.pirelli.com")!=-1 && x=='fr'){
					   					curUrl = curUrl.replace("en.ca.pirelli.svil.abraham.pirelli.com","fr.ca.pirelli.svil.abraham.pirelli.com");
					   					curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("fr.ca.pirelli.svil.abraham.pirelli.com")!=-1 && x=='en' ){
										curUrl = curUrl.replace("fr.ca.pirelli.svil.abraham.pirelli.com","en.ca.pirelli.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
								//ch.de->ch.fr
								if (curUrl.indexOf("ch.pirelli.svil.abraham.pirelli.com")!=-1 && x=='fr' && curUrl.indexOf("it")==-1 &&  curUrl.indexOf("fr")==-1){
					   					curUrl = curUrl.replace("ch.pirelli.svil.abraham.pirelli.com","fr.ch.pirelli.svil.abraham.pirelli.com");
					   					curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("fr.ch.pirelli.svil.abraham.pirelli.com")!=-1 && x=='de'){
										curUrl = curUrl.replace("fr.ch.pirelli.svil.abraham.pirelli.com","ch.pirelli.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
								//ch.de->ch.it
								if (curUrl.indexOf("ch.pirelli.svil.abraham.pirelli.com")!=-1 && x=='it' && curUrl.indexOf("it")==-1 &&  curUrl.indexOf("fr")==-1){
					   					curUrl = curUrl.replace("ch.pirelli.svil.abraham.pirelli.com","it.ch.pirelli.svil.abraham.pirelli.com");
					   					curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("it.ch.pirelli.svil.abraham.pirelli.com")!=-1 && x=='de'){
										curUrl = curUrl.replace("it.ch.pirelli.svil.abraham.pirelli.com","ch.pirelli.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
								//ch.fr->ch.it
								if (curUrl.indexOf("fr.ch.pirelli.svil.abraham.pirelli.com")!=-1 && x=='it'){
										curUrl = curUrl.replace("fr.ch.pirelli.svil.abraham.pirelli.com","it.ch.pirelli.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("it.ch.pirelli.svil.abraham.pirelli.com")!=-1 && x=='fr'){
										curUrl = curUrl.replace("it.ch.pirelli.svil.abraham.pirelli.com","fr.ch.pirelli.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
								//cn.CN->cn.EN
								if (curUrl.indexOf("cn.pirelli.svil.abraham.pirelli.com")!=-1 && x=='en' ){
					   					curUrl = curUrl.replace("cn.pirelli.svil.abraham.pirelli.com","en.cn.pirelli.svil.abraham.pirelli.com");
					   					curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("en.cn.pirelli.svil.abraham.pirelli.com")!=-1 && x=='zh'){
										curUrl = curUrl.replace("en.cn.pirelli.svil.abraham.pirelli.com","cn.pirelli.svil.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
								
								//change sites on abraham/staging
								//labs
								if (curUrl.indexOf("pirellilabs.com.abraham.pirelli.com")!=-1 && x=='it'){
				   					curUrl = curUrl.replace("pirellilabs.com.abraham.pirelli.com","pirellilabs.it.abraham.pirelli.com");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
									}else{
									if (curUrl.indexOf("pirellilabs.it.abraham.pirelli.com")!=-1 && x=='en'){
										curUrl = curUrl.replace("pirellilabs.it.abraham.pirelli.com","pirellilabs.com.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}

								//broadband
								if (curUrl.indexOf("pirellibroadband.com.abraham.pirelli.com")!=-1 && x=='it'){
				   					curUrl = curUrl.replace("pirellibroadband.com.abraham.pirelli.com","pirellibroadband.it.abraham.pirelli.com");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
									}else{
									if (curUrl.indexOf("pirellibroadband.it.abraham.pirelli.com")!=-1 && x=='en'){
										curUrl = curUrl.replace("pirellibroadband.it.abraham.pirelli.com","pirellibroadband.com.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}

								//ambiente
								if (curUrl.indexOf("pirelliambiente.com.abraham.pirelli.com")!=-1 && x=='it'){
				   					curUrl = curUrl.replace("pirelliambiente.com.abraham.pirelli.com","pirelliambiente.it.abraham.pirelli.com");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
									}else{
									if (curUrl.indexOf("pirelliambiente.it.abraham.pirelli.com")!=-1 && x=='en'){
										curUrl = curUrl.replace("pirelliambiente.it.abraham.pirelli.com","pirelliambiente.com.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								//ecotechnology abraham staging
								if (curUrl.indexOf("pirelliecotechnology.com.abraham.pirelli.com")!=-1 && x=='it'){
				   					curUrl = curUrl.replace("pirelliecotechnology.com.abraham.pirelli.com","pirelliecotechnology.it.abraham.pirelli.com");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
									}else{
									if (curUrl.indexOf("pirelliecotechnology.it.abraham.pirelli.com")!=-1 && x=='en'){
										curUrl = curUrl.replace("pirelliecotechnology.it.abraham.pirelli.com","pirelliecotechnology.com.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}

								//pgt-photonics abraham staging
								if (curUrl.indexOf("pgt-photonics.com.abraham.pirelli.com")!=-1 && x=='it'){
				   					curUrl = curUrl.replace("pgt-photonics.com.abraham.pirelli.com","pgt-photonics.it.abraham.pirelli.com");
				   					curUrl = googleAn(curUrl,paramPageUrl);;
									}else{
									if (curUrl.indexOf("pgt-photonics.it.abraham.pirelli.com")!=-1 && x=='en'){
										curUrl = curUrl.replace("pgt-photonics.it.abraham.pirelli.com","pgt-photonics.com.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								//corporate
								if (curUrl.indexOf("pirelli.com.abraham.pirelli.com")!=-1 && x=='it'){
					   					//alert('first if');
										curUrl = curUrl.replace("pirelli.com.abraham.pirelli.com","pirelli.it.abraham.pirelli.com");
										if(curUrl.indexOf("press_dettaglio.page")==-1){
					   						curUrl = curUrl.replace("en_IT","it_IT");
										}
										curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("pirelli.it.abraham.pirelli.com")!=-1 && x=='en'){
										//alert('2 if');
										curUrl = curUrl.replace("pirelli.it.abraham.pirelli.com","pirelli.com.abraham.pirelli.com");
										if(curUrl.indexOf("press_dettaglio.page")==-1){
					   						curUrl = curUrl.replace("it_IT","en_IT");
										}
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
					
								//nl.be->be.fr
								if (curUrl.indexOf("nl.be.pirelli.abraham.pirelli.com")!=-1 && x=='fr'){
					   					//alert('first if');
										curUrl = curUrl.replace("nl.be.pirelli.abraham.pirelli.com","be.pirelli.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("be.pirelli.abraham.pirelli.com")!=-1 && x=='nl'){
										//alert('2 if');
										curUrl = curUrl.replace("be.pirelli.abraham.pirelli.com","nl.be.pirelli.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
								//ca.en->ca.fr
								if (curUrl.indexOf("en.ca.pirelli.abraham.pirelli.com")!=-1 && x=='fr'){
					   					curUrl = curUrl.replace("en.ca.pirelli.abraham.pirelli.com","fr.ca.pirelli.abraham.pirelli.com");
					   					curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("fr.ca.pirelli.abraham.pirelli.com")!=-1 && x=='en'){
										curUrl = curUrl.replace("fr.ca.pirelli.abraham.pirelli.com","en.ca.pirelli.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
								//ch.de->ch.fr
								if (curUrl.indexOf("ch.pirelli.abraham.pirelli.com")!=-1 && x=='fr' && curUrl.indexOf("it")==-1 &&  curUrl.indexOf("fr")==-1){
					   					curUrl = curUrl.replace("ch.pirelli.abraham.pirelli.com","fr.ch.pirelli.abraham.pirelli.com");
					   					curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("fr.ch.pirelli.abraham.pirelli.com")!=-1 && x=='de'){
										curUrl = curUrl.replace("fr.ch.pirelli.abraham.pirelli.com","ch.pirelli.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
								//ch.de->ch.it
								if (curUrl.indexOf("ch.pirelli.abraham.pirelli.com")!=-1 && x=='it' && curUrl.indexOf("it")==-1 &&  curUrl.indexOf("fr")==-1){
					   					curUrl = curUrl.replace("ch.pirelli.abraham.pirelli.com","it.ch.pirelli.abraham.pirelli.com");
					   					curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("it.ch.pirelli.abraham.pirelli.com")!=-1 && x=='de'){
										curUrl = curUrl.replace("it.ch.pirelli.abraham.pirelli.com","ch.pirelli.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
								//ch.fr->ch.it
								if (curUrl.indexOf("fr.ch.pirelli.abraham.pirelli.com")!=-1 && x=='it'){
										curUrl = curUrl.replace("fr.ch.pirelli.abraham.pirelli.com","it.ch.pirelli.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("it.ch.pirelli.abraham.pirelli.com")!=-1 && x=='fr'){
										curUrl = curUrl.replace("it.ch.pirelli.abraham.pirelli.com","fr.ch.pirelli.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}
								
								//cn.CN->cn.EN
								if (curUrl.indexOf("cn.pirelli.abraham.pirelli.com")!=-1 && x=='en'){
					   					curUrl = curUrl.replace("cn.pirelli.abraham.pirelli.com","en.cn.pirelli.abraham.pirelli.com");
					   					curUrl = googleAn(curUrl,paramPageUrl);;
								}else{
									if (curUrl.indexOf("en.cn.pirelli.abraham.pirelli.com")!=-1 && x=='zh'){
										curUrl = curUrl.replace("en.cn.pirelli.abraham.pirelli.com","cn.pirelli.abraham.pirelli.com");
										curUrl = googleAn(curUrl,paramPageUrl);;
									}
								}	
				
				}

			
			//alert(curUrl);
			document.location.href = curUrl;
					
   		}
   	
   		function getUrl()
   			{
					var url = unescape(document.location.href);
					var param = url.indexOf("?")!=-1 ? url.substring(url.indexOf("?")+1) : "";
					url = url.indexOf("?")!=-1 ? url.substring(0,url.indexOf("?")) : url;
					if (param.indexOf("=")!=-1)
						{
							var parray = param.split("&");
							var firstPar = true;
							for (n=0;n<parray.length;n++)
								{
									if (	parray[n].indexOf("country_code=")==-1 && 
											parray[n].indexOf("language_code=")==-1	)
										{
											url += firstPar ? "?" + parray[n]: "&" + parray[n];
											firstPar = false; 
										}
								}
						}      			   
   				return url;
   			}
   			
			function strReplaceFirst( sourceString, oldString, newString, mode ) 
				{
					if ( sourceString == null || sourceString == "") return "";
					loop = true;
					while( sourceString.indexOf( oldString ) != -1 && loop) 
						{
							if (sourceString.indexOf( oldString )==0)
								firstpart = "";
							else	
								firstpart = sourceString.substring(0,sourceString.indexOf( oldString ));
																
							secondpart = sourceString.substring(sourceString.indexOf( oldString ) + oldString.length);

							sourceString = firstpart + newString + secondpart;
							
							if (mode.toUpperCase()=="FIRST") loop = false;
						}

					return sourceString;
				} 
				

   		function doSwitch(tipo,locale,lan,country)
   			{
   				try
   					{
	      			   document.areaSiteChooser.country_code.value = document.areaSiteChooser.country_list[document.areaSiteChooser.country_list.selectedIndex].value;
   					}
   				catch (e) { /* no-op */ }      						

   				try
   					{
	      			   document.areaSiteChooser.language_code.value = lan!="" ?
	      			   															  lan :
	      			   															  document.areaSiteChooser.language_list[document.areaSiteChooser.language_list.selectedIndex].value;      					
   					}
   				catch (e) { /* no-op */ }      						

   				var current_url = getUrl();

   				if (tipo=="language") // effettuo lo switch di lingua/site
   					{
   						/* pirelli.com: en|it
								www.pirelli.com <-> www.it.pirelli.com
								pirelli.com.homer.pirelli.com <-> pirelli.it.homer.pirelli.com      						
   						*/
   						if (current_url.indexOf("pirelli.com.abraham.pirelli.com")!=-1 && lan=="it")
						{
   								current_url = strReplaceFirst(current_url,"pirelli.com.abraham.pirelli.com","pirelli.it.abraham.pirelli.com","FIRST");
								current_url = strReplaceFirst(current_url,"en_IT","it_IT","");
						}
   						if (current_url.indexOf("pirelli.it.abraham.pirelli.com")!=-1 && lan=="en")
						{
   								current_url = strReplaceFirst(current_url,"pirelli.it.abraham.pirelli.com","pirelli.com.abraham.pirelli.com","FIRST");
								current_url = strReplaceFirst(current_url,"it_IT","en_IT","");
						}
							/* pirellibroadband.com: en|it
								www.pirellibroadband.com <-> www.it.pirellibroadband.com
								pirellibroadband.com.homer.pirelli.com <-> pirellibroadband.it.abraham.pirelli.com
							*/	
   						if (current_url.indexOf("pirellibroadband.com.abraham.pirelli.com")!=-1 && lan=="it")
   								current_url = strReplaceFirst(current_url,"pirellibroadband.com.abraham.pirelli.com","pirellibroadband.it.abraham.pirelli.com","FIRST");
   						if (current_url.indexOf("pirellibroadband.it.abraham.pirelli.com")!=-1 && lan=="en")
   								current_url = strReplaceFirst(current_url,"pirellibroadband.it.abraham.pirelli.com","pirellibroadband.com.abraham.pirelli.com","FIRST");

							/* pirellityre US: en|es
								www.us.pirelli.com <-> www.es.us.pirelli.com
								us.pirelli.homer.pirelli.com <-> es.us.pirelli.homer.pirelli.com								
							*/
   						if (current_url.indexOf("us.pirelli.abraham.pirelli.com")!=-1 && lan=="es")
   								current_url = strReplaceFirst(current_url,"us.pirelli.abraham.pirelli.com","es.us.pirelli.abraham.pirelli.com","FIRST");
   						if (current_url.indexOf("es.us.pirelli.abraham.pirelli.com")!=-1 && lan=="en")
   								current_url = strReplaceFirst(current_url,"es.us.pirelli.abraham.pirelli.com","us.pirelli.abraham.pirelli.com","FIRST");

							/* pirellityre CN: zh|en
								www.pirelli.cn <-> www.pirelli.en.cn
								cn.pirelli.homer.pirellli.com <-> en.cn.pirelli.homer.pirelli.com
							*/
   						if (current_url.indexOf("cn.pirelli.abraham.pirelli.com")!=-1 && lan=="en")
   								current_url = strReplaceFirst(current_url,"cn.pirelli.abraham.pirelli.com","en.cn.pirelli.abraham.pirelli.com","FIRST");
   						if (current_url.indexOf("en.cn.pirelli.abraham.pirelli.com")!=-1 && lan=="zh")
   								current_url = strReplaceFirst(current_url,"en.cn.pirelli.abraham.pirelli.com","cn.pirelli.abraham.pirelli.com","FIRST");
   					}

   				if (tipo=="country") // effettuo lo switch area/site
   					{     					

							/* pirellityre GB: UK|IE
								www.pirelli.co.uk <-> www.pirelli.ie [GB/IE]      				
								co.uk.pirelli.homer.pirellli.com <-> ie.pirelli.homer.pirelli.com
							*/
   						if (current_url.indexOf("co.uk.pirelli.abraham.pirelli.com")!=-1 && country=="IE")
   								current_url = strReplaceFirst(current_url,"co.uk.pirelli.abraham.pirelli.com","ie.pirelli.abraham.pirelli.com","FIRST");
   						if (current_url.indexOf("ie.pirelli.abraham.pirelli.com")!=-1 && country=="GB")
   								current_url = strReplaceFirst(current_url,"ie.pirelli.abraham.pirelli.com","co.uk.pirelli.abraham.pirelli.com","FIRST");
						}      				
   					
   				// alert(current_url);
   				document.areaSiteChooser.action = current_url;
   				document.areaSiteChooser.submit();
   			}

   			

    
  // According to RFC 3986, only characters from a set of reserved and a set
  // of unreserved characters are allowed in a URL:
  var unreserved = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.~";
  var reserved = "!*'();:@&=+$,/?%#[]";
  var allowed = unreserved + reserved;
  var hexchars = "0123456789ABCDEFabcdef";

  // --------------------------------- Encoding -------------------------------

  // This function returns a percent sign followed by two hexadecimal digits.
  // Input is a decimal value not greater than 255.
  function gethex(decimal) {
   return "%" + hexchars.charAt(decimal >> 4) + hexchars.charAt(decimal & 0xF);
  }
  
  // ---------------- UTF-8 character encoding ----------------

  function encodeUTF8( decoded ) {
  
    var encoded = '';
    
    for (var i = 0; i < decoded.length; i++ ) {
      var ch = decoded.charAt(i);
      // Check if character is an unreserved character:
      if (unreserved.indexOf(ch) != -1) {
        encoded = encoded + ch;
      } else {

        // The position in the Unicode table tells us how many bytes are needed.
        // Note that if we talk about first, second, etc. in the following, we are
        // counting from left to right:
        //
        //   Position in   |  Bytes needed   | Binary representation
        //  Unicode table  |   for UTF-8     |       of UTF-8
        // ----------------------------------------------------------
        //     0 -     127 |    1 byte       | 0XXX.XXXX
        //   128 -    2047 |    2 bytes      | 110X.XXXX 10XX.XXXX
        //  2048 -   65535 |    3 bytes      | 1110.XXXX 10XX.XXXX 10XX.XXXX
        // 65536 - 2097151 |    4 bytes      | 1111.0XXX 10XX.XXXX 10XX.XXXX 10XX.XXXX

        var charcode = decoded.charCodeAt(i);

        // Position 0 - 127 is equal to percent-encoding with an ASCII character encoding:
        if (charcode < 128) {
          encoded = encoded + gethex(charcode);
        }

        // Position 128 - 2047: two bytes for UTF-8 character encoding.
        if (charcode > 127 && charcode < 2048) {
          // First UTF byte: Mask the first five bits of charcode with binary 110X.XXXX:
          encoded = encoded + gethex((charcode >> 6) | 0xC0);
          // Second UTF byte: Get last six bits of charcode and mask them with binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

        // Position 2048 - 65535: three bytes for UTF-8 character encoding.
        if (charcode > 2047 && charcode < 65536) {
          // First UTF byte: Mask the first four bits of charcode with binary 1110.XXXX:
          encoded = encoded + gethex((charcode >> 12) | 0xE0);
          // Second UTF byte: Get the next six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 6) & 0x3F) | 0x80);
          // Third UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

        // Position 65536 - : four bytes for UTF-8 character encoding.
        if (charcode > 65535) {
          // First UTF byte: Mask the first three bits of charcode with binary 1111.0XXX:
          encoded = encoded + gethex((charcode >> 18) | 0xF0);
          // Second UTF byte: Get the next six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 12) & 0x3F) | 0x80);
          // Third UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex(((charcode >> 6) & 0x3F) | 0x80);
          // Fourth UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
          encoded = encoded + gethex((charcode & 0x3F) | 0x80);
        }

      }

    }  // end of for ...

    // return result:
    return encoded;
  }
  
  