$(document).ready(function()
{
	//$(this).pngFix();
	
	function highlightNo(arg) 
	{
		var caller = arg;
		var number = caller.getCurrentID();
		if(number==0) {
			$("#previous").attr("disabled", "disabled");
			$("#next").removeAttr("disabled");
		} else {
			$("#next, #previous").removeAttr("disabled");
		}
		
		$("#counter li a").removeClass("homescroller-pag-active");
		$("#counter li a:eq("+(number+0)+")").addClass("homescroller-pag-active");
	}							
	
	mcarousel = $("#mycarousel").msCarousel({
												boxClass:'div.home_scoller-item', 
												height:250, 
												width:710, 
												callback:highlightNo, 
												autoSlide:5000
											}).data("msCarousel");
	
	//add event on number
	$("#counter li a:not('.buttons')").click(function() {
		if(mcarousel!=undefined) 
		{
			var no = $(this).html();
			mcarousel.goto(parseInt(no)-1);
		}
	});
	$("#counter li a").mouseover(function() {
		if(mcarousel!=undefined) 
		{
			mcarousel.pause();
		}
	});
	$("#counter li a").mouseout(function() {
		if(mcarousel!=undefined) 
		{
			mcarousel.play();
		}
	});	
});
