function showBigImg(_id,msg_id)
{
if(msg_id)
{
    document.getElementById(msg_id).innerHTML="";
}
    var cont=document.getElementById(_id);
	cont.style.visibility='visible';
}
function insertImage(_id,src)
{
    var img=document.createElement('img');
    img.setAttribute("src",src);
    var cont=document.getElementById(_id);
    if(cont.firstChild!=null)
    cont.removeChild(cont.firstChild);
    cont.appendChild(img);
}
function showBig(_id,src,msg_id,text)
{
    if(msg_id)
	{
	if(text)
		document.getElementById(msg_id).innerHTML=text;
	else
		document.getElementById(msg_id).innerHTML='Идет загрузка...';
	}
    var cont=document.getElementById(_id);
    cont.style.visibility='hidden';
    var img=new Image();
    img.path=src;
	if(msg_id)
    	cont.innerHTML='<img alt="" src="'+src+'" onload="showBigImg(\''+_id+'\',\''+msg_id+'\')"/>';
	else
		cont.innerHTML='<img alt="" src="'+src+'" onload="show(\''+_id+'\')"/>';
} 

var pos=0;
var koef= 1;
var image_width=64;
var count_of_rows=11;
var inter;

var moveUpPos=0;
var moveDownPos=0;

var boolUp=false;
var boolDown=false;

var move_speed=2;

function moveup()
{
boolUp=true;
if(!boolDown)
{
if(moveUpPos>=image_width)
{
clearInterval(inter);
moveUpPos=0;
boolUp=false;
}
moveUpPos++;
var _id='galery_move';
if(pos>=-count_of_rows*koef*image_width)
{
var gal=document.getElementById(_id);
if(!gal.style.top)
{
gal.style.top=0;
}
gal.style.top=parseInt(gal.style.top)-koef;
pos-=koef;
}
else
{
moveUpPos=0;

clearInterval(inter);
boolUp=false;
}
}
}
//*****************************************************
function movedown()
{
//alert(moveUpPos);
boolDown=true;
if(!boolUp)
{
	if(moveDownPos>=image_width)
	{
		clearInterval(inter);
		moveDownPos=0;
		boolDown=false;
	}
	moveDownPos++;
	var _id='galery_move';
	if(pos<0)
	{
		var gal=document.getElementById(_id);
		if(!gal.style.top)
	{
	gal.style.top=0;
	}
		gal.style.top=parseInt(gal.style.top)+koef;
		pos+=koef;
	}
	else
	{
		moveDownPos=0;
		clearInterval(inter);
				boolDown=false;
	}
}
}

function startUp()
{
	if(!boolDown)
	{
		clearInterval(inter);
		inter=setInterval(moveup, move_speed);
	}
}

function startDown()
{
	if(!boolUp)
	{
		clearInterval(inter);
		inter=setInterval(movedown, move_speed);
	}
}
