$(document).ready(function(){
	Cufon.replace('#progetti h2, #scuola h2, #bacheca h2, #aside > h2, #mainContent h1');
	if($.browser.msie && (parseInt($.browser.version, 10) < 7)){
		startList();
	};
	
	$("a[rel=newGallery]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'inside',
		'overlayShow'       : 'true',
		'overlayOpacity'    : '0.6',
		'overlayColor'      : '#000'
		// 'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
		// 	return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		// }
	});
});

var startList = function() {
   if (document.all&&document.getElementById) {
       task(document.getElementById("nav"));
   }
}

function task(navRoot) {
   if (!navRoot.childNodes || navRoot.childNodes.length == 0) {
       return;
   }

   for (var i=0; i<navRoot.childNodes.length; i++) {
       var node = navRoot.childNodes[i];
       if (node.nodeName=="LI") {
           node.onmouseover=function() {
               this.className+=" over";
           }
           node.onmouseout=function() {
               this.className=this.className.replace(" over", "");
           }
       }

       task(node);
   }
}
