$(document).ready(function() {

// ABILITA IL PLUG-IN DEL MENU
$(".menu_ul li a").my_menu();

// AGGIUNGE TASTO PLAY E CORNICE SU THUMB NEWS
if($('.thumb-primo-piano').length) {
		$('.thumb-primo-piano').each(function(i){		
			
			$(this).css('position','relative');
				//$(this).children('img').load(function(){
				/*
                $(this).children('img').each(function(){
				    var img = $(this);
                        var _getimgWidth = $(img).attr("width");
    					var _getimgHeight = $(img).attr("height");                        
    					var _imgHeight = _getimgHeight+"px";
    					var _imgWidth = _getimgWidth+"px";
    					var _spanHeight = _getimgHeight-4+"px";
    					var _spanWidth = _getimgWidth-4+"px";
    					$(img).parent().css({'width':_imgWidth,'height':_imgHeight});
    					$(img).parent().append('<span></span>');
    					$(img).parent().find('span').css({'width':_spanWidth,'height':_spanHeight});							                           
				});
                */				
		});
}


// ARTICOLO COMMENT LIST
if($('#comments-list').length) {
	$('#comments-list').hide();
	$('#toggle-comments-list').click(function(){											  
		$('#comments-list').show();
	//return false
	});
}

// ARTICOLO COMMENT FORM
if($('#comments-form').length) {
	$('#comments-form').hide();
	$('#toggle-comments-form').click(function(){
		$('#comments-form').show();
	//return false
	});
}

if($('#font-scaler').length) {
	$('#font-scaler').append('<a href="#" class="small" title="dimensione font standard">small</a> <a href="#" class="medium" title="dimensione font media">medium</a> <a href="#" class="large" title="dimensione font massima">big</a>');
	$(function() {
		cookieResize('#font-scaler a', 'small');
	});
}

$(".open_popup").click(function(){
    openModal("/getVetrina.php",$(this).attr("rel"),1,"B");
})

$(".open_vetrina").click(function(){
    openModal("/getVetrina.php",$(this).attr("rel"),1,"V");
})
		
});


function validateComment(){
    var error = 0;
    if (!$("#nome").val()){
       $("#nome").parent().find("label").css("color","#FF0000");
       error++; 
    }else{        
        $("#nome").parent().find("label").css("color","#333333");
    }
    if (!$("#email").val()){
       $("#email").parent().find("label").css("color","#FF0000");
       error++; 
    }else{        
        $("#email").parent().find("label").css("color","#333333");
    }
    if (!$("#messaggio").val()){
       $("#messaggio").parent().find("label").css("color","#FF0000");
       error++; 
    }else{        
        $("#messaggio").parent().find("label").css("color","#333333");
    } 
    
    if (error) return false;
    
    return true;  
}

function initNavApprofondimenti(){
	$('.pic-wrapper').find('.nav-link').each(function(i){;
		$(this).hover(function(){
			$(this).stop().animate({ opacity: 1 });
		}, function(){
			//$(this).stop().animate({ opacity: thisOpacity });
			$(this).stop().animate({ opacity: 0.6 });
		});
	});	    
}

