// JavaScript Document
			var animateTime=1000;
			var liWidth=0;
			var animation=true;
			var clickvar=0;
			var show_town=0;
			var show_town_body=1;
			var out_z=0;
			
			$(document).ready(function(){ 
									   var show_survey=0;
									   if(show_survey==1){
									   		pop_view_iframe('/ru/survey/','');
									   }
									  
									   
									   $("body").click(function () {									   		
										 	if(show_town_body==1){
										 		$("#drop").hide();
										 		show_town=0;									 		
										 	}
										 	else{
										 		show_town_body=1;
										 	}
										 });
									   $("a#prev").click(function(){
																  //alert("click");
																 //alert(animation);
																  if (animation==true)
																  {
																  moveRight();																	  
																}
																  return false;
																  })
									   $("a#next").click(function(){
																	 // alert("click");
																	  //alert(animation);
																  if (animation==true)
																  {
																  moveLeft();
																  }
																  return false;
																  })
									   getLiWidth();
									   $("#seltown").click(function () {
										 	 if(show_town==0){
											 	$("#drop").show();
											 	show_town=1;
											 	show_town_body=0;
										 	 }
										 	 else{
											 	$("#drop").hide();									
											 	show_town=0;
											 	show_town_body=1;
										 	 }
										 	 
										 });
									   $("#drop").click(function () {
									   		show_town_body=0;
									   });
									 
									 
									   var ofsetLeftIdeal=-(liWidth-$(".bzContCar").width());
									   var  ofsetLeft=$(".bzContCar div").offset().left-$(".bzContCar").offset().left;
									   if (ofsetLeftIdeal<=ofsetLeft){
											$("#right_slide").attr("src","/images/spacer.gif");
									   }		
			
									   
			});
			function getLiWidth()
			{
									   $(".bzContCar div div.item").each(function (index) {
																liWidth=liWidth+$(this).width();															
																			});
			}
			function moveLeft ()
			{		
			//alert(animation);
					
					var ofsetLeftIdeal=-(liWidth-$(".bzContCar").width());
					var  ofsetLeft=$(".bzContCar div").offset().left-$(".bzContCar").offset().left;
					if (ofsetLeftIdeal<=ofsetLeft)
					{						
						animation=false;
						var left=$(".bzContCar div").offset().left-$(".bzContCar div div").eq(0).width()-$(".bzContCar").offset().left;
						$(".bzContCar div.animate").animate({"left": left}, animateTime, function(){
																									animation=true;
																									clickvar=clickvar+1;
																								  	if(clickvar>0){						
																											$("#left_slide").attr("src","/images/spacer.gif");
																											$("#prev").removeClass("noHover");
																									}
																									var ofsetLeftIdeal=-(liWidth-$(".bzContCar").width());
																									var  ofsetLeft=$(".bzContCar div").offset().left-$(".bzContCar").offset().left;
																									if (ofsetLeftIdeal>ofsetLeft){
																										$("#right_slide").attr("src","/images/spacer.gif");
																										$("#next").addClass("noHover");
																									}
																								  });
						
						
					}
					
					
			}
			function moveRight ()
			{		
			//alert(animation);
						if(clickvar>0){							
							animation=false;
							var ofsetLeft=$(".bzContCar div").offset().left;
							var ofsetLeftBz=$(".bzContCar").offset().left;	
								var left=$(".bzContCar div").offset().left+$(".bzContCar div div").eq(0).width()-$(".bzContCar").offset().left;
								$(".bzContCar div.animate").animate({"left": left}, animateTime, function(){	animation=true;						
																												clickvar=clickvar-1;
																												if(clickvar==0){						
																													$("#left_slide").attr("src","/images/spacer.gif");
																													$("#prev").addClass("noHover");
																												}
																												var ofsetLeftIdeal=-(liWidth-$(".bzContCar").width());
																												var  ofsetLeft=$(".bzContCar div").offset().left-$(".bzContCar").offset().left;
																												if (ofsetLeftIdeal<=ofsetLeft){
																													$("#right_slide").attr("src","/images/spacer.gif");
																													$("#next").removeClass("noHover");
																												}																										  
																										  });							

						}
			}