$(document).ready(
	function() {
		$('#vline').height($('#left_p').height());
			// массив описаний тортов (нулевой пустой)
		var descr_arr = [
			"",
			"For a warm and intimate wedding reception, consider our romantic ideas for a multi-tier wedding cake. -- Click on any picture to view more detail.",
			"This most perfectly balanced peach flavored wedding cake is uniquely decorated according to your specifications. -- Click to order and fill out a simple form.",
			"Reflect romance in your classic wedding cake. Our classic apricot and raspberry vanilla butter cake. -- Click to choose.",
			"An elegant 3-tier hazelnut butter cake, displayed as a centerpiece at the wedding reception table. -- Click to select.",
			"This impressive lemon butter cake layered with lemon buttercream, handmade lemon curd and raspberry preserves. -- Click here to choose.",
			"An exciting birthday cake recipe: chocolate fudge with butter cream icing. -- Click to view more detail.",
			"The pinnacle of the birthday party will be this beautiful chocolate cake frosted with a chocolate buttercream. -- Click to view the detailed description.",
			"The classically scrumptious combination of chocolate and fudge make our triple-chocolate cake a sure hit.",
			"We will decorate an outstanding birthday treat for you that your son's or daughter's classmates won't soon forget. -- Click to select and view cake detail.",
			"Make your sweet peach's birthday a blast with our yummy chocolate fudge cake. -- Just click here to view the cake details and to order. Or call 617-332-4445."
		];
			
		var num = 10; // количество картинок в слайд-шоу
		var ipic = 1;
		var ipicc = 0;
		var sshow = true;
		var ssh = $('#slideshow');
		var descrip = $('#descr');
		var descr_text = $('#descr .descr_text');
		var descrip_transp = $('#descr .transp');
		descrip_transp.css('opacity', '0.7');
		var descr_chk = true;
		ssh.append('<img src="i/slideshow/pic2.jpg" alt="" id="picdown"/>');
		var hobj1 = $('#picup');
		var hobj2 = $('#picdown');
		setint();
		
		function setint() {
			var intervale = setInterval(function() {
			//if(sshow) {
				ipic=ipic+1;
				if(!sshow) {descrip.animate({'height': '0px'}, 200);}
				descr_text.text(descr_arr[ipic]);
				hobj1.animate({'opacity':0}, 1000, function() { 
					ipicc = ipic+1;
					hobj1.attr('src','i/slideshow/pic'+ipic+'.jpg');
					//ssh.animate({'height':hobj1.height()}, 1000);
					ssh.attr('href','/view-all-cakes/?inn=true&cake_pos='+ipic);
					hobj1.animate({'opacity':1}, 1000, function() {hobj2.attr('src','i/slideshow/pic'+ipicc+'.jpg');} );
					if (ipic==num) {ipic=0;ipicc=1;}
				});
			//}	
			}, 7000);
		}
		
		if(descr_chk) {
			ssh.hover(
				function(){
					sshow = true;
					descr_chk = false;
					descrip.animate({'height': '50px'}, 500);
					return false;
				},
				function(){
					sshow = false;
					//descr_chk = false; descrip.animate({'height': '0px'}, 500, function() {descr_chk=true;return false;});
				}
			);
		}
	});
	
