/*!
 * jQuery FlipFox
 * author: Simone Volpini www.simonevolpini.info
 * Copyright 2010, Capolinea srl www.capolinea.it
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://docs.jquery.com/License
 */
function openUfficio()
{
    $("#ContUfficio").empty();
    $("#ContUfficio").css('z-index', '1000');
    pos = $("#ContUfficio").position();

    $("#ContUfficio").animate({width: 1, left: (120 + pos.left), top: (pos.top - 10), borderTopWidth: "10px", borderLeftWidth: '0px', borderRightWidth: '0px', borderBottomWidth: "10px" }, 200, function(){
        pos = $("#ContUfficio").position();

	    $("#ContUfficio").animate({width: 240, height: 140, left: (pos.left - 120), top: (pos.top + 10), borderBottomWidth: "0px", borderTopWidth: "0px" }, 200, function(){
	        pos = $("#ContUfficio").position();
	        $("#ContUfficio").animate({width: 782, height: 330, left: (pos.left), top: (pos.top), borderBottomWidth: "0px", borderTopWidth: "0px" }, 500, function() {
	            $("#ContUfficio").load("ufficio.php");
	            $("#BoxPopDisegno").show(800);
	        });
	    });
    });
}
function closeUfficio()
{
    pos = $("#ContUfficio").position();
    $("#BoxPopDisegno").fadeOut(200);

	$("#ContUfficio").animate({width: 240, height: 140, left: 60, top: 0, borderBottomWidth: "0px", borderTopWidth: "0px"}, 1000, function() {
	    $("#ContUfficio").empty();
	    $("#ContUfficio").append('<a class="LinkSettoreUfficio" href="javascript:openUfficio();">Ufficio</a>');
	    $("#ContUfficio").css('z-index', '1');
	});
}

function openDisegno()
{
    $("#ContDisegno").empty();
    $("#ContDisegno").css('z-index', '1000');
    pos = $("#ContDisegno").position();

    $("#ContDisegno").animate({width: 1, left: (120 + pos.left), top: (pos.top - 10), borderTopWidth: "10px", borderLeftWidth: '0px', borderRightWidth: '0px', borderBottomWidth: "10px" }, 200, function(){
        pos = $("#ContDisegno").position();

	    $("#ContDisegno").animate({width: 240, height: 140, left: (pos.left - 120), top: (pos.top + 10), borderBottomWidth: "0px",  borderTopWidth: "0px" }, 200, function(){
	        pos = $("#ContDisegno").position();
	        $("#ContDisegno").animate({width: 782, height: 330, left: (pos.left - 270), top: (pos.top), borderBottomWidth: "0px",  borderTopWidth: "0px" }, 500, function() {
	            $("#ContDisegno").load("disegno.php");
	            $("#BoxPopDisegno").show(800);
	        });
	    });
    });
}
function closeDisegno()
{
    pos = $("#ContDisegno").position();
    $("#BoxPopDisegno").fadeOut(200);

	$("#ContDisegno").animate({width: 240, height: 140, left: 330, top: 0, borderBottomWidth: "0px", borderTopWidth: "0px"}, 1000, function() {
	    $("#ContDisegno").empty();
	    $("#ContDisegno").append('<a class="LinkSettoreDisegno" href="javascript:openDisegno();">Disegno</a>');
	    $("#ContDisegno").css('z-index', '1');
	});
}

function openArti()
{
    $("#ContBelleArti").empty();
    $("#ContBelleArti").css('z-index', '1000');
    pos = $("#ContBelleArti").position();

    $("#ContBelleArti").animate({width: 1, left: (120 + pos.left), top: (pos.top - 10), borderTopWidth: "10px", borderLeftWidth: '0px', borderRightWidth: '0px', borderBottomWidth: "10px" }, 200, function(){
        pos = $("#ContBelleArti").position();

	    $("#ContBelleArti").animate({width: 240, height: 140, left: (pos.left - 120), top: (pos.top + 10), borderBottomWidth: "0px",  borderTopWidth: "0px" }, 200, function(){
	        pos = $("#ContBelleArti").position();
	        $("#ContBelleArti").animate({width: 782, height: 330, left: (pos.left - 540), top: (pos.top), borderBottomWidth: "0px",  borderTopWidth: "0px" }, 500, function() {
	            $("#ContBelleArti").load("bellearti.php");
	            $("#BoxPopDisegno").show(800);
	        });
	    });
    });
}
function closeArti()
{
    pos = $("#ContBelleArti").position();
    $("#BoxPopDisegno").fadeOut(200);

	$("#ContBelleArti").animate({width: 240, height: 140, left: 600, top: 0, borderBottomWidth: "0px", borderTopWidth: "0px"}, 1000, function() {
	    $("#ContBelleArti").empty();
	    $("#ContBelleArti").append('<a class="LinkSettoreArti" href="javascript:openArti();">Belle Arti</a>');
	    $("#ContBelleArti").css('z-index', '1');
	});
}

function openStampa()
{
    $("#ContStampa").empty();
    $("#ContStampa").css('z-index', '1000');
    pos = $("#ContStampa").position();

    $("#ContStampa").animate({width: 1, left: (120 + pos.left), top: (pos.top - 10), borderTopWidth: "10px", borderLeftWidth: '0px', borderRightWidth: '0px', borderBottomWidth: "10px" }, 200, function(){
        pos = $("#ContStampa").position();

	    $("#ContStampa").animate({width: 240, height: 140, left: (pos.left - 120), top: (pos.top + 10), borderBottomWidth: "0px",  borderTopWidth: "0px" }, 200, function(){
	        pos = $("#ContStampa").position();
	        $("#ContStampa").animate({width: 782, height: 330, left: (pos.left - 134), top: 0, borderBottomWidth: "0px",  borderTopWidth: "0px" }, 500, function() {
	            $("#ContStampa").load("stampa.php");
	            $("#BoxPopDisegno").show(800);
	        });
	    });
    });
}
function closeStampa()
{
    pos = $("#ContStampa").position();
    $("#BoxPopDisegno").fadeOut(200);

	$("#ContStampa").animate({width: 240, height: 140, left: 194, top: 165, borderBottomWidth: "0px", borderTopWidth: "0px"}, 1000, function() {
	    $("#ContStampa").empty();
	    $("#ContStampa").append('<a class="LinkSettoreStampa" href="javascript:openStampa();">Stampa</a>');
	    $("#ContStampa").css('z-index', '1');
	});
}


function openCorrispondenza()
{
    $("#ContCorrispondenza").empty();
    $("#ContCorrispondenza").css('z-index', '1000');
    pos = $("#ContCorrispondenza").position();

    $("#ContCorrispondenza").animate({width: 1, left: (120 + pos.left), top: (pos.top - 10), borderTopWidth: "10px", borderLeftWidth: '0px', borderRightWidth: '0px', borderBottomWidth: "10px" }, 200, function(){
        pos = $("#ContCorrispondenza").position();

	    $("#ContCorrispondenza").animate({width: 240, height: 140, left: (pos.left - 120), top: (pos.top + 10), borderBottomWidth: "0px",  borderTopWidth: "0px" }, 200, function(){
	        pos = $("#ContCorrispondenza").position();
	        $("#ContCorrispondenza").animate({width: 782, height: 330, left: (pos.left - 404), top: 0, borderBottomWidth: "0px",  borderTopWidth: "0px" }, 500, function() {
	            $("#ContCorrispondenza").load("corrispondenza.php");
	            $("#BoxPopDisegno").show(800);
	        });
	    });
    });
}
function closeCorrispondenza()
{
    pos = $("#ContCorrispondenza").position();
    $("#BoxPopDisegno").fadeOut(200);

	$("#ContCorrispondenza").animate({width: 240, height: 140, left: 464, top: 165, borderBottomWidth: "0px", borderTopWidth: "0px"}, 1000, function() {
	    $("#ContCorrispondenza").empty();
	    $("#ContCorrispondenza").append('<a class="LinkSettoreCorrispondenza" href="javascript:openCorrispondenza();">Corrispondenza</a>');
	    $("#ContCorrispondenza").css('z-index', '1');
	});
}
