// JavaScript Document

$(document).ready(function(){
	$('#myRoundabout').roundabout({
		shape: 'figure8',
		minOpacity: 1,				
		btnNext: '#bt-next',
		btnPrev: '#bt-previous'
	}); 
	
	$(".carousel").jCarouselLite({ visible: 1, start: 0, scroll: 1, speed: 300, btnNext: ".carousel .ic_next2", btnPrev: ".carousel .ic_prev2" });
	$(".carousel1").jCarouselLite({ visible: 1, start: 0, scroll: 1, speed: 300, btnNext: ".carousel1 .ic_next2", btnPrev: ".carousel1 .ic_prev2" });
	$(".carousel2").jCarouselLite({ visible: 1, start: 0, scroll: 1, speed: 300, btnNext: ".carousel2 .ic_next2", btnPrev: ".carousel2 .ic_prev2" });
	$("#novelty").css("width", "274px");

	$("#fixed_goods .lenta").jCarouselLite({ visible: 1, start: 0, scroll: 6, speed: 300, btnNext: ".ic_next", btnPrev: ".ic_prev" });
	$("#fixed_goods .lenta").css("width", "910px");
	
	$(".fixed_shadow").css("display", "none");
	$("#fixed_goods .back_block").css("display", "none");
	if ($.browser.msie) {
		$("#fixed_goods .close_panel").click( function() { $(".fixed_shadow").css("display", "none"); $(".fixed_links span").removeClass("act"); $("#fixed_goods").removeClass("show_back"); $("#fixed_goods .back_block").hide(); } );
		$(".fixed_links span").click( function() { $("#fixed_goods").addClass("show_back"); $(this).addClass("act"); $("#fixed_goods .back_block").show(); $(".fixed_shadow").css("display", "block"); } );
	} 
	else {
		$("#fixed_goods .close_panel").click( function() { $(".fixed_shadow").css("display", "none"); $(".fixed_links span").removeClass("act"); $("#fixed_goods").removeClass("show_back"); $("#fixed_goods .back_block").fadeOut(300); } );
		$(".fixed_links span").click( function() { $("#fixed_goods").addClass("show_back"); $(this).addClass("act"); $("#fixed_goods .back_block").fadeIn(450); $(".fixed_shadow").css("display", "block"); } );
	}

	$(".options span.pseudo").click( function() { $(".advanced").slideToggle(); } );

});


	function number_format( number, decimals, dec_point, thousands_sep ) {
		var i, j, kw, kd, km;
		if(number==5000)number=3000;
		if( isNaN(decimals = Math.abs(decimals)) ){
			decimals = 2;
		}
		if( dec_point == undefined ){
			dec_point = ",";
		}
		if( thousands_sep == undefined ){
			thousands_sep = ".";
		}
		i = parseInt(number = (+number || 0).toFixed(decimals)) + "";
		if( (j = i.length) > 3 ){
		j = j % 3;
		} else{
		j = 0;
		}
		km = (j ? i.substr(0, j) + thousands_sep : "");
		kw = i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands_sep);
		kd = (decimals ? dec_point + Math.abs(number - i).toFixed(decimals).replace(/-/, 0).slice(2) : ""); 
		return km + kw + kd;
	}
