$(document).ready(function(){								 
	var colore_bordo = "1px solid #ff0000";

	$("#keyword").focusin(function(){
		if($(this).val() == 'Cerca articolo...')
			$(this).val('');
	});
	
	$("#keyword").focusout(function(){
		if($(this).val() == '')
			$(this).val('Cerca articolo...');
	});

	$("#contAreaAttiva").mouseover(function(){
		$("#AreaAttiva").animate({marginBottom:'150px'},600);
	});
	
	$("#AreaAttiva").mouseout(function(){
		$("#AreaAttiva").delay(7000).animate({marginBottom:'-150px'},1200);
	});
	
	$("#contAreaAttiva img").animate({opacity: 0.40});
	
	$("#contAreaAttiva img").mouseover(function(){
		$(this).animate({opacity:1});
	});
	$("#contAreaAttiva img").mouseleave(function(){
		$(this).animate({opacity:0.40});
	});


	$("a[rel=foto_art]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		//'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">Immagine ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
		}
	});
	

	//invio richiesta info
	/*
	$("#invio_rich_info").click(function(){
		var nome = $("#nomeRich").val();
		var email = $("#emailRich").val();
	  var mail_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
		var messaggio = $("#messaggioRich").val();
		
		if(nome == "" || nome == "undefined"){
			$(".nomeRichConv").show();
			$("#nomeRich").focus();
			return false;
		}
		else if(!mail_reg_exp.test(email) || email == "" || email == "undefined"){
			$(".emailRichConv").show();
			$("#emailRich").focus();
			return false;
		}
		else if(messaggio == "" || messaggio == "undefined"){
			$(".messaggioRichConv").show();
			$("#messaggioRich").focus();
			return false;
		}
		else if($("#privacyRich").attr("checked") == false){
			$(".privacyRichConv").show();
			$("#privacyRich").focus();
			return false;
		}
		else{
			$(".loaderRichInfo").show();
			$.ajax({
				type	: "get",
				cache	: false,
				url		: "includes/action/action_get.php",
				data	: 'azione=rich_info&nome='+nome+'&email='+email+'&messaggio='+messaggio,
				success: function(data) {
					$.fancybox(data);
					$(".loaderRichInfo").hide();
		      $("#nomeRich").val('');
		      $("#emailRich").val('');
					$("#messaggioRich").val('');
					$("#privacyRich").attr("checked",false)
					$("#contRichInfo ul img, #contRichInfo p img").hide();
				}
			});
		}
	});
	*/
	
	//visualizzo dati per azienda
	$("#tipo_reg").change(function(){
		if($(this).val() == "azienda")
			$(".az").show();
		else
			$(".az").hide();
	});
	

	$("#reg_ute input").keypress(function(){
		$("#reg_ute img").hide();
	});

	//invio modulo registrazione utente
	$('#reg_ute').submit(function() {
		var colore_bordo = "1px solid #ff0000";

		var cfReg          = $("#cfReg").val();
		var tipo_reg       = $("#tipo_reg").val();
		var rag_socialeReg = $("#rag_socialeReg").val();
		var pivaReg        = $("#pivaReg").val();
		var nomeReg        = $("#nomeReg").val();
		var cognomeReg     = $("#cognomeReg").val();
		var indirizzoReg   = $("#indirizzoReg").val();
		var comuneReg      = $("#comuneReg").val();
		var provinciaReg   = $("#provinciaReg").val();
		var capReg         = $("#capReg").val();
		var nazioneReg     = $("#nazioneReg").val();
		var telefonoReg    = $("#telefonoReg").val();
		var cellulareReg   = $("#cellulareReg").val();
		var emailReg       = $("#emailReg").val();
		var passwordReg    = $("#passwordReg").val();
	  var mail_reg_exp   = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

		if(tipo_reg == "azienda" && rag_socialeReg == ""){
			$(".rag_socialeRegConv").show();
			$("#rag_socialeReg").css({"border":colore_bordo});
			$("#rag_socialeReg").focus();
			return false;
		}
		else if(tipo_reg == "azienda" && pivaReg == ""){
			$(".pivaRegConv").show();
			$("#pivaReg").css({"border":colore_bordo});
			$("#pivaReg").focus();
			return false;
		}
		else if(nomeReg == "" || nomeReg == "undefined"){
			$(".nomeRegConv").show();
			$("#nomeReg").css({"border":colore_bordo});
			$("#nomeReg").focus();
			return false;
		}
		else if(cognomeReg == "" || cognomeReg == "undefined"){
			$(".cognomeRegConv").show();
			$("#cognomeReg").css({"border":colore_bordo});
			$("#cognomeReg").focus();
			return false;
		}
		else if(indirizzoReg == "" || indirizzoReg == "undefined"){
			$(".indirizzoRegConv").show();
			$("#indirizzoReg").css({"border":colore_bordo});
			$("#indirizzoReg").focus();
			return false;
		}
		else if(comuneReg == "" || comuneReg == "undefined"){
			$(".comuneRegConv").show();
			$("#comuneReg").css({"border":colore_bordo});
			$("#comuneReg").focus();
			return false;
		}
		else if(provinciaReg == "" || provinciaReg == "undefined"){
			$(".provinciaRegConv").show();
			$("#provinciaReg").css({"border":colore_bordo});
			$("#provinciaReg").focus();
			return false;
		}
		else if(capReg == "" || capReg == "undefined"){
			$(".capRegConv").show();
			$("#capReg").css({"border":colore_bordo});
			$("#capReg").focus();
			return false;
		}
		else if(nazioneReg == "" || nazioneReg == "undefined"){
			$(".nazioneRegConv").show();
			$("#nazioneReg").css({"border":colore_bordo});
			$("#nazioneReg").focus();
			return false;
		}
		else if(telefonoReg == "" || telefonoReg == "undefined"){
			$(".telefonoRegConv").show();
			$("#telefonoReg").css({"border":colore_bordo});
			$("#telefonoReg").focus();
			return false;
		}
		else if(cellulareReg == "" || cellulareReg == "undefined" || isNaN(cellulareReg)){
			$(".cellulareRegConv").show();
			$("#cellulareReg").css({"border":colore_bordo});
			$("#cellulareReg").focus();
			return false;
		}
		else if(!mail_reg_exp.test(emailReg) || emailReg == "" || emailReg == "undefined"){
			$(".emailRegConv").show();
			$("#emailReg").css({"border":colore_bordo});
			$("#emailReg").focus();
			return false;
		}
		else if((passwordReg == "" || passwordReg == "undefined") && $("#tipo_azione").val() == "inserisci"){
			$(".passwordRegConv").show();
			$("#passwordReg").css({"border":colore_bordo});
			$("#passwordReg").focus();
			return false;
		}
		else if($("#privacyReg").attr("checked") == false){
			$(".privacyRegConv").show();
			$("#privacyReg").css({"border":colore_bordo});
			$("#privacyReg").focus();
			return false;
		}
		else{
			$(".loaderRegUte").fadeIn();

			var par = $("#reg_ute").serialize();

			$.ajax({
				type    : "get",
				dataType: "html",
				url     : "includes/action/action_get.php?azione=utente&"+par,
				success : function(sText,sStatus){
					var res = sText.split("###");

					if(res[0] == "001" || res[0] == "002"){
						$.fancybox(res[1]);
						$(".loaderRegUte").fadeOut();
					}
					else if(res[0] == "003"){
						//$.fancybox(res[1]);
						$(".loaderRegUte").fadeOut();
						$("#reg_ute input[type='text'], #reg_ute input[type='password']").val('');
						location.href = 'convalida-registrazione.html';
					}
					else if(res[0] == "004"){
						$.fancybox(res[1]);
						$(".loaderRegUte").fadeOut();
					}
					else{
						$.fancybox(sText);
						$(".loaderRegUte").fadeOut();						
					}
				},
				error   : function(sText,sStatus){
					alert(sText);
					$(".loaderRegUte").fadeOut();
				}
			});

			return false;
		}
	});

	//invio modulo registrazione utente
	$('#invia_diventa_riv').click(function() {
		var colore_bordo = "1px solid #ff0000";

		var rag_socialeReg = $("#rag_socialeReg").val();
		var nomeReg        = $("#nomeReg").val();
		var cognomeReg     = $("#cognomeReg").val();
		var comuneReg      = $("#comuneReg").val();
		var telefonoReg    = $("#telefonoReg").val();
		var emailReg       = $("#emailReg").val();
	  var mail_reg_exp   = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
		var messaggio_riv  = $("#messaggio_riv").val();

		if(rag_socialeReg == ""){
			$(".rag_socialeRegConv").show();
			$("#rag_socialeReg").css({"border":colore_bordo});
			$("#rag_socialeReg").focus();
			return false;
		}
		else if(nomeReg == "" || nomeReg == "undefined"){
			$(".nomeRegConv").show();
			$("#nomeReg").css({"border":colore_bordo});
			$("#nomeReg").focus();
			return false;
		}
		else if(cognomeReg == "" || cognomeReg == "undefined"){
			$(".cognomeRegConv").show();
			$("#cognomeReg").css({"border":colore_bordo});
			$("#cognomeReg").focus();
			return false;
		}
		else if(comuneReg == "" || comuneReg == "undefined"){
			$(".comuneRegConv").show();
			$("#comuneReg").css({"border":colore_bordo});
			$("#comuneReg").focus();
			return false;
		}
		else if(telefonoReg == "" || telefonoReg == "undefined"){
			$(".telefonoRegConv").show();
			$("#telefonoReg").css({"border":colore_bordo});
			$("#telefonoReg").focus();
			return false;
		}
		else if(!mail_reg_exp.test(emailReg) || emailReg == "" || emailReg == "undefined"){
			$(".emailRegConv").show();
			$("#emailReg").css({"border":colore_bordo});
			$("#emailReg").focus();
			return false;
		}
		else if(messaggio_riv == "" || messaggio_riv == "undefined"){
			$(".messaggio_rivConv").show();
			$("#messaggio_riv").css({"border":colore_bordo});
			$("#messaggio_riv").focus();
			return false;
		}
		else if($("#privacyReg").attr("checked") == false){
			$(".privacyRegConv").show();
			$("#privacyReg").css({"border":colore_bordo});
			$("#privacyReg").focus();
			return false;
		}
		else{
			$(".loaderRegUte").fadeIn();

			var par = $("#formDiventaRiv").serialize();

			$.ajax({
				type    : "get",
				dataType: "html",
				url     : "includes/action/action_get.php?azione=diventa_riv&"+par,
				success : function(sText,sStatus){
					$(".loaderRegUte").hide();

					if(sText == "ok"){
						$.fancybox('<div style="width:360px; height:70px;"><img src="immagini/ico/ok.png" style="float:left; margin:0px 10px 0px 0px;" /> <h3>Richiesta inviata<br />Ti contatteremo il prima possibile</h3></div>');

						//$("#formDiventaRiv input, #formDiventaRiv textarea").val('');
					}
					else{
						$.fancybox('<div style="width:400px; height:70px;"><img src="immagini/ico/alert.png" style="float:left; margin:0px 10px 0px 0px;" /> <h3>C\'&egrave; stato un problema durante la registrazione, riprova oppure contattaci.</h3></div>');
					}
				},
				error   : function(sText,sStatus){
					alert(sText);
					$(".loaderRegUte").fadeOut();
				}
			});

			return false;
		}
	});

	$("#riventa_div").click(function(){
		$("#cont_diventa_riv").fadeIn().delay(1000).css({height:'380px'});
	});
	
	$("#formDiventaRiv input").keyup(function(){
		$("#formDiventaRiv img").hide();
	});

	//convalida registrazione
	$("#convalida_reg").click(function(){
		var code = $("#cod_verifica").val();
		var errato = '<div style="width:320px; height:70px;">'+
		             '<img src="immagini/ico/alert.png" style="float:left; margin:0px 10px 0px 0px;" /> '+
								 '<h3>Il codice di verifica &egrave; errato, riprova e assicurati che sia un valore numerico.</h3>'+
								 '</div>';

		if(code == "" || isNaN(code)){
			$.fancybox(errato);
			$("#cod_verifica").focus();
			return false;
		}
		else{
			$("#loader_top").slideDown();
			
			$.ajax({
				type    : 'get',
				data    : 'azione=convalida_reg&codice='+code,
				url     : 'includes/action/action_get.php',
				success : function(sText,sStatus){
					$("#loader_top").slideUp();
					if(sText == "ok"){
						$.fancybox('<div style="width:380px; height:150px;"><img src="immagini/ico/ok.png" style="float:left; margin:0px 10px 0px 0px;" /> <h3>Il tuo account &egrave; stato attivato.</h3><br /><a href="./">clicca qui per tornare alla home page</a><br />oppure<br /><a href="carrello.html">clicca qui per andare al carrello</div>');
					}
					else if(sText == "ko"){
						$.fancybox('<div style="width:440px; height:70px;"><img src="immagini/ico/alert.png" style="float:left; margin:0px 10px 0px 0px;" /> <h3>Il codice di verifica &egrave; errato oppure lo hai gi&agrave; utilizzato. Se ritieni che il codice sia corretto contattaci all\'indirizzo info@friulpellet.com.</h3></div>');
					}
					else
						$.fancybox(sText);
				},
				error   : function(sText,sStatus){
					$("#loader_top").slideUp();
					$.fancybox(sText);
				}
			});
		}
	});

	//login utente
	$("#login").click(function(){
		if($("#userLogin").val() == "" || $("#userLogin").val() == "undefined"){
			$(".userLoginConv").show();
			$("#userLogin").css({"border":colore_bordo});
			$("#userLogin").focus();
			return false;
		}
		else if($("#passLogin").val() == "" || $("#passLogin").val() == "undefined"){
			$(".passLoginConv").show();
			$("#passLogin").css({"border":colore_bordo});
			$("#passLogin").focus();
			return false;
		}
		else{
			$(".loaderLogin").fadeIn();
	
			$.ajax({
				type    : "get",
				url     : "includes/action/action_get.php?azione=login&username="+$("#userLogin").val()+"&password="+$("#passLogin").val(),
				success : function(sText,sStatus){
					var res = sText.split("###");

					if(res[0] == "002"){
						$.fancybox(res[1]);
						$(".loaderLogin").fadeOut();
					}
					else{
						//$.fancybox(res[1]);
						$(".loaderLogin").fadeOut();
						location.href = 'carrello.html';
					}
				},
				error   : function(sText,sStatus){
					alert(sText);
				}
			});
		}
	});
	

	//invio il modulo dalla pagina spedizioni e pagamenti
	$("#continua_sped").click(function(){
		if(isNaN($("#formSpedizione input[name='spedizione']:checked").val())){
			$("#formSpedizione table").css({"border":"solid 1px #ff0000"});
			return false;
		}
		else if($("#cambio_sped").is(":visible") && $("#nomeSpe").val() == ''){
			$(".nomeSpeConv").show();
			$("#nomeSpe").css({"border":colore_bordo});
			$("#nomeSpe").focus();
			return false;
		}
		else if($("#cambio_sped").is(":visible") && $("#cognomeSpe").val() == ''){
			$(".cognomeSpeConv").show();
			$("#cognomeSpe").css({"border":colore_bordo});
			$("#cognomeSpe").focus();
			return false;
		}
		else if($("#cfSpe").val() == "" && $("#cambio_sped").is(":visible")){
			$(".cfSpeConv").show();
			$("#cfSpe").css({"border":colore_bordo});
			$("#cfSpe").focus();
			return false;
		}
		else if($("#indirizzoSpe").val() == "" && $("#cambio_sped").is(":visible")){
			$(".indirizzoSpeConv").show();
			$("#indirizzoSpe").css({"border":colore_bordo});
			$("#indirizzoSpe").focus();
			return false;
		}
		else if($("#comuneReg").val() == "" && $("#cambio_sped").is(":visible")){
			$(".comuneSpeConv").show();
			$("#comuneSpe").css({"border":colore_bordo});
			$("#comuneSpe").focus();
			return false;
		}
		else if($("#provinciaSpe").val() == "" && $("#cambio_sped").is(":visible")){
			$(".provinciaSpeConv").show();
			$("#provinciaSpe").css({"border":colore_bordo});
			$("#provinciaSpe").focus();
			return false;
		}
		else if($("#capSpe").val() == "" && $("#cambio_sped").is(":visible")){
			$(".capSpeConv").show();
			$("#capSpe").css({"border":colore_bordo});
			$("#capSpe").focus();
			return false;
		}
		else if($("#nazioneSpe").val() == "" && $("#cambio_sped").is(":visible")){
			$(".nazioneSpeConv").show();
			$("#nazioneSpe").css({"border":colore_bordo});
			$("#nazioneSpe").focus();
			return false;
		}
		else{
			$("#formSpedizione").submit();
		}
	});


	//invio il modulo dalla pagina spedizioni e pagamenti
	$("#continua_pagam").click(function(){														 
		if(isNaN($("#formPagamento input[name='pagamento']:checked").val())){
			$("#formPagamento table").css({"border":"solid 1px #ff0000"});
			return false;
		}
		else{
			$("#formPagamento").submit();
		}
	});

	//invio ordine
	$("#concludi_ord").click(function(){
		//var par = $("#formOrdine").serialize();
		$("#note").val($("#note_copia").val());
		$("#formOrdine").submit();
		return;
	});

	//apro slide spedizione modificate
	$("#cambia_sped").click(function(){
		if($("#cambio_sped").is(":visible"))
			$("#cambio_sped").slideUp(1200);
		else
			$("#cambio_sped").slideDown(1200);
	});
	
	
	//iscri newsletter
	$("#invia_nl").click(function(){
		var email = $("#email_nl").val();
		var mail_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
		
		if(!mail_reg_exp.test(email) || email == "" || email == "undefined"){
			$(".email_nlConv").show();
			$("#email_nl").css({"border":colore_bordo});
			$("#email_nl").focus();
			return false;
		}
		else if($("#privacy_nl").attr("checked") == false){
			$(".privacy_nlConv").show();
			$("#privacy_nl").css({"border":colore_bordo});
			$("#privacy_nl").focus();
			return false;
		}
		else{
			$(".loader_nl").show();

			$.ajax({
				type    : 'get',
				data    : 'azione=iscri_nl&email='+email,
				url     : 'includes/action/action_get.php',
				success : function(sText,sStatus){
					var res = sText.split("###");
					
					if(res[0] == "002"){
						$.fancybox(res[1]);
						$(".loader_nl").fadeOut();
					}
					else{
						$.fancybox(res[1]);
						$(".loader_nl").fadeOut();
						$(".loader_nl").fadeOut();
						$("#email_nl").val('');
						$("#privacy_nl").attr("checked",false)
					}
				},
				error   : function(sText,sStatus){
					$.fancybox(sText);
				}
			});
		}
	});

	//CANCELLAZIONE newsletter
	$("#invia_nl_canc").click(function(){
		var email = $("#email_nl_canc").val();
		var mail_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
		
		if(!mail_reg_exp.test(email) || email == "" || email == "undefined"){
			$(".email_nl_cancConv").show();
			$("#email_nl_canc").css({"border":colore_bordo});
			$("#email_nl_canc").focus();
			return false;
		}
		else{
			$(".loader_nl_canc").show();

			$.ajax({
				type    : 'get',
				data    : 'azione=canc_nl&email='+email,
				url     : 'includes/action/action_get.php',
				success : function(sText,sStatus){
					var res = sText.split("###");
					
					if(res[0] == "002"){
						$.fancybox(res[1]);
						$(".loader_nl_canc").fadeOut();
					}
					else{
						$.fancybox(res[1]);
						$(".loader_nl_canc").fadeOut();
						$("#email_nl_canc").val('');
					}
				},
				error   : function(sText,sStatus){
					$.fancybox(sText);
				}
			});
		}
	});

	//ricorda password
	$("#ricorda_pass").click(function(){
		var cont_box = '<div id="ricorda_pass_box">'+
									 '<h1>Inserisci il tuo indirizzo email</h1>'+
									 'E-mail:<br />'+
									 '<input type="text" name="email_ric_pass" id="email_ric_pass" size="30" /> '+
									 '<a href="javascript:goRicordaPass();" class="bottone_small" id="">Vai</a> '+
									 '<img src="immagini/loader.gif" id="loader_ric_pass" alt="" style="display:none" />'+
									 '</div>';
		$.fancybox(cont_box);
	});

	//apro iframe condizioni privacy
	$("#normativa_priv").fancybox({
		'width'				 : '90%',
		'height'			 : '90%',
    'autoScale'    : false,
    'transitionIn' : 'none',
		'transitionOut': 'none',
		'type'				 : 'iframe'
	});

	$("#prev_sped").click(function(){
		$("#box_richiesta_sped").css({"display":"block","height":"200px"});
		$("#punto_v").val('0');
		$("#cont_punto_v").fadeOut();
	});
	
	//visualizzazione legge privacy
	$("#legge_priv").click(function(){
		$.ajax({
			type    : 'get',
			data    : 'azione=privacy',
			url     : 'includes/action/action_get.php',
			success : function(sText,sStatus){
				$.fancybox('<div style="width:700px; height:400px; text-align:left">'+sText+'</div>');
			},
			error   : function(sText,sStatus){
				$.fancybox(sText);
			}
		});
	});
});


//funzione per ricorda password
function goRicordaPass(){
	var colore_bordo = "2px solid #ff0000";
	var email = $("#email_ric_pass").val();
	
	if(email == ""){
		$("#email_ric_pass").css({"border":colore_bordo});
		$("#email_ric_pass").focus();
	}
	else{
		$("#loader_ric_pass").show();

		$.ajax({
			type    : 'get',
			data    : 'email='+$("#email_ric_pass").val()+'&azione=ricorda_pass',
			url     : 'includes/action/action_get.php',
			success : function(sText,sStatus){
				var res = sText.split("###");
					
				if(res[0] == "002"){
					$.fancybox(res[1]);
					$("#loader_ric_pass").fadeOut();
				}
				else{
					$.fancybox(res[1]);
					$("#loader_ric_pass").fadeOut();
					$("#email_nl_canc").val('');
				}
				
			},
			error   : function(sText,sStatus){
				$.fancybox(sText);
			}
		});
	}
}


function slideSwitch(){
	var $active = $('#slideshow div.active');

  if($active.length == 0 ) 
		$active = $('#slideshow div:last');

  	// use this to pull the divs in the order they appear in the markup
  var $next =  $active.next().length ? $active.next() : $('#slideshow div:first');

  $active.addClass('last-active');

	$next.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0}, 2000, function() {
  	$active.removeClass('active last-active');
	});
}

$(function(){
	setInterval("slideSwitch()",5000 );
});


//funzioni per aumentare/diminuire quantità carrello
function qta_cart(id,tipo){
	$("#loader_top").slideDown();
	
	$.ajax({
		type    : "get",
		url     : "includes/action/action_get.php?azione=qta_cart&tipo="+tipo+"&id="+id,
		success : function(sText,sStatus){
			$(".generalTable").html(sText);
			$("#loader_top").slideUp();
		},
		error   : function(sText,sStatus){
			$("#loader_top").slideUp();
			alert(sText);
		}
	});
}

/*****news ticker*****/
(function(a){a.fn.vTicker=function(b){var c={speed:700,pause:4000,showItems:3,animation:"",mousePause:true,isPaused:false,direction:"up",height:0};var b=a.extend(c,b);moveUp=function(g,d,e){if(e.isPaused){return}var f=g.children("ul");var h=f.children("li:first").clone(true);if(e.height>0){d=f.children("li:first").height()}f.animate({top:"-="+d+"px"},e.speed,function(){a(this).children("li:first").remove();a(this).css("top","0px")});if(e.animation=="fade"){f.children("li:first").fadeOut(e.speed);if(e.height==0){f.children("li:eq("+e.showItems+")").hide().fadeIn(e.speed)}}h.appendTo(f)};moveDown=function(g,d,e){if(e.isPaused){return}var f=g.children("ul");var h=f.children("li:last").clone(true);if(e.height>0){d=f.children("li:first").height()}f.css("top","-"+d+"px").prepend(h);f.animate({top:0},e.speed,function(){a(this).children("li:last").remove()});if(e.animation=="fade"){if(e.height==0){f.children("li:eq("+e.showItems+")").fadeOut(e.speed)}f.children("li:first").hide().fadeIn(e.speed)}};return this.each(function(){var f=a(this);var e=0;f.css({overflow:"hidden",position:"relative"}).children("ul").css({position:"absolute",margin:0,padding:0}).children("li").css({margin:0,padding:0});if(b.height==0){f.children("ul").children("li").each(function(){if(a(this).height()>e){e=a(this).height()}});f.children("ul").children("li").each(function(){a(this).height(e)});f.height(e*b.showItems)}else{f.height(b.height)}var d=setInterval(function(){if(b.direction=="up"){moveUp(f,e,b)}else{moveDown(f,e,b)}},b.pause);if(b.mousePause){f.bind("mouseenter",function(){b.isPaused=true}).bind("mouseleave",function(){b.isPaused=false})}})}})(jQuery);

//aggiungi ai wishlist
function add_wish(idarticolo,idcliente){
	if(idcliente == 0){
		$.fancybox('Solo per utenti registrati.');
		return false;
	}
	else{
		$.ajax({
			type    : "get",
			url     : "includes/action/action_get.php?azione=add_wish&idarticolo="+idarticolo,
			success : function(sText,sStatus){
				var res = sText.split("###");

				$.fancybox(res[1]);
			},
			error   : function(sText,sStatus){
				$.fancybox(sText);
			}
		});
	}
}
