new Image().src = "http://counter.yadro.ru/hit?r"+
escape(document.referrer)+((typeof(screen)=="undefined")?"":
";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?
screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+
";"+Math.random();

function mycarousel_initCallback(carousel)
{
	carousel.buttonNext.bind('click', function() {
		carousel.startAuto(0);
	});

	carousel.buttonPrev.bind('click', function() {
		carousel.startAuto(0);
	});

	carousel.clip.hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});
};

function reInitPretty() {
	$('.pp_pic_holder').remove();
	$('.pp_overlay').remove();
	$('.ppt').remove();
	$("a[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook'});
}

jQuery(document).ready(function(){
	    jQuery("._blank a").click(function(){
	        window.open(this.href);
	        return false;
	    });
	});

jQuery(document).ready(function(){
	    jQuery(".h1-box + :header").addClass("h-first-child");
	});

jQuery(document).ready(function(){
	    jQuery(".private-cab-p a").click(function(){
			if ($(".private-cab").css('display') == 'none') {
				$('#inner-cabinet').load('_cabinet.php', function() {
					$('.private-cab').add('.private-cab-fon').show();
					var h = $('#inner-cabinet').height();
					var l = $(window).height()-2*30-60;
					if (h > l) h = l;
					var d = 350-h;
					$('.private-cab .content-page').height($('.private-cab .content-page').height()-d);
					$('.private-cab').height($('.private-cab').height()-d);
					$('.private-cab-fon').height($('.private-cab-fon').height()-d);
					reInitPretty();
				});
			}
			else {
				$('.private-cab').add('.private-cab-fon').hide();
				$('#inner-cabinet').empty();
				$('.private-cab .content-page').height(350);
				$('.private-cab').height(360);
				$('.private-cab-fon').height(400);
			}
	    });
	});

jQuery(document).ready(function(){
	$('.adder').submit(function() {
		var form = $(this).find('input[type="submit"]');
		$.post(
			'_a_to_cart.php',
			$(this).serializeArray(),
			function (data) {
				var offset = form.offset();
				$('body').append('<div id="cart_informer" style="position:absolute;z-index:1000;left:'+(offset.left-50)+'px;top:'+(offset.top-25)+'px;border:3px solid #7A1310;background-color:white;"><h3 style="margin:0;padding:15px;white-space:nowrap;color:#7A1310;text-align:center;">Товар добавлен<br>в корзину!</h3></div>');
				setTimeout(function() {
					$('#cart_informer').fadeOut('fast',  function() {
						$(this).remove();
						$('input[name^="sizes"]').val('');
					});
				},2000);
			}
		);
		return false;
	})
});

jQuery(document).ready(function() {
	jQuery('.slideshow').cycle();
});

$(function() {
	$("a[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook'});
});

window.onload = function() {
	jQuery('#mycarousel').show();
	jQuery('#mycarousel').jcarousel({
		scroll:1,
		auto: 5,
		wrap: 'last',
		initCallback: mycarousel_initCallback
	});
}
