// Javascript functions to open and manage windows

function getWindowTop(oWindow) {
  with (oWindow) {
    if (window.screenY || document.layers) {
      return window.screenY;
    }
    else if (document.all) {
      return window.screenTop;
    }
    else {
      return 0;
    }
  }	
}  
  
function getWindowWidth(oWindow) {
  with (oWindow) {
    if (window.outerWidth) {
      if(typeof(window.outerWidth) == 'number') {
        // This is not an IE browser
        return window.outerWidth;
	  }
	  else {
	    return parseInt(window.outerWidth);
	  }
    } 
	else if (document.documentElement && document.documentElement.width) {
      //IE 6+ in 'standards compliant mode'
      return document.documentElement.width;
    } 
	else if (document.body && document.body.width) {
      //IE 4 compatible
      return document.body.width;
    }
  }	
}

function getWindowHeight(oWindow) {
  with (oWindow) {
    if (window.outerHeight) {
      if(typeof(window.outerHeight) == 'number') {
        // This is not an IE browser
        return window.outerHeight;
      } 
	  else {
	    return parseInt(window.outerHeight);  
	  }
	}  
	else if (document.documentElement && document.documentElement.clientHeight) {
      //IE 6+ in 'standards compliant mode'
      return document.documentElement.clientHeight;
    } 
	else if (document.body && document.body.clientHeight) {
      //IE 4 compatible
      return document.body.clientHeight;
    }
  }	
}

function getWindowLeft(oWindow) {
  with (oWindow) {
    if (document.all) {
      return window.screenLeft;
    }
    else if (document.layers) {
      return window.screenX;
    }
    else {
      return 0;
    }	
  }	
}

function getScreenWidth(oWindow) {
  with (oWindow) {
    if (screen.availWidth) {
      return screen.availWidth;
    }
	else if (screen.width) {
	  return screen.width;
	}
  }	
}

function getScreenHeight(oWindow) {
  with (oWindow) {
    if (screen.availHeight) {
      return screen.availHeight;
    }
	else if (screen.height) {
	  return screen.height;
	}
  }
}

function setWindowPosition(oWindow, iTop, iWidth, iHeight, iLeft) {
  oWindow.moveTo(iLeft, iTop);
  oWindow.resizeTo(iWidth, iHeight);
}


function showSearchResults(sTarget) {
  setDisplay(sTarget, "block");
  setDisplay("searchclose", "block");
}

function closeSearch() {
  // Empty and close the iFrame holding the search results
  oDoc = getDocumentFromIframe(obj("searchresults"));
  if (oDoc) {
    oDoc.open();
    oDoc.close();
  }
  setDisplay("searchresults", "none");
  setDisplay("searchclose", "none");
  // Empty the search box
  obj("keyword").focus();
}











