window.ELI=window.ELI||{}

ELI.selectedMenu=null;
ELI.menuWidth=0;
jQuery.noConflict();
jQuery(document).ready(function(){
    if(jQuery('#contactform').length>0){
    controlloTrattamento();
    }
    jQuery('a[rel="lightbox[roadtrip]"]').attr('rel','lightbox');
    if(jQuery.fancybox){
        jQuery("a[rel='lightbox']").fancybox();
    }
    jQuery('#fissi a').first().css('border','none');
    //correzione menu
    jQuery('.btnMenu').each(function(){
        ELI.menuWidth+=jQuery(this).outerWidth(true);
    });
    jQuery('.btnMenu').each(function(index){
        padding=Math.floor(((jQuery('#menu').width()-ELI.menuWidth)/jQuery('.btnMenu').length)/2);

        jQuery(this).css({
            'paddingRight':padding,
            'paddingLeft':padding
        });
        if(index==jQuery('.btnMenu').length-1){
            jQuery(this).css("border",'none');
        }
    });
    if(jQuery('#cycle').length>0){
        jQuery('#cycle').cycle({
            nowrap:        1
        });
    }
    jQuery('#menu>ul>li').last().css('border','none');
    if(jQuery('.cycleImmagini').length>0){
     jQuery('.cycleImmagini').cycle();
    }
    
    //gestione menu
    ELI.larghezzaCompleta=jQuery('#menu').width();
    ELI.numeroBottoni=jQuery('#menu>ul>li').length;
    ELI.larghezaBottoniTotale=0;
    jQuery('#menu>ul>li').each(function(){
        ELI.larghezaBottoniTotale+=jQuery(this).outerWidth(true);
    })
    ELI.paddingBottoni=Math.floor((ELI.larghezzaCompleta-(ELI.larghezaBottoniTotale))/(ELI.numeroBottoni)/2);
    jQuery('#menu>ul>li').each(function(index){

        jQuery(this).css({
            'paddingLeft':ELI.paddingBottoni+'px',
            'paddingRight':ELI.paddingBottoni+'px'
        });
        
    });
    jQuery('#menu>ul>li>ul').each(function(index){

        jQuery(this).css({
            'marginLeft':'-'+ELI.paddingBottoni+'px',
            'paddingLeft':ELI.paddingBottoni+'px'
        });
        
    });
    //fine gestione menu
    
    if (jQuery('#box_ricerca').length>0){
        jQuery('.ref_elicent_info a').click(function (e) {
            e.preventDefault();
            ele=jQuery(this).parent().nextAll(".catimp").first();
            jQuery(".catimp").slideUp('slow');
            if (jQuery(ele).is(":hidden")) {
                jQuery(ele).slideDown("slow");
            } else {
                jQuery(ele).slideUp("slow");
            }
        });
    }

    /*slider prodotti pagine interne*/
    if(jQuery('#prodottiInHome').length>0){
        jQuery("#prodottiInHome").easySlider({
            prevId:'sliderLeftButton',
            nextId:'sliderRightButton',
            controlCreate:false
        });
        jQuery("#prodottiInHome").css("height",'157px');
    }
		
    jQuery('#nxtBtn').click(function(){
        //jQuery('#nxtBtn').hide();
        //jQuery('#nxtBtn').css('display','none');
        alert('ciao');
    });
    //correzione finiture
    if(jQuery('.finiture img').length<1){
        jQuery('.finiture').hide();
    }
    //correzione finiture
    if(jQuery('.allegati a').length<1){
        jQuery('.allegati').hide();
    }
    //correzione altre img
    if(jQuery('.altreImg a').length<1){
        jQuery('.altreImg').hide();
    }

   
});

function controlloTrattamento(){
        jQuery("#contactform").bind("submit",function(e){
            if(controllaCampi() == true){
                return true;
            }
            else{
                return false;
            }
        });
         }
        function controllaCampi(){
            var trattamentocont =document.getElementsByName("trattamento1").checked == "cheked";
            if (!trattamentocont) {
                alert("Attenzione!\nDevi acconsentire al trattamento.");
                return false;    
            }
                return true;
 
        }
jQuery(window).load(function(){
    
    //correzione altezze content
    totHeight=jQuery("#box-footer").height()+jQuery("#box-header").height()+jQuery("#divisoria").height()+jQuery('#bottomMiddlePage').height();

});

   



