function Is() {
  var agent = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);
  this.ns = ((agent.indexOf('mozilla')!=-1) && 
    ((agent.indexOf('spoofer')==-1) && 
    (agent.indexOf('compatible') == -1)));
  this.ns2 = (this.ns && (this.major == 3));
  this.ns3 = (this.ns && (this.major == 3));
  this.ns4b = (this.ns && (this.minor < 4.04));
  this.ns4 = (this.ns && (this.major >= 4));
  this.ie = (agent.indexOf("msie") != -1);
  this.ie3 = (this.ie && (this.major == 2));
  this.ie4 = (this.ie && (this.major >= 4));
  this.op3 = (agent.indexOf("opera") != -1);
  this.win = (agent.indexOf("win")!=-1);
  this.mac = (agent.indexOf("mac")!=-1);
  this.unix = (agent.indexOf("x11")!=-1);
}

var is = new Is();

function	findLayer( name )
{
    if( is.ns4 )
	return document.layers[name];
    if( is.ie4 )
	return document.all[name];
    return false;
}

function	findObj( name )
{
    if( is.ns4 )
	return document.all[name];
    if( is.ie4 )
	return document[name];

    return false;
}

function	moveLayer( layer, x, y )
{
  if( layer ){
    if(is.ns4)
      layer.moveTo(x,y);
    if(is.ie4){
      layer.style.left = x;
      layer.style.top = y;
    }
  }
}

function	moveLayerBy( layer, dx, dy )
{
    if( layer ){
	if(is.ns4)
	    memos.moveBy( dx, dy );
	else{
	    memo_style.posLeft += dx;
	    memo_style.posTop += dy;
	}
    }
}

function	getAll(obj)
{
    var	to_return = "";
    var	to_return2 = "";
    for( var prob in obj ){
	if( obj[prob] )
	    to_return += ""+prob+"="+obj[prob]+"\n"
	else
	    to_return2 += "["+prob+"]";
    }
    return to_return+to_return2;
}

function	getLayerInfo( layer )
{
    var	to_return = new Object();
    if( layer ){
	if( is.ns4 ){
	    to_return.left = layer.left;
	    to_return.top = layer.top;
	    to_return.width = layer.clip.width;
	    to_return.height = layer.clip.height;
	}else{
	    to_return.left = layer.style.posX;
	    to_return.top = layer.style.posY;
	    to_return.width = layer.clientWidth;
	    to_return.height = layer.clientHeight;
	}
	return to_return;
    }
    return false;
}
