// Inizio document.ready
$("document").ready(function (){
	
	rotazione();
	prevNext();
	zoom();
	
});
// Fine document.ready

function prevNext() {
	$(".viewer").cycle({ 
	    fx: "scrollHorz", 
	    speed: "fast", 
	    prev: "#prev", 
	    next: "#next", 
	    after: onAfter, 
	    timeout: 0
	});
} 

function rotazione() {
	$(".rotazioneLayout").cycle({ 
		fx: "fade", 
		speed: 800 
	});
} 

function zoom() {
 	$("#viewerBrand a").fancybox({
		"overlayShow": true,
		"overlayOpacity": 0.7
	}); 	
}

//FUNCTION PER NEXT E PREV
function onAfter(curr, next, opts) {
	var index = opts.currSlide;
} 

// FUNCTION FOR LOADING PAGE
var loadPage = function(myFile){
	$("#switch").fadeOut("fast");  
	$("#btnDownloadCurriculum").fadeOut("fast"); 
	$("#main").fadeOut("fast",function(){
		$("#wrapper").append("<img class=\"loaderPage\" src=\"/libs/css/assets/loaderDefaultBg.gif\" />");
		$.ajax({
  			type: "GET",
  			url: myFile,
  			dataType: "text",
  			success: function(text){  				
  				var newHtml = $(""+text).find("#switch");
  				$("#switch").html(""+newHtml.html());
				$("#switch").show();
				$(".loaderPage").fadeOut("fast");
				$("#main").fadeIn("fast",function(){
					prevNext();
					zoom();
				});
  			}		
  		});
	});
}