var limiteY = 0;
function pngfix()
{
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])

	if ((version >= 5.5) && (document.body.filters)) 
	{
	   for(var i=0; i<document.images.length; i++)
	   {
	      var img = document.images[i]
	      var imgName = img.src.toUpperCase()
	      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	      {
	         var imgID = (img.id) ? "id='" + img.id + "' " : ""
	         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
	         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
	         var imgStyle = "display:inline-block;" + img.style.cssText 
	         if (img.align == "left") imgStyle = "float:left;" + imgStyle
	         if (img.align == "right") imgStyle = "float:right;" + imgStyle
	         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
	         var strNewHTML = "<span " + imgID + imgClass + imgTitle
	         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
	         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
	         img.outerHTML = strNewHTML
	         i = i-1
	      }
	   }
	}
}

function $($id){
	return document.getElementById($id);
}
function $id($id){
	return document.getElementById($id);
}

function addEvent(object, eventType, doIt){
	if(object.addEventListener){ // ALL BROWSERS
		object.addEventListener(eventType, doIt, false); 
		return true;
	} else if (object.attachEvent){ // IE	
		var r = object.attachEvent('on'+eventType, doIt);
		return r;
	} else 	return false;
}

function apEx(campo){
	if($("testo_nascosto")){
		if($("testo_nascosto").style.display==""){
			$("testo_nascosto").style.display="none";
			campo.innerHTML = "Maggiori informazioni";
		} else {
			$("testo_nascosto").style.display = "";
			campo.innerHTML = "chiudi";
		}		
	}
}

// ==========================================
// AJAX
function ajax(url, div, info, method, form, script, func)
{
	this.url = url; // content url
	this.method = (method) ? method : 'GET'; // method GET or POST, standard = "GET"
	this.div = div; // content destination
	this.info = (info) ? info : "<center><b><font color='red'>Caricamento<br>in corso</font></b></center>"; // durante il loading mostra qualcosa se non specificato
	this.form = form; //nome del form - richiesto solo per richieste by POST
	this.script = (script==0 || script==1) ? script : 1;
	this.func = func;
}
ajax.prototype = {
    connect: function()
	{
		if(!this.url) return;
        this.xmlHttp = null;
		if( window.XMLHttpRequest ) this.xmlHttp = new XMLHttpRequest(); // tuttu i browser
		else if( window.ActiveXObject){ // IE
			try{
				this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e){
				try{
					this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}
		if(this.xmlHttp != null && this.xmlHttp != undefined )
		{
			var object = this;
			this.xmlHttp.onreadystatechange = function(){ object.getState.call(object); }
			if(this.method=="GET")
				this.executeGET(); // get request
			else 
				this.executePOST() // post request		
		}
	},
	getState: function()
	{
		if(this.xmlHttp.readyState == 4)
		{
			this.result(this.xmlHttp.responseText);
			if(this.func) eval(this.func);
			if(this.script) this.executeScripts(this.xmlHttp.responseText);
		}
		else 
		{
			this.loading();
		}
	},
	executeGET: function()
	{
		this.xmlHttp.open(this.method,this.url, true);
		this.xmlHttp.send(null);
	},
	executePOST: function()
	{
		formLength=this.form.length;
		var fields="";
		
		for(i=0;i<formLength;i++){
			fields+=this.form[i].name+"="+this.form[i].value+"&";
		}
		this.xmlHttp.open(this.method,this.url+"?"+fields, true);
		this.xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		this.xmlHttp.setRequestHeader('Content-Type',"application/x-www-form-urlencoded; charset=iso-8859-1");
		this.xmlHttp.send(fields);
	},	
	executeScripts: function(text)
	{
		var ini = 0;
		while (ini!=-1){
			ini = text.indexOf('<script', ini);
			if (ini >=0){
				ini = text.indexOf('>', ini) + 1;
				var fim = text.indexOf('</script>', ini);
				text = text.substring(ini,fim);
				eval(text);
			}
		}
	},
    loading: function()
	{ 
		var DivInUse = this.div;
		
		this.result(this.info);
		
		if (DivInUse.substr(0, 4) == "div_" && DivInUse != "div_comunicazione" && DivInUse != "div_scegli_prov_modelli" && DivInUse != "div_drag_drop" && DivInUse != "div_drag_drop_principe")
		{
			//document.getElementById("sf_trasparente").style.display="block";
			//document.getElementById("loader").style.display="block";
		}
	},
	result: function(r)
	{ 
		//alert(r);
		var DivInUse = this.div;
		
		if($id(this.div))

		{
			if (DivInUse.substr(0, 4) == "div_" && DivInUse != "div_comunicazione" && DivInUse != "div_scegli_prov_modelli" && DivInUse != "div_drag_drop" && DivInUse != "div_drag_drop_principe")
			{
				//document.getElementById("sf_trasparente").style.display="none";
				//document.getElementById("loader").style.display="none";
			}
			
			$id(this.div).style.display="";
			$id(this.div).style.visibility="";
			$id(this.div).innerHTML=r; 
		}		
	}
}
function fsAjax(url, div, info, method, form, script, func)
{
	var requestContent = new ajax(url, div, info, method, form, script, func);
	requestContent.connect();
}
/* END OF AJAX */ 

// =======================================================
//=================================================
// INPUT LOGIN
function input_click(ogg)
{
	var nome = ogg.getAttribute("name");
	var tipo = ogg.getAttribute("type");
	var valore = ogg.value;
	
	if(tipo=="text")
	{
		if(valore=="password")
		{
			ogg.value="";
			ogg.type="password";
		} 
		else if(valore=="username")
		{
			ogg.value="";
		}	
	}
}

function input_blur(ogg)
{
	var nome = ogg.getAttribute("name");
	var tipo = ogg.getAttribute("type");
	var valore = ogg.value;
	
	if(tipo=="text")
	{
		if(valore=="")
		{
			ogg.value="username";
		}	
	}
	
	if(tipo=="password")
	{
		if(valore=="")
		{
			//ogg.type="text";
			//ogg.value="password";
		}	
	}
}

function val_email(mail)
{
	var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
	
	if(typeof(mail) == "string")
	{
		if(er.test(mail)) return true;
	}
	else if(typeof(mail) == "object")
	{
		if(er.test(mail.value))
		{
			return true;
		}
	}
	else
		return false;
}

function controlla_email(campo_email)
{
	email = campo_email.value;
	if(!val_email(email))
	{
		alert("Email non corretta");
	}
}

function controlla_cap(campo_cap)
{
	cap = campo_cap.value;
	
	if(!/^\d{0,}$/.test(cap))
	{
		alert("CAP non corretto");
	}
	else if(cap.length<5) 
		alert("CAP non corretto");
}

function controllaPIVA(pi)
{
  if(pi=="") return "";

   if( pi.length != 11 )

     return "La lunghezza della partita IVA non è corretta";

   validi = "0123456789";

   for( i = 0; i < 11; i++ ){
     if( validi.indexOf( pi.charAt(i) ) == -1 )
     return "La partita IVA contiene un carattere non valido `" +
     pi.charAt(i) + "‘. I caratteri validi sono le cifre. ";
   }   
   s = 0;

   for( i = 0; i <= 9; i += 2 )

     s += pi.charCodeAt(i) - '0'.charCodeAt(0);

   for( i = 1; i <= 9; i += 2 ){

     c = 2*( pi.charCodeAt(i) - '0'.charCodeAt(0) );

     if( c > 9 ) c = c - 9;

     s += c;

   }

   if( ( 10 - s%10 )%10 != pi.charCodeAt(10) - '0'.charCodeAt(0) )

     return "La partita IVA non è valida: " + "il codice di controllo non corrisponde";

   return "";

}
function controlla_iva(iva){
	var pi = controllaPIVA(iva.value);
	if(pi!="") alert(pi);
}
// =======================================================
//=================================================
// REGISTRAZIONE
function go2Step(num){
	switch(num){
		case 1:
			self.location("/registrati/step1");
			break;
		case 2:
			var form = document.step1;
			form.method = "POST";
			form.action = "/include/registrazione/step1.php";
			for(i=0;i<=form.length;i++){
				if(form[i])
				{
					if(form[i].type=="text" || form[i].type=="password")
					{
						if(form[i].value=="")
						{
							campNome = form[i].name!="conf_password" ? form[i].name : "Conferma password";
							if (campNome != "CodiceManager" && campNome != "sito" && campNome != "fax") //escludo i campi non obbligatori
							{
								alert("Il campo "+campNome+" è obbligatorio");
								form[i].focus();
								return false;
							}	
						}				
					}
				}
			}
			var pi = controllaPIVA(document.step1.iva.value);
			if(pi!=""){
				alert(pi);
				document.step1.iva.focus();
				return false;
			}
			cap = document.step1.cap.value;
	
			if (!/^\d{0,}$/.test(cap))
			{
				alert("CAP non corretto");
				return false;
			}
			else if (cap.length < 5)
			{
				alert("CAP non corretto");
				return false;	
			}
			
			cemail = document.step1.email.value;
			if(!val_email(cemail))
			{
				alert("Email non corretta");
				return false;
			}
			if(document.step1.username.value.length<6){
				alert("E' necessario inserire un USERNAME di almeno 6 caratteri.");
				return false;
			}
			if(document.step1.password.value.length<6){
				alert("E' necessario inserire una PASSWORD di almeno 6 caratteri.");
				return false;
			}
			if (document.step1.password.value != document.step1.conf_password.value) {
				alert("Le PASSWORD non coincindono.");
				return false;
			}
			
			if(document.step1.CodiceManager.value != "" && document.step1.CodiceManager.value.length!=8){
				alert("E' necessario inserire un CODICE MANAGER di almeno 8 caratteri.");
				return false;
			}
			
			if(!$("radio_categoria1").checked && !$("radio_categoria2").checked && !$("radio_categoria3").checked)
			{
				alert("Compila anche l'ultima richiesta per proseguire");
				return false;	
			}
			
			form.submit();
			break;
		case 3:
			var form = document.step2;
			form.method = "POST";
			form.action = "/include/registrazione/step2.php";
			
			/*if (!$("V_U").checked)
			{
				alert("Attenzione, compila i campi relativi ad Attività e servizi per procedere");
				return false;
			}*/
			
			form.submit();
			break;	
		case "fine":
			var form = document.step3;
			form.method = "POST";
			//form.action = "/registrati/fine";
			form.action = "/include/registrazione/step3.php";
			if(form.aut_dati.checked==false){
				alert("Il consenso all'utilizzo dei dati è obbligatorio");
				return false;
			}
			
			form.submit();
			break;						
	}
}
//=================================================
//=================================================
// NETWORK
function network(ogg){
	fsAjax("/include/network.php?c="+ogg,"cont_network");
}

function inviaContatto(){
	var form = document.invia_contatto;
	var formLength=form.length;
	for(i=0;i<formLength;i++){
		if(form[i])
		{
			/*if(form[i].type=="text" || form[i].type=="password")
			{*/
				if(form[i].value=="")
				{
					campNome = form[i].name!="conf_password" ? form[i].name : "Conferma password";
					alert("Il campo "+campNome+" è obbligatorio");
					form[i].focus();
					return false;							
				}					
			//}
		}
	}	
	fsAjax("/include/invia.php","cont_network","","POST",document.invia_contatto);	
}

//=================================================
function box_vede(ogg){
	if((/MSIE 6.0/).test(navigator.appVersion)){
		var ext = ".gif";
	} else var ext = ".png";
	switch(ogg){
		case "mkt":
			$("cont_mkt_diretto").style.display="";
			$("cont_blog").style.display="none";
			$("cont_automoticard").style.display="none";
			$("cont_csi").style.display="none";
			$("cont_bench").style.display="none";
			
			$("img_box_mkt").src="/img/mkt_diretto_giallo"+ext;
			$("img_box_blog").src="/img/box_blog"+ext;
			$("img_box_card").src="/img/automoticard"+ext;
			$("img_box_csi").src="/img/csi"+ext;
			$("img_box_bench").src="/img/benchmark"+ext;
			break;
		case "blog":
			$("cont_mkt_diretto").style.display="none";
			$("cont_blog").style.display="";
			$("cont_automoticard").style.display="none";
			$("cont_csi").style.display="none";
			$("cont_bench").style.display="none";
			
			$("img_box_mkt").src="/img/mkt_diretto"+ext;
			$("img_box_blog").src="/img/box_blog_giallo"+ext;
			$("img_box_card").src="/img/automoticard"+ext;
			$("img_box_csi").src="/img/csi"+ext;
			$("img_box_bench").src="/img/benchmark"+ext;
			break;
		case "card":
			$("cont_mkt_diretto").style.display="none";
			$("cont_blog").style.display="none";
			$("cont_automoticard").style.display="";
			$("cont_csi").style.display="none";
			$("cont_bench").style.display="none";
			
			$("img_box_mkt").src="/img/mkt_diretto"+ext;
			$("img_box_blog").src="/img/box_blog"+ext;
			$("img_box_card").src="/img/automoticard_giallo"+ext;
			$("img_box_csi").src="/img/csi"+ext;
			$("img_box_bench").src="/img/benchmark"+ext;
			break;
		case "csi":
			$("cont_mkt_diretto").style.display="none";
			$("cont_blog").style.display="none";
			$("cont_automoticard").style.display="none";
			$("cont_csi").style.display="";
			$("cont_bench").style.display="none";
			
			$("img_box_mkt").src="/img/mkt_diretto"+ext;
			$("img_box_blog").src="/img/box_blog"+ext;
			$("img_box_card").src="/img/automoticard"+ext;
			$("img_box_csi").src="/img/csi_giallo"+ext;
			$("img_box_bench").src="/img/benchmark"+ext;
			break;
		case "bench":
			$("cont_mkt_diretto").style.display="none";
			$("cont_blog").style.display="none";
			$("cont_automoticard").style.display="none";
			$("cont_csi").style.display="none";
			$("cont_bench").style.display="";
			
			$("img_box_mkt").src="/img/mkt_diretto"+ext;
			$("img_box_blog").src="/img/box_blog"+ext;
			$("img_box_card").src="/img/automoticard"+ext;
			$("img_box_csi").src="/img/csi"+ext;
			$("img_box_bench").src="/img/benchmark_giallo"+ext;
			break;												
	}
	
}
function prendeFlash(){	
	var PlayerVersion=0;
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".");
		}
	}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
		var axo = 1;
		var counter = 3;
		while(axo) {
			try {
				counter++;
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
				PlayerVersion = [counter,0,0];
			} catch (e) {
				axo = null;
			}
		}
	} else { // Win IE (non mobile)
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					if(PlayerVersion) torna = 1;
					else torna = 0;
					return torna;					
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = axo.GetVariable("$version").split(" ")[1].split(",");
		}
	}
	if(PlayerVersion) torna = 1;
	else torna = 0;
	return torna;
}
/* ************************************************** */
// DEALER
function Refresh_Network(select2,hidden,form)
{
	var network = "";
	var totale = select2.options.length;
	for (i = 0; i < totale; i++)
	{
		if (select2.options[i].value != "tutte")
			network = network + '#' + select2.options[i].value;			
	}	
	
	if(select2.options.length > 0)
		network = network + '#';
	
	if(/step1/.test(form.name))
	{
		document.step1.value = network;
		document.step1.network_scelti.value = network;
	}
	else
		document.step2.value = network;
}

function Refresh_Marche(select2,hidden,form)
{
	var marche = "";
	var totale = select2.options.length;
	for (i = 0; i < totale; i++)
	{
		if (select2.options[i].value != "tutte")
			marche = marche + '#' + select2.options[i].value;			
	}	
	
	if(select2.options.length > 0)
		marche = marche + '#';
	
	if(/step1/.test(form.name))
	{
		document.step1.value = marche;
		document.step1.marche_scelte.value = marche;
	}
	else
		document.step2.value = marche;
}

function Refresh_Mezzi(select2,hidden,form)
{
	var mezzi = "";
	var totale = select2.options.length;
	for (i = 0; i < totale; i++)
	{
		if (select2.options[i].value != "tutte")
			mezzi = mezzi + '#' + select2.options[i].value;			
	}	
	
	if(select2.options.length > 0)
		mezzi = mezzi + '#';
	
	if(/step1/.test(form.name))
	{
		document.step1.value = mezzi;
		document.step1.mezzi_scelti.value = mezzi;
	}
	else
		document.step2.value = mezzi;
}


function sortList(lb){
	arrTexts = new Array();
	arrValues = new Array();
	arrOldTexts = new Array();
	arrTexts[0]=arrValues[0]=arrOldTexts[0]="";
	
	
	for(i=1; i<lb.length; i++){
		arrTexts[i] = lb.options[i].text;
		arrValues[i] = lb.options[i].value;
		arrOldTexts[i] = lb.options[i].text;
	}
	arrTexts.sort();
	for(i=1; i<lb.length; i++){
		lb.options[i].text = arrTexts[i];
		for(j=1; j<lb.length; j++){
			if (arrTexts[i] == arrOldTexts[j]){
				lb.options[i].value = arrValues[j];
				j = lb.length;
			}
		}
	}	
}
function aggiungi(form,select1,select2,funzione)
{
	form_attivo = form;
	form = document[form];
	select1 = form[select1];
	select2 = form[select2];
	
	var Nome_Elemento = select1.options[select1.selectedIndex].text //Nome Elemento
	var Valore_Elemento = select1.options[select1.selectedIndex].value //Valore Elemento
	
	if (select1.options.length > 0 && select1.selectedIndex != -1)
	{
		if (Valore_Elemento != "tutte" && Valore_Elemento != "tutti")
		{
			var NrElemento = select1.selectedIndex; //Elemento Nr Selezionato
			var NrElementiSel1 = select1.options.length; //Numero di elementi select 1
			var NrElementiSel2 = select2.options.length; //Numero di elementi select 2
			select2.options[select2.options.length] = new Option(Nome_Elemento, Valore_Elemento); // Aggiungo elemento su select 2
			select1.options[select1.selectedIndex] = null; //Elimino elemento da select 1
			if (form_attivo == 'step1')
			{
				if (funzione=="network")
					Refresh_Network(select2,"network_scelti",form);
				
				if (funzione=="marche")
					Refresh_Marche(select2,"marche_scelte",form);
				
				if (funzione=="mezzi")
					Refresh_Mezzi(select2,"mezzi_scelti",form);
			}
			sortList(select2);
		}
		else if (select1.options.length > 1 && select1.selectedIndex != -1)
		{
			var totale = select1.options.length-1;
			for(i=0;i<totale;i++){
				var Nome_Elemento = select1.options[1].text //Nome Elemento
				var Valore_Elemento = select1.options[1].value //Valore Elemento
				
				var NrElemento = select1[1]; //Elemento Nr Selezionato
				var NrElementiSel1 = select1.options.length; //Numero di elementi select 1
				var NrElementiSel2 = select2.options.length; //Numero di elementi select 2
				select2.options[select2.options.length] = new Option(Nome_Elemento, Valore_Elemento); // Aggiungo elemento su select 2
				select1.options[1] = null; //Elimino elemento da select 1				
			}
			
			if (form_attivo == 'step1')
			{
				if (funzione=="network")
					Refresh_Network(select2,"network_scelti",form);
				
				if (funzione=="marche")
					Refresh_Marche(select2,"marche_scelte",form);
				
				if (funzione=="mezzi")
					Refresh_Mezzi(select2,"mezzi_scelti",form);
			}
			
			sortList(select2);
		}
		select1.selectedIndex=NrElemento;
	}
	
}
function elimina(form,select2,select1,funzione)
{
	form_attivo = form;
	form = document[form];
	select1 = form[select1];
	select2 = form[select2];
	
	if (select2.options.length > 0 && select2.selectedIndex != -1)
	{
		var Nome_Elemento = select2.options[select2.selectedIndex].text //Nome Elemento
		var Valore_Elemento = select2.options[select2.selectedIndex].value //Valore Elemento
		
		var Nome_Elemento = select2.options[select2.selectedIndex].text //Nome Elemento
		var Valore_Elemento = select2.options[select2.selectedIndex].value //Nome Elemento
	
		if (Valore_Elemento != "tutte" && Valore_Elemento != "tutti")
		{
			var NrElemento = select2.selectedIndex; //Elemento Nr Selezionato
			var NrElementiSel1 = select2.options.length; //Numero di elementi select 2
			var NrElementiSel2 = select1.options.length; //Numero di elementi select 1
			select2.options[select2.selectedIndex] = null; //Elimino elemento da select 2
			select1.options[select1.options.length] = new Option(Nome_Elemento, Valore_Elemento); // Aggiungo elemento su select 1
			if (form_attivo == 'step1')
			{
				if (funzione=="network")
					Refresh_Network(select2,"network_scelti",form);
				
				if (funzione=="marche")
					Refresh_Marche(select2,"marche_scelte",form);
				
				if (funzione=="mezzi")
					Refresh_Mezzi(select2,"mezzi_scelti",form);
			}
			if(!/cap/.test(select1.name))
				sortList(select1);
			
		}
		else if (select2.options.length > 1 && select2.selectedIndex != -1)
		{
			var totale = select2.options.length-1;
			
			for(i=0;i<totale;i++)
			{
				var Nome_Elemento = select2.options[1].text //Nome Elemento
				var Valore_Elemento = select2.options[1].value //Valore Elemento
				
				var NrElemento = select2[1]; //Elemento Nr Selezionato
				var NrElementiSel1 = select2.options.length; //Numero di elementi select 1
				var NrElementiSel2 = select1.options.length; //Numero di elementi select 2
				select1.options[select1.options.length] = new Option(Nome_Elemento, Valore_Elemento); // Aggiungo elemento su select 2
				select2.options[1] = null; //Elimino elemento da select 1		
			}
			if (form_attivo == 'step1')
			{
				if (funzione=="network")
					Refresh_Network(select2,"network_scelti",form);
				
				if (funzione=="marche")
					Refresh_Marche(select2,"marche_scelte",form);
				
				if (funzione=="mezzi")
					Refresh_Mezzi(select2,"mezzi_scelti",form);
			}
			sortList(select1);
		}
		//select2.selectedIndex=NrElemento;
	}
}
/* ************************************************** */
function resize(vl){	
	larg = !window.innerWidth ? document.body.offsetWidth+25 : window.innerWidth;
	if (vl != larg) {
		var flash = prendeFlash();		
		
		if (!vl) vl = larg;
		if ($("banner_riga4")) 
			fsAjax("/banner.php?b=4&flash="+flash, "banner_riga4", "loading...");
		if (larg > 1024) {
			if($("riga1")) fsAjax("/banner.php?b=1&r=1024&flash="+flash, "riga1", "loading...");
			if($("riga3")) fsAjax("/banner.php?b=3&r=1024&flash="+flash, "riga3", "loading...");
			if ($("stilo_ie"))				
				$("stilo_ie").href = "/css/stili_ie_1024.css";							
		
			// REGISTRATI
			if ($("sfr_top")) 
				$("sfr_top").src="/img/sfr_top1024.png";
			if ($("img_step1")) 
				$("img_step1").src="/img/r_step1_1024.png";
			if ($("img_step2")) 
				$("img_step2").src="/img/r_step2_1024.png";
			if ($("img_step3")) 
				$("img_step3").src="/img/r_step3_1024.png";
			if ($("step_footer")) 
				$("step_footer").src="/img/sfr_footer1024.gif";
			if($("marche_sotto_1024"))
				$("marche_sotto_1024").src="/img/marche_sotto_1024.gif";
			if($("marche_sotto_1025"))
				$("marche_sotto_1025").src="/img/marche_sotto_1024.gif";	
			if ($("banner5"))
				fsAjax("/banner.php?b=5&r=1024&flash="+flash, "banner5", "loading...");	
			if($("sotto_marche_st1"))
				$("sotto_marche_st1").src="/img/sotto_marche_st1_1024.gif";		
				
		}else {
			if($("riga1")) fsAjax("/banner.php?b=1&r=800&flash="+flash, "riga1", "loading...");
			if($("riga3")) fsAjax("/banner.php?b=3&r=800&flash="+flash, "riga3", "loading...");
			
			var bodyDoc = document.getElementsByTagName("body").item(0);
			var cstilo = document.createElement("link");
			cstilo.href='/css/stili.css';
			cstilo.rel='stylesheet';
			cstilo.type='text/css';
			cstilo.id='st_800';
			bodyDoc.appendChild(cstilo);		
			if ($("stilo_ie"))
				$("stilo_ie").href = "/css/stili_ie_800.css";

			//BLOG
			if ($("blog")) {
				if($("testata_blog"))
					$("testata_blog").src="/img/testata_blog_800.jpg";	
				
				var bodyDoc2 = document.getElementsByTagName("body").item(0);
				var cstilo2 = document.createElement("link");
				cstilo2.href='/css/blog_800.css';
				cstilo2.rel='stylesheet';
				cstilo2.type='text/css';
				cstilo2.id='st_blog_800';
				bodyDoc2.appendChild(cstilo2);				
			}
			// REGISTRATI
			if ($("sfr_top")) 
				$("sfr_top").src="/img/sfr_top800.png";
			if ($("img_step1"))
				$("img_step1").src="/img/r_step1_800.png";
			if ($("img_step2")) 
				$("img_step2").src="/img/r_step2_800.png";
			if ($("img_step3")) 
				$("img_step3").src="/img/r_step3_800.png";	
			if ($("step_footer")) 
				$("step_footer").src="/img/sfr_footer800.gif";
			if($("marche_sotto_1024"))
				$("marche_sotto_1024").src="/img/marche_sotto_800.gif";
			if($("marche_sotto_1025"))
				$("marche_sotto_1025").src="/img/marche_sotto_800.gif";	
			if($("seiundealer"))
				$("seiundealer").src="/img/topmarche_bot_800.jpg";	
			
			if ($("banner5"))
				fsAjax("/banner.php?b=5&r=800&flash="+flash, "banner5", "loading...");	
			if($("sotto_marche_st1"))				
				$("sotto_marche_st1").src="/img/sotto_marche_st1_800.gif";	
			if($("sotto_marche_st1_2"))				
				$("sotto_marche_st1_2").src="/img/sotto_marche_st1_800.gif";	
			if($("marketing_foot"))				
				$("marketing_foot").src="/img/marketing_foot_800.gif";

										
		}
		
		if ($("banner6")) 
			fsAjax("/banner.php?b=6&flash="+flash, "banner6", "loading...");	
		if($("pngfix"))
			$("pngfix").href="/css/pngfix.css";		
	}
	
	//setTimeout("resize('"+larg+"')",10);
}
function getPos(obj){
	if($id(obj)){
		obj = $id(obj);
		var top=obj.offsetTop;
		objY=obj;
		while((objY=objY.offsetParent) != null) top+=objY.offsetTop;
		var left=obj.offsetLeft;
		objX=obj;
		while((objX=objX.offsetParent)!=null) left+=objX.offsetLeft;
		var position=Array(top,left);
		return position;
	} else return Array("ERROR:","Object '"+obj+"' not found");
}
addEvent(window, "load", resize);

function MM_openBrWindow(theURL,winName,features) { //v2.0
  automoticonpop=window.open(theURL,winName,features)
automoticonpop.focus();
}

 //mostra/nascondi livelli
 
 function ShowAndHide(id1,id2){
if(document.getElementById){
    el1=document.getElementById(id1);
    el2=document.getElementById(id2);
    if(el1.style.display=="none"){
        el1.style.display="block";
        el2.style.display="none";
        }
    else{
        el1.style.display="none";
        el2.style.display="block";
        }
    }
}






// mostra/nasconde livelli

function mostra_div(Nr)
{
	document.getElementById(Nr).style.display='block';
	
}
function nascondi_div(Nr)
{
	document.getElementById(Nr).style.display='none';
	
}

// rollover immagini

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_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_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];}
}

