//script
var n = (document.layers) ? 1:0;
var ie = (document.all) ? 1:0;
var loop, timer1, timer2;
var clip_top,clip_bottom;
var clip_left,clip_right;
var len_h;
var len_v;

function makeObj(obj,nest){

    //var nest=(!nest) ? '':'document.'+nest+'.'   
    this.css=(n) ? eval('document.'+nest+'.document.'+obj):eval(obj+'.style');
    len_h=(n) ? this.css.clip.bottom : parseInt(eval(obj+'.style.height'));
    len_v=(n) ? this.css.clip.right : parseInt(eval(obj+'.style.width'));
    clip_top=0;
    clip_left=0;
    clip_bottom=(n) ? eval('document.'+nest+'.clip.bottom') : parseInt(eval(nest+'.style.height'))-1;
    clip_right=(n) ? eval('document.'+nest+'.clip.right') : parseInt(eval(nest+'.style.width'))-1;

    this.up=goUp;
    this.down=goDown;
    this.tright=goRight;
    this.tleft=goLeft;

    this.obj = obj + "Object";
    eval(this.obj + "=this");
    return this;

}

function goDown(speed) {

    clearTimeout(timer1);clearTimeout(timer2);
    if((clip_bottom - parseInt(this.css.top)) < len_h ) {
        this.css.top=parseInt(this.css.top)-10;
    }  else {
	return;
    }
    if(loop) timer1=setTimeout(this.obj+".down("+speed+")",speed);
}



function goUp(speed){

    clearTimeout(timer2);clearTimeout(timer1);
    if( parseInt(this.css.top) < clip_top ) {
	this.css.top=parseInt(this.css.top)+10;
    } else {
	return;
    }
    if(loop) timer2=setTimeout(this.obj+".up("+speed+")",speed);

}

function goRight(speed) {

    clearTimeout(timer1);clearTimeout(timer2);
    if((clip_right - parseInt(this.css.left)) < len_v ) {
        this.css.left=parseInt(this.css.left)-10;
    }  else {
	return;
    }
    if(loop) timer1=setTimeout(this.obj+".tright("+speed+")",speed);
}

function goLeft(speed){

    clearTimeout(timer2);clearTimeout(timer1);
    if( parseInt(this.css.left) < clip_left ) {
	this.css.left=parseInt(this.css.left)+10;
    } else {
	return;
    }
    if(loop) timer2=setTimeout(this.obj+".tleft("+speed+")",speed);

}

function mask(scroll,clip) {

    maskObj=makeObj(scroll,clip);


}

//-->
