// JavaScript Document
phnlastvisibleindex = 0;
phnlastindex =0;
firstvisible =0;
lastvisible= 0;
centervisible =0;
actvele = 0;

$(document).ready(function(){

	$('#nav a,#navindex a').parent('li').css('cursor','pointer').bind('click',function(){
		var goto = $(this).children('a').attr('href');
		window.location = goto;
		
	});

	
	pageurl = window.location.toString();
	var pageurlindex = parseInt(pageurl.lastIndexOf("/"))+1;
	pageurl = pageurl.substring(pageurlindex);
	
	$('#nav a,#navindex a').each(function(){
		var navlink = $(this).attr('href').toString();
		var navlinkindex = parseInt(navlink.lastIndexOf("/"))+1;
		var navlink = navlink.substring(navlinkindex);
		
		if(pageurl == navlink || $(this).parent().next().attr('class') == 'navsub'  ){
			$(this).parent('li').addClass('navactive');
		}
		
		if ( $('#right').is() == true ) {
			var rightlink = $('#right').find('.navtitle').attr('href');
			var rightlinkindex = parseInt(rightlink.lastIndexOf("/"))+1;
			var rightlink = rightlink.substring(rightlinkindex);
			
			if (navlink == rightlink  ){
				$(this).parent('li').addClass('dnone');
			}
		}
	});
	
	
	
	
	/*$('ul.gallery').galleria();*/





	calibar();
}); /*end ready*/









/*calibration bar*/

function calibar(){
	$('.bwsample table').hover(function(){
		$('.curiousspot').fadeIn('fast');			  
	},function(){	
		$('.curiousspot').fadeOut('slow');
	});


	$('.curiousspot').hover(function(){
		var tiptext ='<div class="bwstip"><div class="bwsblock"><p class="bwstop"><a href="#" class="bwsclose">X</a></p>     <p>Ciao, sono la <b>barra di calibrazione</b>. Se vuoi saperne di pi&ugrave; sulla calibrazione dei monitor, <a href="calibrazione-monitor.html">seguimi</a></p></div><div class="bwsbottom"><img src="images/bwsarrow.gif" /></div></div>';
		$(this).parents('.bwsample').prepend(tiptext);
		$('.bwstip').fadeIn('normal');
		},function(){	
			$('.bwsclose').bind('click',function(){
				$('.bwstip').fadeOut('fast',function(){$(this).remove();});
				$('.bwsclose').unbind('click');
				return false;
			});
	});
};
