// menu fixed onscroll
$("document").ready(function($){
var nav = $('.menu');    
$(window).scroll(function () {
        if ($(this).scrollTop() > 100) {
            nav.addClass("smaller");
        } else {
            nav.removeClass("smaller");
        }
    });
});
function MM_openBrWindow(theURL,winName,features){  
 	window.open(theURL,winName,features);
}
function scrollto(anc){  
     target = $(anc);  
     $('html, body').animate({  
         scrollTop: target.offset().top  
     }, 1000);  
};
(function(){var special=$.event.special,uid1='D'+(+new Date()),uid2='D'+(+new Date()+1);special.scrollstart={setup:function(){var timer,handler=function(evt){var _self=this,_args=arguments;if(timer){clearTimeout(timer)}else{evt.type='scrollstart';$.event.handle.apply(_self,_args)}timer=setTimeout(function(){timer=null},special.scrollstop.latency)};$(this).bind('scroll',handler).data(uid1, handler)},teardown:function(){$(this).unbind('scroll',$(this).data(uid1))}};special.scrollstop={latency:300,setup:function(){var timer,handler=function(evt){var _self=this,_args=arguments;if(timer){clearTimeout(timer)}timer=setTimeout(function(){timer=null;evt.type='scrollstop';$.event.handle.apply(_self, _args)},special.scrollstop.latency)};$(this).bind('scroll',handler).data(uid2,handler)},teardown:function(){$(this).unbind('scroll',jQuery(this).data(uid2))}}})()
$(function(){
   $('div.top>a').click(function(e){$('html,body').animate({scrollTop:'0px'},800);return false})
   $(window).scroll(function(){if($(this).scrollTop()>100){$('div.top').fadeIn()}else{$('div.top').fadeOut()}})
   init_events();
});
function init_events(){
	$('a.scrolltop').click(function(e){$('html,body').animate({scrollTop:'0px'},800);return false});
}
function AlertConfirm(url,msg) {
	doConfirm = confirm(msg);
	if (doConfirm == true) { 
		window.location = url;  
	} else {
		return;
	}
}



function add_whishlist(id){
	$.post("include/process.php", {action:'add_whishlist', id:id }, 
	function(data){ 
		$.growl.notice({ title: "Lista dei desideri", message: "Prodotto inserito con successo!" });
		$("#whishlist-"+id).html(data); 
		update_whishlist();
	});
}
function remove_whishlist(id){
	$.post("include/process.php", {action:'remove_whishlist', id:id }, 
	function(data){ 
		$.growl.notice({ title: "Lista dei desideri", message: "Prodotto rimosso con successo!" });
		$("#whishlist-"+id).html(data); 
		update_whishlist();
	});
}
function update_whishlist(){
	$.post("include/process.php", {action:'total_whishlist' }, 
	function(data){ 
		$("#total_whishlist").html(data); 
	});
}