﻿// JavaScript Document
var prec="";
var voci = new Array("attivita","web","contatti","freeware","shareware","tips","portfolio");

function menu(voce) {
	
	if(prec!=voce){
	
	M_NLogo('2');
	
	for(i=0;i<voci.length;i++) {
			//chiude tutto		
			$("#" + voci[i]).animate({width:"7.1%"},{queue:false,duration:300});
			$("#" + voci[i]).css('overflow-y','hidden');
			$("#" + voci[i]).css('cursor','pointer');
			
			$("#" + voci[i] + "includes").fadeOut("fast");
					
	}
	
	
	//$("#" + voce).animate({width:"50%"},700);
setTimeout("$('#" + voce + "').animate({width:'50%'},500)",600);
	setTimeout("$('#" + voce + "includes').fadeIn('fast')",900);
	setTimeout("$('#" + voce + "').css('overflow-y','auto')",900);
	setTimeout("$('#" + voce + "').css('overflow-x','hidden')",900);
	setTimeout("$('#" + voce + "').css('cursor','auto')",900);


prec=voce;
	}
	
}


function M_NLogo(azione) {
	if(azione==1) {
	$("#logo").animate({opacity:"0"},{duration:500});
	$("#logo").fadeOut("fast");
	}
	
	if(azione==2) {
	$("#logo").fadeIn("fast");
	$("#logo").animate({opacity:"0.1"},{duration:500});
	}
	
	if(azione==3) {
	//$("#logo").fadeIn("fast");
	//$("#logo").animate({opacity:"0.4"},{duration:500});
	}
	
	if(azione==4) {
		$(".includes").css("display","none");
	}
}


//per il FORM contatti
function contatto_form() {
$("#form_contatto").submit(function() {
			
			$("#vuoto_cont").html("<br /><br /><br /><br /><br /><strong>Invio in corso....</strong>");														            menu('vuoto');
			
				var dataString = $("#form_contatto").serialize();
                 
				$.ajax({
                    type: "POST",
                    url: "contatti_send.aspx",
                    data: dataString,
                    success: function(msg) {
						//menu('vuoto');
                        $("#vuoto_cont").html(msg);

                    },
					error: function() {
						
						$("#vuoto_cont").html("<br /><br /><br /><br /><br /><strong>Si è verificato un errore, RIPROVARE.</strong>");						menu('vuoto');
						setTimeout("menu('contatti')",2500);
						setTimeout("$('#vuoto_cont').html('')",2500);
					}
					
                });
				
                return false;
               

            });

}

setTimeout("contatto_form()",2000);

//per il FORM acquista
function contatto_acquisto() {
$("#form_acquisto_form").submit(function() {
			
			$("#vuoto_cont").html("<br /><br /><br /><br /><br /><strong>Acquisto in corso....</strong>");														            menu('vuoto');
			
				var dataString = $("#form_acquisto_form").serialize();
                 
				$.ajax({
                    type: "POST",
                    url: "prodotti_vendita_send.aspx",
                    data: dataString,
                    success: function(msg) {
						//menu('vuoto');
                        $("#vuoto_cont").html(msg);

                    },
					error: function() {
						
						$("#vuoto_cont").html("<br /><br /><br /><br /><br /><strong>Si è verificato un errore, RIPROVARE.</strong>");						menu('vuoto');
						setTimeout("menu('shareware')",2500);
						setTimeout("$('#vuoto_cont').html('')",2500);
					}
					
                });
				
                return false;
               

            });

}

setTimeout("contatto_acquisto()",2000);


function svuota(iddiv) {
	
	$("#" + iddiv).html("");
	
}


function valor(valore,id) {
if (valore==8 || valore ==9) {
	document.getElementById(id).style.display='inline';
}else{
	document.getElementById(id).style.display='none';
}
}

function coco_qnt(val) {
if(val < 11) {
	alert("Attenzione:\n\nMinimo ordinabile in questa configurazione: 11 foto");
document.getElementById('qnt_pers').value=11;	
}
}