function obzor(id,path)
	{ 
		if ($("#comments").css("display")=="none") {openComments(id,path);}
		else 
			if($("#rep"+id+" span").hasClass("open")==true) {closeComments("","",'');}
			else {closeComments("open",id,path);}
	}

function openComments(ids, path)
	{
var div_path='';
for (var j=0; j<path.length; j++)
{if (path[j]!=''){div_path+='<img src="'+path[j]+'" />';}}

$("#slide1").html("<div style='position:relative; margin:0px auto;'>"+div_path+"</div>");



$('#slide1 div').cycle({ 
    fx:      'fade', 
    speed:    600, 
    timeout:  8000
});
	
$("#knopki").fadeOut(800,function(){ 
$("#slide1").fadeIn(1200,function(){

	
$("#comments").html($("#id"+ids+" .comments").html()).fadeIn(800,function(){
																			$("#knopki").fadeIn(500);
																			$("#knopki a span").removeClass();
																			$("#rep"+ids+" span").addClass("open"); return false;
																		});
		});
});
}



function closeComments(par,id,path) {
$("#knopki").fadeOut(800,function(){
	$("#comments").fadeOut(600,function(){
										$("#slide1").fadeOut(800,function(){	
														if (par=="open") {
																$("#slide1").cycle('stop').empty();
																$("#knopki a span").removeClass();
																openComments(id,path);}
														else {
															/*
																$("#knopki").fadeIn(800,function(){
																	$("#slide1").cycle('stop').empty();
																	$("#knopki a span").removeClass();
																});
															*/
																openComments(1,'');
														
														}
																			
							});
												});
									});

}

$(document).ready(function(){


function SizeEcran() {
	var de = document.documentElement, 
		h = self.innerHeight || ( de && de.clientHeight ) || document.body.clientHeight;
		//	w = self.innerWidth || ( de && de.clientWidth ) || document.body.clientWidth;
		//alert (self.innerHeight+" "+de.clientHeight+" "+document.body.clientHeight);
		if (h<900) {h=900};
	$("#slide1").css({width:'100%',height:h+'px'});
	$("#ecran").css({height:(h-5)+'px'});
	 
}

$(window).resize(function(){
  SizeEcran();
});

/****************************************/
SizeEcran();
$("#main_logo").css("display","block");
$("#svet").animate({top:'50px', left:'-300px'}, 700,'linear')
			.animate({top:'50px', left:'-400px'}, 600,'linear')
			.animate({top:'-150px', left:'-430px'}, 900,'linear')
			.animate({top:'-350px', left:'-300px'}, 1000,'linear')
			.animate({top:'-350px', left:'-200px'}, 700,'linear')
			.animate({top:'-100px', left:'-200px'}, 700,'linear',function(){
			$("#svet").css({width:'0px',height:'0px',top:'0px',left:'0px'});
			
			$("#main_logo,#korr_sloy").animate({width:'195px', height:'182px'}, 300,'linear',function(){
							$("#ecran").css({'width':'100%'});
							$("#nebo").css({'display':'block'});

						//	$("html").css({'overflow':'auto' });

							$("#korr_sloy").css({'width':'236px','height':'250px'}).append('<a href="'+$('#id1 a.next').attr("href")+'" title="'+$("#id1 a").attr("title")+'" id="logo_small"></a>');
					
								$("#logo_small").fadeIn(500,function(){
										$("#slide1").fadeIn(800,function(){
										
											$("#ecran").css({'width':'100%'});
											$("#slide1").css({"display":"none",'background-image': 'none'})
										


																var counter=0;
															  $('#knopki div').each(function(){
																  var el=$(this);
																  setTimeout(function(){el.fadeIn(300)},counter*800);
																  counter+=1; 
															  });
																														
											}).css("display","block");
										
		

							$("#step_rolik").css("display","none");
							obzor(1,'');
							$("#menu_top").animate({"top":"0px"}, 1800,'linear',function(){
								$("#menu_top ul").fadeIn(1800);

									});
				
						
					});
				});
		
			
			});
			
	
});
