// JavaScript Document


function xGetElementById(e)
{
  if(typeof(e)=='string') {
    if(document.getElementById) e=document.getElementById(e);
    else if(document.all) e=document.all[e];
    else e=null;
  }
  return e;
}

function xStyle(sProp, sVal)
{
  var i, e;
  for (i = 2; i < arguments.length; ++i) {
    e = xGetElementById(arguments[i]);
    if (e.style) {
      try { e.style[sProp] = sVal; }
      catch (err) { e.style[sProp] = ''; } // ???
    }
  }
}

function BorderEffect( style_on, style_off, firstElement)
{
	this.styleOn = style_on;	
	this.styleOff = style_off;	
	this.currentId = firstElement;
	this.fixedId = firstElement;
	
	this.apply = function(id) {
		if(this.currentId != this.fixedId)
		  xStyle( 'backgroundImage', this.styleOff, this.currentId );
		xStyle( 'backgroundImage', this.styleOn, id);
		this.currentId = id;
	};

	this.out = function() {
		if(this.currentId != this.fixedId)
		  xStyle( 'backgroundImage', this.styleOff, this.currentId );
	}

	this.fix = function(id) {
	  xStyle('backgroundImage', this.styleOff, this.fixedId);
	  xStyle('backgroundImage', this.styleOn, id);
	  this.fixedId = id;
	};
}
