function getScrollPos()
	{
	var scrolltop=0;
	if(document.documentElement.scrollTop)
  		{
        scrolltop=document.documentElement.scrollTop;
  		}
 	else
 		{
	  	if(window.scrollY)
	  		{
	  		scrolltop=window.scrollY
	  		}
  		}
  	return scrolltop
	}

function showBigFoto(val)
	{
	document.getElementById('waitAlert').style.display='block';
	ots=-16
	scrolltop=getScrollPos();
	ots=ots+scrolltop;
	document.getElementById('waitAlert').style.margin=''+ots+'px 0 0 -16px';

	var img = new Image();
	img.src='files/'+val+'?'+Math.round(Math.random()*10000) ;
	img.onload = function()
		{
	  	var dw= this.width;
	  	var dh = this.height;
	  	document.getElementById('bigFoto').innerHTML='<a href="javascript:void(0)" onclick="closeBigFoto()" class="close">закрыть</a><a href="javascript:void(0)" onclick="closeBigFoto()"><img src="files/'+val+'" alt="" title="" id="imgBig" /></a>';
	  	wrapW=dw+50;
	  	wrapH=dh+50;
	  	dh2=dh/2*(-1);
	 	dh2=dh2+scrolltop;
	  	document.getElementById('bigFoto').style.width=wrapW+'px';
	  	document.getElementById('bigFoto').style.height=wrapH+'px';
	  	document.getElementById('bigFoto').style.margin=''+dh2+'px 0 0 -'+dw/2+'px';
	  	document.getElementById('bigFoto').style.display='block';
	  	document.getElementById('waitAlert').style.display='none';
	  	}
	}

function closeBigFoto()
	{
	document.getElementById('bigFoto').style.display='none';
   	}

tt=1;
sl=6;
function sloyOff()
	{
	if(document.getElementById('sloy-'+tt))
		{
		document.getElementById('sloy-'+tt).style.display='none';
		document.getElementById('b-'+tt).style.background='none';
		}
	}

function but_on(c)
	{
	document.getElementById('b-'+c).style.backgroundImage="url('/images/bullet.jpg')";
	document.getElementById('b-'+c).style.backgroundRepeat="no-repeat";
	document.getElementById('b-'+c).style.backgroundPosition="45px 79px";
	document.getElementById('sloy-'+tt).style.display='block';
	}

function demofunc()
	{
	sloyOff();
	tt++;
	if(tt<=sl) {}
	else
		{
		tt=1;
		}
	but_on(tt);
	}

function func_stop(a)
	{
	clearInterval(interv);
	sloyOff();
	tt=a;
	but_on(tt);
	document.getElementById('sloy-'+tt).style.display='block';
	}

function func_start(b)
	{
	tt=b;
	but_on(tt);
	interv=setInterval('demofunc();', 4000);
	}
