﻿jQuery(document).ready(function(){
	

	if(!jQuery('#container').is('.book')){
		jQuery('#deco-3.mainanim').height(jQuery('#deco-3.mainanim').height());
		jQuery('#deco-5.mainanim,#content.mainanim').css('opacity',0);
		jQuery('#deco-4.mainanim').hide().slideDown(2000,function(){ jQuery('#deco-3').height('auto'); });
		jQuery('#deco-5.mainanim').delay(2000).animate({opacity:1},1000,function(){ jQuery('#content.mainanim').animate({opacity:1},1000); });
	}
	
/*
	jQuery('#head').flash({
		'src':'flash/head.swf',
		'width':'100%',
		'height':'293'
	});
	jQuery('#menu').flash({
		'src':'flash/menu.swf',
		'width':'952',
		'height':'49'
	});
	jQuery('#container.book').flash({
		'src':'flash/tabakov_book_946x615.swf',
		'width':'946',
		'height':'615'
	});
	*/
	
	jQuery('div.block-slide >h2 a').click(function(){
		jQuery(this).toggleClass('open').parents('h2').next().slideToggle();
		return(false);
	});
	
	
	/*swfobject.embedSWF("flash/head.swf", "head", "100%", "293", "8.0.0", "flash/expressInstall.swf");
	swfobject.embedSWF("flash/menu.swf", "menu", "952", "49", "8.0.0", "flash/expressInstall.swf");
	
	swfobject.embedSWF("flash/tabakov_book_946x615.swf", "container", "952", "49", "8.0.0", "flash/expressInstall.swf");*/
});



function switchBlocks(docID, oElement){


aCont = oElement.innerHTML;

var months=["null","Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"];

//liCont = oElement.parentNode.innerHTML;
//alert(oElement.parentNode.parentNode.childNodes[2].innerHTML);

	for (var i=1; i<=12; i++){

		divName = "month" + i;
		if (document.getElementById(divName)){
			document.getElementById(divName).style.display = "none";
		}

		liName = "monthLi" + i;
		if (document.getElementById(liName)){
			document.getElementById(liName).innerHTML = '<a href="#" onClick="switchBlocks('+i+', this);return false;">'+months[i]+'</a>';
		}	

	}

	curBlockID = "month" + docID;
    curLiID = "monthLi" + docID;
	document.getElementById(curBlockID).style.display = "block";
//	oElement.parentNode.innerHTML = "<strong>"+ aCont +"</strong>";
	document.getElementById(curLiID).innerHTML = "<strong>"+ aCont +"</strong>";

}

/*
function closeBook(){
	jQuery('#book').animate({opacity:'hide'},600,function(){ jQuery('#shadow').animate({opacity:'hide'},600); });
}
*/
function closeBook(){
    jQuery('#book').hide();
    jQuery('#shadow').animate({opacity:'hide'},600);
}

/*
$('#shadow').hide().animate({opacity:'show'},1000,function(){
        jQuery('#book >div').flash({
            'src':'flash/artists.swf',
            'width':'946',
            'height':'615',
            'wmode':'transparent'
        });
    });*/
