var sito="\/fitart\/fitart\/";
document.observe("dom:loaded", function() {
		unloading.delay(1);
});

storia=history.length;
Ajax.Responders.register({
	onCreate: function(){
		loading();
	}, 
  	onComplete: function(){
		unloading.delay(1);
 	}
});

function controllo() {
        if($('unload')==1) {
		$('unload').value=0;
	}
	
        if($('unload')==0) {
	//	controllo.delay(20);
	} else {
//	alert('pass');
		controllo.delay(5);
		}
}
function wpopup(arg) {
        var oWin = window.open(arg,"Fitart","width=1000,height=650,resizable=no, location=no, directories=no,status=no, toolbar=no, menubar=no, left=0, top=0 ");
        oWin.moveTo(screen.width / 2 - 1000 / 2, screen.height / 2 - 650 / 2);
       if (oWin==null || typeof(oWin)=="undefined") {
        document.write("You HAVE A POPUP BLOCKER");
	        } else {
       }
}
 // document.location.replace(document.location);
/*
function reset(sessionid) {
  if (sessionid) {
    var url= 'mv_nextpage=ord/basket&mv_session_id=' + sessionid + '&mv_todo=refresh&mv_orderpage=2007_carrello&mv_ip=2&';
    updater_standard('etichetta','process', url,'1');
    //  alert($('elenco_carrello').innerHTML.length + ' ' + $('elenco_carrello').innerHTML) 
    if($('elenco_carrello').innerHTML.length > 10 ) {
      ingrandisci_carrello(); 
    }
  }
  $('lresources_dx').style.width='0px;';
  $('letichette_dx').style.width='0px;';
  $('larchives_dx').style.width='0px;';
  $('lresources_dx').style.width='0px;';
  updater_standard('letichette_dx','2007_etichette.html', '','');
}
*/

function loading() {
  $('loader').show();
  $('loader').style.position='absolute';
  $('loader').style.top='50%';
  $('loader').style.left='30%';
  $('loader').style.marginTop='0px';
//  $('loader').style.marginLeft='-150px';
}

function unloading() {
  $('loader').hide();
}
function effetto(contenitore) {
        // new Effect.Highlight(contenitore,{duration:1, from:0.3, to: 1,startcolor: '#bbccaa',endcolor: '#ffffff'});
}
function rebuild(a,b,c,d) {
   posizione=c.indexOf("div");
   posizione2=c.indexOf("?",posizione);
   new Ajax.Updater(a,sito + b, {method:'post',postBody:c,evalScripts:true,success:a, asynchronous:false});
}
function reset() {
  new Ajax.Updater('vuoto',sito + '2007_status.html', {method:'post',postBody:'flag=reset',evalScripts:true,success:'vuoto', asynchronous:false});
  document.location.href=sito + 'index.html';
}
function updater_standard(a,b,c,d) {
c=unescape(c);
// alert(a + ' \n ' + b + ' \n '  + c);
if (b.indexOf('http')) {
  var sito="\/fitart\/fitart\/";
} else {
  var sito="";
};
//
// la condizione precedente serve per identificare la rewrite rule
// e quindi per non inserire l'url completo se gia' disponibile
//
//
// a il div
// b l'url
// c i parametri
// d a '1' se syncrono
//
// vecchio metodo
//
//  new Ajax.Updater(a,b, {parameters:c,evalScripts:true,success:a, asynchronous:true });
//
  $(a).style.display='inline';
  $(a).style.background_color='#fff';

// gestione del tasto back
  if(c.length>0) {
    c2=c.replace(/&/g,"xsostituitoy");
  parametri="div=" + a + "&pagina=" + b + "&forma=" + c2;
  } else {
  parametri="div=" + a + "&pagina=" + b ;
  }

//
// chiamata sincrona/asincrona
//
  if (d=='1') {
    new Ajax.Updater(a,sito + b, {method:'post',postBody:c,evalScripts:true,success:a, asynchronous:false  });
  } else  {
    new Ajax.Updater(a,sito + b, {method:'post',postBody:c,evalScripts:true,success:a, asynchronous:true });
  };
  new Ajax.Updater('vuoto',sito + '2007_status.html', {method:'post',postBody:parametri,evalScripts:true,success:a, asynchronous:false});
  altezza();
}




var preloaded = new Array();
function preload_images() {
    for (var i = 0; i < arguments.length; i++){
        preloaded[i] = document.createElement('img');
        preloaded[i].setAttribute('src',arguments[i]);
    };
};
preload_images(
    '/2007/css/bgetichetta_open.gif',
    '/2007/css/bgetichetta.gif'
);




function l1_no_children(a,b,c,d) {
l1_children(a,b,c,d);
}
function l1_children(a,b,c,d) {
  divs = document.getElementsByTagName('li');
  for(var i = 0, n = divs.length, c; i < n; ++i) {
    // c = divs[i].substring(1,3);
    var str="Hello world!";
    if (divs[i].getAttribute('id')) {
      ellei=divs[i].getAttribute('id');
      primo=ellei.substring(0,5);
      if (primo=="primo") {
// alert('a');
         if (primo == d) {
         } else {
         new Effect.Opacity(ellei, { duration: 0.1, transition: Effect.Transitions.linear, from: 1.0, to: 0.5, queue: 'start' });
         }
      }
    }
  }
  setTimeout('appari_div("' + d + '")',2000);
  $('lresources_dx').style.display='inline';
  new updater_standard(a,b,c,'1');
  // riduci_esiste('lresources_dx')
}
function appari_div(d) {
  new Effect.Opacity(d, { duration: 0.1, transition: Effect.Transitions.linear, from: 1, to: 2, queue: 'end' });
}
function riduci_esiste(a) {
// a div
// b x
// c y
// d 1 riduce
// e 1 ingrandisce
  x= Element.getStyle(a, 'width');
  pixel=x.substring(0,x.length-2);
  if(pixel >0 ) {
   //   alert('a');
   // new Effect.Morph('lresources_dx',{ style:'width:0px; border: 0px; margin-left:0px; margin-bottom:0px; margin-top:0px; margin-right:0px; height: 0px;', duration:0.8, queue:'start' });    
  } else {
   //         alert('b');
   //  new Effect.Scale(a, 100,{ scaleFrom: 0, queue: 'end', scaleMode: {originalHeight: b, originalWidth: c }});
   //    new Effect.Morph('lresources_dx',{ style:'width:320px; height: auto;', duration:0.8, queue:'start' });    
    $('lresources_dx').style.display='inline';
  }
}

function my_slide(large, uno, due, tre, quattro,direzione) {
 Element.setStyle('new_slideshow', {display:'inline'});
 Element.setStyle('sl_ce', {backgroundRepeat:'no-repeat'});
 Element.setStyle('sl_ce', {backgroundRepeat:'no-repeat'});

 immagine=Element.getStyle('sl_ce', 'backgroundImage');
 immagine_sx=Element.getStyle('sl_sx', 'backgroundImage');
 immagine_dx=Element.getStyle('sl_dx', 'backgroundImage');
 controllo_dx=0;
 controllo_sx=0;
 if (immagine_dx.indexOf('fleche')!=-1 ) {
   } else { 
   controllo_dx=1;
 }

 if (immagine_sx.indexOf('fleche')!=-1 ) {
   } else { 
   controllo_sx=1;
 }
 if ((controllo_sx==1 && direzione=="giu") || (controllo_dx==1 && direzione == "su")) {
  } else {
 
 Element.setStyle('sl_dx', {backgroundImage:'url(/2007/css/fleche2.png)'});
   if (immagine.indexOf(quattro) != -1) {
       if(direzione == 'su') { 
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + quattro + ')'});
        Element.setStyle('sl_sx', {backgroundImage:'url(/2007/css/fleche1.png)'});
        } else {
          Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + tre + ')'});
          Element.setStyle('sl_sx', {backgroundImage:'url(/2007/css/fleche1.png)'});
       }
   }

   if (immagine.indexOf(tre) != -1) {
       if(direzione == 'su') { 
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + quattro + ')'});
        Element.setStyle('sl_sx', {backgroundImage:'url(/2007/css/fleche1.png)'});
       } else {
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + due + ')'});
        Element.setStyle('sl_sx', {backgroundImage:'url(/2007/css/fleche1.png)'});
       }
   }

   if (immagine.indexOf(due) != -1) {
       if(direzione == 'su') { 
         Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + tre + ')'});
         Element.setStyle('sl_sx', {backgroundImage:'url(/2007/css/fleche1.png)'});
         if(quattro == '' ) {
            Element.setStyle('sl_dx', {backgroundImage:'url(/2007/css/)'});
         } else {
            Element.setStyle('sl_dx', {backgroundImage:'url(/2007/css/fleche2.png)'});
         }

       } else {
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + uno + ')'});
        Element.setStyle('sl_sx', {backgroundImage:'url(/2007/css/fleche1.png)'});
       }
   }

   if (immagine.indexOf(uno) != -1) {
       if(direzione == 'su') { 
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + due + ')'});
        Element.setStyle('sl_sx', {backgroundImage:'url(/2007/css/fleche1.png)'});
         if(tre == '' ) {
            Element.setStyle('sl_dx', {backgroundImage:'url(/2007/css/)'});
         } else {
            Element.setStyle('sl_dx', {backgroundImage:'url(/2007/css/fleche2.png)'});
         }

       } else {
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + large + ')'});
        Element.setStyle('sl_sx', {backgroundImage:'url(/2007/css/)'});
       }
   }

   if (immagine.indexOf(large) != -1) {
      if(direzione == 'su') { 
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + uno + ')'});
        Element.setStyle('sl_sx', {backgroundImage:'url(/2007/css/fleche1.png)'});
         if(due == '' ) {
            Element.setStyle('sl_dx', {backgroundImage:'url(/2007/css/)'});
         } else {
            Element.setStyle('sl_dx', {backgroundImage:'url(/2007/css/fleche2.png)'});
         }
      } else {
        Element.setStyle('sl_sx', {backgroundImage:'url(/2007/css/)'});
      }
   }
 
   if (immagine == 'none') {
     test=0;

     if(quattro != '' ) {
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + quattro + ')'});
        test++;
     }
     if(tre != '' ) {
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + tre + ')'});
        test++;
     }
     if(due != '' ) {
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + due + ')'});
        test++;
     }
     if(uno != '' ) {
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + uno + ')'});
        test++;
     }
     if(large != '' ) {
        Element.setStyle('sl_ce', {backgroundImage:'url(/images/dettagli/' + large + ')'});
        test++;
     }
     if (test == 1) {
        Element.setStyle('sl_dx', {backgroundImage:'url(/2007/css/)'});
     }
     if (test == 2) {
        Element.setStyle('sl_dx', {backgroundImage:'url(/2007/css/fleche2.png)'});
     }
    Element.setStyle('sl_sx', {backgroundImage:'url(/2007/css/)'});

    }
  }
}
function menu_alto(a,b,c,d) {
    $('lselect').innerHTML='';
    $('letichette_dx').style.display='none';
//    new Effect.Morph('lresources_dx',{ style:'width:0px; border: 0px; margin-left:0px; margin-bottom:0px; margin-top:0px; margin-right:0px; height: 0px;', duration:0.8, queue:'start' });    
    $('lresources').style.display='inline';
// alert('a ' + a + ' b ' + b + ' c ' + c );
  updater_standard('lresources_dx','2007_nulla','')
  updater_standard(a,b,c,'0')
}
function apro_scheda(a,b,c, sku) {
// a div
// b pagina 
// c parametri 
//  alert(a + ' ' + b + ' ' + c);

//  updater_standard('lresources_dx','search','sp=2007_articoli_correlati&' + c);
   updater_standard(a,b,'sp=2007_scheda_prodotto&' + c,'1')
$('dettaglio_tecnico_' + sku).style.display='inline';
// updater_standard('scheda_prodotto','search','sp=2007_scheda_prodotto&fi=products&st=db&co=1&sf=sku&se=00634&op=eq&nu=0&bs=1&ml=1&controllo=1','');
updater_standard('lresources_dx','2007_articoli_correlati','sku='+sku,'');
updater_standard('larchives_dx','2007_descrizione_sezione','sku='+sku,'');
// $('larchives_dx').innerHTML='';
}
function inserisci_carrello(url,parametri,numero_articoli) {
    updater_standard('etichetta',url, parametri,'1');
    dimensione_carrello(numero_articoli);

  }
  
function dimensione_carrello(numero_articoli) {
  var larghezza=$('etichetta').style.width;
//  alert('a' + larghezza + 'b')
//  new Element.setStyle('elenco_carrello',{display:'none'});
//  alert('   larghezza '+ larghezza);
  if (larghezza=='') {
//    alert('a')
    $('etichetta').style.width='36px';
    $('etichetta').style.marginLeft='136px';
    ingrandisci_carrello()
    } else {
      ingrandisci_carrello()
    }
  var altezza=numero_articoli*25+110;
//  alert(altezza + ' x ' + numero_articoli);
//  alert (altezza);
  altezza=altezza+"px";
//  alert (altezza);
//   //   $('etichetta').style.height=altezza;
  Element.setStyle('etichetta', {height:'auto'} ); 
}

function ingrandisci_carrello() {
      Element.setStyle('etichetta',{backgroundImage:'url(/2007/css/bgetichetta_open.gif)'});
      new Effect.Morph('etichetta',{ style:'width:172px; margin-left:0px; background: #fff;', duration:0.8 });
      setTimeout('appari_elenco()',1500);
      new Effect.Highlight('elenco_carrello',{duration:1, from:0.3, to: 1,startcolor: '#bbccaa',endcolor: '#ffffff'});

}

function appari_elenco() {
  $('elenco_carrello').style.display='inline';
}
function ridimensiona_carrello() {
  var larghezza=$('etichetta').style.width;
    Element.setStyle('etichetta',{backgroundImage:'url(/2007/css/bgetichetta_open.gif)'});
    $('elenco_carrello').style.display='inline';
  Element.setStyle('etichetta', {height:'auto'} ); 
}
function little_carrello() {
	//    new Effect.Morph('elenco_carrello',{ style:'width:50px; margin-left:122px; height:1px;', duration:0.8 });
//   new Element.setStyle('elenco_carrello',{display:'none';});
//  $('elenco_carrello').style.display='none';
    new Effect.Morph('etichetta',{ style:'width:36px;margin-left:136px;', duration:0.8 });
}

function dettaglio_carrello() {
  updater_standard('supportingText','2007_dettaglio_carrello','','');
}

function apri_cerca() {
  $('lselect').innerHTML='';
  $('letichette_dx').style.display='none';
  updater_standard('larchives_dx','2007_cerca', '','1');
}
function apri_login() {
  $('lselect').innerHTML='';
  $('letichette_dx').style.display='none';
  updater_standard('larchives_dx','2007_login','','');
  updater_standard('supportingText','2007_richiesta_account','','');
}
function caratteristiche_tecniche() {
  var visibile1=$('titolo_finiture').style.height;
  var visibile2=$('titolo_finiture_2').style.height;
}

Effect.divSwap = function(element,container){
    var div = document.getElementById(container);
    var nodeList = div.childNodes;
    var queue = Effect.Queues.get('menuScope');

    if(queue.toArray().length<1){
        if(Element.visible(element)==false){
            for(i=0;i<nodeList.length;i++){
                if(nodeList.item(i).nodeName=="DIV" && nodeList.item(i).id!=element){
                    if(Element.visible(nodeList.item(i))==true){
                        Effect.SlideUp(nodeList.item(i),{queue:{position:'end',scope:'menuScope',limit:2}})
                    }
                }
            }
            Effect.SlideDown(element,{queue:{position:'end',scope:'menuScope',limit:2}})
       }
   }
}
function aggiorna_quantita(articolo,quantita,sessionid,varquantity,logged){
  // alert('a');
  ridimensiona_carrello();
  var url= 'mv_nextpage=ord/basket&mv_session_id=' + sessionid + '&mv_todo=refresh&mv_orderpage=2007_carrello&mv_ip=2&' +  articolo + '=' + quantita + '&' + varquantity ;
  // alert(url);
  inserisci_carrello('process',url,'');   
  if(logged==''){
 	 updater_standard('supportingText','2007_dettaglio_carrello','','1');
  } else {
//  alert('a')
  	acquista('loggato');
  }
}
function inserimento_anagrafica(sessionid,mv_username, mv_password, mv_verify) {
var url='';
url=url + 'mv_doit=return';
url=url + '&mv_click=Save_database';
url=url + '&mv_session_id=' + sessionid;
url=url + '&mv_order_profile=account_change';
url=url + '&mv_todo=return';
url=url + '&mv_nextpage=2007_benvenuto';
url=url + '&mv_check=Save_database';
url=url + '&mv_successpage=2007_benvenuto';
if (mv_password.length >0) {
  url=  url + '&mv_username=' + mv_username;
  url=  url + '&mv_password=' + mv_password;
  url=  url + '&mv_verify=' + mv_verify;
url=url + '&function=new_account';
} else {
  url=  url + '&mv_username=' + mv_username;
  // url=  url + '&mv_password=' + $('mv_password.value');
  // url=  url + '&mv_verify=' + $('mv_verify').value;
url=url + '&function=save';
}

fname          =$('fname').value;
lname          =$('lname').value;
address1          =$('address1').value;
city          =$('city').value;
state          =$('state').value;
zip          =$('zip').value;
email          =$('email').value;
email_ver          =$('email_ver').value;
country          =$('country').value;
phone_day          =$('phone_day').value;
fax          =$('fax').value;
company          =$('company').value;

fname     = fname.replace('&',' and ');      
lname     = lname.replace('&',' and ');      
address1  = address1.replace('&',' and ');   
city      = city.replace('&',' and ');       
state     = state.replace('&',' and ');      
zip       = zip.replace('&',' and ');        
email     = email.replace('&',' and ');      
email_ver = email_ver.replace('&',' and ');  
country   = country.replace('&',' and ');    
phone_day = phone_day.replace('&',' and ');  
fax       = fax.replace('&',' and ');        
company   = company.replace('&',' and ');    

fname          =escape(fname);
lname          =escape(lname);
address1          =escape(address1);
city          =escape(city);
state          =escape(state);
zip          =escape(zip);
email          =escape(email);
email_ver          =escape(email_ver);
country          =escape(country);
phone_day          =escape(phone_day);
fax          =escape(fax);
company          =escape(company);

url=  url + '&fname=' +         fname    ; 
url=  url + '&lname=' +         lname     ;
url=  url + '&address1=' +      address1  ;
url=  url + '&city=' +          city      ;
url=  url + '&state=' +         state     ;
url=  url + '&zip=' +           zip       ;
url=  url + '&email=' +         email     ;
url=  url + '&email_ver=' +     email_ver ;
url=  url + '&country=' +       country   ;
url=  url + '&phone_day=' +     phone_day ;
url=  url + '&fax=' +           fax       ;
url=  url + '&company=' +       company    ;
url=  url + '&payment_method=credit';
// url=  url + '&phone_night=' + escape($('phone_night').value);
  url+='&_='
// url=  url + '&b_nickname=' + $('b_nickname').value;
// url=  url + '&b_fname=' + $('b_fname').value;
// url=  url + '&b_lname=' + $('b_lname').value;
// url=  url + '&b_address1=' + $('b_address1').value;
// url=  url + '&b_city=' + $('b_city').value;
// url=  url + '&b_state=' + $('b_state').value;
// url=  url + '&b_zip=' + $('b_zip').value;
// url=  url + '&b_country=' + $('b_country').value;
var url_str=url.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
 url_str=url_str.replace('&','<br>');
//    updater_standard('supportingText','process', Form.serialize(document.accounto),'1');
    updater_standard('supportingText','process', url,'1');
      setTimeout('box_login()',1000);

secondo_url='http://www.fitart.com/proxy_contatti.php?mv_username=sito&mv_password=sitootis&company=' + company + '&address1=' + address1 + '&zip=' + zip + '&citta=' + city + '&state=' + state + '&country=' + country + '&phone_day=' + phone_day + '&fax=' + fax + '&email=' + email + '&tasti=inserisci';

    updater_standard('vuoto',secondo_url, '','1');
}
function box_login() {
      updater_standard('larchives_dx','2007_login','','');

// updater_standard('supportingText','process', url);
//    $('lresources_dx').innerHTML=url_str;
}

function controlla_esistenza_utente(username,password, verify) {
 alert('entro  in controllo esistenza utente');
 
}
function registrati(username,password, verify,username_r, password_r) {
//	alert('username ' + username + 'password' + password + 'verify' + verify + 'username_r' + username_r + 'password_r' + password_r)
  var msg='';
  if(username_r == '' && password_r =='') {
    if (username.length < 6  ) {
      msg=msg + 'inserire un nome utente di almeno 6 caratteri \n\n';
    }
    if (password.length < 6 ) {
      msg=msg + 'inserire una password di almeno 6 caratteri \n\n';
    }
    if (verify.length < 6 ) {
      msg=msg + 'inserire una password di verifica di almeno 6 caratteri \n\n';
    }
    if (verify !=  password) {
      msg=msg + 'inserire password e password di verifica identiche \n\n';
    }
  } else {
    if (username_r.length < 6  ) {
      msg=msg + 'inserire un nome utente di almeno 6 caratteri \n\n';
    }
    if (password_r.length < 6 ) {
      msg=msg + 'inserire una password di almeno 6 caratteri \n\n';
    }
  }
  if (msg.length > 10) {
    alert(msg);
  } else {
    if(username_r == '' && password_r =='') {
      url='mv_click=NewAccount&';
      url+='mv_todo=return&';
      url+='mv_nextpage=2007_account&';
      url+='mv_cookie_password=0&';
      url+='mv_failpage=2007_account&';
      url+='mv_successpage=2007_account&';
      url+='function=new_account&';
      url+='mv_order_profile=account_change&';
      url+='mv_username=' + username + '&';
      url+='mv_password=' + password + '&';
      url+='mv_verify=' + verify + '&';
      url+='nuovo_utente=1'
      url+='&_='
      updater_standard('supportingText','process', url,'1' );
//      updater_standard('larchives_dx','2007_login', '','1' );
    } else {
      url='mv_todo=return&';
      url+='mv_failpage=2007_account_errato&';
      url+='mv_successpage=2007_benvenuto&';
      url+='mv_nextpage=2007_benvenuto&';
      url+='mv_username=' + username_r + '&';
      url+='mv_password=' + password_r + '&';
      url+='function=login&';
      url+='mv_cookie_password=0&';
      url+='&_='
      updater_standard('supportingText','process', url,'1' );
      updater_standard('larchives_dx','2007_login', '','1' );
      inserisci_carrello('process','mv_nextpage=ord/basket&mv_todo=refresh&mv_orderpage=2007_carrello','')
    }
    updater_standard('lselect_dx','2007_menu_dx', '','1' );
  }
}
function slogout(){
  updater_standard('larchives_dx','2007_logout','','1');
  updater_standard('supportingText','2007_logo','','1');
  updater_standard('lselect_dx','2007_menu_dx','','1');
  inserisci_carrello('process','mv_nextpage=ord/basket&mv_todo=refresh&mv_orderpage=2007_carrello','')
}
/*
function acquista(logged){
  if(logged=="loggato") {
    updater_standard('supportingText','ord/2007_checkout2','','1');
    updater_standard('sotto_ordine','2007_dettaglio_carrello','','1');
    $('sotto_ordine').style.display='none';
  } else {
    $('supportingText').innerHTML='';
    apri_login();
    $('lselect').innerHTML='';
    $('letichette_dx').style.display='none';
    updater_standard('larchives_dx','2007_login','','');
    updater_standard('supportingText','2007_richiesta_account','','');

  }
}
*/
function acquista(logged){
setTimeout('acquista2("' + logged+ '")',500);
}
function acquista2(logged){
    $('letichette_dx').style.display='none';
    if($('gift_note')) {
   	 updater_standard('supportingText','ord/2007_checkout2','note=' + $('gift_note').value,'1');
    } else {
    	updater_standard('supportingText','ord/2007_checkout2','','1');
    }
    updater_standard('sotto_ordine','2007_dettaglio_carrello','','1');
    $('lresources_dx').innerHTML='';
    if(logged=="sloggato") {
      updater_standard('larchives_dx','2007_login','','');
    }
}
 

function ordina(tipo,idsessione,note) {
  var url='';
  if (note=="") { note=" "; }
  url+='gift_note=' + note + '&';
  url+='mv_shipmode=default&';
  url+='mv_session_id=' + idsessione;
  url+='mv_doit=refresh&';
  url+='mv_order_receipt=etc/2007_receipt.html&';
  
  url+='mv_nextpage=ord/2007_checkout2&';
  url+='mv_order_route=log+main+copy_user&';
  url+='mv_check=Save_database&';




	
  if(tipo=="offerta") {
    url+='mv_click=Offerta&';
    url+='mv_order_profile=offerta&';
  }
  if(tipo=="disponibilita") {
    url+='mv_click=disponibilita&';
    url+='mv_order_profile=disponibilita&';
  }

  if(tipo=="ordine") {
    url+='mv_click=ordine&';
    url+='mv_order_profile=ordine&';
  }

  

  url+='payment_method=' + tipo + '&';
  url+='mv_payment=' + tipo + '&';
  url+='po_number=1&'
  url+='email_copy=1&';
  url+='mv_todo=submit';
  
  updater_standard('supportingText','process', url,'1' );
  var url= 'mv_nextpage=ord/basket&mv_todo=refresh&mv_orderpage=2007_carrello';
  inserisci_carrello('process',url,'');   
 // new Effect.Morph('etichetta',{ style:'width:36px; border: 0px; margin-left:136px; margin-bottom:0px; margin-top:0px; margin-right:0px; background: #fff;', duration:0.8 });
}
function quarto_potere(nome,codice,url,questo, questo2) {
  updater_standard('lselect','2007_quarto_livello.html','parente='+ codice,'');
  variabile='parente='+ codice + '&questo=' + questo2;
  updater_standard('supportingText','2007_results_children_2.html',variabile,'');
  updater_standard('lresources_dx','search', url + '&sp=2007_results_no_children','1');

  //  updater_standard('','2007_cerca3.html','','');
  div_chiaro='quarto_' + questo;
  var divs = document.getElementsByClassName("identifica_quarto");
  for(var i = 0, n = divs.length, c; i < n; ++i) {
    if (divs[i].getAttribute('id')) {
      ellei=divs[i].getAttribute('id');
      if (ellei==div_chiaro) {
       appari_div(div_chiaro);
      } else {
         new Effect.Opacity(ellei, { duration: 0.1, transition: Effect.Transitions.linear, from: 1.0, to: 0.5, queue: 'start' });
      }
    }
  }
}
function eyes_wide_shut(url) {
  updater_standard('supportingText','search', url + '&sp=2007_primo_risultato','1');
  var struttura=url.split("&"); 
  campo="";
  valore="";
  valore_gamma="";
  valore_merceologico="";
  valore_macrocategoria="";
  for(i=0; i<struttura.length; i++) {
    var sottostringa=struttura[i].substring(0,2);
    if(sottostringa=="se") {
      valore=struttura[i].split("=");
    }
    if(sottostringa=="sf") {
      campo=struttura[i].split("=");
    }
    if(campo[1]=="gamma") {valore_gamma=valore[1];}
    if(campo[1]=="merceologico") {valore_merceologico=valore[1];}
    if(campo[1]=="macrocategoria") {valore_macrocategoria=valore[1];}
  }
//  alert('valore_gamma ' + valore_gamma + ' \nvalore_merceologico ' + valore_merceologico + ' \nvalore_macrocategoria ' + valore_macrocategoria );
  $('letichette_dx').style.display='none';
  updater_standard('larchives_dx','2007_descrizione_sezione','gamma=' + valore_gamma + '&merceologico=' + valore_merceologico,'');
  updater_standard('lresources_dx','2007_nulla','','');
}


function apri_etichetta(etichetta){
  $('presentazione').style.display='none';
  
  if(etichetta=="uno"){
    $('compatibilita').style.display='inline';
  }else{
    $('compatibilita').style.display='none';
  }
  
    if(etichetta=="due"){
    $('qualita').style.display='inline';
  }else{
    $('qualita').style.display='none';
  }
  
    if(etichetta=="tre"){
    $('design').style.display='inline';
  }else{
    $('design').style.display='none';
  }
  
  if(etichetta=="qua"){
    $('natura').style.display='inline';
  }else{
    $('natura').style.display='none';
  }
  
  
}
function dettaglio_scheda(sku) {
  new Effect.divSwap('caratteristiche','contenitore_scheda'); 
  updater_standard('caratteristiche_tecniche','2007_scheda_prodotto_caratteristiche_tecniche','sku=' + sku,'1'); 
  updater_standard('lresources_dx','2007_articoli_correlati','sku=' + sku,'1');

  // alert('a');
  if($('ct_lu_1')) {
    altezza=Element.getStyle($('ct_lu_2'),'height');
 //  alert(altezza);
    Element.setStyle($('ct_lu_1'),{height:altezza });
  }
  if($('ct_la_1')) {
    altezza=Element.getStyle($('ct_la_2'),'height');
    Element.setStyle($('ct_la_1'),{height:altezza });
  }
  if($('ct_al_1')) {
    altezza=Element.getStyle($('ct_al_2'),'height');
    Element.setStyle($('ct_al_1'),{height:altezza });
  }
  if($('ct_pr_1')) {
    altezza=Element.getStyle($('ct_pr_2'),'height');
    Element.setStyle($('ct_pr_1'),{height:altezza });
  }
  if($('ct_ma_1')) {
    altezza=Element.getStyle($('ct_ma_2'),'height');
    Element.setStyle($('ct_ma_1'),{height:altezza });
  }
  if($('ct_fi_1')) {
    altezza=Element.getStyle($('ct_fi_2'),'height');
    Element.setStyle($('ct_fi_1'),{height:altezza });
  }
  if($('ct_sp_1')) {
    altezza=Element.getStyle($('ct_sp_2'),'height');
    Element.setStyle($('ct_sp_1'),{height:altezza });
  }
  if($('ct_ca_1')) {
    altezza=Element.getStyle($('ct_ca_2'),'height');
    Element.setStyle($('ct_ca_1'),{height:altezza });
  }
  if($('ct_st_1')) {
    altezza=Element.getStyle($('ct_st_2'),'height');
    Element.setStyle($('ct_st_1'),{height:altezza });
  }
}
function altezza() {
     var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
//  Element.setStyle('body',{height:'auto' });
//  Element.setStyle('body2',{height:'auto' });
//  Element.setStyle('supportingText',{height:'auto' });
  altezza_browser_tutto=((window.outerHeight)*1)-200;
  altezza_browser=myHeight;
  altezza_body2=Element.getHeight('body2');
  altezza_supporting=Element.getHeight('supportingText');
//  alert('tutto ' + window.outerHeight + 'altezza browser ' + altezza_browser + ' altezza body2 ' + altezza_body2 + ' altezza supporting' + altezza_supporting);
  altezza_supporting=(altezza_supporting*1)+150;

  var altezza=Math.max(altezza_browser_tutto, altezza_browser, altezza_body2,altezza_supporting);
  altezza_def=(altezza*1);
//  Element.setStyle('container',{height:altezza_def + 'px' });
//  alert(altezza_def)
//  Element.setStyle('supportingText',{height:'auto' });
}

function filmato(nome_file) {
// var uscita="<div id=\"visualizza_filmato\">
Element.setStyle('larchives_dx',{display:'inline' });
updater_standard('larchives_dx','2007_flash_video.html','video='+nome_file,'');
}

function terzo_passaggio(primo,secondo,terzo) {
 // alert('primo ' + primo + ' secondo ' + secondo + ' terzo' + terzo)
  if(secondo!='tutto') {
    secondo = secondo + '&op=eq';
  } else {
    secondo = '&op=rm';
  }
  if(terzo!='tutto') {
    terzo=terzo + '&op=eq';
  } else {
    terzo='&op=rm';
  }
  updater_standard('lresources_dx','search', 'sp=2007_results_no_children&fi=products&ml=300&sf=cod_111&se=' + primo + '&sf=cod_2222&se=' + secondo + '&sf=cod_333&se=' + terzo + '&op=eq','');
 $('page_name').focus();
}
function cerca_libera(codice) {
 // alert('primo ' + primo + ' secondo ' + secondo + ' terzo' + terzo)
  updater_standard('lresources_dx','search', 'sp=2007_results_no_children&fi=products&ml=300&sf=codice_articolo&se=' + codice + '&op=eq','1');
}

function altezza_lresources(altezza) {
  Element.setStyle($('lresources_dx'),{height: altezza});
//  Element.setStyle($('lresources_dx'),{width: '320px'});
}
function area_news(il_link, sku) {
  updater_standard('supportingText','search',il_link,'');
  updater_standard('lresources_dx','2007_articoli_correlati','sku=' + sku,'');
  $('letichette_dx').style.display='none';
}
function apri_window(titolo) {
  win = new UI.Window({ theme: 'vista', shadow: false});
  testo=$('scheda_immagini_hidden').innerHTML;
  win.setContent(testo);
  win.setHeader(titolo);
  win.setSize(750,500);
  win.center();
  win.activate();
  win.show();
}
function apri_window_2(titolo) {
  win = new UI.Window({ theme: 'vista', shadow: false});
  win.setAjaxContent('test_file_manager.html',{parameters:{'codice':titolo}});
  win.setSize(750,500);
  win.setHeader(titolo);
  win.center();
  win.activate();
  win.show();
}

function evidenzia_immagini(div) {
   if(div=="immagine_large") {
      $('immagine_large').style.display='inline';
   } else {
      $('immagine_large').style.display='none';
   }
   if(div=="immagine_1") {
      $('immagine_1').style.display='inline';
   } else {
      $('immagine_1').style.display='none';
   }
   if(div=="immagine_2") {
      $('immagine_2').style.display='inline';
   } else {
      $('immagine_2').style.display='none';
   }
   if(div=="immagine_3") {
      $('immagine_3').style.display='inline';
   } else {
      $('immagine_3').style.display='none';
   }
   if(div=="immagine_4") {
      $('immagine_4').style.display='inline';
   } else {
      $('immagine_4').style.display='none';
   }
}
function percorso(uno,due,tre,quattro,cinque,sei,sette,otto,nove) {
    il_link="" ;
    il_link=il_link + "uno=" + uno + "&";
    il_link=il_link + "due=" + due + "&";
    il_link=il_link + "tre=" + tre + "&";
    il_link=il_link + "quattro=" + quattro + "&";
    il_link=il_link + "cinque=" + cinque + "&";
    il_link=il_link + "sei=" + sei + "&";
    il_link=il_link + "sette=" + sette + "&";
    il_link=il_link + "otto=" + otto + "&";
    il_link=il_link + "nove=" + nove;
    updater_standard('percorso','2007_percorso',il_link,'');
}

function replaceAll( str, replacements ) {
alert('a');
    for ( i = 0; i < replacements.length; i++ ) {
        var idx = str.indexOf( replacements[i][0] );
        while ( idx > -1 ) {
            str = str.replace( replacements[i][0], replacements[i][1] );
            idx = str.indexOf( replacements[i][0] );
        }
  }
}

function invia_messaggio_contatti() {
  var test=0;
  if ($('mail_contatti').value=='') { test=(test*1)+1; }  
  if ($('mail_contatti').value.length < 7 ) { test=(test*1)+1; }  
  if ($('nome_contatti').value=='' ) { test=(test*1)+1; }  
  if ($('cognome_contatti').value=='' ) { test=(test*1)+1; }  
  if ($('citta_contatti').value=='' ) { test=(test*1)+1; }  
  if ($('ragione_sociale_contatti').value=='' ) { test=(test*1)+1; }  
  if ($('catalogo_contatti_si').checked && $('indirizzo_contatti').value=='') { test=(test*1)+1; }  
  if ($('catalogo_contatti_si').checked && $('cap_contatti').value=='') { test=(test*1)+1; }  
  if ($('catalogo_contatti_si').checked && $('country_contatti').value=='') { test=(test*1)+1; }  
  if (test >0 ){
    var messaggio='Inserire tutti i campi obbligatori';
    alert(messaggio );
  } else {
    var messaggio_mail=$('messaggio_contatti').value; 
    messaggio_mail = messaggio_mail.replace(/\n/g,' ----- '); 
    urlo='mail=' + $('mail_contatti').value ;
    urlo=urlo + '&tipologia=' + $('tipologia_contatti').value ;
    urlo=urlo + '&settore=' + $('categoria_contatti').value ; 
    urlo=urlo + '&nome=' + $('nome_contatti').value  
    urlo=urlo + '&cognome=' + $('cognome_contatti').value  ;
    if ($('catalogo_contatti_si').checked) {
      urlo=urlo + '&catalogo=catalogo' ;  
      urlo=urlo + '&indirizzo=' + $('indirizzo_contatti').value  ;
      urlo=urlo + '&cap=' + $('cap_contatti').value  ;
      urlo=urlo + '&country=' + $('country_contatti').value  ;
    }
    urlo=urlo + '&citta=' + $('citta_contatti').value  ;
    urlo=urlo + '&ragione_sociale=' + $('ragione_sociale_contatti').value  ;
    urlo=urlo + '&testo=' + messaggio_mail;
    updater_standard('supportingText','2007_contatti2.html',urlo,'' );
  }
}

function illumina(div) {
  $('immagini_fm').style.display='none';
  $('immagine_fm_full').style.display='none';
  $('pdf_fm').style.display='none';
  $('video_fm').style.display='none';
  $('cad_fm').style.display='none';
  $(div).style.display='inline';
}

/*
navHover = function() {
  var lis = document.getElementById("navmenu-h").getElementsByTagName("LI");
  for (var i=0; i<lis.length; i++) {
    lis[i].onmouseover=function() {
      this.className+=" iehover";
    }
    lis[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" iehover\\b"), "");
    }
  }
}
if (window.attachEvent) window.attachEvent("onload", navHover);
*/
