function myclock(){
ndata=new Date(); secs= ndata.getSeconds();
if (secs==0) mins = mins+1; if (mins==60) { hours=hours+1;  mins=0;  } 
hours=(hours==24)? 0:hours; 
hours2=(hours < 10)?"0"+hours:hours;  
mins2= (mins < 10 )?"0"+mins:mins;  
datastr ='<div class="cloktwo"></div><div class="rtoch">'+hours2+'</div><div class="toch">'+toc+'</div><div class="rtoch">'+mins2+'</div>';
toc = (toc==":") ? '&nbsp;' : ':';$("#clockexam").html(datastr+' ');setTimeout("myclock()", 1000);
}

function panorams_viwe(bg){
	
	$('#content_loading').hide(); 
	$('#bcknew').show();
	
	var imageWidth = 0;
	
	imgPreloader = new Image();
    imgPreloader.onload = function(){
    	imgPreloader.onload = null;
		imageWidth = imgPreloader.width;
		 sizes = imageWidth;					
	}
						
	imgPreloader.src = bg;
	
	
	$('#conta_img').css('backgroundImage','url('+bg+')'  ); 
	
}

var e=0;
var er=0;
var sr=0;
var start = start ? start : 0;
$(document).ready(function() {
	

	var sloi = 0;

	$(".arrleft").mouseover(function() { er = 0; e = 1; runIt2(+2,1); });
	$(".arrright").mouseover(function() {  er = 0; e = 1; runIt2(-2,1); });
	//$(".arrow").mouseup(function() { e = 0; });
	$(".arrow").mouseout(function() { e=0; er=0; removeRandomGo(); });
	//setTimeout("setRandomGo()", 5000);
	
});


	function getRand(min, max){
		return Math.round(Math.random()*(max-min))+min;
	}

	function setRandomGo() {
		if (!e) {
			er=1;
			sr=0;
			var pos = getRand(0, 2) <=1 ? -1 : 1;
			runIt2(pos, getRand(100, 500));
			setTimeout("removeRandomGo()", getRand(100, 5000));
		}
	}
	
	function removeRandomGo() {
		er=0;
		if (!e) { if (!sr) setTimeout("setRandomGo()", 5000); sr = 1;
		} else setTimeout("removeRandomGo()", 5000); 
	}




function runIt2(pos, speed) {
	if (e || er) {
		var p = parseInt($('#bcknew .conta').css('marginLeft'))+pos;
		p = ( p > 0 ) ? 0 : p;
		p = ( p < -(sizes-580) ) ? -(sizes-580) : p;
		
		$('#bcknew .conta').css('marginLeft', p+'px');
		setTimeout("runIt2("+pos+","+speed+")", speed);
	}
}

function toggles2(id, id2, id3){ $('#'+id).hide(); $('#'+id3).hide(); $('#'+id2).show(); }

function toggles5(id){ $('#uslugi_dop_1').hide(); $('#uslugi_dop_2').hide(); $('#uslugi_dop_3').hide(); $('#uslugi_dop_4').hide(); $('#'+id).show();  }
function toggles4(id, typ){ if (typ==1)	 $('#'+id).show(); else  $('#'+id).hide();  }

function toggles(id){	$('#'+id).toggle(); }
function toggles3(id, id2){ $('#bcknew').hide(); $('#content_loading').show();   $('#cont2v').css('backgroundImage','url('+ id2+')'  );
$('#cont2_2').css('backgroundImage','url('+ id2+')'  ); } 


var img = 3,
img_i = 1;				  						  
function scroll_image()
{
			$("#cont2_2").css('backgroundPosition', ' 0px '+ ((img_i)*560)+'px');
			
	 		$("#cont2v").animate({opacity: "hide"}, "slow", function(){											  
				$("#cont2v").css('backgroundPosition', ' 0px '+ (img_i*560)+'px');
				img_i++;  
	 		});
			
			$("#cont2v").animate({opacity: "show"}, "slow"); 
			
			if (img_i > img) { img_i=0; }

 			setTimeout("scroll_image()",7000);
}		
 


var img2 = 5,
img_i2 = 1;				  					  
function scroll_image2()
{
			$("#cont2_2").css('backgroundPosition', ' 0px '+ ((img_i2)*560)+'px');
			
	 		$("#cont2v").animate({opacity: "hide"}, "slow", function(){
				$("#cont2v").css('backgroundPosition', ' 0px '+ (img_i2*560)+'px'); 
				img_i2++;  
	 		});
			
			$("#cont2v").animate({opacity: "show"}, "slow"); 
			
			
			if (img_i2 > img2) { img_i2=0; }

 			setTimeout("scroll_image2()",7000);
}
