// Scroller
scrollStep=2
timerUp=""
timerDown=""

function toTop(id){
    document.getElementById(id).scrollTop=0
}

function scrollDivDown(id){
    clearTimeout(timerDown)
    document.getElementById(id).scrollTop+=scrollStep
    timerDown=setTimeout("scrollDivDown('"+id+"')",10)
}

function scrollDivUp(id){
    clearTimeout(timerUp)
    document.getElementById(id).scrollTop-=scrollStep
    timerUp=setTimeout("scrollDivUp('"+id+"')",10)
}

function toBottom(id){
    document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight
}

function stopMe(){
    clearTimeout(timerDown)
    clearTimeout(timerUp)
}

// Switch Foto
function vedi(prmGrande,prmDid) {
    document.images["vistag"].src = prmGrande;
}

// Accordion
$(document).ready(function(){
  	lastBlock = $("#a1");
    maxWidth = 487;
	minWidth = 35;

    $(".tendina").click(
		function(){
			$(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
			$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400});
			currentBlock = this;
			lastBlock = this;
	    }
	);
});


// Fade su Contatti
$(document).ready(function(){
    $("#span_contatti").click(function () {
        $("#indirizzi").fadeOut("slow", function() {
        	$("#contatti").fadeIn("slow");
        });
    });

    $("#span_indirizzi").click(function () {
        $("#contatti").fadeOut("slow", function() {
        	$("#indirizzi").fadeIn("slow");
        });
    });
});


//

$.fn.cycle.defaults.timeout = 6000;
$(function() {
    // run the code in the markup!
    $('td pre code').each(function() {
        eval($(this).text());
    });
});
