function Is ()
{   // convert all characters to lowercase to simplify testing
	var agt=navigator.userAgent.toLowerCase()

	// --- BROWSER VERSION ---
	this.major = stringToNumber(navigator.appVersion)
	this.minor = parseFloat(navigator.appVersion)

	this.nav  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1)
				&& (agt.indexOf('compatible') == -1)))
	this.nav2 = (this.nav && (this.major == 2))
	this.nav3 = (this.nav && (this.major == 3))
	this.nav4 = (this.nav && (this.major == 4))
	
	//Netscape 6
	this.nav5 =	(this.nav && (this.major == 5))
	this.nav6 = (this.nav && (this.major == 5))
	this.gecko = (this.nav && (this.major >= 5))

	this.ie   = (agt.indexOf("msie") != -1)
	this.ie3  = (this.ie && (this.major == 2))
	this.ie4  = (this.ie && (this.major == 3))
	this.ie5  = (this.ie && (this.major == 4))


	this.opera = (agt.indexOf("opera") != -1)
	 
	this.nav4up = this.nav && (this.major >= 4)
	this.ie4up  = this.ie  && (this.major >= 4)
}


var is = new Is();

function getElt () 
{ if (is.nav4)
  {
	var currentLayer = document.layers[getElt.arguments[0]];
	for (var i=1; i<getElt.arguments.length && currentLayer; i++)
	{   currentLayer = currentLayer.document.layers[getElt.arguments[i]];
	}
	return currentLayer;
  } 
  else if(document.getElementById && document.getElementsByName)
  { 
	var name = getElt.arguments[getElt.arguments.length-1];
	if(document.getElementById(name))					  //First try to find by id
	   return document.getElementById(name);
	else if (document.getElementsByName(name))			 //Then if that fails by name
	   return document.getElementsByName(name)[0];
  }
  else if (is.ie4up) {
	var elt = eval('document.all.' + getElt.arguments[getElt.arguments.length-1]);
	return(elt);
  }

}

function setEltVisibility (elt, value)
{  if (is.nav4) elt.visibility = value;
   else if (elt.style) elt.style.visibility = value;
}

function getEltVisibility (elt)
{  if (is.nav4) 
   {  var value = elt.visibility;
	  if (value == "show") return "visible";
	  else if (value == "hide") return "hidden";
	  else return value;
   }
   else if (elt.style) return elt.style.visibility;
}

function setEltLeft (elt, x) {
  if (is.nav4)	 elt.left=x;
  else if (is.ie4up) elt.style.pixelLeft=x;
  else if (is.gecko) elt.style.left = (x + "px");
}


function getEltLeft (elt) {
  if (is.nav4)	 return (elt.left);
  else if (is.ie4up) return (elt.style.pixelLeft);
  else if (is.gecko) return stringToNumber(elt.style.left);
}

function setEltTop (elt, y) 
{ if (is.nav4)	 elt.top=y;
  else if (is.ie4up) elt.style.pixelTop=y;
  else if (is.gecko) elt.style.top= (y + "px");
}

function getEltTop (elt) 
{ if (is.nav4)	 return (elt.top);
  else if (is.ie4up) return (elt.style.pixelTop);
  else if (is.gecko) return stringToNumber(elt.style.top);
}

function getEltWidth(elt) {

  if (is.nav4) {
	if (elt.document.width)
	  return elt.document.width;
	else
	  return elt.clip.right - elt.clip.left;
  }
  if (is.ie4up) {
	if (elt.style.pixelWidth)
	  return elt.style.pixelWidth;

	else
	  return elt.offsetWidth;
  }
  if (is.gecko) {
	if (elt.style.width)
	  return stringToNumber(elt.style.width);
	else
	  return stringToNumber(elt.offsetWidth);
  }
  return -1;
}

function setEltWidth(elt,wdth)
{
	if(is.nav4)
	{ 
		 elt.document.width = wdth;
	}
	else if(elt.style)
	{ 
		elt.style.width = wdth;
	}
}

function getEltHeight(elt) {
  if (is.nav4) {
	if (elt.document.height)
	  return elt.document.height;
	else
	  return elt.clip.bottom - elt.clip.top;
  }
  if (is.ie4up) {
	if (elt.style.pixelHeight)
	  return elt.style.pixelHeight;
	else
	  return elt.clientHeight;
  }
  if (is.gecko) {
	if (elt.style.height)
	  return stringToNumber(elt.style.height);
	else
	  return stringToNumber(elt.offsetHeight);
  }
  return -1;
}

function setEltHeight(elt,hght)
{
	if(is.nav4)
	{ 
		elt.document.height = hght;
	}
	else if(elt.style)
	{ 
		elt.style.height = hght;
	}
}

function setEltClip (elt, cliptop, clipright, clipbottom, clipleft) 
{ if (is.nav4) {
	elt.clip.left   = clipleft;
	elt.clip.top	= cliptop;
	elt.clip.right  = clipright;
	elt.clip.bottom = clipbottom;
  }
  else if (is.ie4up)  elt.style.clip = 'rect(' + cliptop + ' ' +  
	   clipright + ' ' + clipbottom + ' ' + clipleft +')';
  else if (is.gecko)  elt.style.clip = 'rect(' + cliptop + ' ' +  
	   clipright + ' ' + clipbottom + ' ' + clipleft +')';
}

/* utility function for IE only -- does not use regular expressions
   in order to avoid triggering syntax error if parsed by Nav3 */
function tempClipObj (elt)
{  var clipStr = elt.style.clip;
  
   clipStr = clipStr.substring (clipStr.indexOf("(") + 1);
   this.top = stringToNumber(clipStr);
   clipStr = clipStr.substring (clipStr.indexOf(" ") + 1);
   this.right = stringToNumber(clipStr);
   clipStr = clipStr.substring (clipStr.indexOf(" ") + 1);
   this.bottom = stringToNumber(clipStr);
   clipStr = clipStr.substring (clipStr.indexOf(" ") + 1);
   this.left = stringToNumber(clipStr);
}

function getEltClipLeft (elt) 
{ if (is.nav4)	 return (elt.clip.left);
  else if (elt.style) 
  {  var tempClip = new tempClipObj (elt);
	 return tempClip.left;
  }
}

function getEltClipTop (elt) 
{ if (is.nav4)	 return (elt.clip.top);
  else if (elt.style) 
  {  var tempClip = new tempClipObj (elt);
	 return tempClip.top;
  }
}

function getEltClipRight (elt) {
  if (is.nav4)	 return (elt.clip.right);
  else if (elt.style) 
  {  var tempClip = new tempClipObj (elt);
	 return tempClip.right;
  }

}

function getEltClipBottom (elt) 
{ if (is.nav4)	 return (elt.clip.bottom);
  else if (elt.style) 
  {  var tempClip = new tempClipObj (elt);
	 return tempClip.bottom;
  }
}

function getEltClipWidth (elt) 
{
	return (getEltClipRight(elt) - getEltClipLeft(elt));
}

function getEltClipHeight (elt) 
{
	return (getEltClipBottom(elt) - getEltClipTop(elt));
}

function getCurrentWinWidth() 
{ if (is.nav4)	 return(window.innerWidth);
  else if (is.ie4up) return(document.body.clientWidth);
  else if (is.gecko) return(window.innerWidth);
}

function getCurrentWinHeight() 
{ if (is.nav4)	 return(window.innerHeight);
  else if (is.ie4up) return(document.body.clientHeight);
  else if (is.gecko) return(window.innerHeight);
}

function getEltZIndex (elt) 
{ if (is.nav4) return(elt.zIndex);
  else if (elt.style) return (elt.style.zIndex);
}

function setEltZIndex (elt, z) 
{ if (is.nav4) elt.zIndex = z;
  else if (elt.style) elt.style.zIndex = z;
}

function stringToNumber(s)
{
		return parseInt(('0' + s), 10)
}