/////////////////////////////////////////////////////////////////////////////
//Copyright (C) 2003-2005 ict-control
//
//ICTC_JS_Dimensions

//Status          : Ready
//Version         : v1.0
//Description     : Javacript for dimensions
//Valid browsers	: NN7,FF 1.0,IE 6
//
//Authors         : Jan Boerlage
//Copyright       : The copyright to the code herein is the property of
//                  ict-control This code may be used and/or copied
//                  only with the written permission of ict-control or
//                  in accordance with the terms and conditions stipulated in
//                  the agreement/contract under which the code has been
//                  supplied.
//
/////////////////////////////////////////////////////////////////////////////

browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);


function getbodywidth()
   {

    if((browserName == "Netscape" || browserName == "Mozilla") && browserVer>= 3 && browserVer< 5)
      {
       // Netscape
       return(document.body.innerWidth);
      }
    else if((browserName == "Microsoft Internet Explorer") && browserVer >=4 && document.compatMode=="CSS1Compat")
      {
       // use IE6
       return(document.documentElement.clientWidth);
      }
     else if (((browserName == "Microsoft Internet Explorer") && (browserVer >=4)) || ((browserName == "Netscape" || browserName == "Mozilla") && (browserVer>= 5)))
      {
       // use IE4+ or firefox
        return(document.body.clientWidth);
      }
   }

function getbodyheight()
   {

    if((browserName == "Netscape" || browserName == "Mozilla") && browserVer>= 3 && browserVer< 5)
      {
       // Netscape
       return(parent.document.body.innerHeight);
      }
    else if((browserName == "Microsoft Internet Explorer") && browserVer >=4 && parent.document.compatMode=="CSS1Compat")
      {
       // use IE6
       return(parent.document.documentElement.clientHeight);
      }
    else if (((browserName == "Microsoft Internet Explorer") && (browserVer >=4)) || ((browserName == "Netscape" || browserName == "Mozilla") && (browserVer>= 5)))
      {
       // use IE4+ or firefox
       return(parent.document.body.clientHeight);
      }
   }

function getDocumentWidth(ADocument)
   {

    if((browserName == "Netscape" || browserName == "Mozilla") && browserVer>= 3 && browserVer< 5)
      {
       // Netscape
       return(ADocument.body.innerWidth);
      }
    else if((browserName == "Microsoft Internet Explorer") && browserVer >=4 && ADocument.compatMode=="CSS1Compat")
      {
       // use IE6
       return(ADocument.documentElement.clientWidth);
      }
     else if (((browserName == "Microsoft Internet Explorer") && (browserVer >=4)) || ((browserName == "Netscape" || browserName == "Mozilla") && (browserVer>= 5)))
      {
       // use IE4+ or firefox
        return(ADocument.body.clientWidth);
      }
   }

function getDocumentHeight(ADocument)
   {

    if((browserName == "Netscape" || browserName == "Mozilla") && browserVer>= 3 && browserVer< 5)
      {
       // Netscape
       return(ADocument.body.innerHeight);
      }
    else if((browserName == "Microsoft Internet Explorer") && browserVer >=4 && ADocument.compatMode=="CSS1Compat")
      {
       // use IE6
       return(ADocument.documentElement.clientHeight);
      }
    else if (((browserName == "Microsoft Internet Explorer") && (browserVer >=4)) || ((browserName == "Netscape" || browserName == "Mozilla") && (browserVer>= 5)))
      {
       // use IE4+ or firefox
       return(ADocument.body.clientHeight);
      }
   }

function getAbsoluteLeft(objectId) {
	// Get an object left position from the upper left viewport corner
	o = document.getElementById(objectId)
	oLeft = o.offsetLeft            // Get left position from the parent object
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference
		oLeft += oParent.offsetLeft // Add parent left position
		o = oParent
	}
	// Return left postion
	return oLeft
}

function getAbsoluteTop(objectId) {
	// Get an object top position from the upper left viewport corner
	o = document.getElementById(objectId)
	oTop = o.offsetTop            // Get top position from the parent object
	while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent  // Get parent object reference
		oTop += oParent.offsetTop // Add parent top position
		o = oParent
	}
	// Return top position
	return oTop
}

