$(document).ready( function() {
	// Flash;
	$("#flash").flash({
		src: "/templates/flash/car1.swf",
		width: "920",
		height: "390",
		wmode: "transparent"
	});
	var id = $('#tabid').val();
	var no1 = Number($('#tabno1').val());
	var no2 = Number($('#tabno2').val());
	// Показать меню;
	$("#catalog").show();
	// Скроллинг меню;
	$("#carousel1").jCarouselLite({ btnNext: ".next1", btnPrev: ".prev1", vertical: false, visible: 7, start: no1 });
	$("#carousel2").jCarouselLite({ btnNext: ".next2", btnPrev: ".prev2", vertical: false, visible: 7, start: no2 });
	// Спрятать вкладку;
	$(".tabcon").hide();
	$("#tabcon"+id).show();
	// Слайдер;
	$("#anyClass").jCarouselLite();
	// Подсветка;
	$("#anyClass li").css('opacity','0.5');
	$("#anyClass li").mouseover( function() {
	    $(this).css('opacity','1');
	});
	$("#anyClass li").mouseout( function() {
    	$(this).css('opacity','0.5');
	});
	// Подсветка меню;
	$(".carousel li").mouseover( function() {
		if (!$(this).hasClass("iselect"))
    		$(this).css("background","url('/templates/images/up.gif')");
	});
	$(".carousel li").mouseout( function() {
		if (!$(this).hasClass("iselect"))
    		$(this).css("background","none");
	});
	// ;
	$(".carousel_ li").bind('click', function () {
		$(".carousel li").removeClass("iselect");
		$(".carousel li").css("background","none");
		$(this).addClass("iselect");
		$(this).css("background","url('/templates/images/upselect.gif') repeat-x");
		$("#center2").load($("a",this).attr('href') + ' #center2', {}, function() { $('#imgmax').pngFix(); } );
		return false;
	});
	$("#menu_ a").mouseover( function() {
		if (!$(this).hasClass("select")) {
		    $(".img1",this).hide();
		    $(".img2",this).show();
		    //$(".img1",this).css("display","none");
    		//$(this).css("background","green");
        }
	});
	$("#menu_ a").mouseout( function() {
		if (!$(this).hasClass("select")) {
		    $(".img1",this).show();
		    $(".img2",this).hide();
		    //jQuery(".img2",this).css("display","none");
    		//$(this).css("background","none");
        }
	});
	// PNG;
	var tid = Number($('#tabid').val());
	$('#tabcon'+tid).pngFix();
	$('#imgmax').pngFix();
	$('.imgpng').pngFix();
});

// ;
function any() {
	// Слайдер;
	$("#anyClass").jCarouselLite();
	// Подсветка;
	$("#anyClass li").css('opacity','0.5');
	$("#anyClass li").mouseover( function() {
	    $(this).css('opacity','1');
	});
	$("#anyClass li").mouseout( function() {
    	$(this).css('opacity','0.5');
	});
}

// Вкладки;
function tab(id) {
	jQuery('#catalog-top div a').addClass('dashed');
	jQuery('#tab'+id+' a').removeClass();
	jQuery('#tab'+id+' a').addClass('no');
	jQuery('#catalog-top div').removeClass();
	jQuery('#catalog-top div').addClass('unselect');
	jQuery('#tab'+id).removeClass();
	jQuery('#tab'+id).addClass('select');

	jQuery('.tabcon').hide();
	jQuery('#tabcon'+id).show();

	jQuery('.jarrow').hide();
	jQuery('.prev'+id).show();
	jQuery('.next'+id).show();

	// PNG;
	$('#tabcon'+id).pngFix();
}
// Смена изображений;
function loadimg(file) {
	$("#img").attr({
		src: "/files/images/catalog/"+file+"-mid.jpg"
	});
	$("#a").attr({
		href: "/files/images/catalog/"+file+"-max.jpg"
	});
}
function loadimg2(file) {
	$("#img").attr({
		src: "/files/images/producers/"+file+"-mid.jpg"
	});
	$("#a").attr({
		href: "/files/images/producers/"+file+"-max.jpg"
	});
}
function loadimg3(file) {
	$("#img").attr({
		src: "/files/images/portfolio/"+file+"-mid.jpg"
	});
	$("#a").attr({
		href: "/files/images/portfolio/"+file+"-max.jpg"
	});
}

// ;
function showlist(id) {
	$("#list"+id).toggle();
	$('#a'+id).toggleClass('dashed-title');
	$('#a'+id).toggleClass('dashed-no');
}
// ;
function mod(group,producer,model) {
	$('#load').show();
	$('#mod').load('/systems/includes/php/mod.php', { 'group': group, 'producer': producer, 'model': model }, function() {
		$('#load').hide();
	});
}
// ;
function selectflash(i) {
	// Flash;
	$("#flash").html('');
	if (i==1) {
		$("#b1").attr("src","/templates/images/b1s.gif");
		$("#b2").attr("src","/templates/images/b2.gif");
		$("#b3").attr("src","/templates/images/b3.gif");
		$("#flash-select").css("top","360px");
		$("#flash").flash({
			src: "/templates/flash/car1.swf",
			width: "920",
			height: "390",
			wmode: "transparent"
		});
	} else if (i==2) {
		$("#b1").attr("src","/templates/images/b1.gif");
		$("#b2").attr("src","/templates/images/b2s.gif");
		$("#b3").attr("src","/templates/images/b3.gif");
		$("#flash-select").css("top","590px");
		$("#flash").flash({
			src: "/templates/flash/car2.swf",
			width: "900",
			height: "650",
			wmode: "transparent"
		});
	} else if (i==3) {
		$("#b1").attr("src","/templates/images/b1.gif");
		$("#b2").attr("src","/templates/images/b2.gif");
		$("#b3").attr("src","/templates/images/b3s.gif");
		$("#flash-select").css("top","550px");
		$("#flash").flash({
			src: "/templates/flash/car3.swf",
			width: "900",
			height: "600",
			wmode: "transparent"
		});
    }
}