$(document).ready(function(){
	
	$("#charc h4").click(function(){$(this).next().slideToggle();});
	
	$(".fin_auto_bl .act").hover(function() {
$(this).animate({top:'-211px',left:'0'}, 500 );
 }, function() {
 $(this).animate({top:'0',left:'0'}, 500 );
 });

});
function complect(num,price,price2,mid) {
$("#calc_mid").val(mid);
$("#calc_vznos").val(parseInt(price2*0.1));
$("#head_price .complect_text span").css('display','none');
$("#head_price .complect_text #comp"+num).css('display','block');
$("#head_price .price2").html(price);
$("#head_price .complect li").removeClass("active");
$("#head_price .complect li.id"+num).addClass("active");
$("#head_price #calc_price").val(price2);

}
function oncolorpic(model,color,str_color) {
$('#color_pictures').css('backgroundImage', 'url(/images.tpl/loading.gif)');

var heavyImage = new Image();
heavyImage.src = "/images.col/"+model+"/"+color+"big.jpg";
heavyImage.onload = function() {
$('#color_pictures').css('backgroundImage', 'url(' + heavyImage.src + ')');
$('#bl_color .textcolor span').html(str_color);
$('#head_color .tit b').html(str_color);
};


}
function DisplKuzov(typ) {
$('#head_price').css('backgroundPosition','50% 100px');
$('#head_price').css('backgroundImage', 'url(/images.tpl/loading.gif)');
var heavyImage = new Image();

	if(typ=='sedan') {
$("#head_price .complect li").css('display','none');
$("#head_price .complect li.sedan").css('display','block');
heavyImage.src = "/images.page/chance_price.jpg";
heavyImage.onload = function() {
$('#head_price').css('backgroundPosition', 'left top');
$('#head_price').css('backgroundImage', 'url(/images.page/chance_price.jpg)');
}
	}
	else {
$("#head_price .complect li").css('display','none');
$("#head_price .complect li.hatch").css('display','block');
heavyImage.src = "/images.page/chance_hatch_price.jpg";
heavyImage.onload = function() {
$('#head_price').css('backgroundPosition', 'left top');
$('#head_price').css('backgroundImage', 'url(/images.page/chance_hatch_price.jpg)');
}
	}
}

function main_bg(model) {
var curadr=$('#mainbg').css('backgroundImage');
var par_pattern=eval("/"+model+"/i"); var prov1=par_pattern.test(curadr); 	
if(prov1==false) {
var start = new Date().getTime();
$('body.mainpage').css('backgroundImage', 'none');
$('body.mainpage').css('backgroundColor', 'black');
$("#mainbg").animate({opacity: 0}, 200,function(){
var heavyImage = new Image();
if($.browser.msie)
heavyImage.src = "/images.page/main/"+model+".jpg?"+start;
else
heavyImage.src = "/images.page/main/"+model+".jpg";
heavyImage.onload = function() {
$('#mainbg').css('backgroundImage', 'url(' + heavyImage.src + ')');
$("#mainbg").animate({opacity: 1},200);
}
});

if(model=='daewoo') $("#startpage").attr('href','/uzdaewoo.html');
if(model=='chance') $("#startpage").attr('href','/autochance.html');
if(model=='tagaz') $("#startpage").attr('href','/tagaz.html');
if(model=='gelly') $("#startpage").attr('href','/geely.html');
if(model=='hyundai') $("#startpage").attr('href','/hyundai.html');
}
}


function mycarousel_initCallback(carousel) {
    jQuery('.arr_right').bind('click', function() {
      carousel.next();
        return false;
  });

    jQuery('.arr_left').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        scroll: 1,
        initCallback: mycarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
	});
});
