function mycarousel_initCallback(carousel) {
	jQuery('#mycarousel-next_1').bind('click', function() {
		carousel.next();
		return false;
	});

	jQuery('#mycarousel-prev_1').bind('click', function() {
		carousel.prev();
		return false;
	});

};

function mycarousel1_initCallback(carousel) {
	jQuery('#mycarousel-next_2').bind('click', function() {
		carousel.next();
		return false;
	});

	jQuery('#mycarousel-prev_2').bind('click', function() {
		carousel.prev();
		return false;
	});
};

function mycarousel3_initCallback(carousel) {
	jQuery('#mycarousel-next_3').bind('click', function() {
		carousel.next();
		return false;
	});

	jQuery('#mycarousel-prev_3').bind('click', function() {
		carousel.prev();
		return false;
	});
};

jQuery(document).ready(function() {
	
	jQuery("#mycarousel1").jcarousel({
		scroll: 1,
		initCallback: mycarousel_initCallback,
		buttonNextHTML: null,
		buttonPrevHTML: null
	});
	
	jQuery("#mycarousel2").jcarousel({
		scroll: 1,
		initCallback: mycarousel1_initCallback,
		buttonNextHTML: null,
		buttonPrevHTML: null
	});
	jQuery("#mycarousel3").jcarousel({
		scroll: 1,
		initCallback: mycarousel3_initCallback,
		buttonNextHTML: null,
		buttonPrevHTML: null
	});
});

	function setHomePage (url) {
		if (document.all) {
			document.body.style.behavior = 'url(#default#homepage)';
			document.body.setHomePage(url);
		}
		else if (window.sidebar) {
		if (window.netscape) {
			try {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}
			catch (e) {
				var strTemp = '';
				strTemp += "Permission denied";
				alert(strTemp);
			}
		}
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage', url);
		}
	}
	
$(document).ready(function(){
		
	var browserCheck = (document.all) ? 1 : 0; 
	if (!browserCheck) {
		$('#btli').hide();
		$('#btli_smap').hide();
	}
	$('#bookmarkthis').click(function () {
		setHomePage ('http://www.divertimento.it');
		return false;
	});
		
	$('a.vote').click(function () {
		$("#rate").toggle();
		return false;
	});
	$('a.share').click(function () {
		$("#share").toggle();
		return false;
	});

		
	$('#top10 div').hide(); // Hide all divs
	   $('#top10 div:first').show(); // Show the first div
	   $('#top10 ul li:first').addClass('active'); // Set the class for active state
	   $('#top10 ul li a').click(function(){ // When link is clicked
		   $('#top10 ul li').removeClass('active'); // Remove active class from links
		   $(this).parent().addClass('active'); //Set parent of clicked link class to active
		   var currentTab = $(this).attr('href'); // Set currentTab to value of href attribute
		   $('#top10 div').hide(); // Hide all divs
		   $(currentTab).show(); // Show div with id equal to variable currentTab
		   return false;
	   });



});
$(function() {
	$(".jCarousel_lite").jCarouselLite({
		btnNext: ".jfNext",
		btnPrev: ".jfPrev",
		visible: 1,
		btnGo:
		[".imageSliderExt .1", ".imageSliderExt .2",
		".imageSliderExt .3", ".imageSliderExt .4"],
		auto: 10000
	});
});

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("main-menu");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace
	(" over", "");
   }
   }
  }
 }
}
window.onload=startList;
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
