var check = (document.all == '[object]' || document.all == '[object Collection]');

function start(){
	defWin();
	defHod();
	fsetLayer();
	tentoText.visibility = (check) ? 'visible' : 'hidden';
    def_doraz();
}

var winWidth = 0;
var winHeight = 0;
var defLeft = 0;
var defTop = 10;
var xtimer = 0;
var vstep = (check) ? 7 : 2;    
var timer =5;
var defxrect = 440;             
var defyrect = 0;
var defheight = 240;            
var ytop = 0;
var xrect = defxrect;
var yrect= defyrect;

function ftext(up_do) {
	if (xtimer != 0) {
		clearTimeout(xtimer);
	}
	difer = (check) ? 80 : 65;
	if ((up_do == '01') && (yrect < (doraz - defheight))){
		ytop    -= vstep;
		yrect	+= vstep;
	} else if((up_do == '10') && ((yrect + vstep + defheight) > defheight)){
		ytop    += vstep;
		yrect	-= vstep;
	}	
	fsetLayer();
	xtimer = setTimeout('ftext(\'' + up_do + '\');', timer);
}

function text_up(){
	ytop = 0;
	yrect = 0;
	fsetLayer();
}

function text_down() {
	ytop = defheight - doraz;
	yrect = doraz - defheight;
	fsetLayer();
}

function fStop() {
	if (xtimer != 0){
		clearTimeout(xtimer);
	}
	xtimer = 0;
}

function def_doraz() {
	doraz = (check) ? document.all.text.offsetHeight : document.text.layers[0].clip.height;
}

function defWin(){
	winWidth = (check) ? document.body.clientWidth : window.innerWidth;
	winHeight = (check) ? document.body.clientHeight : window.innerHeight;
}

function defHod(){
	defLeft = 58;            
	defTop = 5;    
}

function fsetLayer() {
	tentoText = (check) ? document.all.text.style :document.text;
	tentoText.left = defLeft + 5;
	textTop = defTop + ytop;
	cl_top = yrect.toString();
    cl_right = xrect.toString();
    cl_left = (xrect - defxrect).toString();
    cl_bot = (yrect + defheight).toString();
	if (check)	{
    	tentoText.top = textTop;
    	tentoText.clip = 'rect(' + cl_top + ' ' + cl_right + ' ' + cl_bot + ' ' + cl_left + ')';
	} else {
		tentoText.top = textTop;
		tentoText.clip.top = cl_top;
		tentoText.clip.right = cl_right;		
		tentoText.clip.bottom = cl_bot;
		tentoText.clip.left = cl_left;
	}
}