/*
-----------------------------------------------------------------
SF2Scroll.js
-----------------------------------------------------------------
Desc:	This functions are scrolling the innerLayer!
		NOTE: You must have the SF2DynamicLayerApiV1_4.js
		In <Body > you need put a onload.. <body onload="initScroll();">
		And you need to have two layer nestled like this:
		<div id="idLayerOut" style="position:absolute; width:180px; height:150px;  z-index:5; left:0px; clip:rect(0, 180, 150, 0); overflow:hidden; top:80px;  visibility:visible;">
			<div id="idLayerIn" style="position:absolute; width:200px;  left:5px; top:0px;">
				You’re content here
			</div>
		</div>
		Okay now to the action:-) put this to a link:
		onMouseover="scrollStart(3);" onMouseout="mouseOut();"
		This is scrolling up. To scroll down you only put -3 instead of 3 like this:
		onMouseover="scrollStart(-3);" onMouseout="mouseOut();"
		If you want the layer to scroll slower then you only change to ex. (2)
		
		To speed up onMouseDown you only put this code to the link:
		onMouseover="scrollStart(3);" onMouseout="mouseOut();" onMouseDown="scrollStart2(2);" onMouseup="mouseUp();"
		
		if you change the name of the layers , then change the variables strLayerOut and strLayerIn to the new name..
		
		This works in:
		IE4x , IE5x , NN4x , N6x
-----------------------------------------------------------------
*/

// Set this 2 variables to the name of the layers !
var strLayerOut = "idLayerOut" //layer 1 (The out-side layer)
var strLayerIn  = "idLayerIn"  //layer 2 (The Layer that you have the content in!)

var intId;
var intId2;
var intHeight;
var posY = 0;
var objRefFirstLayer, objRefSecondLayer;

/*
------------------------------------------------
function initScroll()
------------------------------------------------
Desc:	This function put the referenses to
		objRefSecondLayer and objRefFirstLayer.
		It also gives intHeight the height difrens 
		betwen the two Layers.  
Arg:	none
Ret:	none
------------------------------------------------
*/
function initScroll()
{
	if(NN)
	{
		objRefSecondLayer = document.layers[strLayerOut].document.layers[strLayerIn]; 
	}
	else
	{
		objRefSecondLayer = strLayerIn;
	}
	objRefFirstLayer  = strLayerOut;
	intHeight = getObjHeight(objRefSecondLayer) - getObjHeight(objRefFirstLayer);
}
/*
------------------------------------------------
function scroll()
------------------------------------------------
Desc:	This function moves the layer if there 
		is a need for it
Arg:	intY = number of pixels to move..
Ret:	none
------------------------------------------------
*/
function scroll(intY)
{
	posY += intY;
	if(getObjTop(objRefSecondLayer) >= -intHeight && intY < 0 || getObjTop(objRefSecondLayer) <= 0 && intY > 0)
	{
		moveLayer(objRefSecondLayer, 0, intY);
	}
}
/*
------------------------------------------------
function scrollStart(intY)
------------------------------------------------
Desc:	This function set a interval to move the
		layer 
Arg:	intY = number of pixels to move.
Ret:	none
------------------------------------------------
*/	
function scrollStart(intY)
{
	intId = window.setInterval("scroll("+ intY + ")",30);
}
/*
------------------------------------------------
function scrollStart2(intY)
------------------------------------------------
Desc:	This function set a interval to move the
		layer this is used to speed up the scroll 
Arg:	intY = number of pixels to move.
Ret:	none
------------------------------------------------
*/	
function scrollStart2(intY)
{
	intId2 = window.setInterval("scroll("+ intY + ")",30);
}
/*
------------------------------------------------
function mouseOut()
------------------------------------------------
Desc:	This function clear Interval.
		this must be used onMouseOut to stop the
		scroll.
Arg:	none
Ret:	none
------------------------------------------------
*/	
function mouseOut()
{
	window.clearInterval(intId);
	window.clearInterval(intId2);
}
/*
------------------------------------------------
function mouseUp()
------------------------------------------------
Desc:	This function clear Interval.
		this must be used mouseUp to stop the
		scroll, If scrollStart2() is used onmouseDown
		to speed up the scroll.
Arg:	none
Ret:	none
------------------------------------------------
*/	
function mouseUp()
{
	window.clearInterval(intId2);
}
