function printpr() {
    var OLECMDID = 7;
    /* OLECMDID values:
    * 6 - print
    * 7 - print preview
    * 1 - open window
    * 4 - Save As
    */
    var PROMPT = 1; // 2 DONTPROMPTUSER     
    var READYSTATE_COMPLETE = 4;
    
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
 
    WebBrowser1.ExecWB(OLECMDID, PROMPT);
    WebBrowser1.outerHTML = "";
}

function createLayer(name,left,top,width,height,visibility,content) {
    document.writeln("<div id='" + name + "' style='position:absolute; overflow:hidden; " +
            "left:" + left + "px; top:" + top + "px; width:" + width + "px; height:");
    document.writeln(height + "px;; z-index:1; visibility:" + (visibility?"visible;":"hidden;") + "'>\n");
    document.writeln(content + "\n");
    document.writeln("</div>\n");
}

function changeLayer(theLayerName, left, top, width, height, visibility) {
    theLayerStyle = document.getElementById(theLayerName).style;
    theLayerStyle.visibility = visibility?"visible":"hidden";
    theLayerStyle.left = left;
    theLayerStyle.top = top;
    theLayerStyle.width = width;
    theLayerStyle.height = height;
    return;
}

function submitHiddenForm() {
    var d = new Date();
    parent.hiddenframe.document.hiddenform.time.value = d.getTime();
    if (parent.hiddenframe.document.hiddenform.refresh.value=="yes")
        parent.mapframe.document.getElementById("loaddatadiv").style.visibility = 'visible';
    parent.hiddenframe.document.hiddenform.submit();
}


function isMSIE5up() {
    msieIndex = navigator.appVersion.indexOf("MSIE");
    if (msieIndex < 0) return false;
    if (parseFloat(navigator.appVersion.substr(msieIndex + 5,3)) <5) return false;
    return true;
}

function isNetscape7up() {
    if (navigator.appName != 'Netscape') return false;
    if (getGeckoRv() < 1.0001) return false;
    return true;
}

function getMapWidth() {
    mapframewidth = window.innerWidth;   // Netscape
    if (mapframewidth == null) {
        mapframewidth = document.body.clientWidth;    // MSIE
    }
    return mapframewidth;
}

function getMapHeight() {
    mapframeheight = window.innerHeight;    // Netscape
    if (mapframeheight == null) {
        mapframeheight = document.body.clientHeight;    // MSIE
    }
    return mapframeheight;
}

/*
 * geckoGetRv.js
 * $Revision: 1.2 $ $Date: 2003/02/07 16:04:16 $
 */

/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Netscape code.
 *
 * The Initial Developer of the Original Code is
 * Netscape Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2001
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s): Bob Clary <bclary@netscape.com>
 *
 * ***** END LICENSE BLOCK ***** */

// return the rv value of a Gecko user agent
// as a floating point number. 
// returns -1 for non-gecko browsers, 
//          0 for pre Netscape 6.1/Gecko 0.9.1 browsers
//          number > 0 where each portion of 
//          the rv value delimited by . 
//          will be treated as value out of 100.
//          e.g. for rv: 3.12.42, 
//          getGeckoRv() returns 3.1242
//          
function getGeckoRv()
{
  if (navigator.product != 'Gecko')
  {
    return -1;
  }
  var rvValue = 0;
  var ua      = navigator.userAgent.toLowerCase();
  var rvStart = ua.indexOf('rv:');
  var rvEnd   = ua.indexOf(')', rvStart);
  var rv      = ua.substring(rvStart+3, rvEnd);
  var rvParts = rv.split('.');
  var exp     = 1;

  for (var i = 0; i < rvParts.length; i++)
  {
    var val = parseInt(rvParts[i]);
    rvValue += val / exp;
    exp *= 100;
  }

  return rvValue;
}
