



    function atk_cambio(livello){

        el_div_cat = document.getElementById('div_catalogo');
        el_div_cat.style.display = 'none';
        el_div_cat.style.visibility = 'hidden';

        el_div_cart = document.getElementById('div_carrello');
        el_div_cart.style.display = 'none';
        el_div_cart.style.visibility = 'hidden';


        el = document.getElementById(livello);
        el.style.display = 'block';
        el.style.visibility = 'visible';

    }

    function atk_preferito(cdpreferito){
  
        atk_wait();
        atk_nascondi_title();


        el_f = document.getElementById('if_0');
        
        el_f.src = 'catalogo_lista.jsp?r_cdpreferito='+cdpreferito;

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;
    }

    function atk_marca_web(cdmarcaw){
  
        atk_wait();
        atk_nascondi_title();


        el_f = document.getElementById('if_0');
        
        el_f.src = 'catalogo_lista.jsp?r_cdmarcaw='+cdmarcaw;

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;
    }

    
    function atk_categoria(cdgptipm){
  
        atk_wait();
        atk_nascondi_title();


        el_f = document.getElementById('if_0');
        
        el_f.src = 'catalogo_lista.jsp?r_cdgptipm='+cdgptipm;

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;
    }
    
    function atk_categoria_web(cdgptipmw){
  
        atk_wait();
        atk_nascondi_title();


        el_f = document.getElementById('if_0');
        
        el_f.src = 'catalogo_lista.jsp?r_cdgptipmw='+cdgptipmw;

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;
    }

    function atk_ric_avanz(){
  
        atk_wait();
        atk_nascondi_title();


        el_f = document.getElementById('if_0');
        
        el_f.src = 'catalogo_ric_avanz.jsp';

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;
    }



  
    function atk_cerca(){
        
        f_barcode = document.form_cerca.f_barcode;
        f_search = document.form_cerca.f_search;
        el_cdacli = document.getElementById('f_cdacli');
        
        var ls_cdacli = '';
        if (el_cdacli) ls_cdacli = el_cdacli.value;


        if (f_barcode.value == '' && f_search.value == '' && ls_cdacli == ''){
            

            alert('Valorizzare un parametro di ricerca!');

            return false;
        }


        atk_wait();
        atk_nascondi_title();
        document.form_cerca.submit();

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;

        return false;


    }

    function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
    }

    function atk_cerca_avanz(form_cerca_avanz){
        
        f_search  = form_cerca_avanz.f_search;

        f_barcode    = form_cerca_avanz.f_barcode;
        f_cdgptipm   = form_cerca_avanz.f_cdgptipm;
        f_sesso      = form_cerca_avanz.f_sesso;      
        f_fgfascia   = form_cerca_avanz.f_fgfascia; //questi radio button è cecchato sempre
        f_fascia_da  = form_cerca_avanz.f_fascia_da;
        f_fascia_a   = form_cerca_avanz.f_fascia_a;
        f_prezzo_da  = form_cerca_avanz.f_prezzo_da;
        f_prezzo_a   = form_cerca_avanz.f_prezzo_a;
        
        if (f_search.value == '' 
        && f_barcode.value == ''
        && f_cdgptipm.selectedIndex == 0
        && getCheckedValue(f_sesso) == ''
        && f_fascia_da.value == ''
        && f_fascia_a.value == ''
        && f_prezzo_da.value == ''
        && f_prezzo_a.value == ''
                ){
            
            alert('Valorizzare un parametro di ricerca!');

            return false;
        }


        atk_wait();
        atk_nascondi_title();
        form_cerca_avanz.azione.value = 'cerca';
        form_cerca_avanz.submit();

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;
       
        return false;


    }




    
    function atk_sotto_cat(cdsttcat){
  
        atk_wait();
        atk_nascondi_title();
        
        cdgptipmw = document.form_ric.r_cdgptipmw.value;

        el_f = document.getElementById('if_0');
        
        el_f.src = 'catalogo_lista.jsp?r_cdgptipmw='+cdgptipmw+'&r_cdsttcat='+cdsttcat;

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;
    }



    // --- Scheda ---


    function atk_catalogo(){

        el_f_app = document.getElementById('if_0');

        /*** **
        if (el_f_app.src.indexOf('catalogo_lista.jsp') == 0){
    
            el_f = document.frames('if_0');

            el_mod = el_f.document.getElementById('div1');;
            el = document.getElementById('td_centrale');
        
            el.innerHTML = el_mod.innerHTML;
        
            document.body.scrollTop  = ii_scrollTop;
        
            atk_cambio('div_catalogo');

        }else {

            atk_wait();
            el_f_app.src = 'catalogo_lista_categorie.jsp';
            atk_cambio('div_catalogo');
        }
        *** */

        atk_wait();
        atk_nascondi_title();
        el_f_app.src = 'catalogo_lista_categorie.jsp';
        atk_cambio('div_catalogo');
        
    }


    function atk_back_catalogo(){
        
        el_f = document.getElementById('if_0').contentWindow.document;
        
        
        el_mod = el_f.getElementById('div1');
        el = document.getElementById('td_centrale');
    
        el.innerHTML = el_mod.innerHTML;
    
        document.body.scrollTop  = ii_scrollTop;
    
        atk_cambio('div_catalogo');


    }


    var ii_scrollTop = 0;
    var ii_scrollLeft = 0;

    function atk_scheda(cdarti){
  
    
        atk_wait();
        atk_nascondi_title();
        
        el_f = document.getElementById('if_1');
        
        el_f.src = 'catalogo_scheda.jsp?r_cdarti='+cdarti;

        ii_scrollTop  = document.body.scrollTop;
        ii_scrollLeft = document.body.scrollLeft;

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;

        atk_cambio('div_catalogo');
    }

 
    var img_idx = 0;


    function atk_chgImg(pos){

        el = document.form_scheda.pathfoto;
        
        idx = img_idx + pos;

        if (idx >= el.length   ) idx = (el.length - 1);
        if (idx < 0 ) idx = 0;

        el_img = document.form_scheda.img_pathfoto;

        el_img.src = el[idx].value;
        img_idx = idx;

        if (img_idx > 0){
            document.form_scheda.b_prev.src = 'img/b_prev.gif';
        }else {
            document.form_scheda.b_prev.src = 'img/null.gif';
        }

        if ((img_idx+1) < el.length){
            document.form_scheda.b_next.src = 'img/b_next.gif';
        }else {
            document.form_scheda.b_next.src = 'img/null.gif';
        }

        el_descr = document.getElementById("img_tot_foto");

        el_descr.innerHTML = (img_idx+1) + '/' + el.length;

    }






    function atk_carr(){
       
        atk_wait();

        el_f = document.getElementById('if_1');
        
        el_f.src = 'catalogo_carrello.jsp';

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;

        atk_cambio('div_carrello');
    }


    function atk_carr_delete(tkposi){
       
        if (confirm('\n\n\tEliminare l\'articolo dal Carrello?\t\t\n\n')){

            atk_wait();

            el_f = document.getElementById('if_1');
            
            el_f.src = 'catalogo_carrello.jsp?tkposi_del='+tkposi+'&azione=delete';
    
            document.body.scrollTop = 0;
            document.body.scrollLeft = 0;
        }

    }
    
   function atk_carr_elimina(tkordi){
       
        if (confirm('\n\n\tEliminare il Carrello?\t\t\n\n')){

            atk_wait();

            el_f = document.getElementById('if_1');
            
            el_f.src = 'catalogo_carrello_lista.jsp?tkordi_del='+tkordi+'&azione=delete';
    
            document.body.scrollTop = 0;
            document.body.scrollLeft = 0;
        }

    }
    
    function atk_carr_delete_arti(tkposi){
        
        if (confirm('\n\n\tEliminare l\'articolo dal Carrello?\t\t\n\n')){

            atk_wait();

            el_f = document.getElementById('if_1');
            
            el_f.src = 'catalogo_carrello.jsp?tkposi_del='+tkposi+'&azione=delete';
    
            document.body.scrollTop = 0;
            document.body.scrollLeft = 0;
        }

    }


    function atk_carr_delete_all(){
       
        if (confirm('\n\n\tSvuotare il Carrello?\t\t\n\n')){

            atk_wait();

            el_f = document.getElementById('if_1');
            
            el_f.src = 'catalogo_carrello.jsp?azione=delete_all';
    
            document.body.scrollTop = 0;
            document.body.scrollLeft = 0;
        }

    }



    function atk_calc_prezzo(){

        atk_wait();
        
        document.form2.azione.value = 'calcolo_prezzo';
        
        return true;

    }



    function atk_reset_il_resto(el){
        
        app_ = el.value;

        if (app_ == ''){
            return;
        }

        el_cdacli = document.getElementById('f_cdacli');
        
        document.getElementById('f_search').value = "";
        document.getElementById('f_barcode').value = "";
        if (el_cdacli) el_cdacli.value = "";

        el.value = app_;

    }



    function atk_conf_ordine(){

        atk_wait();

//        el_f = document.getElementById('if_1');
//        
//        el_f.src = 'catalogo_dest_merce.jsp';
        document.location = 'catalogo_dest_merce.jsp';

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;

//        atk_cambio('div_carrello');

    }


//    function atk_conf_uniloc(azione){
//
//        atk_wait();
//
//        document.body.scrollTop = 0;
//        document.body.scrollLeft = 0;
//
//
//        document.form_ordi.azione.value = azione;
//        document.form_ordi.action = 'catalogo_dest_merce.jsp';
//        document.form_ordi.target = 'if_1';
//        document.form_ordi.submit();
//
//    }


    function atk_login(){


        user_name = document.form_login.user_name;
        pwd  = document.form_login.pwd;

        if (user_name.value == '' ){
            
            alert('Inserire l\'utente');
            user_name.focus();
            return false;
        }


        if (pwd.value == '' ){
            
            pwd.focus();
            return false;
        }

        atk_wait();

        return true;

    }

    function atk_login_reg(tipo_reg){

        atk_wait();

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;


        document.form_login.action = 'epLogin_registrazione_catalogo.jsp';
        document.form_login.tipo_reg.value = tipo_reg;
        document.form_login.submit();

    }

    function atk_regSubmit(){

        atk_wait();

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;
        
        return true;


    }



    function atk_dest_merce(el){

        if(el.checked){

            document.form_ordi.ragcog_de.disabled = false;
            document.form_ordi.indiri_de.disabled = false;
            document.form_ordi.cap_de.disabled = false;
            document.form_ordi.comune_de.disabled = false;
            document.form_ordi.cdprov_de.disabled = false;
            document.form_ordi.cdnazi_de.disabled = false;

            document.form_ordi.ragcog_de.readOnly = false;
            document.form_ordi.indiri_de.readOnly = false;
            document.form_ordi.cap_de.readOnly = false;
            document.form_ordi.comune_de.readOnly = false;
            document.form_ordi.cdprov_de.readOnly = false;
            document.form_ordi.cdnazi_de.readOnly = false;


            document.form_ordi.ragcog_de.className = 'in';
            document.form_ordi.indiri_de.className = 'in';
            document.form_ordi.cap_de.className = 'in in_dta';
            document.form_ordi.comune_de.className = 'in';
            document.form_ordi.cdprov_de.className = 'sl';
            document.form_ordi.cdnazi_de.className = 'sl';

            document.form_ordi.ragcog_de.focus();

        }else {

            document.form_ordi.ragcog_de.disabled = true;
            document.form_ordi.indiri_de.disabled = true;
            document.form_ordi.cap_de.disabled    = true;
            document.form_ordi.comune_de.disabled = true;
            document.form_ordi.cdprov_de.disabled = true;
            document.form_ordi.cdnazi_de.disabled = true;

            document.form_ordi.ragcog_de.readOnly = true;
            document.form_ordi.indiri_de.readOnly = true;
            document.form_ordi.cap_de.readOnly = true;
            document.form_ordi.comune_de.readOnly = true;
            document.form_ordi.cdprov_de.readOnly = true;
            document.form_ordi.cdnazi_de.readOnly = true;

            document.form_ordi.ragcog_de.className = 'in in_ro';
            document.form_ordi.indiri_de.className = 'in in_ro';
            document.form_ordi.cap_de.className = 'in in_dta in_ro';
            document.form_ordi.comune_de.className = 'in in_ro';
            document.form_ordi.cdprov_de.className = 'sl in_ro';
            document.form_ordi.cdnazi_de.className = 'sl in_ro';

        }

        document.form_ordi.ragcog_de.value = '';
        document.form_ordi.indiri_de.value = '';
        document.form_ordi.cap_de.value    = '';
        document.form_ordi.comune_de.value = '';

        document.form_ordi.cdprov_de.selectedIndex = 0;
        document.form_ordi.cdnazi_de.selectedIndex = 0;

    }



    function atk_pagamento(){

        el_ = document.form_ordi.tipo_pagamento;

        var ls_tipo_pagamento = '';

        if (el_[0].checked) ls_tipo_pagamento = el_[0].value;
        if (el_[1].checked) ls_tipo_pagamento = el_[1].value;
            
        if(ls_tipo_pagamento == 'bonifico'){

            atk_wait();
            
            self.location = 'catalogo_ordine_fine.jsp';
            return;
        }
        if(ls_tipo_pagamento == 'banca_sella'){
            
            atk_wait();
            self.location = 'catalogo_pagamento.jsp?azione=banca_sella';
            return;
        }

    }




    function atk_opzioni(){
        atk_wait();
        document.form_opz.azione.value = 'aggiorna';
        document.form_opz.submit();
    }

    function atk_tipolista(el){

        atk_wait();
                                           
        el_f = document.getElementById('if_0');
        
        el_f.src = 'catalogo_lista_categorie.jsp?azione=aggiorna&r_tipolista='+el.value;

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;

    }


    

    function atk_importazione(el){

        atk_wait();

        el_f = document.getElementById('if_0');
        
        el_f.src = 'catalogo_lista_categorie.jsp?azione=aggiorna&f_importazione='+el.value;

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;

    }
    
    
    //Inizio -- avendramin20080229
    function atk_login_on_dest_merce(){
       
        user_name = document.form_ordi.login_user_name;
        pwd  = document.form_ordi.login_pwd;
        
        if (user_name.value == '' ){
            
            alert('Inserire l\'utente');
            user_name.focus();
            return false;
        }


        if (pwd.value == '' ){
            
            pwd.focus();
            return false;
        }
        
        atk_wait();

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;

        document.form_ordi.azione.value = 'login';
        document.form_ordi.action = 'catalogo_dest_merce.jsp';
        document.form_ordi.target = 'if_1';
        document.form_ordi.submit();

    }
    
    function atk_registra_on_dest_merce(){
       
        atk_wait();

        document.body.scrollTop = 0;
        document.body.scrollLeft = 0;


        document.form_ordi.azione.value = 'registra';
        document.form_ordi.action = 'catalogo_dest_merce.jsp';
        document.form_ordi.target = 'if_1';
        document.form_ordi.submit();

    }
    //Inizio -- avendramin20080229


    function atk_nascondi_title(){

        el = document.getElementById('div_title');

        if (el){
           el.style.display = 'none';
        }

    }

    


