$(document).ready(function(){
	/* боковой блок с проектами на внутренних */
	$("div#b1l,div#b2i,div#b3i").css("display","none");
	
	var animationInProcess = false;
	
	$('.accordion .head').mouseover(function() {
	  if (animationInProcess)
	    return false;
	
	  if ($(this).prev().css('display') == 'none') {
	    animationInProcess = true;
  		$('.accordion .section').slideUp('fast');
	  	$(this).prev().slideDown('fast', function() {
	  	  animationInProcess = false;
	  	});
	  	
	  	$('.accordion .head').removeClass('active');
	  	$(this).addClass('active');
  	}
		return false;
	})
	
	$('.accordion .section').hide();
	$('.accordion .section:first').show();
	$('.accordion .head:first').addClass('active')
	
	/* красный текстовый блок на главной */
	$('.redaccordion .head').mouseover(function() {
	  if (animationInProcess)
	    return false;
	    
	  if ($(this).next().css('display') == 'none') {
	    animationInProcess = true;
  		$('.redaccordion .section').slideUp('fast');
	  	$(this).next().slideDown('fast', function() {
	  	  animationInProcess = false;
	  	});
	  	
	  	$('.redaccordion .head').removeClass('active');
	  	$(this).addClass('active');
  	}
		return false;
	})
	
	$('.redaccordion .section').hide();
	$('.redaccordion .section:first').show();
	$('.redaccordion .head:first').addClass('active')
	
	
	/* * * * * * * */
	
	$("#section2, #section3").css("display","none");
	
	$('#head1').mouseover(function() {
		$("#section1").css("display","block");
		$("#section2, #section3").css("display","none");		
	})
	
	$('#head2').mouseover(function() {
		$("#section2").css("display","block");
		$("#section1, #section3").css("display","none");		
	})	
	
	$('#head3').mouseover(function() {
		$("#section3").css("display","block");
		$("#section2, #section1").css("display","none");		
	})	
	
	
	/* всплывающие контакты */
	$("div#Contacts").css("display","none");
	$("span.HBText2").mouseover(function(){
        $("span#cblink").removeClass("HBText2");
		//$("div#Contacts").fadeIn("fast");
		$("div#Contacts").css("display","block");
		
	});

	$("div#Contacts").mouseover(function(){
		$("div#Contacts").css("display","block");
	 }).mouseout(function(){
		$("div#Contacts").css("display","none");
		$("span#cblink").addClass("HBText2");
    });
		
	/* прозрачность фона на главной */
	$("div.MPRT1,div.MPRT2").css("opacity","0.6");
	$(".BlankSpace").css("opacity","0");
	
	/* картинки в шапке на главной странице */	
    $('#jc').cycle({
        fx: 'scrollHorz',
        prev: '#toleft',
        next: '#toright,.BlankSpace',
        timeout: 0,
		after: onAfter
    });
	function onAfter(){
		var cont = $('#jc img').index(this);
		$('#jcadress > div').hide().filter("div:eq("+cont+")").show();
		$('#jcname > div').hide().filter("div:eq("+cont+")").show();
	};
	
	/* кнопки на картинках на главной */
	$("div.MPRT1,div.MPRT2,div.MPRT3,div.MPRT4,div.MPRT5,div.MPRT6,div.MPRT5_,div.MPRT6_,div.BlankSpace").css("display","none");

/*	$("div.MPR, div.MPRT4, div.MPRT3, div.MPRT2, div.MPRT1").mouseover(function(){
		$("div.MPRT1,div.MPRT2,div.MPRT3,div.MPRT4,div.MPRT5,div.MPRT6,div.MPRT5_,div.MPRT6_").css("display","block");
	}).mouseout(function(){
		$("div.MPRT1,div.MPRT2,div.MPRT3,div.MPRT4,div.MPRT5,div.MPRT6,div.MPRT5_,div.MPRT6_").css("display","none");
    });
*/

	$("div.MPR").mouseover(function(){
		//$("div.MPRT1,div.MPRT2,div.MPRT3,div.MPRT4,div.MPRT5,div.MPRT6,div.MPRT5_,div.MPRT6_,div.BlankSpace").fadeIn("fast");
		$("div.MPRT1,div.MPRT2,div.MPRT3,div.MPRT4,div.MPRT5,div.MPRT6,div.MPRT5_,div.MPRT6_,div.BlankSpace").css("display","block");
	}).mouseout(function(){
		$("div.MPRT1,div.MPRT2,div.MPRT3,div.MPRT4,div.MPRT5,div.MPRT6,div.MPRT5_,div.MPRT6_,div.BlankSpace").css("display","none");
    });
	
	$("div.MPRT4, div.MPRT3, div.MPRT2, div.MPRT1,div.BlankSpace").mouseover(function(){
		$("div.MPRT1,div.MPRT2,div.MPRT3,div.MPRT4,div.MPRT5,div.MPRT6,div.MPRT5_,div.MPRT6_,div.BlankSpace").css("display","block");
	}).mouseout(function(){
		$("div.MPRT1,div.MPRT2,div.MPRT3,div.MPRT4,div.MPRT5,div.MPRT6,div.MPRT5_,div.MPRT6_,div.BlankSpace").css("display","none");
    });

	$("div.MPRT1,div.MPRT2,div.MPRT3,div.MPRT4,div.MPRT5,div.MPRT6,div.MPRT5_,div.MPRT6_,div.BlankSpace").mouseover(function(){
        $("div.MPRT1,div.MPRT2,div.MPRT3,div.MPRT4,div.MPRT5,div.MPRT6,div.MPRT5_,div.MPRT6_,div.BlankSpace").css("display","block");
	});	

});
