function InitLayer(layer,x,y,l,t,r,b) {
    if (ie) { v=document.all[layer].style; }
    if (nn) { v=document[layer]; }
    if (moz){ v=document.getElementById(layer).style; }		
    
    v.LayerName=layer;
    
    v.Moving=0;
    v.Scrolling=0;
    
    v.DefPosX=x;
    v.DefPosY=y;
    v.DefClipLeft=l;
    v.DefClipTop=t;
    v.DefClipRight=r;
    v.DefClipBottom=b;
    
    v.NowClipLeft=l;
    v.NowClipTop=t;
    v.NowClipRight=r;
    v.NowClipBottom=b;
    
    return v;
}

function SetMoveStepY(v,s) {	v.MoveStepY=s; }
function SetMoveStepX(v,s) {	v.MoveStepX=s; }
function SetMoveDelay(v,d) {	v.MoveDelay=d; }

function DefPlaceLayer(v) {
    if (Loading==0) {
	v.top=v.DefPosY;
	v.left=v.DefPosX;
	ClipLayer(v,v.DefClipLeft,v.DefClipTop,v.DefClipRight,v.DefClipBottom);
	if (ie) { v.visibility="visible"; }
	if (nn) { v.visibility="show"; }
	if (moz) { v.visibility="visible"; }
    }
}

function ClipLayer (v,l,t,r,b) {
    if (Loading==0) {
	if (ie || moz) { v.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)" }
	if (nn) { 
	    v.clip.left = l;
	    v.clip.top = t;
	    v.clip.right = r;
	    v.clip.bottom = b;
	}
    }
}

function MoveByStepUp(v) { v.top=parseInt(v.top)-v.MoveStepY; }
function MoveByStepDown(v) { v.top=parseInt(v.top)+v.MoveStepY; }

function SlideUp(v) {
    if (Loading==0) {
	MoveAction=1;
	CurrentMovingLayer=v;
	CurrentMovingLayer.MovingTO=this.setTimeout("MoveByStepUp2a()",CurrentMovingLayer.MoveDelay);
    }
}

function SlideDown(v) { 
    if (Loading==0) {
	MoveAction=1;
	CurrentMovingLayer=v;
	CurrentMovingLayer.MovingTO=this.setTimeout("MoveByStepDown2a()",CurrentMovingLayer.MoveDelay);
    }
}

function MoveByStepUp2a() { 
    CurrentMovingLayer.top=parseInt(CurrentMovingLayer.top)-CurrentMovingLayer.MoveStepY;
    CurrentMovingLayer.Moving=1;
    CurrentMovingLayer.MovingTO=this.setTimeout("MoveByStepUp2a()",CurrentMovingLayer.MoveDelay);
}

function MoveByStepDown2a() { 
    CurrentMovingLayer.top=parseInt(CurrentMovingLayer.top)+CurrentMovingLayer.MoveStepY;
    CurrentMovingLayer.Moving=1;
    CurrentMovingLayer.MovingTO=this.setTimeout("MoveByStepDown2a()",CurrentMovingLayer.MoveDelay);
}

function StopMove() {
    if (Loading==0) {
	if (MoveAction==1) {
	    if (CurrentMovingLayer.Moving==1) {
		clearTimeout(CurrentMovingLayer.MovingTO);
		CurrentMovingLayer.Moving=0;
		MoveAction=0;
	    }
	}
    }
}


function MoveDefaults(v) {
    if (Loading==0) {
	DeltaX=v.NowClipLeft-v.DefClipLeft;
	DeltaY=v.NowClipTop-v.DefClipTop;
	v.left=v.DefPosX-DeltaX;
	v.top=v.DefPosY-DeltaY;
    }
}

function MoveLayer(v,x,y) {
    v.top=y;
    v.left=x;
}

function SetScrollStepY(v,s) {	v.ScrollStepY=s; }
function SetScrollStepX(v,s) {	v.ScrollStepX=s; }
function SetScrollDelay(v,d) {	v.ScrollDelay=d; }
function SetScrollHeight(v,h) {	v.ScrollHeight=h; }

function ScrollByStepUp(v) {
    v.top=parseInt(v.top)-v.ScrollStepY;
    v.NowClipLeft=parseInt(v.NowClipLeft);
    v.NowClipTop=parseInt(v.NowClipTop)+v.ScrollStepY;
    v.NowClipRight=parseInt(v.NowClipRight);
    v.NowClipBottom=parseInt(v.NowClipBottom)+v.ScrollStepY;
    ClipLayer(v,v.NowClipLeft,v.NowClipTop,v.NowClipRight,v.NowClipBottom);
}

function ScrollByStepDown(v) {
    v.top=parseInt(v.top)+v.ScrollStepY;
    v.NowClipLeft=parseInt(v.NowClipLeft);
    v.NowClipTop=parseInt(v.NowClipTop)-v.ScrollStepY;
    v.NowClipRight=parseInt(v.NowClipRight);
    v.NowClipBottom=parseInt(v.NowClipBottom)-v.ScrollStepY;
    ClipLayer(v,v.NowClipLeft,v.NowClipTop,v.NowClipRight,v.NowClipBottom);
}

function StopScroll() { 
    if (ScrollAction==1) { 
	if (CurrentScrollingLayer.Scrolling==1) { 
	    this.clearTimeout(CurrentScrollingLayer.ScrollingTO);
	    CurrentScrollingLayer.Scrolling=0;
	    ScrollAction=0; 
	} 
    }
}

function ScrollUp(v) {
    if (Loading==0) {
	ScrollAction=1; 
	CurrentScrollingLayer=v;
	CurrentScrollingLayer.ScrollingTO=this.setTimeout("ScrollByStepUp2a()",CurrentScrollingLayer.ScrollDelay);
    }
	el = document.getElementById( 'to_the_top' );
	if( el != undefined ){
		el.style.display = 'block';
	}
}

function ScrollDown(v) {
    if (Loading==0) {
	ScrollAction=1; 
	CurrentScrollingLayer=v;
	CurrentScrollingLayer.ScrollingTO=this.setTimeout("ScrollByStepDown2a()",CurrentScrollingLayer.ScrollDelay);
    }
	el = document.getElementById( 'to_the_bot' );
	if( el != undefined ){
		el.style.display = 'block';
	}
}


function ScrollByStepUp2a() {
    if (parseInt(v.DefPosY-v.ScrollHeight)<parseInt(v.top)) {
	CurrentScrollingLayer.top=parseInt(CurrentScrollingLayer.top)-CurrentScrollingLayer.ScrollStepY;
	CurrentScrollingLayer.NowClipLeft=parseInt(CurrentScrollingLayer.NowClipLeft);
	CurrentScrollingLayer.NowClipTop=parseInt(CurrentScrollingLayer.NowClipTop)+CurrentScrollingLayer.ScrollStepY;
	CurrentScrollingLayer.NowClipRight=parseInt(CurrentScrollingLayer.NowClipRight);
	CurrentScrollingLayer.NowClipBottom=parseInt(CurrentScrollingLayer.NowClipBottom)+CurrentScrollingLayer.ScrollStepY;
	ClipLayer(CurrentScrollingLayer,CurrentScrollingLayer.NowClipLeft,CurrentScrollingLayer.NowClipTop,CurrentScrollingLayer.NowClipRight,CurrentScrollingLayer.NowClipBottom);
	CurrentScrollingLayer.Scrolling=1;
	CurrentScrollingLayer.ScrollingTO=this.setTimeout("ScrollByStepUp2a()",CurrentScrollingLayer.ScrollDelay);
	} else{
		el = document.getElementById( 'to_the_bot' );
		if( el != undefined ){
			el.style.display = 'none';
		}
	}
}

function ScrollByStepDown2a() {
    if (parseInt(v.top)<v.DefPosY) {
	CurrentScrollingLayer.top=parseInt(CurrentScrollingLayer.top)+CurrentScrollingLayer.ScrollStepY;
	CurrentScrollingLayer.NowClipLeft=parseInt(CurrentScrollingLayer.NowClipLeft);
	CurrentScrollingLayer.NowClipTop=parseInt(CurrentScrollingLayer.NowClipTop)-CurrentScrollingLayer.ScrollStepY;
	CurrentScrollingLayer.NowClipRight=parseInt(CurrentScrollingLayer.NowClipRight);
	CurrentScrollingLayer.NowClipBottom=parseInt(CurrentScrollingLayer.NowClipBottom)-CurrentScrollingLayer.ScrollStepY;
	ClipLayer(CurrentScrollingLayer,CurrentScrollingLayer.NowClipLeft,CurrentScrollingLayer.NowClipTop,CurrentScrollingLayer.NowClipRight,CurrentScrollingLayer.NowClipBottom);
	CurrentScrollingLayer.Scrolling=1;
	CurrentScrollingLayer.ScrollingTO=this.setTimeout("ScrollByStepDown2a()",CurrentScrollingLayer.ScrollDelay);
	} else{
		el = document.getElementById( 'to_the_top' );
		if( el != undefined ){
			el.style.display = 'none';
		}
	}
}


function ScrollDefaults(v) {
    DeltaX=v.NowClipLeft-v.DefClipLeft;
    DeltaY=v.NowClipTop-v.DefClipTop;
    v.left=parseInt(v.left)+DeltaX;
    v.top=parseInt(v.top)+DeltaY;
    v.NowClipLeft=v.DefClipLeft;
    v.NowClipTop=v.DefClipTop;
    v.NowClipRight=v.DefClipRight;
    v.NowClipBottom=v.DefClipBottom;
    ClipLayer(v,v.DefClipLeft,v.DefClipTop,v.DefClipRight,v.DefClipBottom);
}


