/*!
 * Custom JavaScript Library v1.4.2
 * http://www.publimediaweb.it/jspmw/custom.js
 *
 * Copyright 2010, Publimedia Web
 *
 */


// effetto fade in sulle pagine
//	$(document).ready(function () {
//	$('.container_12').fadeIn(1000);
//	});

// SlideSwitch
function slideSwitch() {
    var $active = $('#slideshow IMG.active');
    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');
    // uncomment the 3 lines below to pull the images in random order
    
    // 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()", 5000 ); });



// effetto fadeimg
//$(document).ready(function(){ $('a img').addClass('fadeimg'); });
//$(function(){
//	$('.fadeimg')
//		.mouseover(function(){
//			$(this).stop().animate({opacity: 0.6}, "fast"); 
//			}) 
//		.mouseout(function(){
//			$(this).stop().animate({opacity: 1.0}, "fast"); 
//			}) 
//	})


// effetto fade out sulle pagine
//$(document).ready(function(){ $('.fade-a').addClass('fadeout'); });
//	function fadeout (pagina){
//	$('.container_12').fadeOut(1000); 
//	setTimeout("location.href='"+pagina+"'",1000);
//}


// effetto fade z-index
//$(function(){
//	$('.fade-foto')
//		.mouseover(function(){
//			$(this).stop().animate({opacity: 0.3, zIndex:1}, "fast"); 
//			}) 
//		.mouseout(function(){
//			$(this).stop().animate({opacity: 1.0, zIndex:3}, "fast"); 
//			}) 
//	})
	
	
//  effetto slide-box
//$(function(){
//	$('.box-slide')
//		.mouseover(function(){
//			$(this).stop().animate({left: 0}, "fast"); 
//			}) 
//		.mouseout(function(){
//			$(this).stop().animate({left: -180}, "fast");  
//			}) 
//	})
//	
//
////  effetto slide-box
//$(function(){
//	$('.box-power')
//		.mouseover(function(){
//			$(this).stop().animate({left: -10}, "fast"); 
//			}) 
//		.mouseout(function(){
//			$(this).stop().animate({left: -180}, "fast");  
//			}) 
//	})

//  effetto fade sulle immagini con doppio sfondo
$(document).ready(function() {
	hoverOpacity.init()
});

hoverOpacity = {
	init : function(){
		$('a.linkFader').css({
			position:"relative",
			backgroundPosition:"0px 0px",
			cursor:"pointer"
		})
		$('a.linkFader').each(function(){
			
			spanFader = document.createElement('span');
			myBG = $(this).css("background-image")
			
			$(this).append(spanFader);
		
			myBG = $(this).css("background-image")
			spanWidth =  $(this).css("width")
			spanHeight =  $(this).css("height")
				
			$(this).find("span").css({
				backgroundImage:myBG,
				backgroundPosition:"bottom right",
				position:"absolute",
				display:"block",
				cursor:"pointer",
				top:"0px",
				left:"0px",
				width:spanWidth,
				height:spanHeight,
				opacity:0,
				visibility:"visible"
			})
		})
		$("a.linkFader").hover(function () {
			$(this).find("span").stop()
			$(this).find("span:not(:animated)").animate({opacity: 1}, 300)
		},
		function () {
			$(this).find("span").animate({opacity: 0},250)
		});
	}
}	

//  effetto movimento sul menu
//$(function(){
//	$('.menu-motion')
//		.mouseover(function(){
//			$(this).stop().animate({marginRight: 15}, "fast")
//			}) 
//		.mouseout(function(){
//			$(this).stop().animate({marginRight: 0}, "fast")
//			}) 
//	})


//  effetto tooltip collegato al file tooltip.js
//$(document).ready(function(){
//	/* Adding a colortip to any tag with a title attribute: */
//	$('[title]').colorTip({color:'yellow'});
//});


