function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function checkrequired(which)
{
	var pass=true
	if (document.images)
		for (i=0;i<which.length;i++)
		{
			var tempobj=which.elements[i]
			if (tempobj.name.substring(0,8)=="required")
				if (((tempobj.type=="text" || tempobj.type=="checkbox" || tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1))
				{
					pass=false
					break
				}
		}
	if (!pass)
	{
		alert("Completa i campi RICHIESTI.")
		return false
	}
	return true
}

var checkobj

function accetta(el)
{
	checkobj=el
	if (document.all||document.getElementById)
		for (i=0;i<checkobj.form.length;i++)
		{
			var tempobj=checkobj.form.elements[i]
			if(tempobj.type.toLowerCase()=="submit")
				tempobj.disabled=!checkobj.checked
		}
}

function disabilita(el)
{
	if (!document.all&&!document.getElementById){
		if (window.checkobj&&checkobj.checked)
			return true
		else
		{
			alert("Per favore accetta i termini del contratto")
			return false
		}
	}
}


function cambiaclasse(id,newClass) 
{
	identity = document.getElementById(id);
	identity.className = newClass;
}

function submitFormPage(Numeropagina)
{
	document.forms[1].Numeropagina.value = Numeropagina;
}

function dettagliovetrina(id)
{
	window.open('dettaglio_vetrina.php?id='+id,'vetrina'+id,'top=10, left=10, width=600, height=420, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function dettaglioauto(id)
{
	window.open('dettaglio.php?id='+id,'auto'+id,'top=10, left=10, width=620, height=500, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function dettaglionuovomodello(id)
{
	window.open('dettaglio_nuovo_modello.php?id='+id,'modello'+id,'top=10, left=10, width=620, height=500, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function dettaglioveicolonoleggio(id)
{
	window.open('dettaglio_veicolo_noleggio.php?id='+id,'modello'+id,'top=10, left=10, width=620, height=500, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function dettagliocitycar(id)
{
	window.open('dettaglio_citycar.php?id='+id,'modello'+id,'top=10, left=10, width=620, height=500, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function dettaglioevento(id)
{
	window.open('dettaglio_evento.php?id='+id,'evento'+id,'top=10, left=10, width=620, height=420, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function dettagliopromozione(id)
{
	window.open('dettaglio_promozione.php?id='+id,'evento'+id,'top=10, left=10, width=620, height=420, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function dettaglioservizio(id)
{
	window.open('dettaglioservizio.php?id='+id,'servizio'+id,'top=10, left=10, width=550, height=400, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function OpenCredits()
{
	window.open('credits.php','1','top=50, left=50, width=250, height=150, status=no, menubar=no,toolbar=no, scrollbars=no');
}
function OpenMappa()
{
	window.open('immagini/mappa.jpg','1','top=50, left=50, width=687, height=625, status=no, menubar=no,toolbar=no scrollbars=no');
}
function opensalone()
{
	window.open('media/video.php','salone','top=100, left=100, width=345, height=450, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function openspot()
{
	window.open('media/spot.php','salone','top=100, left=100, width=345, height=450, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function openradio()
{
	window.open('media/radio.php','salone','top=100, left=100, width=345, height=450, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function opendownload()
{
	window.open('media/documentazione.php','doc','top=100, left=100, width=345, height=450, status=no, menubar=no,toolbar=no, scrollbars=yes');
}
function FlashMovie(movie,width,height) 
{ 
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + width + '" height="' + height + '">'); 
	document.write('<param name="movie" value="' + movie + '" />'); 
	document.write('<param name="quality" value="high" />'); 
	document.write('<embed src="' + movie + '" quality=high width="' + width + '" height="' + height + '" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash">') 
	document.write('</object>'); 
}
