
$(document).ready(function() {

    
    //twitter scroll
    $('.TweetFade').innerfade({ speed: 'slow', timeout: 5000, type: 'sequence', containerheight: 'auto' });
 

  //backToHome button
  $("#backHome").hover(
        function () {
                  $(this).animate({left:"40px"}, 1000, "easeOutBounce"
                    );
        }, 
        function () {
                $(this).animate({ left:"0px" }, 1000,"easeOutBounce" );
        }
      );
    
    
  //pngfix
    $(document).pngFix(); 


//fix IE7 z-index issues
// $(function() {
// 	var zIndexNumber = 1000;
// 	$('#works').each(function() {
// 		$(this).css('zIndex', zIndexNumber);
// 		zIndexNumber -= 10;
// 	});
// });

  //mod css x pag non slide
    var serverUri = "<?=$_SERVER['REQUEST_URI']; ?>" 
    if ( serverUri != 'index.php'  &&  serverUri != '/index.php' && serverUri != ''  && serverUri != '/' )  
      {  
      $('#header').css({ position: "relative", "background-image": "url(img/void.png)" , height:"220px" });
      $('body').css({ "background-image":"url(img/bk.jpg)", "background-position":"top center", "background-repeat":"no-repeat", 	"background-color": "#0a0a0a" });
      }
    else
      {   
        //fix for IE6   x pag slide 
        if (jQuery.browser.msie)
         {    
            if(parseInt(jQuery.browser.version) == 6) 
            {  
//               $('#footer').css({ position: "absolute", "bottom": "0px" });
                $('#FooterCenterBox').css({ "bottom": "-1px" });
                $('#contentGeneric').css({ "overflow": "visible" });
            }    
         }        
      }

        //fix for IE6   in tutte le pag 
        if (jQuery.browser.msie)
         {    
            if(parseInt(jQuery.browser.version) == 6) 
            {  
                $('#contentGeneric').css({ "overflow": "visible" });
            }    
         }  


	
  //get the width of the element
  	 widthSingleElement   = $(".singleTab").width();
     paddingSingleElement = parseInt($(".singleTab").css("padding-right"));
  	 numberOfElement      = $("#slide").children().size();
  	 SlideTotalWidth      = numberOfElement*(widthSingleElement+paddingSingleElement); 
  	 $("#contentSlide").css({ width:SlideTotalWidth });  //iniect it!
  	  $("#slide").css({ width:SlideTotalWidth });  //iniect it!
  	 
  	//  $('#footer').css( 'left', SlideTotalWidth );
  	


//TOOLTIP on link ----------- 
      var hoverText
    	$(".singleTab a,.singleTabWork").hover(function() {
    	  hoverText = $(this).attr("title");
    	  $(this).prepend("<div id='tooltip' style = 'background:transparent url(img/tooltip.png) repeat scroll 0%; color:#FFFFFF;  display: none; font-size:23px; font-weight: bold; padding:10px 15px; margin-top:155px;  background-color:#000000;  position:absolute; left:0px; z-index:10000;'>"+hoverText+"</div>");
    		
    		$(this).attr("title",""); //cosi il browser non stampa il suo tooltip	
    		
        $(this).find("#tooltip").animate({opacity: "show"}, "slow");
        
    	}, function() {
    		$(this).find("#tooltip").animate({opacity: "hide"}, "fast");
    		$(this).find('#tooltip').remove(); // remove the tooltip
    		$(this).attr("title",hoverText); //ripasso il valore del title

    	}); 
      
        
  
  	
  //*SLIDESCROLL*

  //check mouse position
  
  var  mousePointX;
  var  mousePointY;
 
 

  
 

        var docH = $(window).height();
        var	docW = $(window).width();
        var navW
        var navWcenter
        
        docWcenter =  docW / 2;
      
        var scrollPointH = $(window).scrollTop();
        var	scrollPointW = $(window).scrollLeft();
        navWcenter =  navW + docWcenter;

 
 
   var	docW = $(window).width();
  	 $("#contentSlide").css({ width:docW });  //iniect it!
  	 
  	  //$('#footer').css( 'left', SlideTotalWidth );
  	  $('#navRight').css( 'left', docW-110 );
 
 
$('#contentSlide').autoscroll(AUTOSCROLL_X);
 $('.singleTab img').hover(
				function() {$(this).addClass('hover');},
				function() {$(this).removeClass('hover');}
			);  
 
 
    

 
 
    
       
       //check activation button

// var speedoGear;
// var gear;
// 
// 
//    $().mousemove(function(e){
//       	mousePointX = e.pageX;
//         mousePointY = e.pageY;
// 
// 
//        areaRight = (docW - 110);
//        if ( mousePointX >= areaRight ) {
//          $('#navRight').css({ display:"block" });
//        
//          
// 
//          gear = Math.abs(docW - mousePointX - 110);
//          speedoGear = gear * 11;       
// 
// 
//           $("#navRight").mouseover(function(){
// 
//                  areaRight = (docW - 110);
//                  gear = 110 - mousePointX ;
//                  speedoGear = gear * 11;
//                     
//               //  $("#contentSlide").css( 'position', 'absolute' ).animate({ left : -SlideTotalWidth+docW + "px"}, {"duration": "5000", "easing": "easeInQuart"} );
//            
//               }).mouseout(function(){
//                  $('#navRight').css({ display:"none" });
//                  $('#navLeft').css({ display:"none" });
//               });
//        
//         
//        }
//       else if (mousePointX <= 110) {
//        $('#navLeft').css({ display:"block" });
//        gear = 110 - mousePointX ;
//        speedoGear = gear * 11;
// 
// 
// 
// 
// 
//           $("#navLeft").mouseover(function(){
//           
//                  areaRight = (docW - 110);
//                  gear = Math.abs(docW - mousePointX - 110);
//                  speedoGear = gear * 11;  
//                     
//                    //  $("#contentSlide").css( 'position', 'absolute' ).animate({ left : 0 + "px"}, {"duration": "5000", "easing": "easeInQuart"} );
//                          
//               }).mouseout(function(){
//                  $('#navRight').css({ display:"none" });
//                  $('#navLeft').css({ display:"none" });
//               });
// 
// 
// 
// 
//        
//        
//        }
// //        if ( (mousePointX < areaRight) && (mousePointX > 110)) {
// //        $('#navRight').css({ display:"none" });
// //        $('#navLeft').css({ display:"none" });
// //        }  
// 
// //_--------------------------------------------------------
// 
//     //debug
// //     $("#debug").remove();
// //     $("#footer").html('<div id="debug">docw='+docH+' docW='+docW+' scrollPointH='+scrollPointH+' scrollPointW='+scrollPointW+' mousePointX='+mousePointX+' mousePointY='+mousePointY+' areaRight'+areaRight+'  speedoGear: '+speedoGear+' gear : '+gear+'</div>');
// //     
// 
// 
//     });
  



  //schissa sù
 // Using multiple unit types within one animation.
//     $(".singleTab").toggle(function(){
//       $(this).animate({ 
//         width: "700px",
//         height: "450px",
//         marginLeft: "0.6in",
//         fontSize: "3em", 
//         backgroundColor: "white",
//         marginTop: "auto",
//         marginBottom: "auto",
//         position:"fixed" ,
//         zIndex:"10",
//         left: "-300px",
//         top: "-100px"
//       }, 1500 )},
//             function () {
//       $(this).animate({ 
//         width: "200px",
//         height: "200px",
//         marginLeft: "0.6in",
//         fontSize: "3em", 
//         backgroundColor: "white",
//         marginTop: "auto",
//         marginBottom: "auto",
//         position:"fixed" ,
//         zIndex:"10",
//         left: "-300px",
//         top: "-100px"
//       }, 1500 )
//       }
//      
//       
//       );
      
      
      

// $("#SlideWrap").prepend('<div id="slideOverlay"></div>');
// $("#slideOverlay").css({'width': $(window).width(), 'height': $(document).height(), 'opacity': 0.2});
//  if ($.browser.msie) {
//  $("#SlideWrap").prepend('<iframe id="fancy_bigIframe" scrolling="no" frameborder="0"></iframe>');
//  $("#fancy_bigIframe").css({'width': $(window).width(), 'height': $(document).height(), 'opacity': 0.2});
//  }
//  //$("#slideOverlay").click($.fn.fancybox.close);
//    
//       
//     });


 });
