var isNav4, isIE
var coll = ""
var styleObj = ""

if (parseInt(navigator.appVersion) >= 4) {
  if (navigator.appName == "Netscape") {
    isNav4 = true
  } else {
    isIE = true
    coll = "all."
    styleObj = ".style"
  }
}

// Convert object name string or object reference
// into a valid object reference
function getObject(obj) {
	var theObj
	theObj = eval("document." + coll + obj + styleObj)
	return theObj
}

// Setting the visibility of an object to hidden
function hdscrHideObject(Object) {
	var theObj = getObject(Object)
	theObj.visibility = "hidden"
}

// Setting the visibility of an object to visible
function hdscrShowObject(Object) {
	var theObj = getObject(Object)
	theObj.visibility = "visible"
}

	//	hdscrBringForward(Object)
	function hdscrBringForward(Object)
	{
   		var theObj = getObject(Object)
    	theObj.zIndex += 1
  	}

	//	hdscrSendBackward(Object)
	function hdscrSendBackward(Object)
	{
   		var theObj = getObject(Object)
    	theObj.zIndex -= 1
  	}

	//	hdscrBringToFront(Object)
	function hdscrBringToFront(Object)
	{
   		var theObj = getObject(Object)
    	theObj.zIndex = 1
  	}

	//	hdscrSendToBack(Object)
	function hdscrSendToBack(Object)
	{
   		var theObj = getObject(Object)
    	theObj.zIndex = -1
  	}

	//	todo hdscrSetImage(Object, Image)
	//	todo hdscrUseImage(Object, Image)

	//	todo hdscrFly(Object, StartX, StopX, StartY, StopY)

	//	hdscrMoveTo(Object, X, Y)
	// Positioning an object at a specific pixel coordinate
	function hdscrMoveTo(Object, X, Y)
	{
		var theObj = getObject(Object)
    	if (isNav4) {
      		theObj.moveTo(X,Y)
    	} 
		else 
		{
      		theObj.pixelLeft = X
      		theObj.pixelTop = Y
		}
	}

	//	hdscrMoveBy(Object, X, Y)
	//	Moving an object by x and/or y pixels
	function hdscrMoveBy(Object, X, Y)
	{
		var theObj = getObject(Object)
		if (isNav4) {
			theObj.moveBy(X, Y)
		} 
		else 
		{
			theObj.pixelLeft += X
			theObj.pixelTop += Y
		}
	}

	//	todo hdscrBeginDrag(Object)
	//	todo hdscrEndDrag(Object)

	//	hdscrGetTop(Object);';
	// Retrieving the y coordinate of a positionable object
	function getObjectTop(obj)  
	{
		var theObj = getObject(obj)
		if (isNav4) 
		{
			return theObj.top
		} 
		else 
		{
			return theObj.pixelTop
		}
	}

	//	hdscrGetLeft(Object);';
	//	Retrieving the x coordinate of a positionable object
	function hdscrGetLeft(obj)  
	{
		var theObj = getObject(obj)
		if (isNav4) 
		{
			return theObj.left
		} 
		else 
		{
			return theObj.pixelLeft
		}
	}

	//	todo hdscrGetPosition(Object);';
	//	todo hdscrGetZ-Order(Object);';
	//	todo hdscrGetClip Top(Object);';
	//	todo hdscrGetClipBottom(Object);';
	//	todo hdscrGetClipLeft(Object);';
	//	todo hdscrGetClipRight(Object);';
	//	todo hdscrGetImageSrc(Object);';
	//	todo hdscrGetImageLowSrc(Object);';

	//	hdscrSetTop(Object, Top)'
	function hdscrSetTop(Object, Top)
	{
		var theObj = getObject(Object)
		if (isNav4) 
		{
			theObj.top = Top
		} 
		else 
		{
			theObj.pixelTop = Top
		}
	}

	//	hdscrSetLeft(Object, Left)';
	function hdscrSetLeft(Object, Left)
	{
		var theObj = getObject(Object)
		if (isNav4) 
		{
			theObj.left = Left
		} 
		else 
		{
			theObj.pixelLeft = Left
		}
	}

	//	hdscrSetPosition(Object, Top, Left)';
	function hdscrSetPosition(Object, Top, Left)
	{
		var theObj = getObject(Object)
		if (isNav4) 
		{
			theObj.top = Top
			theObj.left = Left
		} 
		else 
		{
			theObj.pixelTop = Top			
			theObj.pixelLeft = Left
		}
	}

  //	hdscrSetZOrder(Object, zOrder)';
  // Setting the z-order of an object
  function hdscrSetZOrder(Object, zOrder) {
    var theObj = getObject(Object)
    theObj.zIndex = zOrder
  }

	//	todo hdscrSetClipTop(Object)';
	//	todo hdscrSetClipBottom(Object)';
	//	todo hdscrSetClipLeft(Object)';
	//	todo hdscrSetClipRight(Object)';

	//	hdscrSetBGColor(Object, Color)';
  // Setting the background color of an object
  function hdscrSetBGColor(Object, Color) {
    var theObj = getObject(Object)
    if (isNav4) {
      theObj.bgColor = Color
    } else {
      theObj.backgroundColor = Color
    }
  }

	//	todo hdscrSetImageSrc(Object)';
	//	todo hdscrSetImageLowSrc(Object)';

  // 	hdscrSetLocation(Object, URL);';
  function hdscrSetLocation(Object, URL) {
	window.location = URL
  }

  //	hdscrAlert(Object, Message)';
  function hdscrAlert(Object, Message) {
		alert(Message)
  }

  //	hdscrConfirmation(Object, Message)';
  function hdscrConfirmation(Object, Message) {
		confirm(Message)
  }

  //	hdscrPrompt(Object, Message)';
  function hdscrPrompt(Object, Message, Default) {
		prompt(Message, Default)
  }

  //	hdscrSetStatus(Object, Status);';
  function hdscrSetStatus(Object, Status) {
	window.statue = Message
  }

  //	hdscrResizeTo(Object, Width, Height)';
  // this only works for window object
  function hdscrResizeTo(Object, Width, Height)
  {
    if (isNav4 | isIE)
    {
      resizeTo(Width, Height);
    }
  }

  //	hdscrResizeBy(Object, Width, Height)';
  function hdscrResizeBy(Object, Width, Height)
  {
    if (isNav4 | isIE)
    {
      resizeBy(Width, Height);
    }
  }

  //	hdscrRepositionTo(Object, Top, Left, Width, Height)';
  function hdscrRepositionTo(Object, Top, Left, Width, Height)
  {
    if (isNav4 | isIE)
    {
      resizeTo(Width, Height);
      moveTo(Top, Left);
    }
  }

  //	hdscrRepositionBy(Object, Top, Left, Width, Height)';
  function hdscrRepositionTo(Object, Top, Left, Width, Height)
  {
    if (isNav4 | isIE)
    {
      resizeBy(Width, Height);
      moveBy(Top, Left);
    }
  }

  //	hdscrScrollTo(Object, X, Y)';
  function hdscrScrollTo(Object, X, Y)
  {
    if (isNav4 | isIE)
    {
      ScrollTo(X, Y);
    }
  }

  //	hdscrScrollBy(Object, X, Y)';
  function hdscrScrollBy(Object, X, Y)
  {
    if (isNav4 | isIE)
    {
      ScrollBy(X, Y);
    }
  }

  //	hdscrClose(Object)';
  function hdscrClose(Object)
  {
    close();
  }

  //	hdscrFocus(Object)';
  function hdscrFocus(Object)
  {
    focus();
  }

  //	hdscrBlur(Object)';
  function hdscrBlur(Object)
  {
    blur();
  }

  //	todo hdscrGetOpener(Object)';

  //	todo hdscrGetName(Object)';

  //	hdscrSetName(Object, Name)';
  function hdscrSetName(Object, Name)
  {
    var theObj = getObject(Object)
    theObj.name = Name;
  }

  //	hdscrOpenNew(Object)';
  function hdscrOpenNew(Object, URL, Name)
  {
    var newWindow = window.open(Object, URL, Name);
    newWindow.focus();
  }

  //	todo hdscrSendMessage(Object, Message)';

  //	todo hdscrCheckBrowser(Object)';

  //	todo hdscrCustom(Object)';




