var scrollingObj = null;
var scrollSpeed = 100;
var scrollMove = 0;
var timeOut = null;

function scrollArea(objHat, move)
{
	objHat=document.getElementById("mscrolldiv");
	ceaseScroll();
	scrollMove = move;
	doScroll(move);

}

function doScroll(height)
{
	allheight = document.getElementById("allheight");	
    allheight = parseInt('-'+allheight.value);


	scrollingObj=document.getElementById("imagesdiv");	
	topdiv=document.getElementById("imagesdiv2");
	var oldtop = parseInt(topdiv.style.top);

	var newTop = (scrollMove + oldtop);
	//alert(newTop+' - '+allheight);

	//alert(newTop + topdiv.offsetHeight+' - '+newTop)
	if ((newTop + topdiv.offsetHeight) <0)
	{ 
		ceaseScroll();
		return false;
	} 
	if (parseInt(newTop) == parseInt(allheight))
	{
		ceaseScroll();
		return false;
    }
    
	if (newTop > 0)
	{
        topdiv.style.top = '0px';
	} else {
    	topdiv.style.top = newTop + 'px';
    }
	
	if (timeOut) clearTimeout(timeOut);
	timeOut = setTimeout('doScroll()',scrollSpeed);

  //  recount();
}

function ceaseScroll()
{
	scrollingObj = null;
	scrollMove = 0;
	if (timeOut) clearTimeout(timeOut);
}

/*
function recount(direction) {

	var h;
	obj=document.getElementById("input1");


    topdiv=document.getElementById("imagesdiv2");
    topdivheight = parseInt(topdiv.style.top);
    
    alert()

    if (topdivheight < -240)
    {
        h = topdivheight / 240;
         if (parseInt(h) != h)
         {
             h = h+'aaa';
             h_new = parseInt(h.substr(1,2));
             h = h_new +1;             
         }
    } else {
        h = 1;
    }

    obj.innerHTML= h;

	if (direction == 'down' && h > 1 ) {

    } else if (topdivheight == -240){
        h = parseInt(h);
        h = h+1;


		h = h - 1;
		obj.innerHTML= h;
	}

	if (direction == 'up') {
		h = h + 1;
		obj.innerHTML= h++;
	}
}
*/

function str(id,num) {

	obj=document.getElementById(id);	

    if (id == 's1')
    {
        if (num == 1)
        {
            obj.src = "images/str_up_on.gif";
        } else {
            obj.src = "images/str_up.gif";
        }
    }

    if (id == 's2')
    {
        if (num == 1)
        {
            obj.src = "images/str_down_on.gif";
        } else {
            obj.src = "images/str_down.gif";
        }
    }

}
