//*

$(document).ready(function() {
    
    $('#leggi').click(function() {

            $('.news_show').show('slow');
            $('#leggi').css({"display":"none"});


    });
 

$('#line_toogle').click(function() {
	$('#short_container').toggle();
	
   });


 $("#line_toogle").toggle(function(){
                $('#short_container').load("info_box.php");
		$("#line_toogle").css({"background-position":"left bottom"});

		}, function () {
                $('#short_container').hide();
		$("#line_toogle").css({"background-position":"left top"});


	});






//////////SLIDE SHOW FORMA





/*
$('#main').hover(function() {

    $('div.slide_menu ul li.active a'). animate({width: "0px"}, {duration: 600, easing:"easeOutsine"});
    },
    function() {
	$('div.slide_menu ul li.active a'). animate({width: "100px"}, {duration: 600, easing:"easeOutsine"});
    });
*/


 $('div.slide_menu ul.forma li.active a').css({
	'min-width': '520px'
    });

    $('#main').hover(function() {

	$('div.slide_menu ul.forma li.active a').css({
	    'min-width': '0px'
	});
	//$('div.slide_menu ul li.active a'). animate({width: "100px"}, {duration: 600, easing:"easeOutQuad"});
    },
    function() {

	$('div.slide_menu ul.forma li.active a').css({
	    'min-width': '520px'
	});
    });



    $('div.slide_menu ul.forma li a').hover(function() {
	if ($(this).is(':animated')) {
	    $(this).stop().animate({
		width: "520px"
	    },
	    {
		duration: 600,
		easing: "easeOutQuad"
	    });
	} else {
	    $(this).stop().animate({
		width: "520px"
	    },
	    {
		duration: 600,
		easing: "easeOutQuad"
	    });
	}
    },
    function() {
	if ($(this).is(':animated')) {
	    $(this).stop().animate({
		width: "150px"
	    },
	    {
		duration: 600,
		easing: "easeInSine"
	    })
	} else {
	    $(this).stop('animated:').animate({
		width: "150px"
	    },
	    {
		duration: 600,
		easing: "easeInSine"
	    });
	}
    });

    //////////SLIDE SHOW COLORE

//animate search vertical accordion
    $('div.slide_menu ul.colore li.active a').css({
	'min-width': '150px'
    });

    $('#main').hover(function() {

	$('div.slide_menu ul.colore li.active a').css({
	    'min-width': '0px'
	});
	//$('div.slide_menu ul li.active a'). animate({width: "100px"}, {duration: 600, easing:"easeOutQuad"});
    },
    function() {

	$('div.slide_menu ul.colore li.active a').css({
	    'min-width': '150px'
	});
    });



    $('div.slide_menu ul.colore li a').hover(function() {
	if ($(this).is(':animated')) {
	    $(this).stop().animate({
		width: "150px"
	    },
	    {
		duration: 600,
		easing: "easeOutQuad"
	    });
	} else {
	    $(this).stop().animate({
		width: "150px"
	    },
	    {
		duration: 600,
		easing: "easeOutQuad"
	    });
	}
    },
    function() {
	if ($(this).is(':animated')) {
	    $(this).stop().animate({
		width: "25px"
	    },
	    {
		duration: 600,
		easing: "easeInSine"
	    })
	} else {
	    $(this).stop('animated:').animate({
		width: "50px"
	    },
	    {
		duration: 600,
		easing: "easeInSine"
	    });
	}
    });


  //////////SLIDE SHOW UTILIZZO


//animate search vertical accordion
    $('div.slide_menu ul.utilizzo li.active a').css({
	'min-width': '570px'
	
    });

    $('#main').hover(function() {

	$('div.slide_menu ul.utilizzo li.active a').css({
	    'min-width': '0px'
	});
	//$('div.slide_menu ul li.active a'). animate({width: "100px"}, {duration: 600, easing:"easeOutQuad"});
    },
    function() {

	$('div.slide_menu ul.utilizzo li.active a').css({
	    'min-width': '570px'
	});
    });



    $('div.slide_menu ul.utilizzo li a').hover(function() {
	if ($(this).is(':animated')) {
	    $(this).stop().animate({
		width: "650px"
	    },
	    {
		duration: 600,
		easing: "easeOutQuad"
	    });
	} else {
	    $(this).stop().animate({
		width: "570px"
	    },
	    {
		duration: 600,
		easing: "easeOutQuad"
	    });
	}
    },
    function() {
	if ($(this).is(':animated')) {
	    $(this).stop().animate({
		width: "200px"
	    },
	    {
		duration: 600,
		easing: "easeInSine"
	    })
	} else {
	    $(this).stop('animated:').animate({
		width: "200px"
	    },
	    {
		duration: 600,
		easing: "easeInSine"
	    });
	}
    });

    //opacity

    $(".item_list img").animate( {opacity: "0.5"}, 10 );


    $(".item_list img").hover(

                function() {

                       $( this ).animate( {opacity: "1"}, 10 );

               },

               function() {

                       $( this ).animate( {opacity: "0.5"}, 10 );

               });



$('#list').pager('div');
$('#list1').pager('div');
$('#list2').pager('div');
$('#list3').pager('div');
$('#list4').pager('div');
$('#list5').pager('div');
$('#list6').pager('div');
$('#list7').pager('div');
$('#list8').pager('div');
$('#list9').pager('div');
$('#list10').pager('div');
}); ///document ready


//accordion
$(function() {
    $("#accordion").accordion();
});





$(function() {
    $("#nav_category").lavaLamp({
                fx: "backout",
                speed: 700,
                click: function(event, menuItem) {

                }
    });
});





    ///ajax load item dettaglio
    $(function() {
	$("#main_products .show_item").click(function(){
	id=$(this).attr("id");
	//$('#'+id+'.img').animate( {opacity: "1"}, 10 );

	$('#'+id).addClass("active");
	//$(this).next('div').append(id);
	$('#show_attributes').load("catalogs.php?s=0&item_id="+id);
	$('#show_dati_tecnici').load("catalogs.php?s=2&item_id="+id);
        $('#show_colori').load("catalogs.php?s=1&item_id="+id);
        
	},

        function() {

                    $('#'+id).removeClass("active");

        });





    });






    ///ajax load
      /*
    $("img").attr("title", function() { return this.src });
    $(function() {
	$("#accordion h3").click(function(){
	cat_id=$(this).next('div').attr("id")
	line_id=$(this).next('div').attr("line")
	//$(this).next('div').append(id);
	$(this).next('div').load("catalogs.php?cid="+cat_id+"&line_id="+line_id);
	});
    });

      */


    /*
function ajax(resource){
$.ajax({
    url: resource //'document.xml',
    type: 'GET',
    dataType: 'xml',
    timeout: 1000,
    error: function(){
        alert('Error loading XML document');
    },
    success: function(xml){
        // do something with xml
    }
});

    */

