$(document).ready( function() {
							
	// Flash;
/*	$("#flash_collection1").flash({
		src: "/templates/flash/01.swf",
		width: "1145",
		height: "550",
		wmode: "transparent"
	});
		
	$("#flash_collection2").flash({
		src: "/templates/flash/02.swf",
		width: "1150",
		height: "550",
		wmode: "transparent"
	});
		
		
	$("#flash_collection3").flash({
		src: "/templates/flash/03.swf",
		width: "1145",
		height: "550",
		wmode: "transparent"
	});
		

	$("#flash_collection5").flash({
		src: "/templates/flash/05.swf",
		width: "1150",
		height: "550",
		wmode: "transparent"
	});
	$("#flash_collection7").flash({
		src: "/templates/flash/07.swf",
		width: "1150",
		height: "550",
		wmode: "transparent"
	});
				
		
	$("#flash_collection8").flash({
		src: "/templates/flash/08.swf",
		width: "1145",
		height: "550",
		wmode: "transparent"
	});
		
	$("#flash_collection10").flash({
		src: "/templates/flash/10.swf",
		width: "1100",
		height: "550",
		wmode: "transparent"
	});
	
	$("#flash_collection11").flash({
		src: "/templates/flash/11.swf",
		width: "617",
		height: "375",
		wmode: "transparent"
	});
	
	$("#flash_collection13").flash({
		src: "/templates/flash/13.swf",
		width: "594",
		height: "404",
		wmode: "transparent"
	});

	$("#flash_collection9").flash({
		src: "/templates/flash/09.swf",
		width: "505",
		height: "400",
		wmode: "transparent"
	});

	$("#flash_collection12").flash({
		src: "/templates/flash/12.swf",
		width: "695",
		height: "270",
		wmode: "transparent"
	});

	$("#flash_collection6").flash({
		src: "/templates/flash/06.swf",
		width: "1145",
		height: "550",
		wmode: "transparent"
	});
	
	$("#flash_collection4").flash({
		src: "/templates/flash/04.swf",
		width: "445",
		height: "350",
		wmode: "transparent"
	});*/	
	
		
		
	// Подсветка групп;
	$("div.group").hover(
		function() {
			if (!$("img",this).hasClass("group-select")) {
				$("img",this).removeClass("group-out");
				$("img",this).addClass("group-in");
	        }
		}, function() {
			if (!$("img",this).hasClass("group-select")) {
				$("img",this).removeClass("group-in");
				$("img",this).addClass("group-out");
	        }
		}
	);
	// Подсветка групп 2;
	$("div.top-item div").hover(
		function() {
			$("img",this).css("top","-112px");
		}, function() {
			$("img",this).css("top","0px");
		}
	);
	// Подсветка новостей;
	$("div.news-main").hover(
		function() {
			//$("div.new-announce",this).css("font-style","italic");
			$("div.new-announce",this).css("text-decoration","underline");
			$("div.new-date",this).css("background-image","url('/templates/images/date-select.gif')").css("color","#e9c99a");
		}, function() {
			//$("div.new-announce",this).css("font-style","");
			$("div.new-announce",this).css("text-decoration","");
			$("div.new-date",this).css("background-image","url('/templates/images/date.gif')").css("color","#634715");
		}
	);
	// Всплывающие подсказки (убрать);
//	$("div.top-text").hover(
//		function() {}, function() {
//			$(this).hide();
//		}
//	);


});

//;






function fleshka(){
	
	$("#flash_collection1").flash({
		src: "/templates/flash/01.swf",
		width: "1145",
		height: "550",
		wmode: "transparent"
	});
		
	$("#flash_collection2").flash({
		src: "/templates/flash/02.swf",
		width: "1150",
		height: "550",
		wmode: "transparent"
	});
		
		
	$("#flash_collection3").flash({
		src: "/templates/flash/03.swf",
		width: "1145",
		height: "550",
		wmode: "transparent"
	});
		

	$("#flash_collection5").flash({
		src: "/templates/flash/05.swf",
		width: "1150",
		height: "550",
		wmode: "transparent"
	});
	$("#flash_collection7").flash({
		src: "/templates/flash/07.swf",
		width: "1150",
		height: "550",
		wmode: "transparent"
	});
				
		
	$("#flash_collection8").flash({
		src: "/templates/flash/08.swf",
		width: "850",
		height: "600",
		wmode: "transparent"
	});
		
	$("#flash_collection10").flash({
		src: "/templates/flash/10.swf",
		width: "1100",
		height: "550",
		wmode: "transparent"
	});
	
	$("#flash_collection11").flash({
		src: "/templates/flash/11.swf",
		width: "678",
		height: "412",
		wmode: "transparent"
	});
	
	$("#flash_collection13").flash({
		src: "/templates/flash/13.swf",
		width: "723",
		height: "406",
		wmode: "transparent"
	});

	$("#flash_collection9").flash({
		src: "/templates/flash/09.swf",
		width: "552",
		height: "431",
		wmode: "transparent"
	});

	$("#flash_collection12").flash({
		src: "/templates/flash/12.swf",
		width: "706",
		height: "412",
		wmode: "transparent"
	});

	$("#flash_collection6").flash({
		src: "/templates/flash/06.swf",
		width: "1145",
		height: "550",
		wmode: "transparent"
	});
	
	$("#flash_collection4").flash({
		src: "/templates/flash/04.swf",
		width: "445",
		height: "350",
		wmode: "transparent"
	});	

	
	
	}






















function tops(id) {
  $("div.top-text").hide();
  $("#top-text"+id).show().load('/units/php/_top.php', { 'id': id } );  
}

function tops2(id) {
  $("div.top-text2").hide();
  $("#top-text2"+id).show().load('/units/php/_top.php', { 'id': id } );  
}

//;
function topsout() {
  $("div.top-text").hide();
}

// Количество;
function plus(id) {
	var value = Number($('#count'+id).val());
	if (value < 99) $('#count'+id).val(value+1); else $('#count'+id).val(99);
}
function minus(id) {
	var value = Number($('#count'+id).val());
	if (value > 1) $('#count'+id).val(value-1); else $('#count'+id).val(1);
}
// Заказ;
function order(id) {
	var value = Number($("#count"+id).val());
	$("#load"+id).show();
	$("#order"+id).load("/units/php/_order.php", { id: id, count: value }, function() {
    $("#catalog-menu").load('/catalog/ #catalog-menu', {}, function() {
		  $("#load"+id).hide();
    });
	});
	$("#count"+id).val(1);
}
function order2(id) {
	var value = Number($("#count"+id).val());
	$.post("/units/php/_order.php", { id: id, count: value }, function() {
    $("#catalog-menu").load('/catalog/ #catalog-menu');
  });
	$("#order1_"+id).html('<span class="min">&nbsp;</span>');
	$("#order2_"+id).html('<span class="min">Товар добавлен в <a href="/basket/">корзину</a></span>');
	$("#count"+id).val(1);
}
// Обновить заказ;
function order_sum() {
	$("#basket").load("/basket/ #sum");
}
// Обновить заказ;
function order_sum2() {
	$("#basket").load("/dealers/ #sum");
}



// Изменить товар;
function order_edit(id) {

	var price = Number($("#price"+id).val());
	var count = Number($("#count"+id).val());
	if ((count>=0) && (count<=99)) {
		$("#sum"+id).load("/units/php/_order.php", { order_edit: true, id: id, price: price, count: count }, function() { order_sum(); });
	} else {
		$("#count"+id).val("1");
	}
}

// Изменить товар;
var sum_itogo = 0;
function order_edit2(id) {

	var price2 = Number($("input[name='block"+id+"']:checked").val());
	var price = Number($("#price"+id).val());
	var count = Number($("#count"+id).val())*price2;
	$("#hidden_count"+id).val(count);
	var sum = count*price;
	if ((count>=0) && (count<=9999)) {
	$("#sum"+id).html("<strong>"+sum+" Р</strong>");
	$("#hidden_sum"+id).val(sum);
	sum_itogo = sum_itogo + sum;
	$("#itogo").html("<strong> "+sum_itogo+" Р</strong>");
	$("#hidden_itogo").val(sum_itogo);
	} else {
		alert("кол-во товаров от 0 до 9999");
		$("#count"+id).val("0");
		$("#sum"+id).html("<strong>0 Р</strong>");
		$("#hidden_sum"+id).val("0");
	}
}



// Удалить товар;
function order_delete(id) {
	$("#basket"+id).hide();
	$.post("/units/php/_order.php", { order_delete: true, id: id } );
}
// Список товаров;
function group_list(id) {
	if ($("#group_list"+id).hasClass("open")) {
		//$("#group_list"+id).hide();
    	$("#group_list"+id).slideUp("slow");
		$("#group_list"+id).removeClass("open");
    	$("a","#group_name"+id).removeClass("open");
    } else {
    	//$("div.group_list").hide();
    	$("div.group_list").slideUp("slow");
		$("#group_list"+id).slideDown("slow");
    	$("div.group_list").removeClass("open");
    	$("#group_list"+id).addClass("open");
    	$("a","div.group_name").removeClass("open");
    	$("a","#group_name"+id).addClass("open");
    }
}
// Смена коллекции;
function topset(id) {
	$("div.group img").removeClass("group-select");
	$("div.group img").addClass("group-out");
	$("img","#group"+id).removeClass("group-in");
	$("img","#group"+id).addClass("group-select");
	$("#top").css("background","url('/templates/images/top-load.gif') 50% 50% no-repeat");
	$("#top").html('<img id="topimg" src="/templates/images/groups/'+id+'.png" alt="" class="hidden" onload="$(\'#topimg\').width(640).height(410); $(\'#top\').css(\'background\',\'\');">');
	
	$(".top_main").hide();
	$("#main_tops"+id).show();	
	
}

// Добавить город;
function ncity() {
  $("#newcity").show();
}



var radio = 0;

function send_form() {
	if (radio == 0){

		var empty = $(".required2").css({border: "1px solid  #A8A090", backgroundColor: "#ffffff"}).filter('[value=""]');
		if(empty.size()) {
			empty.css({border: "1px solid #f00", backgroundColor: "#f1cdcd"});
			$("#outt").html("<font color=red>Заполните все обязательные поля</font>");
		} else {
			$("#outt").html("<font color=green>Успешно ! Успешно ! Успешно ! Успешно ! Успешно !</font>").slideUp(1000, function(){$('#vhod').submit();});
			// Посылаем данные формы любым доступным способом
		}
	}
	else {

		var empty = $(".required").css({border: "1px solid  #A8A090", backgroundColor: "#ffffff"}).filter('[value=""]');
		if(empty.size()) {
			empty.css({border: "1px solid #f00", backgroundColor: "#f1cdcd"});
			$("#outt").html("<font color=red>Заполните все обязательные поля</font>");
		} else {
			$("#outt").html("<font color=green>Успешно !</font>").hide(1000, function(){$('#vhod').submit();});
			// Посылаем данные формы любым доступным способом
		}
		}

}

function send_ost() {
 $('#ost').submit();
}




var radio2 = 0;

function send_form2() {
	if (radio2 == 0){

		var empty = $(".required2").css({border: "1px solid  #A8A090", backgroundColor: "#ffffff"}).filter('[value=""]');
		if(empty.size()) {
			empty.css({border: "1px solid #f00", backgroundColor: "#f1cdcd"});
			$("#outt2").html("<font color=red>Заполните все обязательные поля</font>");
		} else {
			$("#outt2").html("<font color=green>Успешно ! Успешно ! Успешно ! Успешно ! Успешно !</font>").slideUp(1000, function(){$('#registr').submit();});
			// Посылаем данные формы любым доступным способом
		}
	}
	else {

		var empty = $(".required").css({border: "1px solid  #A8A090", backgroundColor: "#ffffff"}).filter('[value=""]');
		if(empty.size()) {
			empty.css({border: "1px solid #f00", backgroundColor: "#f1cdcd"});
			$("#outt2").html("<font color=red>Заполните все обязательные поля</font>");
		} else {
			$("#outt2").html("<font color=green>Успешно !</font>").hide(1000, function(){$('#registr').submit();});
			// Посылаем данные формы любым доступным способом
		}
		}

}









