// Slider
function slideSwitch() {
    var $active = $('#slideshow DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow DIV:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 4500 );
});

$('#slideshow')
	.mouseover(function() {
		$('.dida').css('display','block');
	})
	.mouseout(function() {
		$('.dida').css('display','none');
	})



// Tips

$("#chi").simpletip({
	position: [-285, 65], content: '<div class="arrow"></div><strong>apiuvi</strong> si propone come fornitore nel settore della grafica e dell\'editoria, sia su carta che su web. <strong>apiuvi</strong> &egrave; formata da soci che contano già anni di attivit&agrave; ed esperienza nel settore della grafica pubblicitaria' }); 
	
$("#cosa").simpletip({
	position: [-565, 65], content: '<div class="arrow"></div><div><strong>apiuvi</strong> ha come attivit&agrave; principale lo studio di promozione pubblicitaria, attraverso la progettazione di immagine coordinata (loghi, marchi, biglietti da visita, brochure, opuscoli, volantini), la progettazione editoriale (libri, riviste e organi aziendali, monografie, cataloghi, pieghevoli) e la realizzazione di siti e portali web; collabora con societ&agrave; di hosting e software per progettare e costruire siti dinamici, gestibili dal cliente e soluzioni di e-commerce</div>' }); 

$("#dove").simpletip({
	position: [-145, 65], content: '<div class="arrow"></div><strong>Contatti</strong><br />T 335 847 7543<br />F 011 1979 0092<br /><a href="mailto:grafica@apiuvi.com">grafica@apiuvi.com</a><br /><a href="mailto:varsallona@apiuvi.com">varsallona@apiuvi.com</a>' });

$("#gallery").simpletip({
	position: [-70, 80], content: '<div class="arrow"></div><strong>GALLERY</strong>' });



// Slide out div
    $(function(){
        $('.slide-out-div').tabSlideOut({
            tabHandle: '.handle',                     //class of the element that will become your tab
            //pathToTabImage: 'images/open-div.gif', //path to the image for the tab //Optionally can be set using css
            //imageHeight: '38px',                     //height of tab image           //Optionally can be set using css
            //imageWidth: '26px',                       //width of tab image            //Optionally can be set using css
            tabLocation: 'right',                      //side of screen where tab lives, top, right, bottom, or left
            speed: 300,                               //speed of animation
            action: 'click',                          //options: 'click' or 'hover', action to trigger animation
            topPos: '50%',                          //position from the top/ use if tabLocation is left or right
            leftPos: '0px',                          //position from left/ use if tabLocation is bottom or top
            fixedPosition: false                      //options: true makes it stick(fixed position) on scroll
        });
    });
	
	$('.slide-out-div').click(function() {
			$('.close').delay(300).fadeTo(200,1)
		});

	
	
	
	
	
	
// Overlay	
	    $('.handle').click(function() {
			$('.overlay').fadeTo(300,0.6);
        });
		
	    $('.overlay, .close').click(function() {
			$('.overlay').css('display','none');
			$('.close').css('display','none')
        })
		

