function blink(id, delay) {
	this.obj = "blinkObj" + blink.count++;
	eval(this.obj + " = this ");
	this.css = ( document.getElementById? document.getElementById( id ).style : (document.all? document.all.fooImg.style : document.layers.fooImg ) );
	if( !this.css && !document.layers ) 
		alert( 'Errore: non trovo il DIV con id="' + id + '"' );
	this.delay = delay || 1000;
	this.blinking = false;
	
	this.setDelay = function( delay ) {
		this.delay = delay; 
	}
	
	this.isBlinking = function() {
		return this.blinking; 
	}

	this.start = function() {
		if(this.isBlinking()) 
			return false;
		else 
			this.go(); 
		return true; 
	}
	
	this.go = function() {
		this.blinking = true;
		if(this.isVisible()) 
			this.hide();
		else 
			this.show();
		this.timer = setTimeout(this.obj + ".go()", this.delay);
	}
	
	this.isVisible = function() {
		return (this.css.visibility == "visible" || this.css.visibility == "show"); 
	}
	
	this.hide = function() {
		this.css.visibility = (document.layers? "hide" : "hidden");  
	}
	
	this.show = function() {
		this.css.visibility = (document.layers? "show" : "visible"); 
	}

	this.stop = function() {
		this.show();
		this.blinking = false;
		clearTimeout(this.timer);
	}

	return this;
}
blink.count = 0;

