function show_colors_one_page()
{
	nw = window.open("","nw");
	var colors_content = document.getElementById("colors_loop").innerHTML;
	nw.document.write("<html><head><link REL='StyleSheet' href='../../style.css' type='text/css'><script type='text/javascript' src='/highslide/highslide-full.js'></script><script type='text/javascript'> hs.outlineType = 'rounded-white'; hs.showCredits = false; </script></head>"+colors_content+"</html>");
	nw.document.close();
}

function show_basket_info()
{
	if($('.cart').length) 
	{
		$.post("/cgi-bin/dsp.pl", { cl: "order", event: "show_basket_info", rnd: Math.random(), utf8: 1 }, 
		function(data) {
			$('.cart').html(data);
		});	
	}
}

$(document).ready(function(){
	hs.showCredits = false;
	
	show_basket_info();
	$("select[name=delivery_cities_id]").change(function show_delivery_info()
	{
		
		var delivery_cities_id = $('select[name=delivery_cities_id] option:selected').val();
		var weight = $('input[name=weight]').val();
		
		$.post("/cgi-bin/dsp.pl", { cl: "search", event: "show_delivery_info", delivery_cities_id: delivery_cities_id, weight:weight, rnd: Math.random(), utf8: 1, ajax:1 }, 
		function(data) {
			if(data != '')
			{
				$('.delivery_info').html(data);
				$('.delivery_info').show('fast');
			}
			else
			{
				$('.delivery_info').hide('fast');
			}
		});	
	});	
	$("select[name=sub_fabric]").change(function search_cat_fabric()
	{
		var fabric_id = $('select[name=sub_fabric] option:selected').val();
		var catalog_id = $('#cat_id').val();
		window.location.href = '/cgi-bin/dsp.pl?cl=search&event=cat_fabric&fabric_id='+fabric_id+'&catalog_id='+catalog_id;
	});
	$("select[name=sub_country]").change(function search_cat_country()
	{
		var country_id = $('select[name=sub_country] option:selected').val();
		var catalog_id = $('#cat_id').val();
		window.location.href = '/cgi-bin/dsp.pl?cl=search&event=catalog_country&country_id='+country_id+'&catalog_id='+catalog_id;
	});
	
	// обязательное поле email
	show_required_email();	
	show_required_email_pay();	
	$("input[name='delivery_method']").change(show_required_email);
	$("input[name='pay_method']").change(show_required_email_pay);
}); 
 
 function show_required_email(){
	if($("input:radio.need_email:checked").val() && $("input[name=varemail]").val() == ''){
		$('.user_email_in_delivery').show('fast');
	}
	else{
		$('.user_email_in_delivery').hide('fast');
	} 
}
	function show_required_email_pay(){
	if($("input:radio.need_email_pay:checked").val() && $("input[name=varemail]").val() == ''){
		$('.user_email_in_pay').show('fast');
	}
	else{
		$('.user_email_in_pay').hide('fast');
	}
}
