$(document).ready( function(){
if( $.browser.msie && $.browser.version > 8 ){
$('head').append("");
}
// validate signup form on keyup and submit
if( document.getElementById("contact") ){
$("#contact").validate({
rules: {
nome: "required",
telefono: "required",
email: {
required: true,
email: true
},
testo: "required",
privacy: "required"
},
messages: {
nome: "Inserisci il tuo nome e cognome",
telefono: "Inserisci il tuo numero di telefono",
email: "Inserisci il tuo indirizzo email",
testo: "Inserisci il testo del messaggio",
privacy: "Devi accettare il trattamento dei dati personali"
}
});
}
$('.fancybox').fancybox();
//order form
if( document.getElementById("form_order") ){
$("#form_order").validate({
rules: {
nome: "required",
cognome: "required",
indirizzo: "required",
citta: "required",
provincia: "required",
cap: "required",
nazione: "required",
telefono: "required",
email: {
required: true,
email: true
}
},
messages: {
nome: "Inserisci il tuo nome",
cognome: "Inserisci il tuo cognome",
indirizzo: "Inserisci il tuo indirizzo",
citta: "Inserisci la tua citta'",
provincia: "Inserisci la tua provincia",
cap: "Inserisci il tuo cap",
nazione: "Inserisci la tua nazione",
telefono: "Inserisci il tuo numero di telefono",
email: "Inserisci il tuo indirizzo email"
}
});
}
$('#slideshow').nivoSlider({
effect:'fold,sliceUpDownLeft', //Specify sets like: 'fold,fade,sliceDown'
slices:15,
animSpeed:500, //Slide transition speed
pauseTime:6000,
startSlide:0, //Set starting Slide (0 index)
directionNav:false, //Next & Prev
directionNavHide:false, //Only show on hover
controlNav:true, //1,2,3...
controlNavThumbs:false, //Use thumbnails for Control Nav
controlNavThumbsFromRel:false, //Use image rel for thumbs
keyboardNav:true, //Use left & right arrows
pauseOnHover:true, //Stop animation while hovering
manualAdvance:false, //Force manual transitions
captionOpacity:0.8 //Universal caption opacity
});
$('.theme-dark .nivo-controlNav a').text('');
//Toggle sulla popup utente al click sul +
$('#ordine>div.clickable').click( function(){
if( parseInt($('#ordine').css('top'))=='0' ){
$('#ordine').stop().animate({ 'top': -280 });
$(this).text('Mostra profilo utente');
}
else{
$('#ordine').stop().animate({ 'top': 0 });
$(this).text('Nascondi profilo utente');
}
});
//Al click sul + apro la popup utente
$('.add').click( function(){
if( parseInt($('#ordine').css('bottom'))=='-280' ){
$('#ordine').stop().animate({ 'bottom': 0 });
$('#ordine>div.clickable').text('Mostra profilo utente');
}
});
});
function getCurrentPage( url ){
page = url;
re = /(.+)\/(.+)$/g;
complete_url = page.replace(re,"$2");
//tolgo il parametro lang
re = /(.+)&lang=[a-z]{2}/g;
complete_url = complete_url.replace( re, "$1" );
complete_url = complete_url.replace( /#.*/, '' );
return complete_url;
}
function qty_add( el, price, q ){
thisq = parseInt( el.val() );
newq = thisq+q;
if( newq > 0 && newq<1000 ){
el.val( thisq+q );
subtot = price*newq;
$('#totale').html( subtot.toFixed(2).replace('.', ',')+" €" );
}
}
function check_form( formid ){
return false;
}