var p;

var lang_code = 0;

function checkLanguageCode(){
    if (location.href.toLowerCase().indexOf("it-it") > 0){
            lang_code = 0;
    } else {
            lang_code = 1;
    }
}

checkLanguageCode();

function changeLanguageCode(language)
{
	var url;

	if (language.toLowerCase()=='it-it')
	{
		url = location.href.toLowerCase();
		url = url.replace('/it-it/','/en-us/');
		url = url.replace('/pagine/','/pages/');
		url = url.replace('/documenti/','/documents/');
	}
	else
	{
		url = location.href.toLowerCase();
		url = url.replace('/en-us/','/it-it/');
		url = url.replace('/pages/','/pagine/');
		url = url.replace('/documents/','/documenti/');
	}

	location.href = url;
}

voce = new Array();
		voce[0] = new Array();  // LINGUA it-IT = 0 ---- en-US = 1
		voce[1] = new Array();
		
		voce[0][0] = "Sfide";
		voce[0][1] = "Aree";
		voce[0][2] = "Azienda";
		voce[0][3] = "Network";
		voce[0][4] = "Documenti";
		voce[0][5] = "Newsletter";
		voce[0][6] = "News";
		voce[0][7] = "Careers";
		voce[0][8] = "Contatti";
		voce[0][9] = "Motopropulsore";
		voce[0][10] = "Veicolo";		
		voce[0][11] = "Sistemi";			
		voce[0][12] = "Materiali";
		voce[0][13] = "Infomobilit&agrave;";
		voce[0][14] = "Produzione";
		voce[0][15] = "Ambiente<br>&amp; Mobilit&agrave;";
		voce[0][16] = "Sicurezza";
		//voce[0][17] = "Comfort &amp; Benessere"; 
		voce[0][17] = "Benessere"; 
		voce[0][18] = "Prestazioni"; 
		voce[0][19] = "Eccellenza nella competitivit&agrave;"; 
		voce[0][20] = "Profilo";
		voce[0][21] = "Storia"; 
		voce[0][22] = "Missione<br>&amp; Valori"; 
		voce[0][23] = "Sedi"; 
		voce[0][24] = "Corporate Governance"; 
		voce[0][25] = "Fiat Group"; 
		voce[0][26] = "Nazionale"; 
		voce[0][27] = "Mondo";
		voce[0][28] = "Intro";
		voce[0][29] = " Ricerca";

		
		voce[0][30] = "Diesel";
		voce[0][31] = "Benzina";
		voce[0][32] = "Carburanti alternativi";
		voce[0][33] = "Propulsioni alternative";
		voce[0][34] = "Trasmissioni";
						
		voce[0][35] = "Architettura";
		voce[0][36] = "Scocca &amp; finizioni";
		voce[0][37] = "Telaio &amp; sospensioni";
		voce[0][38] = "Interni &amp; interfaccia uomo-macchina (HMI)";
						
		voce[0][39] = "Sistemi termici";
		voce[0][40] = "Sistemi di assistenza alla guida (ADAS)";
		voce[0][41] = "Sistemi attivi";
		voce[0][42] = "Sistemi di illuminazione";
		voce[0][43] = "Sistemi elettrici &amp; elettronici";
						
		voce[0][44] = "Materiali multifunzionali";
		voce[0][45] = "Materiali per l'alleggerimento";
		voce[0][46] = "Materiali ecologici";
						
		voce[0][47] = "Multimedia &amp; telematica";
		voce[0][48] = "Sistemi wireless";
		voce[0][49] = "Servizi per l'impresa";
		voce[0][50] = "Servizi per il cliente";
						
		voce[0][51] = "Tecnologie di processo";
		voce[0][52] = "Sistemi di produzione";
		voce[0][53] = "Fabbrica ecologica";
		voce[0][54] = "Fabbrica digitale";

		voce[0][55] = "Efficienza energetica";
		voce[0][56] = "Emissioni";
		voce[0][57] = "Sistemi di mobilita";
		voce[0][58] = "Materiali ecologici";
		voce[0][59] = "Fabbrica ecologica";

		voce[0][60] = "Passiva";
		voce[0][61] = "Attiva";
		voce[0][62] = "Preventiva";
		voce[0][63] = "Sistemi cooperativi";

		voce[0][64] = "Ergonomia &amp; funzionalita";
		voce[0][65] = "Comfort acustico &amp; vibrazionale";
		voce[0][66] = "Comfort termico";
		voce[0][67] = "Multimedia &amp; connettivita";
		voce[0][68] = "Ergonomia del posto&nbsp; di lavoro";
		voce[0][69] = "Manovre assistite";

		voce[0][70] = "Guidabilita";
		voce[0][71] = "Manovrabilita";

		voce[0][72] = "Metodologie";
		voce[0][73] = "Produzione efficiente &amp; flessibile";
		voce[0][74] = "Rete Accademica &amp; Industriale";
		voce[0][75] = "Impresa estesa";
		voce[0][76] = "Capitale intangibile";
		voce[0][77] = "Europa";

								
		voce[1][0] = "Challenges";
		voce[1][1] = "Areas";
		voce[1][2] = "Company";
		voce[1][3] = "Network";
		voce[1][4] = "Library";
		voce[1][5] = "Newsletter";
		voce[1][6] = "News";
		voce[1][7] = "Careers";
		voce[1][8] = "Contacts";
		voce[1][9] = "Powertrain";
		voce[1][10] = "Vehicle";		
		voce[1][11] = "Systems";			
		voce[1][12] = "Materials";
		voce[1][13] = "Infomobility";
		voce[1][14] = "Manufacturing";
		voce[1][15] = "Environment &amp; mobility";
		voce[1][16] = "Safety";
		//voce[1][17] = "Comfort &amp; Wellbeing"; 
		voce[1][17] = "Wellbeing";
		voce[1][18] = "Performance"; 
		voce[1][19] = "Leadership in competitivenes"; 
		voce[1][20] = "Overview";
		voce[1][21] = "History"; 
		voce[1][22] = "Mission <br/>&amp; Values"; 
		voce[1][23] = "Branches"; 
		voce[1][24] = "Corporate Governance"; 
		voce[1][25] = "Fiat Group"; 
		voce[1][26] = "National"; 	
		voce[1][27] = "International";
		voce[1][28] = "Intro";
		voce[1][29] = " Search";
		voce[1][30] = "Diesel";
		voce[1][31] = "Gasoline";
		voce[1][32] = "Alternative fuels";
		voce[1][33] = "Alternative propulsions";
		voce[1][34] = "Transmissions";
		
		voce[1][35] = "Architecture";
		voce[1][36] = "Body &amp; trimming";
		voce[1][37] = "Chassis &amp; suspensions";
		voce[1][38] = "Interiors &amp; HMI (Human-Machine Interface)";
		
		voce[1][39] = "Thermal systems";
		voce[1][40] = "ADAS (Advanced Driving Assist Systems)";
		voce[1][41] = "Active systems";
		voce[1][42] = "Lighting systems";
		voce[1][43] = "Electric &amp; electronic systems";
		
		voce[1][44] = "Multifunctional materials";
		voce[1][45] = "Materials for weight reduction";
		voce[1][46] = "Ecological materials";
		
		voce[1][47] = "Multimedia &amp; telematics";
		voce[1][48] = "Wireless systems";
		voce[1][49] = "Enterprise services";
		voce[1][50] = "Customer services";
		
		voce[1][51] = "Process technologies";
		voce[1][52] = "Production systems";
		voce[1][53] = "Eco-factory";
		voce[1][54] = "Digital factory";

		voce[1][55] = "Energy efficiency";
		voce[1][56] = "Emissions";
		voce[1][57] = "Mobility systems";
		voce[1][58] = "Ecological materials";
		voce[1][59] = "Eco-facory";

		voce[1][60] = "Passive";
		voce[1][61] = "Active";
		voce[1][62] = "Preventive";
		voce[1][63] = "Co-operative systems";

		voce[1][64] = "Ergonomics &amp; functionality";
		voce[1][65] = "Acoustical &amp; vibrational comfort";
		voce[1][66] = "Thermal comfort";
		voce[1][67] = "Multimedia &amp; connectivity";
		voce[1][68] = "Workplace ergonomics";
		voce[1][69] = "Assisted manoeuvres";

		voce[1][70] = "Drivability";
		voce[1][71] = "Handling";

		voce[1][72] = "Methodologies";
		voce[1][73] = "Efficient &amp; flexible manufacturing";
		voce[1][74] = "Academic &amp; Industriasl network";
		voce[1][75] = "Extended enterprise";
		voce[1][76] = "Intangible capital";
		voce[1][77] = "Europe";

		nomeMenu = new Array(9);
		nomeMenu[0] = "Menu1";
		nomeMenu[1] = "Menu2";		
		nomeMenu[2] = "Menu3";
		nomeMenu[3] = "Menu4";
		nomeMenu[4] = "Menu5";
		nomeMenu[5] = "Menu6";
		nomeMenu[6] = "Menu7";
		nomeMenu[7] = "Menu8";
		nomeMenu[8] = "Menu9";

		nomeSubMenu = new Array(20);
		nomeSubMenu[0] = "Menu1_1";
		nomeSubMenu[1] = "Menu1_2";
		nomeSubMenu[2] = "Menu1_3";
		nomeSubMenu[3] = "Menu1_4";
		nomeSubMenu[4] = "Menu1_5";			
		nomeSubMenu[5] = "Menu2_1";
		nomeSubMenu[6] = "Menu2_2";
		nomeSubMenu[7] = "Menu2_3";
		nomeSubMenu[8] = "Menu2_4";
		nomeSubMenu[9] = "Menu2_5";			
		nomeSubMenu[10] = "Menu2_6";		
		nomeSubMenu[11] = "Menu3_1";
		nomeSubMenu[12] = "Menu3_2";
		nomeSubMenu[13] = "Menu3_3";
		nomeSubMenu[14] = "Menu3_4";
		nomeSubMenu[15] = "Menu3_5";
		nomeSubMenu[16] = "Menu4_1";
		nomeSubMenu[17] = "Menu4_2";
		nomeSubMenu[18] = "Menu4_3";
		nomeSubMenu[19] = "Menu4_4";


function Show(id)
{	

	BlockSecondLevelMenu('li_'+id+ '_1');
	document.getElementById('li_'+id+ '_1').style.fontSize='13px';
	document.getElementById('li_'+id+ '_1').style.color='#ffffff';
	document.getElementById('li_'+id+ '_1').style.backgroundColor='#cccccc';
	document.getElementById('li_'+id+ '_1').style.fontWeight='bold';
	document.getElementById('li_'+id+ '_1').style.fontFamily='Arial';

	if (id=='Menu1')			
	{
		document.getElementById('Menu1').style.display="block";
		document.getElementById('Menu2').style.display="none";
		document.getElementById('Menu3').style.display="none";
		document.getElementById('Menu4').style.display="none";	
	}	
	if (id=='Menu2')			
	{
		document.getElementById('Menu1').style.display="none";
		document.getElementById('Menu2').style.display="block";
		document.getElementById('Menu3').style.display="none";
		document.getElementById('Menu4').style.display="none";	
	}	
	if (id=='Menu3')
	{
		document.getElementById('Menu1').style.display="none";
		document.getElementById('Menu2').style.display="none";
		document.getElementById('Menu3').style.display="block";		
		document.getElementById('Menu4').style.display="none";
		
	}	
	if (id=='Menu4')
	{
		document.getElementById('Menu1').style.display="none";
		document.getElementById('Menu2').style.display="none";
		document.getElementById('Menu3').style.display="none";
		document.getElementById('Menu4').style.display="block";	
	}	
			// Accendere il menu
	for (i=1; i-1<nomeMenu.length; i++) 
	{ 
		if (id=='Menu'+i)
		{	
			NoMouseOutLevel1 = 'li_'+id; 
			document.getElementById('li_'+id).style.fontWeight='bold';
			document.getElementById('li_'+id).style.fontFamily='Arial';			   
			//document.getElementById('li_'+id).style.fontSize='13px';
			document.getElementById('li_'+id).style.color='#ffffff';
			if (i<3){					
				document.getElementById('li_'+id).style.backgroundImage = "url(/Style%20Library/Images/Common/rollove_menu2.jpg)";
			}
			else{
				document.getElementById('li_'+id).style.backgroundImage = "url(/Style%20Library/Images/Common/rollove_menu.jpg)";			
			}
		}
		else
		{	  
			document.getElementById('li_Menu'+i).style.fontWeight='';
			document.getElementById('li_Menu'+i).style.fontFamily='';			   
			document.getElementById('li_Menu'+i).style.fontSize='';
			document.getElementById('li_Menu'+i).style.color='';					
			if (i<3){	
				document.getElementById('li_Menu'+i).style.backgroundImage = "url(/Style%20Library/Images/Common/Background_Lev1-2.jpg)";
				}
			else 
				{
				document.getElementById('li_Menu'+i).style.backgroundImage = ""; 
				}

		}
	}

}	

function BlockFirstLevelMenu(id){	
	//alert (id);
	NoMouseOutLevel1 = id;
	NoMouseOutLevel2 = "";
	for (i=0; i<nomeMenu.length; i++) {   
		mouseOutLevel1('li_'+nomeMenu[i]);
	} 

	for (j=0; j<nomeSubMenu.length; j++) {   
		mouseOutLevel2('li_'+nomeSubMenu[j]);
	}

	document.getElementById('Menu1').style.display="none"; 
	document.getElementById('Menu2').style.display="none"; 	
	document.getElementById('Menu3').style.display="none"; 
	document.getElementById('Menu4').style.display="none";


}

function BlockSecondLevelMenu(id){	
	//alert (id);
	NoMouseOutLevel2 = id;
	for (j=0; j<nomeSubMenu.length; j++) {   
		mouseOutLevel2('li_'+nomeSubMenu[j]);
	}
}


function ShowThirdLevelMenu(SubMenuId)
{	
	for (j=0; j<nomeSubMenu.length; j++) 
	{  
		if(document.getElementById)
		{  
			document.getElementById(nomeSubMenu[j]).style.display="none";
			document.getElementById(SubMenuId).style.display="block";

			if (SubMenuId==nomeSubMenu[j])
			{						
				document.getElementById('li_'+SubMenuId).style.fontSize='13px';
				document.getElementById('li_'+SubMenuId).style.color='#ffffff';
				document.getElementById('li_'+SubMenuId).style.backgroundColor='#cccccc';
				document.getElementById('li_'+SubMenuId).style.fontWeight='bold';
				document.getElementById('li_'+SubMenuId).style.fontFamily='Arial';
			}
			else
			{  
				document.getElementById('li_'+nomeSubMenu[j]).style.fontSize='';
				document.getElementById('li_'+nomeSubMenu[j]).style.color='';
				document.getElementById('li_'+nomeSubMenu[j]).style.backgroundColor='';
				document.getElementById('li_'+nomeSubMenu[j]).style.fontWeight='';
				document.getElementById('li_'+nomeSubMenu[j]).style.fontFamily='';		
			}
		}
	}
}
	

function showRollOver(id)
{
	document.getElementById('Menu' + id).className="MenuVoiceHover";
	document.getElementById('Link' + id).style.color="#ffffff";
}
	
function hideRollOver(id)
{
	document.getElementById('Menu' + id).className="MenuVoice";
	document.getElementById('Link' + id).style.color="#cccccc";
}


function ShowCombo(whichLayer){       


    var numcombo = 20;

    var elem = document.getElementById(whichLayer);
    	
    var	vis = elem.style;										  
	
	if(isIE()) {
		vis.top =p.y+17;
    }else {
		vis.top =p.y+17;
    }	

	vis.left=p.x;


	if(vis.display=='' && elem.offsetWidth != undefined && elem.offsetHeight!=undefined)
	{
		vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
	}

	for (i=1; i<=numcombo; i++){	
		if (whichLayer != "MenuCombo_prjList_"+i) {	
			if (document.getElementById("MenuCombo_prjList_"+i)!=undefined){
				document.getElementById("MenuCombo_prjList_"+i).style.display='none'; 
			}
			else{
				break;
			}
		}
	} 

	vis.display = (vis.display==''||vis.display=='block')?'none':'block';
	vis.innerHtml = vis.innerHtml;


}

function getPageCoords (element) {


var coords = {x: 0, y: 0}; 
var tblCat=false;
var tempx=0;
if (element!=null)
{
	while (element){ 

			coords.x += element.offsetLeft; 
			coords.y += element.offsetTop; 

			if (element.id=="tblCategory")
{
				tblCat=true;
				break;
}
			if (element.id=="Testing01")
			{
				tempx=coords.x;
			}
			element = element.offsetParent; 

	}

} 


if (tblCat==false)
{

	coords.y=0;
	
	coords.x=tempx;


}

return coords; 
} 


function OpenPopup(url, widthPopUp, heightPopUp) {
   var w = widthPopUp;
   var h = heightPopUp;
   var l = Math.floor((screen.width-w)/2);
   var t = Math.floor((screen.height-h)/2);
      window.open(url,"","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
}

var NoMouseOutLevel1=""; 
var NoMouseOutLevel2="";

function mouseOverLevel1(id)
{	   
	//alert 	 (id);
	//document.getElementById(id).style.backgroundImage = "url(/Style%20Library/Images/Common/rollove_menu.jpg)" ;
	document.getElementById(id).style.fontWeight='bold';
	document.getElementById(id).style.fontFamily='Arial';			   
	/*document.getElementById(id).style.fontSize='13px';*/
	document.getElementById(id).style.color='#ffffff';					
	if ((id=='li_Menu1') || (id=='li_Menu2')){					
		document.getElementById(id).style.backgroundImage = "url(/Style%20Library/Images/Common/rollove_menu2.jpg)";
	}
	else{
		document.getElementById(id).style.backgroundImage = "url(/Style%20Library/Images/Common/rollove_menu.jpg)";			
	}
}
function mouseOutLevel1(id)
{		 
	if (NoMouseOutLevel1!=id){
		document.getElementById(id).style.fontWeight='';
		document.getElementById(id).style.fontFamily='';			   
		document.getElementById(id).style.fontSize='';
		document.getElementById(id).style.color='';					

		if ((id=='li_Menu1') || (id=='li_Menu2')){					
			document.getElementById(id).style.backgroundImage = "url(/Style%20Library/Images/Common/Background_Lev1-2.jpg)";
		}
		else{
			document.getElementById(id).style.backgroundImage = ""; 		
		}				
	}
}

function mouseOverLevel2(id)
{
		document.getElementById(id).style.fontSize='13px';
		document.getElementById(id).style.color='#ffffff';
		document.getElementById(id).style.backgroundColor='#cccccc';
		document.getElementById(id).style.fontWeight='bold';
		document.getElementById(id).style.fontFamily='Arial';		
}
function mouseOutLevel2(id)
{		 
	if (NoMouseOutLevel2!=id){
		document.getElementById(id).style.fontSize='';
		document.getElementById(id).style.color='';
		document.getElementById(id).style.backgroundColor='';
		document.getElementById(id).style.fontWeight='';
		document.getElementById(id).style.fontFamily='';	
	}
}

function closeLevel3(id, ancor)
{

	if(document.getElementById)
		{
			document.getElementById(id).style.display="none";
			location.hash=ancor;

		}
}
function BackProject()
{
	var indirizzo = String(window.location.href).toLowerCase();
	
	var pos;
	if (lang_code == 0){
	     pos = indirizzo.indexOf("/pagine/");
	} else {
	     pos = indirizzo.indexOf("/pages/");	
	}
	
	if (pos > 0){
	    location.href = indirizzo.substring(0, pos +1 );
	}
    
}

function DefaultPage()
{
	document.getElementById('TextSearch').value=voce[lang_code][29];
	document.getElementById('li_Menu1').style.backgroundImage = "url(/Style%20Library/Images/Common/Background_Lev1-2.jpg)";
	document.getElementById('li_Menu2').style.backgroundImage = "url(/Style%20Library/Images/Common/Background_Lev1-2.jpg)";

	var indirizzo = String(window.location.href).toLowerCase();

	var pagina = indirizzo.substring(indirizzo.lastIndexOf("/")+1,indirizzo.indexOf(".aspx"));
	
	
	if (indirizzo.indexOf("/sfide/")!=-1){
	    Show('Menu1');

		if (indirizzo.indexOf("/sfide/safety/")!=-1){
		    BlockSecondLevelMenu('li_Menu1_2');
		    mouseOverLevel2('li_Menu1_2');			
		}
		if (indirizzo.indexOf("/sfide/comfort/")!=-1){
		    BlockSecondLevelMenu('li_Menu1_3');
		    mouseOverLevel2('li_Menu1_3');			
		}
		if (indirizzo.indexOf("/sfide/performance/")!=-1){
		    BlockSecondLevelMenu('li_Menu1_4');
		    mouseOverLevel2('li_Menu1_4');			
		}
		if (indirizzo.indexOf("/sfide/leadership/")!=-1){
		    BlockSecondLevelMenu('li_Menu1_5');
		    mouseOverLevel2('li_Menu1_5');			
		}

	}
	if (indirizzo.indexOf("/aree/")!=-1){
	    Show('Menu2');

		if (indirizzo.indexOf("/aree/vehicle/")!=-1){
		    BlockSecondLevelMenu('li_Menu2_2');
		    mouseOverLevel2('li_Menu2_2');			
		}
		if (indirizzo.indexOf("/aree/systems/")!=-1){
		    BlockSecondLevelMenu('li_Menu2_3');
		    mouseOverLevel2('li_Menu2_3');			
		}
		if (indirizzo.indexOf("/aree/materials/")!=-1){
		    BlockSecondLevelMenu('li_Menu2_4');
		    mouseOverLevel2('li_Menu2_4');			
		}
		if (indirizzo.indexOf("/aree/infomobility/")!=-1){
		    BlockSecondLevelMenu('li_Menu2_5');
		    mouseOverLevel2('li_Menu2_5');			
		}

		if (indirizzo.indexOf("/aree/manufactoring/")!=-1){
		    BlockSecondLevelMenu('li_Menu2_6');
		    mouseOverLevel2('li_Menu2_6');			
		}

	}


	if (pagina=="companyprofilo"){
	    Show('Menu3');
	}
	if (pagina=="history"){
	    Show('Menu3');
	    BlockSecondLevelMenu('li_Menu3_2');
	    mouseOverLevel2('li_Menu3_2');		
	}

	if (pagina=="companymission"){
	    Show('Menu3');
	    BlockSecondLevelMenu('li_Menu3_3');
	    mouseOverLevel2('li_Menu3_3');		
	}

	if (pagina=="companyvalori"){
	    Show('Menu3');
	    BlockSecondLevelMenu('li_Menu3_3');
	    mouseOverLevel2('li_Menu3_3');		
	}


	if (pagina=="companysedi"){
	    Show('Menu3');
	    BlockSecondLevelMenu('li_Menu3_4');
	    mouseOverLevel2('li_Menu3_4');
		
	}
	
	if (pagina=="corporategovernace"){
	    Show('Menu3');
	    BlockSecondLevelMenu('li_Menu3_5');
	    mouseOverLevel2('li_Menu3_5');
		
	}

	if (pagina=="netfiatgroup"){
	    Show('Menu4');
	}

	if (pagina=="netitalia"){
	    Show('Menu4');
	    BlockSecondLevelMenu('li_Menu4_2');
	    mouseOverLevel2('li_Menu4_2');
	}

	if (pagina=="netitaliacollaborazioni"){
	    Show('Menu4');
	    BlockSecondLevelMenu('li_Menu4_2');
	    mouseOverLevel2('li_Menu4_2');
	}

	if (pagina=="neteurope"){
	    Show('Menu4');
	    BlockSecondLevelMenu('li_Menu4_3');
	    mouseOverLevel2('li_Menu4_3');	
	}

	if (pagina=="netandamento"){
	    Show('Menu4');
	    BlockSecondLevelMenu('li_Menu4_3');
	    mouseOverLevel2('li_Menu4_3');	
	}	

	if (pagina=="netaccademico"){
	    Show('Menu4');
	    BlockSecondLevelMenu('li_Menu4_3');
	    mouseOverLevel2('li_Menu4_3');	
	}

	if (pagina=="progettiattuali"){
	    Show('Menu4');
	    BlockSecondLevelMenu('li_Menu4_3');
	    mouseOverLevel2('li_Menu4_3');	
	}

	if (pagina=="netindustriale"){
	    Show('Menu4');
	    BlockSecondLevelMenu('li_Menu4_3');
	    mouseOverLevel2('li_Menu4_3');	
	}


	if (pagina=="networld"){
	    Show('Menu4');
	    BlockSecondLevelMenu('li_Menu4_4');
	    mouseOverLevel2('li_Menu4_4');
	}

	if (indirizzo.indexOf("/library/")!=-1){
	//if (pagina=="library"){
	    BlockFirstLevelMenu('li_Menu5');
	    mouseOverLevel1('li_Menu5');
	}
	if (pagina=="newsletter"){
	    BlockFirstLevelMenu('li_Menu6');
	    mouseOverLevel1('li_Menu6');
	}
	if (indirizzo.indexOf("/news/")!=-1){
	    BlockFirstLevelMenu('li_Menu7');
	    mouseOverLevel1('li_Menu7');
	}
	if (pagina=="newsarchive"){
	    BlockFirstLevelMenu('li_Menu7');
	    mouseOverLevel1('li_Menu7');
	}

	if (pagina=="careers"){
	    BlockFirstLevelMenu('li_Menu8');
	    mouseOverLevel1('li_Menu8');
	}
	if (indirizzo.indexOf("/contacts/")!=-1){
	    BlockFirstLevelMenu('li_Menu9');
	    mouseOverLevel1('li_Menu9');
	}
}

function isIE(){
    if(navigator.userAgent.search(/msie/i)!= -1) { 
        return true;
    } else { 
        return false;
    } 
}


function checkSearchSubmit(field,e){
    var keycode = 0;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    
    if (keycode == 13) {
       startSearch();
       return false;
    }
    return true;
}

function startSearch(){
    var searchInput = document.getElementById('TextSearch');
    var keywords = searchInput.value;
    
    
    
    if (keywords && searchInput.defaultValue && searchInput.defaultValue != keywords){
        var url;
   
        if (location.href.toLowerCase().indexOf("it-it") > 0){
            url = '/it-IT/Pagine/SearchResults.aspx';
        } else {
            url = '/en-US/Pages/SearchResults.aspx';
        }
        
        location.href = url + '?k=' + keywords + '&s=CRF_All';
    }
    return false;
}


function registerSearch(id){
    var input = document.getElementById(id);
    input.onkeypress = function(e){return checkSearchSubmit(input,e); }
}



