$(document).ready(function(){	optionCss();

	$(window).resize(function(){
		optionCss();
	 });
})

function optionCss(){
	$(document).ready(function(){
		$("#carousels").css("left", Math.floor((document.body.clientWidth-984)/2) + 'px');
	});
}

/*>ÁÀÍÍÅÐ --------------------------------------------------------------------*/
var calcPics=6;
var timeVal=5000;
var delayVal=1000;

$(document).ready(function(){
	$("#main_banner_tools A").mouseover(function(){
		if($("#main_banner_cur_pic").html()!=this.id.substr(3))
			$("#"+this.id).css("background", "url(design/images/index/main_banner/main_banner_on.png) no-repeat 0 0");
	});

	$("#main_banner_tools A").mouseout(function(){
		if($("#main_banner_cur_pic").html()!=this.id.substr(3))
			$("#"+this.id).css("background", "url(design/images/index/main_banner/main_banner_off.png) no-repeat 0 0");
	});

	$("#main_banner_tools A").click(function(){
		mainBannerToolsShow(this.id);
	});

	$(window).load(function(){		$("#mbk1").css("background", "url(design/images/index/main_banner/main_banner_on.png) no-repeat 0 0");
		$("#main_banner_loader").hide();
		$("#main_banner").fadeIn(delayVal);
		$("#carousels").hide();
		$("#carousels").css('top','485px');
		$("#carousels").fadeIn(delayVal);
	});

	function mainBannerToolsChange(i)
	{		id=new String(i);

		if($("#mainBannerToolsCurPic").html()!=id.substr(3))
			$("#"+i).css("background", "url(design/images/index/main_banner/main_banner_on.png) no-repeat 0 0");
	}

	window.setTimeout("mainBannerDo();", timeVal);
});

function mainBannerDo(){
	$(document).ready(function(){
		cals=parseInt($("#main_banner_cur_pic").html())+1
		if(cals>calcPics)	cals=1;

		mainBannerToolsShow('mbk'+cals);
		window.setTimeout("mainBannerDo();", timeVal);
	});
}

function mainBannerToolsShow(i)
{
	$(document).ready(function(){		$("#main_banner IMG").hide();
		$("#main_banner_tools SPAN").hide();

		id=new String(i);
		id.substr(this.id);
		pred=parseInt($("#main_banner_cur_pic").html());
		$("#mb"+pred).css('z-index','1');
		$("#mb"+id.substr(3)).css('z-index','2');
		$("#mb"+pred).show();
		$("#mbt"+id.substr(3)).show();
		$("#mb"+id.substr(3)).fadeIn(delayVal);
		$("#main_banner_cur_pic").html(id.substr(3));

		$("#main_banner_tools A").css("background", "url(design/images/index/main_banner/main_banner_off.png) no-repeat 0 0");
		$("#mbk"+id.substr(3)).css("background", "url(design/images/index/main_banner/main_banner_on.png) no-repeat 0 0");
	});
}

/*<ÁÀÍÍÅÐ --------------------------------------------------------------------*/


/*>ÊÀÐÓÑÅËÜ ------------------------------------------------------------------*/
function mycarousel_initCallback(carousel)
{
    carousel.buttonNext.bind('click', function() {
        carousel.scroll(carousel.first + 1, true);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.scroll(carousel.first - 1, true);
    });

    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
	jQuery('#carousel').jcarousel({		scroll:1,
/*        auto: 3,*/
        wrap: 'circular',
        animation: 800,
        initCallback: mycarousel_initCallback});
});
/*<ÊÀÐÓÑÅËÜ ------------------------------------------------------------------*/
