
$(document).ready(function() {
						   
						   
//HOMEPAGE
var larghezza_elemento = $("#Template_Mod_Content").width();
var larghezza_finestra = $("#Template_slide_overflow").width();
var posizione = larghezza_elemento;
var n_spostamento = 0;	

function avanti() {	
					if(n_spostamento == 0) { posizione = larghezza_elemento; }
							if (larghezza_finestra < posizione) 
								{
								$("#Template_slide_overflow table").animate({"left": "-=840px"}, 2500, "easeOutSine");
								posizione = posizione - larghezza_finestra;
								n_spostamento = n_spostamento + 1;
							    }
				  	 }
function indietro() {	
						if (n_spostamento != 0) 
						{
						$("#Template_slide_overflow table").animate({"left": "+=840px"}, 2500, "easeOutSine");
						n_spostamento =  n_spostamento - 1;
						}
					 }

/*RICHIAMA LA FUNZIONE ONCLICK */
 $("#Template_Btn_Back").click(function(){indietro();});
 $("#Template_Btn_Next").click(function(){avanti();});
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//HOMEPAGE
//COOLPIX NEWS

var larghezza_elemento_HomeNews = $(".BoxSlide_HomeNews_Content").width();
var larghezza_finestra_HomeNews = $(".BoxSlide_HomeNews_Hidden").width();
var posizione_HomeNews = larghezza_elemento_HomeNews;
var n_spostamento_HomeNews = 0;
		
function avanti_HomeNews() 
						{	
						if(n_spostamento_HomeNews == 0) { posizione_HomeNews = larghezza_elemento_HomeNews; }
						if (larghezza_finestra_HomeNews < posizione_HomeNews) 
							{
							$(".BoxSlide_HomeNews_Content").animate({"left": "-=930px"}, 2500, "easeOutSine");
							posizione_HomeNews = posizione_HomeNews - larghezza_finestra_HomeNews;
							n_spostamento_HomeNews = n_spostamento_HomeNews + 1;
							
							}
				  		}
function indietro_HomeNews()
						{	
						if (n_spostamento_HomeNews != 0) 
							{
							$(".BoxSlide_HomeNews_Content").animate({"left": "+=930px"}, 2500, "easeOutSine");
							n_spostamento_HomeNews =  n_spostamento_HomeNews - 1;
							}
					    }
					
/*RICHIAMA LA FUNZIONE ONCLICK */
$(".BoxSlide_Btn_Back").click(function(){indietro_HomeNews();});
$(".BoxSlide_Btn_Next").click(function(){avanti_HomeNews();});
 

 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//PAGINA INTERNA
//GALLERY

var larghezza_elemento_gallery = $(".table_content").width();
var larghezza_finestra_gallery = $(".BoxSlide_Hidden").width();
var posizione_gallery = larghezza_elemento_gallery;
var n_spostamento_gallery = 0;
		
function avanti_gallery() 
						{	
						if(n_spostamento_gallery == 0) { posizione_gallery = larghezza_elemento_gallery; }
						if (larghezza_finestra_gallery < posizione_gallery) 
							{
							$(".table_content").animate({"left": "-=770px"}, 2500, "easeOutSine");
							posizione_gallery = posizione_gallery - larghezza_finestra_gallery;
							n_spostamento_gallery = n_spostamento_gallery + 1;
							
							}
				  		}
function indietro_gallery()
						{	
						if (n_spostamento_gallery != 0) 
							{
							$(".table_content").animate({"left": "+=770px"}, 2500, "easeOutSine");
							n_spostamento_gallery =  n_spostamento_gallery - 1;
							}
					    }
					
/*RICHIAMA LA FUNZIONE ONCLICK */
$(".BoxSlide_Btn_Back").click(function(){indietro_gallery();});
$(".BoxSlide_Btn_Next").click(function(){avanti_gallery();});
 


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//PAGINA INTERNA
//ACCESSORI
var larghezza_elemento_accessori = $(".table_content_accessori").width();
var larghezza_finestra_accessori = $(".BoxSlideAccessori_Hidden").width();
var posizione_accessori = larghezza_elemento_accessori;
var n_spostamento_accessori = 0;	

function avanti_accessori() {
						if(n_spostamento_accessori == 0) { posizione_accessori = larghezza_elemento_accessori; }
						if (larghezza_finestra_accessori < posizione_accessori) 
							{
							$(".table_content_accessori").animate({"left": "-=770px"}, 2500, "easeOutSine");
							posizione_accessori = posizione_accessori - larghezza_finestra_accessori;
							n_spostamento_accessori = n_spostamento_accessori + 1;
							}
				  		}
function indietro_accessori() 
						{	
						if (n_spostamento_accessori != 0) 
							{
							$(".table_content_accessori").animate({"left": "+=770px"}, 2500, "easeOutSine");
							n_spostamento_accessori =  n_spostamento_accessori - 1;
							}
						}

/*RICHIAMA LA FUNZIONE ONCLICK */
 $(".BoxSlideAccessori_Btn_Back").click(function(){indietro_accessori();});
 $(".BoxSlideAccessori_Btn_Next").click(function(){avanti_accessori();});
 
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//PAGINA INTERNA
//ARTICOLI CORRELATI

var larghezza_elemento_correlati = $(".table_content_correlati").width();
var larghezza_finestra_correlati = $(".BoxSlideCorrelati_Hidden").width();
var posizione_correlati = larghezza_elemento_correlati;
var n_spostamento_correlati = 0;	

function avanti_correlati() {
						
						if(n_spostamento_correlati == 0) { posizione_correlati = larghezza_elemento_correlati; }
						if (larghezza_finestra_correlati < posizione_correlati) 
							{
							$(".table_content_correlati").animate({"left": "-=600px"}, 2500, "easeOutSine");
							posizione_correlati = posizione_correlati - larghezza_finestra_correlati;
							n_spostamento_correlati = n_spostamento_correlati + 1;
							$(".BoxSlideCorrelati_Btn_Back").css("display", "block");
							if(larghezza_finestra_correlati >= posizione_correlati)
								{
								$(".BoxSlideCorrelati_Btn_Next").css("display", "none");
								}
							}
				  		}
function indietro_correlati() 
						{	
						if (n_spostamento_correlati != 0) 
							{
							$(".BoxSlideCorrelati_Btn_Next").css("display", "block");	
							$(".table_content_correlati").animate({"left": "+=600px"}, 2500, "easeOutSine");
							n_spostamento_correlati =  n_spostamento_correlati - 1;
							if (n_spostamento_correlati == 0) 
								{
							 	$(".BoxSlideCorrelati_Btn_Back").css("display", "none");
								}
							} 
						}

/*RICHIAMA LA FUNZIONE ONCLICK */
 $(".BoxSlideCorrelati_Btn_Back").click(function(){indietro_correlati();});
 $(".BoxSlideCorrelati_Btn_Next").click(function(){avanti_correlati();});
 
});

