//open_rivenditoriitalia_right('<%=rsSub("provincia")%>', <%=rs("IDRegioni")%>, '<%=rs("ItaRegioni")%>', '<%=rsProv("Nome")%>')
function fnProcessa(str)
{
	var reCom = /<!--[\s\S]*?-->/gi;
	var re = /<script[\s\S]*?<\/script>/gi;
	str = str.replace(reCom,"");
	
	var arrMatch = str.match(re);
	
	if(arrMatch != null)
	{
		for(var i = 0; i < arrMatch.length; i++)
		{
			var myStr = String(arrMatch[i]);
			myStr = myStr.replace(/<script[^>]*>/gi,"");
			myStr = myStr.replace("</script>","");
			
			if (myStr.length>0)
				eval(myStr);
		}
	}
}


var globalLoadingVar=true
var globalRivend = "1"
var globalRivendId= ""
var globalRivendId_Id = ""
function rivendColor(IdFont, type){
	if (type=="over"){
		
		var arr= new Array();
		arr = document.getElementsByTagName("font")
		var idFontTrue=""
		
		for (var i = 0; i < arr.length; i++){
			if (arr[i].getAttribute("nome")==IdFont){
				arr[i].parentNode.style.color="#E7E708"
				idFontTrue=arr[i].getAttribute("IdReg")
				//alert(idFontTrue)
			}
				
		}
	
		if (globalRivend == "1"){
			var objScr = "wn2_scrollToId_" + idFontTrue + "2_lyr2";
			//alert(objScr);
			var wndo = dw_scrollObj.col['wn2'];
			dw_scrollToObjId(objScr);
		}
		
	}
	if (type=="out"){
		
		var arr= new Array();
		arr = document.getElementsByTagName("font")
		
		for (var i = 0; i < arr.length; i++){
			if (arr[i].getAttribute("nome")==IdFont)
				arr[i].parentNode.style.color=globalColorMaps
				if (arr[i].parentNode.id==globalIdMaps && globalColorMaps=="#8483AF"){
					arr[i].parentNode.style.color="white"
				}
		}		
	}
	
}

function rivendEsp(IdFont, IdShape, mappa){
	var arr= new Array();
	arr = document.getElementsByTagName("font")
	var idFontTrue="";
	
	for (var i = 0; i < arr.length; i++){
		if (arr[i].getAttribute("nome")==IdFont){
			var IdDiv = arr[i].getAttribute("IdReg")
			var ParentDiv = arr[i].parentNode
		}
	}
	
	espandi2(String(IdDiv), mappa, IdShape)
	sfn_click2(ParentDiv)
}


var cont=0;
var aspetta
function turnOn(id){
	var obj = document.getElementById(id);
	if (cont<=90){
		back = "url(../../img/black"+String(cont)+".png)";
		obj.style.background = back;
		cont+=10;
		aspetta = setTimeout("turnOn('" + id + "')",40);
	}
}

function turnOff(id){
	var obj = document.getElementById(id);
	if (cont>=0){
		back = "url(../../img/black"+String(cont)+".png)";
		obj.style.background = back;
		cont-=10;
		aspetta = setTimeout("turnOff('" + id + "')",40);
	}
}


function ferma(){
	clearTimeout(aspetta)
}

/*flash immagini catalogo*/
var lval;
function loadingStart(obj)
{
	try
	{
		lval=getBusyOverlay(
		obj,
		{
		color:'black', 
		opacity:0.5, 
		size:78,
		radius:19,
		text:'loading', 
		style:'text-decoration:blink;font-weight:bold;font-size:12px;color:white'},
		{color:'#fff', size:78, type:'t'});
	}
	catch(e)
	{}
}

function loadingStop()
{
	try {lval.remove(); lval='';}
	catch(e)
	{}
}

var templateAnteprimaRight = '<table width="100%" height="100%" cellpadding="0" cellspacing="0">' +
	'<tr>' +
		'<td align="center" >' +
			'<table cellpadding="0" cellspacing="0" width="100%">' +
				'<tr>' +
					'<td width="80" align="right" ><img src="../../img/clip_02.gif"></td>' +
					'<td width="1"  valign="middle">' +
						'<table cellpadding="0" cellspacing="0">' +
							'<tr>' +
								'<td style=" border-right:1px solid #8483AF" height="34">&nbsp;</td>' +
							'</tr>' +
						'</table>' +
					'</td>' +
					'<td>' +
						'<table height="150" valign="top" cellpadding="0" cellspacing="0" width="100%">' +
							'<tr><td height="57"></td></tr>' +
							'<tr>' +
								'<td height="10" style="font-family:Arial; font-size:18px; color:#4C5985;">&nbsp;---Descrizione---</td>' +
							'</tr>' +
							'<tr>' +
								'<td valign="top">' +
									'<table cellpadding="0" cellspacing="0" valign="top">' +
										'<tr>' +
											'<td width="5"></td>' +
											'<td valign="top" style="font-family:Arial; font-size:10px; color:#8483AF;">---DescrEstesa---</td>' +
										'</tr>' +
									'</table>' +
								'</td>' +
							'</tr>' +
						'</table>' +
					'</td>' +
				'</tr>' +
			'</table>' +
		'</td>' +
	'</tr>' +
'</table>';

var templateAnteprimaRightSel = '<table width="100%" height="100%" cellpadding="0" cellspacing="0">' +
	'<tr>' +
		'<td align="center" valign="middle">' +
			'<table cellpadding="0" cellspacing="0" width="100%">' +
				'<tr>' +
					'<td width="80" align="right" ><img src="../../img/clip_02.gif"></td>' +
					'<td width="1" style=" border-right:1px solid #8483AF">&nbsp;</td>' +
					'<td>' +
						'<table cellpadding="0" cellspacing="0" width="100%">' +
							'<tr>' +
								'<td style="font-family:Arial; font-size:18px; color:#4C5985;">&nbsp;Seleziona un Menu</td>' +
							'</tr>' +
							'<tr>' +
								'<td style="font-family:Arial; font-size:10px; color:#8483AF;">&nbsp;&nbsp;Usare il menu di sinistra per accedere ai contenuti</td>' +
							'</tr>' +
						'</table>' +
					'</td>' +
				'</tr>' +
			'</table>' +
		'</td>' +
	'</tr>' +
'</table>';

function immagini_catalogo(){
	
AC_FL_RunContent(
	'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
	'width', '530',
	'height', '200',
	'src', 'gallery',
	'quality', 'high',
	'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
	'align', 'middle',
	'play', 'true',
	'loop', 'true',
	'scale', 'showall',
	'wmode', 'window',
	'devicefont', 'false',
	'id', 'gallery',
	'bgcolor', '#ffffff',
	'name', 'gallery',
	'menu', 'true',
	'allowFullScreen', 'false',
	'allowScriptAccess','sameDomain',
	'movie', 'gallery',
	'salign', ''
	); //end AC code
}


/*fine flash immagini catalogo*/

function checkform(form, sez, lang){
	var arrRequested = new Array();
	arrRequested[0] = "Mittente";
	arrRequested[1] = "emailM";
	arrRequested[2] = "stato";
	arrRequested[3] = "testo";
	
	var errore = 0
	var myerr = ""
	var boolReq;
	for(var i=0; i<form.elements.length; i++){
		boolReq = false;
		for(var j = 0; j < arrRequested.length; j++)
		{
			if(form.elements[i].name == arrRequested[j])
			boolReq = true;
		}
		
		if((form.elements[i].type!="submit" && form.elements[i].value=="" && boolReq))
		{
			if (!lang){
				alert("Attenzione! Non risulta compilato un campo richiesto");
			}else if (lang=="eng"){
				alert("Caution! A request field is not compiled");
			}else if (lang=="esp"){
				alert("Caution! A request field is not compiled");
			}else if (lang=="fr"){
				alert("Caution! A request field is not compiled");
			}else if (lang=="usa"){
				alert("Caution! A request field is not compiled");
			}
			form.elements[i].focus();
			return false;
		}
    
		if(String(form.elements[i].name) == "emailM" && String(form.elements[i].value).length > 0)
		{
			if(String(form.elements[i].value).indexOf("@") == -1)
			{
				if (!lang){
					alert("Attenzione indirizzo email non valido. Carattere @ richiesto");
				}else if (lang=="eng"){
					alert("Invalid email address. @ character requested");
				}else if (lang=="esp"){
					alert("No válida de email. Carácter @ necesario");
				}else if (lang=="fr"){
				
				}else if (lang=="usa"){
				
				}
				return false;
			}
			if(String(form.elements[i].value).indexOf(".") == -1)
			{
				if (!lang){
					alert("Attenzione indirizzo email non valido.");
				}else if (lang=="eng"){
					alert("Invalid email address.");
				}else if (lang=="esp"){
					alert("No válida de email.");
				}else if (lang=="fr"){
				
				}else if (lang=="usa"){
				
				}
				form.elements[i].focus();
				return false;
			}
		}

	}
	if (sez == "linee"){
		var IdLinea = form.elements["IdLinea"].value
		var nomeLinea = form.elements["nomeLinea"].value
	}
	
	if (sez == "tutto"){
		var IdTab = form.elements["IdTab"].value
		var IdMarca = form.elements["IdMarca"].value
		var IdTipo = form.elements["IdTipo"].value
	}
	
	
	var Mittente = form.elements["Mittente"].value
	var email = form.elements["email"].value
	var emailM = form.elements["emailM"].value
	var testo = form.elements["testo"].value
	var descr = form.elements["descr"].value
	var stato = form.elements["stato"].value
	
	if (sez == "linee"){
		senda_info_linee(IdLinea,Mittente,email,emailM,testo,descr,stato,nomeLinea);
	}
	
	if (sez == "tutto"){
		senda_info_tutto(IdTab,Mittente,email,emailM,testo,descr,stato,IdMarca,IdTipo);
	}
	return false;
}


function senda_info_linee(IdLinea,Mittente,email,emailM,testo,descr,stato,nomeLinea){
	var loading= document.getElementById("loadingArrowRight");
		if (loading) {
			loading.style.visibility="visible";
		}
	//alert("IdLinea="+IdLinea+"&Mittente="+Mittente+"&email="+email+"&emailM="+emailM+"&testo="+testo+"&descr="+descr+"&stato="+stato )
	ajaxPost("../catalogo/send_info_linee.asp?IdLinea="+IdLinea+"&Mittente="+Mittente+"&email="+email+"&emailM="+emailM+"&testo="+testo+"&descr="+descr+"&stato="+stato+"&nomeLinea="+nomeLinea ,scrivi_scroll3,c=1);
}

function senda_info_tutto(IdTab,Mittente,email,emailM,testo,descr,stato,IdMarca,IdTipo){
	var loading= document.getElementById("loadingArrowRight");
		if (loading) {
			loading.style.visibility="visible";
		}
	//alert("IdTab="+IdTab+"&Mittente="+Mittente+"&email="+email+"&emailM="+emailM+"&testo="+testo+"&descr="+descr+"&stato="+stato )
	ajaxPost("../tutto/send_info.asp?IdTab="+IdTab+"&Mittente="+Mittente+"&email="+email+"&emailM="+emailM+"&testo="+testo+"&descr="+descr+"&stato="+stato+"&IdMarca="+IdMarca+"&IdTipo="+IdTipo ,scrivi_scroll3,c=1);
}

var sfn_globale
function sfn_click(td, nomesez, stato){
	sfn_globale=td
	var arraycolori=new Array
	arraycolori=document.getElementsByClassName("td_sopra")
	for(i=0;i<=(arraycolori.length-1);i++){
		sfn_over(arraycolori[i])
	}
	sfn_out(td)
	//alert(nomesez)
	
	var arraycolori2 = new Array()
	arraycolori2 = document.getElementsByClassName("menu_left")
	
	for(i=0;i<=(arraycolori2.length-1);i++){
		arraycolori2[i].style.color="#8483AF"
	}
	
	arraycolori2 = document.getElementsByClassName("menudisinistra")
	
	for(i=0;i<=(arraycolori2.length-1);i++){
		if (arraycolori2[i].getAttribute("nomeContainer")==nomesez){
			arraycolori2[i].style.color="white"
		}else{
			arraycolori2[i].style.color="#8483AF"
		}
	}
	
	
	document.getElementById(nomesez+"2").style.color="white"
	
	if (nomesez!="news" && stato=="hidden"){
		loadingStart(document.getElementById("loadingcontent"));
		//var FlashNextCall="flashFunc()"
		ajaxGetRand("../website/sezione_top_"+nomesez+".asp", scrivi_maincontent);
	}
	
	if (stato=="alone"){
		espandi("alone");
	}
}
/*
function flashFunc(){
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '766',
			'height', '341',
			'src', 'Gallery_home',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'Gallery_home',
			'bgcolor', '#000011',
			'name', 'Gallery_home',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', 'Gallery_home',
			'salign', ''
			); //end AC code
	}
}*/

var globalColorMaps="white"
var globalIdMaps=""
function sfn_click2(myDiv){
	var arraycolori = document.getElementsByClassName("menudicentro2")
	for(i=0;i<=(arraycolori.length-1);i++){
		arraycolori[i].style.color="#8483AF"
	}
	var arraycolori2 = document.getElementsByClassName("sottomenu")
	for(i=0;i<=(arraycolori2.length-1);i++){
		if (arraycolori2[i].getAttribute("nomeContainer")==(String(myDiv.id))   ){
			arraycolori2[i].style.color="white"
		}else{
			arraycolori2[i].style.color="#8483AF"
		}
	}
	
	myDiv.style.color="white"
	
	
	globalColorMaps="#8483AF"
	globalIdMaps=String(myDiv.id)
}

function sfn_over(td){
	if (sfn_globale!=td){
		var obj = td.childNodes;
		var myDiv = obj[0];
		myDiv.style.visibility = "hidden";
	}
}

function sfn_out(td){
	var obj = td.childNodes;
	var myDiv = obj[0];
	myDiv.style.visibility = "visible";
	//alert(myDiv.style.visibility)
}

function scrivi_maincontent(content, ea, mappa, param){
	var main = document.getElementById("maincontent")
	
	if (main){
	main.innerHTML = content;
	fnProcessa(content);
	}else{
	window.setTimeout("scrivi_maincontent("+content+", "+ea+", "+mappa+")", 200);
	}
	
	
	
	if(!param){
		if (mappa){
			if (mappa=="mappaita"){
				window.setTimeout("open_rivenditoriitalia(1)", 200);
			}
			if (mappa=="mappaeu"){
				window.setTimeout("open_rivenditorieuropa(1)", 200);
			}
			if (mappa=="mappawrld"){
				window.setTimeout("open_rivenditorimondo(1)", 200);
			}
		}
	}
	
	if (document.getElementById("wn2"))
		init_dw_Scroll2(); 
		
		
	if(ea)
		eval(ea);
	
	
	ferma_loading(0)
	
	
	if(SearchDhonishow.show){
		SearchDhonishow.show=null
	}
}

function scrivi_rightcontent(content, ea){
	var right = document.getElementById("rightcontent")
	right.innerHTML = content;
	
	fnProcessa(content);
	
	if (document.getElementById("lyr3"))
		window.setTimeout("init_dw_Scroll3()", 600)
	
	
	
	if(ea)
		eval(ea.replace(/'/g, "\'"));
	 
	Shadowbox.init();
	
	ferma_loading(0)
}

function fineShadowbox(){
	if (document.all){
		document.getElementById("shadowbox").style.left=String((document.body.clientWidth/2)-document.getElementById("shadowbox").offsetWidth/2)+"px"
	}
}

function scrivi_rightcontent_tutto(content,ea){
	
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading

	var right = document.getElementById("rightcontent")
	right.innerHTML = content;
	if (document.getElementById("lyr3"))
		//initscroll3();
		window.setTimeout("init_dw_Scroll3()", 600)
	
	if(ea)
		var str_setTimeOut = window.setTimeout(ea, 200)
	
	/*if(ea)if
		eval(ea);*/
		
	//Behaviour.apply();
}

function scrivi_schede(content, ea){
	var schede = document.getElementById("schede");
	schede.innerHTML = content;
	
	if (ea)
		eval(ea)
}

function scrivi_titolo3(content, ea){
	var titolo = document.getElementById("titolo3");
	if (titolo)
		titolo.innerHTML = content.replace(/'/g, "\'");
		
	if(ea)
		eval(ea);
		
	//alert(document.getElementById('label').innerHTML);
		
}


function scrivi_scroll3(content, ea){
	var right = document.getElementById("lyr3")
	right.innerHTML = content;
	
	window.setTimeout("init_dw_Scroll3(); ", 600)
	
	if(ea)
		eval(ea);
	
	
	ferma_loading(0)
}
			
function scrivi_scroll3_flash(content){
	var right = document.getElementById("scroll3Content")
	
	immagini_catalogo()
	right.innerHTML = content;
	//initscroll3();
	window.setTimeout("init_dw_Scroll3(); ", 600)
}			



function ferma_loading(cont){
	loadingStop(null);
	cont+=1
	if (cont<=6){
		window.setTimeout("ferma_loading("+cont+")", 200)
	}
	
}
/*---------------------------------------------------------------  parte destra delle linee     -------------------------------------------------------------------------- */
var _globalRight = 0;

function desc_right(o){

	if(_globalRight == 0)
	{
		if (!document.getElementById("right_fullcontent"))
		{
			//var percorso = "../catalogo/linee_antep_right.asp?IdLinea="+IdLinea
			
			//ajaxGet(percorso, scrivi_rightcontent);
			
			var descr = o.getAttribute("descrizioneR");
			var descrE = o.getAttribute("descrizioneER");
			
			var str = templateAnteprimaRight.replace("---Descrizione---", descr);
			str = str.replace("---DescrEstesa---", descrE);
			
			scrivi_rightcontent(str);
		}
	}
}

function desc_right_out(){
	if(_globalRight == 0)
	{
		if (!document.getElementById("right_fullcontent")){
		
			//ajaxPost("seleziona.asp", scrivi_rightcontent,c=1);
			
			scrivi_rightcontent(templateAnteprimaRightSel);
			
		}
	}
}

function fullcontent_linee(IdLinea, nomeLinea, ea, param){

//loading
loadingStart(document.getElementById("rightcontent"));
//fine loading

	_globalRight = 1;
	var percorso = "../catalogo/right.asp?IdLinea="+IdLinea
	
	//scrive il titolo--------------------------------
 
	var contenuto =		'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
						'<tr>'+
							'<td width="15" height="16"></td>'+
							'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="top">'+
							'<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+nomeLinea.replace(/'/g, "\\'")+'<br>'+
							'<div style="position:relative;"><div id="divInfo_linee" style="top:-3;visibility:hidden;position:absolute;"><font class="link_small05">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;utilizza questo modulo per richiedere informazioni riguardanti la linea&nbsp;'+nomeLinea+'</font></div></div>'+
							'</div></div>'+
							'</td>'+
							'<td align="right" valign="top"></td>'+
							'<td width="10"></td>'+
						'</tr>'+
						'<tr>'+
							'<td height="10"></td>'+
						'</tr>'+
						'<tr>'+
							'<td></td>'+
							'<td height="2" bgcolor="#1E222C" colspan="2"></td>'+
						'</tr>'+
						'<tr>'+
							'<td></td>'+
							'<td height="3" colspan="2"></td>'+
						'</tr>'+
					'</table>';
	
	var re = /\'/g;
	contenuto=contenuto.replace(re, "\\'")
	//fine scrive il titolo--------------------------------

	var nextCall  = "scrivi_titolo3('"+contenuto+"')"
	ajaxGetRand(percorso, scrivi_rightcontent, nextCall);
	
	if (!param){
		window.setTimeout("ajaxGetRand('../catalogo/descrizione_linee.asp?IdLinea="+IdLinea+"', scrivi_scroll3)", 300);
	}
	
	
	if (!param){
		schede_linee(IdLinea, "descrizione", 1 , nomeLinea, ea, "true");
	}else{
		eval(ea)
	}
}

function schede_linee(IdLinea, scheda , param , nomeLinea, ea, param){
	if (globalLoadingVar==true) {
		globalLoadingVar=false;
		if (scheda=="descrizione"){
			if (document.getElementById("divInfo_linee"))
				document.getElementById("divInfo_linee").style.visibility="hidden";
			
			if (param!=1){
				//loading
				loadingStart(document.getElementById("rightcontent"));
				//alert("aspetta")
				//fine loading
			}
			//alert(nomeLinea)
			ajaxGetRand("../catalogo/schede_linee.asp?IdLinea="+IdLinea+"&scheda=descrizione&nomeLinea="+nomeLinea, scrivi_schede, "globalLoadingVar=true");
			if (param!=1)
				ajaxGetRand("../catalogo/descrizione_linee.asp?IdLinea="+IdLinea, scrivi_scroll3, "globalLoadingVar=true");
		}else{
			if (scheda=="info"){
				//loading
				if (document.getElementById("divInfo_linee"))
					//document.getElementById("divInfo_linee").style.visibility="visible";	
				
				loadingStart(document.getElementById("rightcontent"));
				//fine loading
				ajaxPost("../catalogo/schede_linee.asp?IdLinea="+IdLinea+"&scheda="+scheda+"&nomeLinea="+nomeLinea, scrivi_schede,c=1);
				ajaxGetRand("../catalogo/info_linee.asp?IdLinea="+IdLinea+"&nomeLinea="+nomeLinea, scrivi_scroll3, "globalLoadingVar=true");
			}
			if (scheda=="disponibile"){
				if (document.getElementById("divInfo_linee"))
					document.getElementById("divInfo_linee").style.visibility="hidden";
				//loading
				loadingStart(document.getElementById("rightcontent"));
				//fine loading
				ajaxPost("../catalogo/schede_linee.asp?IdLinea="+IdLinea+"&scheda="+scheda, scrivi_schede,c=1);
				ajaxGetRand("../catalogo/disponibile_linee.asp?IdLinea="+IdLinea, scrivi_scroll3, "globalLoadingVar=true");
			}
			if (scheda=="immagini"){
				if (document.getElementById("divInfo_linee"))
					document.getElementById("divInfo_linee").style.visibility="hidden";
				//loading
				loadingStart(document.getElementById("rightcontent"));
				//fine loading
				ajaxPost("../catalogo/schede_linee.asp?IdLinea="+IdLinea+"&scheda="+scheda, scrivi_schede,c=1);
				ajaxGetRand("../catalogo/immagini_linee.asp?IdLinea="+IdLinea, scrivi_scroll3_flash, "globalLoadingVar=true");
				
			}
		}
	
		if(ea){
			eval(ea)
		}
		
		
	}
}


/*--------------------------------------------------------------- fine parte destra delle linee     -------------------------------------------------------------------------- */

/*---------------------------------------------------------------------  colori menu ---------------------------------------------------------------------------------------------*/

function cambiacoloriTop(oggetto, IdClick){

var idFont = String(IdClick)+"2";

var allDiv = document.getElementsByTagName("div");
for (i=0;i<allDiv.length;i++){
	if (allDiv[i].className){
		if (String(allDiv[i].className)=="menudisinistra"){
			allDiv[i].style.color="#8483AF";
		}
	}
}

var allTd = document.getElementsByTagName("td");
for (i=0;i<allTd.length;i++){
	if (allTd[i].className){
		if (String(allTd[i].className)=="menu2"){
			//alert(allTd[i].id +" , "+allTd[i].className)
			allTd[i].style.color="#8483AF";
		}
	}
}


var allFont = document.getElementsByTagName("font");
for (i=0;i<allFont.length;i++){
	if (allFont[i].id!=idFont && String(allFont[i].id).indexOf("2")!=-1){
		allFont[i].style.color="#8483AF"
	}
	
	if (allFont[i].id==idFont) 
	{
		allFont[i].style.color="white"
	}
}

oggetto.style.color="white"

/*var obj =  document.getElementById(IdClick).childNodes
var i = 0
while (i<=obj.length) {
	if (obj[i]!=null){
		alert(obj[i].tagname)
		if(obj[i].tagname != "undefined"){
			//per ogni nodo ricicla ogni suo nodo 
			obj[i].style.color="white"
		}
	}
	i+=1;
}*/


}

function cambiacolori(oggetto, IdClick){
if (IdClick){
var idFont = String(IdClick)+"2";
}else{
var idFont="niente"
}

var allDiv = document.getElementsByTagName("div");
for (i=0;i<allDiv.length;i++){
	if (allDiv[i].className){
		if (String(allDiv[i].className)=="menudisinistra"){
			allDiv[i].style.color="#8483AF";
			if(allDiv[i].parentNode.tagName=="LI"){
				allDiv[i].parentNode.style.background="url(/img/menu_scuro.gif) no-repeat 0px 3px"
			}
			//alert(allDiv[i].parentNode.style.background)
		}
	}
}

var allTd = document.getElementsByTagName("td");
for (i=0;i<allTd.length;i++){
	if (allTd[i].className){
		if (String(allTd[i].className)=="menu2"){
			//alert(allTd[i].id +" , "+allTd[i].className)
			allTd[i].style.color="#8483AF";
		}
	}
}


var allFont = document.getElementsByTagName("font");
for (i=0;i<allFont.length;i++){
	if (allFont[i].id!=idFont && String(allFont[i].id).indexOf("2")!=-1){
		allFont[i].style.color="#8483AF"
	}
	
	if (allFont[i].id==idFont) 
	{
		allFont[i].style.color="white"
	}
}

if(oggetto.style.color){
oggetto.style.color="white"
}
if (oggetto.parentNode.tagName=="LI"){
	oggetto.parentNode.style.background="url(/img/menu.gif) no-repeat 0px 3px"
}
	
}



function cambiacoloriMenu2(oggetto, IdClick){
var idDiv = String(IdClick)+"2";

var allDiv = document.getElementsByTagName("div");
for (i=0;i<allDiv.length;i++){
	if (allDiv[i].className){
		if (String(allDiv[i].className)=="menudicentro2" && allDiv[i].id != idDiv){
			allDiv[i].style.color="#8483AF";
		}
	}
}

var allTd = document.getElementsByTagName("td");
var liPadre
for (i=0;i<allTd.length;i++){
	if (allTd[i].className){
		if (String(allTd[i].className)=="sottomenu"){
			//alert(allTd[i].id +" , "+allTd[i].className)
			allTd[i].style.color="#8483AF";
			
			liPadre = allTd[i].parentNode.parentNode.parentNode.parentNode
			if(liPadre.tagName=="LI"){
				liPadre.style.background="url(/img/menu_scuro.gif) no-repeat 0px 5px"
			}
			//alert(liPadre.tagName)
			//alert(liPadre.style.background)
		}
	}
}

if(document.getElementById(idDiv)){
	document.getElementById(idDiv).style.color="white"
}
oggetto.style.color="white"
if (oggetto.parentNode.parentNode.parentNode.parentNode.tagName=="LI"){
	oggetto.parentNode.parentNode.parentNode.parentNode.style.background="url(/img/menu.gif) no-repeat 0px 5px"
}

}

/*---------------------------------------------------------------------  fine colori menu ---------------------------------------------------------------------------------------------*/

/*---------------------------------------------------------------  Storia     -------------------------------------------------------------------------- */

function open_storia(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading

	ajaxPost("../storia/storia.asp", scrivi_maincontent,c=1);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

function open_storia_right(IdNews, titolo){
	_globalRight = 1;
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	var contenuto = '<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
				'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+titolo.replace(/'/g, "\\'")+'<br>'+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>'+
				'</div></div>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"');window.setTimeout('if(isIE){addIEReflex();}else {addReflex();}', 400)"
	ajaxGetRand("../storia/right.asp?IdNews="+IdNews, scrivi_rightcontent, nextCall);
}

/*---------------------------------------------------------------  Fine storia     -------------------------------------------------------------------------- */

/*---------------------------------------------------------------  Dove     -------------------------------------------------------------------------- */

function open_dove(){
	ajaxPost("../arrow/dove.asp", scrivi_maincontent,c=1);
}
/*---------------------------------------------------------------  Fine dove     -------------------------------------------------------------------------- */

/*---------------------------------------------------------------  Catalogo     -------------------------------------------------------------------------- */
function open_catalogo(nextCall){
//loading
	//loadingStart(document.getElementById("loadingcontent"));

//fine loading
	_globalRight = 0;
	
	if(nextCall){
		ajaxGetRand("../catalogo/catalogo.asp", scrivi_maincontent, nextCall);
	}else{
		ajaxGetRand("../catalogo/catalogo.asp", scrivi_maincontent);
	}
}


function open_catalogo_da_tutto(IdLinea){
	cambiacolori(document.getElementById("id_catalogo_colori"), "prodotti")
	var nextCall = "ajaxGetRand('../catalogo/calcolaIdCat.asp?IdLinea="+IdLinea+"', percorso_catalogo, "+IdLinea+");"
	open_catalogo(nextCall)
}

function percorso_catalogo(content, IdLinea){
	
	
	var myArr = new Array()
	myArr = String(content).split(",")
	var IdCat = myArr[0]
	var CatDescr = myArr[1]
	var LineaDescr = myArr[2]
	
	var myDiv=document.getElementById(CatDescr+"2")
	sfn_click2(myDiv)
	espandi2(CatDescr)
	
	var myArrSotto = new Array()
	myArrSotto = document.getElementsByClassName("sottomenu")
	for (i=0; i<=(myArrSotto.length-1);i++){
		if (   String(myArrSotto[i].getAttribute("IdLinea")) == String(IdLinea)  ) {
			var mySubDiv=myArrSotto[i]
		}
	}
	
	cambiacoloriMenu2(mySubDiv, CatDescr);
	if (globalSearch!="true"){
		var myNextCall = "schede_linee("+IdLinea+", 'disponibile')"
		fullcontent_linee(IdLinea, LineaDescr, myNextCall, "da_tutto");
	}else{	
		var myNextCall = "schede_linee("+IdLinea+", 'scarichi')"
		fullcontent_linee(IdLinea, LineaDescr, myNextCall);
	}
	globalSearch="false";
	//fullcontent_linee(IdLinea, LineaDescr, myNextCall, "da_tutto");
	
}
/*--------------------------------------------------------------- Catalogo     -------------------------------------------------------------------------- */



/*---------------------------------------------------------------  Tutto per la tua moto     -------------------------------------------------------------------------- */
function open_tutto_da_linee(IdMarca, IdTab, IdTipo, IdLinea){
//loading
	//loadingStart(document.getElementById("loadingcontent"));

//fine loading
	//var nextCall = "schede_motocicli("+IdTab+",'scarichi',"+IdMarca+", "+IdTipo+")"
	//var nextCall2 = "schede_motocicli("+IdTab+",'scarichi',"+IdMarca+", "+IdTipo+")"
	cambiacolori(document.getElementById("id_tutto_colori"), "prodotti")
	ajaxGetRand("../tutto/marche.asp", percorso_tutto, "tipi", IdTipo, IdMarca, IdTab, IdLinea);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

function percorso_tutto(content, param, IdTipo, IdMarca, IdTab, IdLinea){
	if(param=="tipi"){
		var main = document.getElementById("maincontent")
		
		//main.innerHTML = content;
		if (main){
		main.innerHTML = content;
		}else{
		window.setTimeout("percorso_tutto("+content+", "+param+", "+IdTipo+", "+IdMarca+", "+IdTab+", "+IdLinea+")", 200);
		}
		
		if (document.getElementById("wn2"))
			//initscroll2();
			init_dw_Scroll2(); 
			
		espandi2(String(IdMarca));
		
		var arrBianco = new Array()
		arrBianco = document.getElementsByClassName("sottomenu")
		for(i=0;i<=(arrBianco.length-1);i++){	
			//alert(arrBianco[i].getAttribute("marcaEtipo"))
			if(arrBianco[i].getAttribute("marcaEtipo")==String(IdMarca)+","+String(IdTipo)){
			arrBianco[i].style.color="WHITE"
			}else{
			arrBianco[i].style.color="#8483AF"
			}
		}
		
		/*
		arrBianco = document.getElementsByName(String(IdTipo)+"colorimenu2")
		for(i=1;i<=(arrBianco.length-1);i++){
			arrBianco[i].style.color="white"
		}
		*/
		
		//alert("tipi")
		if (globalSearchProd!="true"){
			ajaxGetRand("../tutto/right.asp?IdTipo="+IdTipo+"&IdMarca="+IdMarca+"&IdLinea="+IdLinea+"&param=dalinee", percorso_tutto, "titolo3", IdTipo, IdMarca, IdTab);
		}else{
			ajaxGetRand("../tutto/right.asp?IdTipo="+IdTipo+"&IdMarca="+IdMarca+"&IdLinea="+IdLinea, percorso_tutto, "titolo3", IdTipo, IdMarca, IdTab);
		}
		globalSearchProd="false";
	}
	
	if(param=="titolo3"){
		var right = document.getElementById("rightcontent")
		right.innerHTML = content;
		if (document.getElementById("lyr3"))
			//initscroll3();
			window.setTimeout("init_dw_Scroll3(); ", 600)
		
		//alert("titolo3")
		document.getElementById("schede").innerHTML="";
		ajaxGetRand("../tutto/titolo3.asp?IdTipo="+IdTipo+"&IdMarca="+IdMarca , percorso_tutto, "schede", IdTipo, IdMarca, IdTab);
	}
	if(param=="schede"){
		var titolo = document.getElementById("titolo3");
		if (titolo){
			titolo.innerHTML = content;
		}
		
		//alert("schede")
		//alert(IdTab+" "+IdMarca+" "+IdTipo)
		schede_motocicli(IdTab,"scarichi", IdMarca, IdTipo, "dalinee");
	}
}

function open_tutto(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading

	ajaxPost("../tutto/marche.asp", scrivi_maincontent,c=1);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

var array_marche = new Array();

function riempi_array(elementi){
		//alert(elementi)
		array_marche = elementi.split(",")
		/*for (i=0;i<=array_marche.length;i++){
			alert(array_marche[i])
		}*/
}

function open_tipi(IdTipo, IdMarca){
	_globalRight = 1;
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	var nextCall = "ajaxGetRand('../tutto/titolo3.asp?IdTipo="+IdTipo+"&IdMarca="+IdMarca+"', scrivi_titolo3_tutto);"
	ajaxGetRand("../tutto/right.asp?IdTipo="+IdTipo+"&IdMarca="+IdMarca, scrivi_rightcontent_tutto, nextCall);
	//ajaxPost("../tutto/titolo3.asp?IdTipo="+IdTipo+"&IdMarca="+IdMarca, scrivi_titolo3,c=1);
	document.getElementById("schede").innerHTML="";
}

function scrivi_titolo3_tutto(content){
	var titolo = document.getElementById("titolo3");
	if (titolo){
		titolo.innerHTML = content;
	}
	//document.getElementById("omolog").style.position="visible"

}

function stampa_motocicli(IdTab, stampa){
	document.getElementById("label").innerHTML="";
	ajaxPost("../tutto/stampa.asp?IdTab="+IdTab+"&stampa="+stampa, scrivi_scroll3,c=1);
}

var array_stampa = new Array();

function check_stampa_motocicli(form, oggetti, IdTab){
	var array_stampa = oggetti.split(",");
	var stampa=""
	for (i=0;i<=array_stampa.length;i++){
			if (form.elements[array_stampa[i]]){
				if (form.elements[array_stampa[i]].checked==true){
					
					stampa+=","+String(array_stampa[i])
				}
			}
	}
	if (stampa==""){
		return false;
	}
	window.open('../tutto/stampa_motocicli.asp?stampa='+stampa+"&IdTab="+IdTab,'stampa_motocicli','height=600,width=559,scrollbars=yes,left=150,top=150');
	return false;
	
}

function CheckAll_motocicli(form,check)
{
	if(check.checked)
	{
		for(var i = 0; i < form.elements.length; i++)
		{
			var objItem = form.elements[i];
			if(objItem.type == "checkbox")
				objItem.checked = true;
		}
	}
	else
	{
		for(var i = 0; i < form.elements.length; i++)
		{
			var objItem = form.elements[i];
			if(objItem.type == "checkbox")
				objItem.checked = false;
		}
	}
}
function info_motocicli(IdTab, IdMarca, IdTipo){

	/*var loading= document.getElementById("loadingArrowRight");
		if (loading) {
			document.getElementById("loadingArrowRight").style.visibility="visible";
		}*/
	document.getElementById("label").innerHTML="";
	ajaxPost("../tutto/info.asp?IdTab="+IdTab+"&IdMarca="+IdMarca+"&IdTipo="+IdTipo, scrivi_scroll3,c=1);
}
function schede_motocicli(IdTab, scheda,  IdMarca, IdTipo, param){
	if (globalLoadingVar==true) {
		globalLoadingVar=false;
		
		
		var NextFirst="if (document.getElementById('backArrow')) {document.getElementById('backArrow').style.visibility='visible'};"
		var nextCall
		//if (!param){
			loadingStart(document.getElementById("rightcontent"));
		//}
		if (scheda=="scarichi"){
			ajaxPost("../tutto/schede_motocicli.asp?IdTab="+IdTab+"&scheda="+scheda+"&IdMarca="+IdMarca+"&IdTipo="+IdTipo, scrivi_schede,c=1);
			nextCall = NextFirst+"globalLoadingVar=true;ajaxGetRand('../tutto/schema_montaggio.asp?IdTab="+IdTab+"', scrivisuLabel)//'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Omol.<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>codice'"
			ajaxGetRand("../tutto/titolo3.asp?IdTab="+IdTab+"&IdMarca="+IdMarca+"&IdTipo="+IdTipo, scrivi_titolo3, nextCall);
			ajaxGetRand("../tutto/scarichi.asp?IdTab="+IdTab, scrivi_scroll3);
		}
		if (scheda=="scarichi_scheda"){
			ajaxPost("../tutto/schede_motocicli.asp?IdTab="+IdTab+"&scheda="+scheda+"&IdMarca="+IdMarca+"&IdTipo="+IdTipo, scrivi_schede,c=1);
			nextCall = NextFirst+"globalLoadingVar=true;ajaxGetRand('../tutto/schema_montaggio.asp?IdTab="+IdTab+"', scrivisuLabel)//'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Omol.<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>codice'"
			ajaxGetRand("../tutto/scarichi.asp?IdTab="+IdTab, scrivi_scroll3, nextCall);
		}
		if (scheda=="parti_speciali"){
			ajaxPost("../tutto/schede_motocicli.asp?IdTab="+IdTab+"&scheda="+scheda+"&IdMarca="+IdMarca+"&IdTipo="+IdTipo, scrivi_schede,c=1);
			nextCall = NextFirst+"globalLoadingVar=true;document.getElementById('label').innerHTML=''"
			ajaxGetRand("../tutto/parti_speciali.asp?IdTab="+IdTab, scrivi_scroll3, nextCall);
		}
		if (scheda=="immagini"){
			ajaxPost("../tutto/schede_motocicli.asp?IdTab="+IdTab+"&scheda="+scheda+"&IdMarca="+IdMarca+"&IdTipo="+IdTipo, scrivi_schede,c=1);
			//ajaxPost("../tutto/immagini.asp?IdTab="+IdTab, scrivi_scroll3_flash,c=1);
			
		}
		if (scheda=="info_tecniche"){
			ajaxPost("../tutto/schede_motocicli.asp?IdTab="+IdTab+"&scheda="+scheda+"&IdMarca="+IdMarca+"&IdTipo="+IdTipo, scrivi_schede,c=1);
			nextCall = NextFirst+"globalLoadingVar=true;ajaxGetRand('../tutto/grafici_potenza.asp?IdTab="+IdTab+"', scrivisuLabel)"
			ajaxGetRand("../tutto/info_tecniche.asp?IdTab="+IdTab, scrivi_scroll3, nextCall);
		}
		if (scheda=="download"){
			ajaxPost("../tutto/schede_motocicli.asp?IdTab="+IdTab+"&scheda="+scheda+"&IdMarca="+IdMarca+"&IdTipo="+IdTipo, scrivi_schede,c=1);
			nextCall = NextFirst+"globalLoadingVar=true;document.getElementById('label').innerHTML=''"
			ajaxGetRand("../tutto/download.asp?IdTab="+IdTab, scrivi_scroll3, nextCall);
			
		}
		if (scheda=="multimedia"){
			ajaxPost("../tutto/schede_motocicli.asp?IdTab="+IdTab+"&scheda="+scheda+"&IdMarca="+IdMarca+"&IdTipo="+IdTipo, scrivi_schede,c=1);
			nextCall = NextFirst+"globalLoadingVar=true;document.getElementById('label').innerHTML=''"
			ajaxGetRand("../tutto/multimedia.asp?IdTab="+IdTab, scrivi_scroll3, nextCall);
			
		}
		
		
	
	}
	
}

function scrivisuLabel  (content){
	document.getElementById('label').innerHTML=content
}
/*--------------------------------------------------------------- Fine tutto per la tua moto     -------------------------------------------------------------------------- */
/*--------------------------------------------------------------- Schede ricambi    -------------------------------------------------------------------------- */
function open_schedericambi(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading
	ajaxPost("../schedericambi/schedericambi.asp", scrivi_maincontent,c=1);
}



function open_schedericambi_right(IdMarca, nomeMarca){

//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
		
	/*var contenuto =		'<table cellpadding="0" cellspacing="0" width="559" height="30">'+
						'<tr>'+
							'<td width="15"></td>'+
							'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="26">'+
								'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+nomeMarca+'<br><font class="link_small05">Utilizza queste schede per ordinare i ricambi</font>'+
							'</td>'+
							'<td width="10"></td>'+
						'</tr>'+
						'<tr>'+
							'<td></td>'+
							'<td height="1" bgcolor="#1E222C"></td>'+
						'</tr>'+
						'<tr>'+
							'<td></td>'+
							'<td height="3" ></td>'+
						'</tr>'+
						'<tr>'+
							'<td></td>'+
							'<td height="10" align="left" class="link_small05">'+
								'<div id="label" style="position:absolute;top:18;left:405;"></div>'+
							'</td>'+
							'<td></td>'+
						'</tr>'+
					'</table>';
					
	scrivi_titolo3(contenuto);
	*/
	
	var contenuto =			'<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
						'<table cellpadding="0" cellspacing="0" width="595" height="30"> '+
							'<tr>'+
								'<td width="15"></td>'+
								'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
									'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+nomeMarca.replace(/'/g, "\\'")+'<br>'+
								'</td>'+
								'<td align="right" valign="bottom">'+
									
								'</td>'+
								'<td width="10"></td>'+
							'</tr>'+
							'<tr>'+
								'<td height="10"></td>'+
							'</tr>'+
							'<tr>'+
								'<td></td>'+
								'<td height="1" bgcolor="#1E222C" colspan="2"></td>'+
								'<td></td>'+
							'</tr>'+
							'<tr>'+
								'<td></td>'+
								'<td height="10" colspan="2" align="right" class="link_small05">'+
									'<div id="label" style="position:absolute;top:18;left:405;"></div>'+
								'</td>'+
								'<td></td>'+
							'</tr>'+
						'</table>'+
						'</div></div>';
	
	var nextCall ="scrivi_titolo3('"+contenuto+"')"
	ajaxGetRand("../schedericambi/right.asp?IdMarca="+IdMarca, scrivi_rightcontent, nextCall);
	//ajaxPost("../schedericambi/titolo3.asp?IdMarca="+IdMarca, scrivi_titolo3,c=1);
}




/*--------------------------------------------------------------- Fine Schede ricambi    -------------------------------------------------------------------------- */


/*--------------------------------------------------------------- Schede tecniche    -------------------------------------------------------------------------- */
function open_schedetecniche(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading
	ajaxPost("../schedetecniche/schedetecniche.asp", scrivi_maincontent,c=1);
}


function open_schedetecniche_right(IdMarca, nomeMarca){

//loading
	loadingStart(document.getElementById("rightcontent"));
//fine loading
	
	var contenuto =		'<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
					'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
						'<tr>'+
							'<td width="15"></td>'+
							'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
								'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+nomeMarca.replace(/'/g, "\\'")+'<br>'+
							'</td>'+
							'<td width="10"></td>'+
						'</tr>'+
						'<tr>'+
							'<td height="10"></td>'+
						'</tr>'+
						'<tr>'+
							'<td></td>'+
							'<td height="1" bgcolor="#1E222C"></td>'+
						'</tr>'+
						'<tr>'+
							'<td></td>'+
							'<td height="3" ></td>'+
						'</tr>'+
					'</table>'+
					'</div></div>';
					
	var nextCall = "scrivi_titolo3('"+contenuto+"')"
	ajaxGetRand("../schedetecniche/right.asp?IdMarca="+IdMarca, scrivi_rightcontent, nextCall);
	//ajaxPost("../schedetecniche/titolo3.asp?IdMarca="+IdMarca, scrivi_titolo3,c=1);
}


/*--------------------------------------------------------------- Fine Schede tecniche    -------------------------------------------------------------------------- */
/*--------------------------------------------------------------- Rivenditori nel mondo   -------------------------------------------------------------------------- */
function open_rivenditorimondo(param){
	globalRivendId = ""
//loading
	if(!param){
		loadingStart(document.getElementById("loadingcontent"));
	}

//fine loading
	//if (param){
		//ajaxGetRand("../rivenditori/rivenditori_mondo.asp", scrivi_maincontent, "//cvi_map.add(document.getElementById('mappawrld'),{opacity: 100, areacolor: '#0099ff', noborder: true, nofade: true});", "mappawrld", param);
	//}else{
		//ajaxGetRand("../rivenditori/rivenditori_mondo.asp", scrivi_maincontent, "//cvi_map.add(document.getElementById('mappawrld'),{opacity: 100, areacolor: '#0099ff', noborder: true, nofade: true});", "mappawrld");
		ajaxGetRand("../rivenditori/rivenditori_mondo.asp", scrivi_maincontent);
	//}
	//ajaxPost("../rivenditori/calcolo_array_mondo.asp", riempi_array_mondo,c=1);
	globalColorMaps="white"
}

function open_rivenditorimondo_right(IdNaz, IdCont, Naz, Cont){
	
	//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	var contenuto = '<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
				'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+Cont.replace(/'/g, "\\'")+'&nbsp;&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+Naz.replace(/'/g, "\\'")+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>'+
				'</div></div>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"')"
	ajaxGetRand("../rivenditori/right_mondo.asp?IdNaz="+IdNaz+"&IdCont="+IdCont, scrivi_rightcontent, nextCall);
}

function open_rivenditoriUSA_right(IdNaz, Naz){

	//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	var contenuto = '<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
				'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+Naz.replace(/'/g, "\\'")+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>'+
				'</div></div>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"')"
	ajaxGetRand("../rivenditori/right_italia.asp?IdNaz="+IdNaz, scrivi_rightcontent,nextCall);
}

var array_mondo = new Array();

function riempi_array_mondo(elementi){
		//alert(elementi)
		array_mondo = elementi.split(",")
		/*for (i=0;i<=array_mondo.length;i++){
			alert(array_mondo[i])
		}*/
}

/*--------------------------------------------------------------- Fine  Rivenditori nel mondo    -------------------------------------------------------------------------- */


/*--------------------------------------------------------------- Rivenditori in europa   -------------------------------------------------------------------------- */
function open_rivenditorieuropa(param){
	globalRivendId = ""
//loading
	if(!param){
		loadingStart(document.getElementById("loadingcontent"));
	}

//fine loading
	/*if (param){
		ajaxGetRand("../rivenditori/rivenditori_europa.asp", scrivi_maincontent, "cvi_map.add(document.getElementById('mappaeu'),{opacity: 100, areacolor: '#0099ff', noborder: true, nofade: true});", "mappaeu", param);
	}else{*/
		//ajaxGetRand("../rivenditori/rivenditori_europa.asp", scrivi_maincontent, "cvi_map.add(document.getElementById('mappaeu'),{opacity: 100, areacolor: '#0099ff', noborder: true, nofade: true});", "mappaeu");
		ajaxGetRand("../rivenditori/rivenditori_europa.asp", scrivi_maincontent);
	//}
	
	globalColorMaps="white"
}

function open_rivenditorieuropa_right(IdNaz, Naz){

	//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	var contenuto = '<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
				'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+Naz.replace(/'/g, "\\'")+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>'+
				'</div></div>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"')"
	ajaxGetRand("../rivenditori/right_europa.asp?IdNaz="+IdNaz, scrivi_rightcontent,nextCall);
}

function openFromMap(nomeNaz){
	var myThis = document.getElementsByName("DivEu"+nomeNaz)
	var myID = String(myThis[0].id).replace("2", "")
	sfn_click2(myThis[0]);
	cambiacoloriMenu2(myThis[0], String(myID));
	open_rivenditorieuropa_right(String(myID), String(nomeNaz))
	//alert(myThis[0].id)
	
	
	/* onclick="sfn_click2(this);cambiacoloriMenu2(this, '<%=String(rs("IDNazioni"))%>');open_rivenditorieuropa_right(<%=rs("IDNazioni")%>, '<%=rs("ItaNazioni")%>')"   */
}

/*--------------------------------------------------------------- Fine  Rivenditori in europa    -------------------------------------------------------------------------- */

/*--------------------------------------------------------------- Rivenditori in italia   -------------------------------------------------------------------------- */
function open_rivenditoriitalia(param){
	globalRivendId = ""
//loading
	if(!param){
		loadingStart(document.getElementById("loadingcontent"));
	}

//fine loading
	//alert("step  1")
	/*if (param){
		ajaxGetRand("../rivenditori/rivenditori_italia.asp", scrivi_maincontent, "cvi_map.add(document.getElementById('mappaita'),{opacity: 100, areacolor: '#0099ff', noborder: true, nofade: true});", "mappaita", param);
	}else{*/
		//ajaxGetRand("../rivenditori/rivenditori_italia.asp", scrivi_maincontent, "cvi_map.add(document.getElementById('mappaita'),{opacity: 100, areacolor: '#0099ff', noborder: true, nofade: true});", "mappaita");
		ajaxGetRand("../rivenditori/rivenditori_italia.asp", scrivi_maincontent);
	//}
	//ajaxPost("../rivenditori/calcolo_array_italia.asp", riempi_array_mondo,c=1);
	
	
	globalColorMaps="white"
}

function open_rivenditoriitalia_right(prov, IdReg, Reg, Nprov){

	//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	var contenuto = '<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
				'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+Reg.replace(/'/g, "\\'")+'&nbsp;&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+Nprov.replace(/'/g, "\\'")+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>'+
				'</div></div>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"')"
	//alert(IdReg , prov)
	
	ajaxGetRand("../rivenditori/right_italia.asp?IdReg="+IdReg+"&prov="+prov, scrivi_rightcontent, nextCall);
}

var array_italia = new Array();

function riempi_array_italia(elementi){
		//alert(elementi)
		array_italia = elementi.split(",")
		/*for (i=0;i<=array_mondo.length;i++){
			alert(array_mondo[i])
		}*/
}
/*--------------------------------------------------------------- Fine  Rivenditori in italia    -------------------------------------------------------------------------- */


/*--------------------------------------------------------------- News   -------------------------------------------------------------------------- */
function open_news(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading
	ajaxPost("../news/news.asp", scrivi_maincontent,c=1);
}

function open_news_right(IdCat, nomeCategoria){
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	if (String(nomeCategoria)=="undefined"){
		var sezione ="Tutte"
	}else{
		var sezione = nomeCategoria;
	}
	var contenuto = '<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
				'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+sezione.replace(/'/g, "\\'")+'<br>'+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td><div style="position:relative;">'+
						'<div id="PagingLabel" style="text-align:right;position:absolute;width:350px;top:-28;left:232;">'+
						'</div></div></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>'+
				'</div></div>';
	
	var nextCall = "ajaxGetRand('../news/paging.asp?IdCat="+IdCat+"', scrivi_paging);scrivi_titolo3('"+contenuto+"', 'paging(1, \\'"+IdCat+"\\')');"
	
	ajaxGetRand("../news/right.asp?IdCat="+IdCat, scrivi_rightcontent, nextCall);
	
	
}

function paging(page, IdCat){
	loadingStart(document.getElementById("rightcontent"));
	var nextCall = "ajaxGetRand('../news/paging.asp?page="+page+"&IdCat="+IdCat+"', scrivi_paging);window.setTimeout('if(isIE){addIEReflex();}else {addReflex();}', 400)"
	ajaxGetRand("../news/descrizione_newsP.asp?IdCat="+IdCat+"&page="+page, scrivi_scroll3, nextCall);
}

function scrivi_paging(content){
	if (document.getElementById("PagingLabel")){
		document.getElementById("PagingLabel").innerHTML=content
	}
	document.getElementById("PagingLabel").style.align="right"
}
/*--------------------------------------------------------------- Fine  News    -------------------------------------------------------------------------- */
/*---------------------------------------------------------------  Rubriche tecniche   OLD  -------------------------------------------------------------------------- */
/*
function open_tecniche(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading

	ajaxPost("../tecniche/tecniche.asp", scrivi_maincontent,c=1);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

function open_tecniche_right(IdCat, nomeCategoria){
	_globalRight = 1;
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	var sezione = nomeCategoria;
	
	var contenuto = '<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+sezione+'<br>'+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"');window.setTimeout('if(isIE){addIEReflex();}else {addReflex();}', 400)"
	ajaxGetRand("../tecniche/right.asp?IdCat="+IdCat, scrivi_rightcontent, nextCall);
}
*/
/*---------------------------------------------------------------  Fine Rubriche  tecniche OLD -------------------------------------------------------------------------- */
/*---------------------------------------------------------------  Rubriche tecniche   -------------------------------------------------------------------------- */

function open_tecniche(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading

	ajaxPost("../tecniche/tecniche.asp", scrivi_maincontent,c=1);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

function open_tecniche_right(IdNews, titolo){
	_globalRight = 1;
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	var contenuto = '<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+titolo.replace(/'/g, "\\'")+'<br>'+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"');window.setTimeout('if(isIE){addIEReflex();}else {addReflex();}', 400)"
	ajaxGetRand("../tecniche/right.asp?IdNews="+IdNews, scrivi_rightcontent, nextCall);
}

/*---------------------------------------------------------------  Fine Rubriche tecniche     -------------------------------------------------------------------------- */
/*---------------------------------------------------------------  Rubriche  commerciali OLD-------------------------------------------------------------------------- */
/*
function open_commerciali(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading

	ajaxPost("../commerciali/commerciali.asp", scrivi_maincontent,c=1);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

function open_commerciali_right(IdCat, nomeCategoria){
	_globalRight = 1;
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	var sezione = nomeCategoria;
	
	var contenuto = '<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+sezione+'<br>'+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"');window.setTimeout('if(isIE){addIEReflex();}else {addReflex();}', 400)"
	ajaxGetRand("../commerciali/right.asp?IdCat="+IdCat, scrivi_rightcontent, nextCall);
}
*/
/*---------------------------------------------------------------  Fine Rubriche commerciali OLD-------------------------------------------------------------------------- */

/*---------------------------------------------------------------  Rubriche commerciali   -------------------------------------------------------------------------- */

function open_commerciali(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading

	ajaxPost("../commerciali/commerciali.asp", scrivi_maincontent,c=1);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

function open_commerciali_right(IdNews, titolo){
	_globalRight = 1;
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	var contenuto = '<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+titolo.replace(/'/g, "\\'")+'<br>'+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"');window.setTimeout('if(isIE){addIEReflex();}else {addReflex();}', 400)"
	ajaxGetRand("../commerciali/right.asp?IdNews="+IdNews, scrivi_rightcontent, nextCall);
}

/*---------------------------------------------------------------  Fine Rubriche commerciali     -------------------------------------------------------------------------- */

/*---------------------------------------------------------------  R&D     -------------------------------------------------------------------------- */

function open_ReD(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading

	ajaxPost("../research/research.asp", scrivi_maincontent,c=1);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

function open_research_right(IdNews, titolo){
	_globalRight = 1;
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	var contenuto = '<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
				'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+titolo.replace(/'/g, "\\'")+'<br>'+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>'+
				'</div></div>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"');window.setTimeout('if(isIE){addIEReflex();}else {addReflex();}', 400)"
	ajaxGetRand("../research/right.asp?IdNews="+IdNews, scrivi_rightcontent, nextCall);
}

/*---------------------------------------------------------------  Fine R&D     -------------------------------------------------------------------------- */


/*---------------------------------------------------------------  OEM   -------------------------------------------------------------------------- */

function open_oem(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading

	ajaxPost("../OEM/OEM.asp", scrivi_maincontent,c=1);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

function open_OEM_right(IdNews, titolo){
	_globalRight = 1;
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	var contenuto = '<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
				'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+titolo.replace(/'/g, "\\'")+'<br>'+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>'+
				'</div></div>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"');window.setTimeout('if(isIE){addIEReflex();}else {addReflex();}', 400)"
	ajaxGetRand("../OEM/right.asp?IdNews="+IdNews, scrivi_rightcontent, nextCall);
}

/*---------------------------------------------------------------  Fine OEM     -------------------------------------------------------------------------- */
/*---------------------------------------------------------------  FAQ   -------------------------------------------------------------------------- */

function open_FAQ(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading

	ajaxPost("../FAQ/FAQ.asp", scrivi_maincontent,c=1);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

function open_FAQ_right(IdNews, titolo){
	_globalRight = 1;
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	var contenuto = '<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
				'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+titolo.replace(/'/g, "\\'")+'<br>'+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>'+
				'</div></div>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"');window.setTimeout('if(isIE){addIEReflex();}else {addReflex();}', 400)"
	ajaxGetRand("../FAQ/right.asp?IdNews="+IdNews, scrivi_rightcontent, nextCall);
}

/*---------------------------------------------------------------  Fine FAQ     -------------------------------------------------------------------------- */

/*---------------------------------------------------------------  Media Center   -------------------------------------------------------------------------- */

function open_mediacenter(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading

	ajaxPost("../mediacenter/mediacenter.asp", scrivi_maincontent,c=1);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

function open_mediacenter_right(IdNews, titolo){
	_globalRight = 1;
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	var contenuto = '<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
				'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+titolo.replace(/'/g, "\\'")+'<br>'+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>'+
				'</div></div>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"');window.setTimeout('if(isIE){addIEReflex();}else {addReflex();}', 400)"
	ajaxGetRand("../mediacenter/right.asp?IdNews="+IdNews, scrivi_rightcontent, nextCall);
}

/*---------------------------------------------------------------  Fine Media Center   -------------------------------------------------------------------------- */


/*---------------------------------------------------------------  Coming Soon   -------------------------------------------------------------------------- */

function open_coming(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading

	ajaxPost("../coming/coming.asp", scrivi_maincontent,c=1);
	//ajaxPost("../tutto/calcolo_array_marche.asp", riempi_array,c=1);
}

function open_coming_right(IdNews, titolo){
	_globalRight = 1;
//loading
	loadingStart(document.getElementById("rightcontent"));

//fine loading
	
	var contenuto = '<div style="position:relative;"><div style="position:absolute;top:-2px;">'+
				'<table cellpadding="0" cellspacing="0" width="595" height="30">'+
					'<tr>'+
						'<td width="15"></td>'+
						'<td style="font-family:Arial; font-size:18px; color:#8483AF;" valign="middle" height="16">'+
							'&nbsp;<img src="../../img/clip_01.gif">&nbsp;&nbsp;'+titolo.replace(/'/g, "\\'")+'<br>'+
						'</td>'+
						'<td width="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td height="10"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="1" bgcolor="#1E222C"></td>'+
					'</tr>'+
					'<tr>'+
						'<td></td>'+
						'<td height="3"></td>'+
					'</tr>'+
				'</table>'+
				'</div></div>';
	
	var nextCall = "scrivi_titolo3('"+contenuto+"');window.setTimeout('if(isIE){addIEReflex();}else {addReflex();}', 400)"
	ajaxGetRand("../coming/right.asp?IdNews="+IdNews, scrivi_rightcontent, nextCall);
}

/*---------------------------------------------------------------  Fine Coming Soon     -------------------------------------------------------------------------- */
/*--------------------------------------------------------------- Contatti   -------------------------------------------------------------------------- */
function open_contatti(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading
	ajaxGetRand("../contatti/contatti.asp", scrivi_maincontent);
}
/*--------------------------------------------------------------- Fine Contatti   -------------------------------------------------------------------------- */
/*--------------------------------------------------------------- Phillips Motorsport   -------------------------------------------------------------------------- */
function open_phillips(){
//loading
	loadingStart(document.getElementById("loadingcontent"));

//fine loading
	ajaxGetRand("../phillips/phillips.asp", scrivi_maincontent);
}
/*--------------------------------------------------------------- Fine Phillips Motorsport   -------------------------------------------------------------------------- */

/*--------------------------------------------------------------- Area riservata  -------------------------------------------------------------------------- */
function checkAgente(){
	var myString = "rnd=" + escape(Math.random()) + "&Nome="+document.getElementById("NomeAreaRis").value+"&Password="+document.getElementById("PasswordAreaRis").value
	ajaxPost("../area_riservata/login_agenti.asp", returnLogin, myString);
	
	return false;
}

function returnLogin(content){
	if (content=="trueAgente"){
		//alert("loggato")
		var obj = document.getElementById("linkToAreaRis")
		//4obj.href="../area_riservata/default.asp?rnd="+escape(Math.random())
		//return hs.htmlExpand(obj , { objectType: 'ajax', preserveContent: true, width: '600', height: '700'} )
		GWindowOpen(0, '../area_riservata/area_riservata_sopra.asp', 650, 700, "AreaRiservata")
	}
	if (content=="falseAgente"){
		PopOpen(0)
	}
}

function PopOpen(opac){
	if (opac==0){
		document.getElementById("overlayLog").style.visibility="visible"
		document.getElementById("overlayLogErr").style.visibility="visible"
	}
	
	opac+=10
	
	if (opac<=100){
		if(document.all){
			opac=100
			document.getElementById('overlayLogErr').filters.alpha.opacity = opac;
		}

		if (document.getElementById('overlayLogErr').style.MozOpacity){
			document.getElementById('overlayLogErr').style.MozOpacity = opac/100;
		}
		
		if(document.getElementById('overlayLogErr').style.opacity){
			document.getElementById('overlayLogErr').style.opacity = opac/100;
		}
		window.setTimeout("PopOpen("+opac+")", 40)
	}
	
}

function PopClose(){
	document.getElementById("overlayLog").style.visibility="hidden"
	if(document.all){
		document.getElementById('overlayLogErr').filters.alpha.opacity = 0;
	}

	if (document.getElementById('overlayLogErr').style.MozOpacity){
		document.getElementById('overlayLogErr').style.MozOpacity = 0.0;
	}
	
	if(document.getElementById('overlayLogErr').style.opacity){
		document.getElementById('overlayLogErr').style.opacity = 0.0;
	}
	document.getElementById("overlayLogErr").style.visibility="hidden"
}
var ordGlobPubb="Nome"
var ordGlobPriv="Nome"
function areaRisDoc(param){
	if (param=="AreaPubb"){
		if (ordGlobPubb=="Nome"){
			//loading
				//loadingStart(document.getElementById("areaPubb"));
			
			//fine loading
			ajaxGetRand("../area_riservata/ordinaDataPubb.asp", scrivi_areaFiles,  "areaPubb", "data");
			document.getElementById("ordinaPbl").innerHTML="ordina per nome"
			ordGlobPubb="Data"
		}else{
			//loading
				//loadingStart(document.getElementById("areaPubb"));
			
			//fine loading
			ajaxGetRand("../area_riservata/ordinaNomePubb.asp", scrivi_areaFiles, "areaPubb", "nome");
			document.getElementById("ordinaPbl").innerHTML="ordina per data"
			ordGlobPubb="Nome"
			
		}
	}


	if (param=="AreaPriv"){
		if (ordGlobPriv=="Nome"){
			//loading
				//loadingStart(document.getElementById("areaPriv"));
			
			//fine loading
			ajaxGetRand("../area_riservata/ordinaDataPriv.asp", scrivi_areaFiles,  "areaPriv", "data");
			document.getElementById("ordinaPrv").innerHTML="ordina per nome"
			ordGlobPriv="Data"
		}else{
			//loading
				//loadingStart(document.getElementById("areaPriv"));
			
			//fine loading
			ajaxGetRand("../area_riservata/ordinaNomePriv.asp", scrivi_areaFiles, "areaPriv", "nome");
			document.getElementById("ordinaPrv").innerHTML="ordina per data"
			ordGlobPriv="Nome"
			
		}
	}
}

function closeAreaRis(){
	ajaxPost("../area_riservata/logout.asp", GWindowClose, c=1);
	document.getElementById("NomeAreaRis").value = ""
	document.getElementById("PasswordAreaRis").value = ""
}

function scrivi_areaFiles (content,IdDiv,tipo){
	//alert(content)
	document.getElementById(IdDiv).innerHTML=content
	//loadingStop(null);
}


function conferma(fileName) {
   var annulla = window.confirm("Eliminare il file?");   
   if (annulla) {
		ajaxGetRand("../area_riservata/elimina.asp?file="+fileName, blankFunc);
      }else {
         return false;
      }
}

function blankFunc(){
	areaRisDoc("AreaPriv")
}
/*--------------------------------------------------------------- Fine area riservata  -------------------------------------------------------------------------- */


/*--------------------------------------------------------------- Ricerca  -------------------------------------------------------------------------- */
var globalScrSearch = "false"
function openSearch(obj){
	if (Trim(String(obj.elements['q'].value))==0){
		
	}else{
		globalScrSearch = "true";
		GWindowOpen(0, '../ricerca/default.asp?q='+Trim(String(obj.elements['q'].value)), 550, 700, 'Ricerca')
	}
}


function checkSearch(obj){
	if (Trim(String(obj.value))==0){
		obj.value="search"
	}
}


function search_scrUp(){
	if (document.getElementById('risLinee').style.visibility=='visible'){
		gWinRicLinee.scrollBy(0, -20);aspettaR=setTimeout("search_scrUp()", 10);
	}else if (document.getElementById('risNews').style.visibility=='visible'){
		gWinRicNews.scrollBy(0, -20);aspettaR=setTimeout("search_scrUp()", 10);
	}else if (document.getElementById('risProdotti').style.visibility=='visible'){
		gWinRicProdotti.scrollBy(0, -20);aspettaR=setTimeout("search_scrUp()", 10);
	}else{
		aspettaR=setTimeout("var not='1'", 10);
	}
}
function search_scrDwn(){
	
	if (document.getElementById('risLinee').style.visibility=='visible'){
		gWinRicLinee.scrollBy(0, 20);aspettaR=setTimeout("search_scrDwn()", 10);
	}else if (document.getElementById('risNews').style.visibility=='visible'){
		gWinRicNews.scrollBy(0, 20);aspettaR=setTimeout("search_scrDwn()", 10);
	}else if (document.getElementById('risProdotti').style.visibility=='visible'){
		gWinRicProdotti.scrollBy(0, 20);aspettaR=setTimeout("search_scrDwn()", 10);
	}else{
		aspettaR=setTimeout("var not='1'", 10);
	}
}

function SearchStop(){
	if(aspettaR)
	 clearTimeout(aspettaR);
}

var ArrDiv = new Array()
ArrDiv[0]="risLinee"
ArrDiv[1]="risProdotti"
ArrDiv[2]="risNews"
ArrDiv[3]="risSondaggi"
ArrDiv[4]="risSezioni"
function SearchToggle(IdDiv, stato) {
	var myDiv = document.getElementById(IdDiv)
	for(i=0;i<ArrDiv.length;i++){
		if (document.getElementById(ArrDiv[i]) ){
					//alert(ArrDiv[i])
					document.getElementById(ArrDiv[i]).style.position='absolute';
					document.getElementById(ArrDiv[i]).style.visibility='hidden';
					if ( document.getElementById(String(ArrDiv[i]).replace("ris", "show")) ) {
						if(globalSrcLang=="it"){
							document.getElementById(String(ArrDiv[i]).replace("ris", "show")).innerHTML="<b>&raquo;&nbsp;vedi dettagli</b>"
						}else if(globalSrcLang=="en"){
							document.getElementById(String(ArrDiv[i]).replace("ris", "show")).innerHTML="<b>&raquo;&nbsp;show details</b>"
						}else if(globalSrcLang=="es"){
							document.getElementById(String(ArrDiv[i]).replace("ris", "show")).innerHTML="<b>&raquo;&nbsp;mostrar detalles</b>"
						}else{
							document.getElementById(String(ArrDiv[i]).replace("ris", "show")).innerHTML="<b>&raquo;&nbsp;show details</b>"
						}
					}
		}
	}
	
	if (String(stato)=="absolute"){
		myDiv.style.position='relative';
		myDiv.style.visibility='visible';
		
		if(globalSrcLang=="it"){
			document.getElementById(String(myDiv.id).replace("ris", "show")).innerHTML="<b>&laquo;&nbsp;chiudi dettagli</b>"
		}else if(globalSrcLang=="en"){
			document.getElementById(String(myDiv.id).replace("ris", "show")).innerHTML="<b>&laquo;&nbsp;hide details</b>"
		}else if(globalSrcLang=="es"){
			document.getElementById(String(myDiv.id).replace("ris", "show")).innerHTML="<b>&laquo;&nbsp;ocultar detalles</b>"
		}else{
			document.getElementById(String(myDiv.id).replace("ris", "show")).innerHTML="<b>&laquo;&nbsp;hide details</b>"
		}
		
	}
	
}


var globalSearch="false";
function searchLines(IdLinea){
	globalScrSearch = "false";
	GWindowClose();
	globalSearch="true";
	
	if (document.getElementById('prodotti').style.visibility=="hidden")
		espandi('prodotti')
	
	open_catalogo_da_tutto(IdLinea)
}

var globalSearchProd = "false"
function searchProducts(IdMarca, IdTab, IdTipo){
	globalScrSearch = "false";
	GWindowClose();
	
	globalSearchProd="true";
	
	if (document.getElementById('prodotti').style.visibility=="hidden")
		espandi('prodotti')
	
	open_tutto_da_linee(IdMarca, IdTab, IdTipo)
}

function searchNews(IdNews){
	globalScrSearch = "false";
	GWindowClose();
	
	GWindowOpen(0, '../news/dett_news_sopra.asp?IdNews='+IdNews, 550, 700, 'News');
}
/*--------------------------------------------------------------- Fine Ricerca  -------------------------------------------------------------------------- */