/************************************************************************************************
*
*     General use javascript routines to support the display of information
*
**************************************************************************************************/
/*     Display a new window centered in the main brower window */

 var picWindow = null;
 function doWind(caption,isrc,wwidth,wheight,pwidth,pheight) {
  var winleft = (screen.width-wwidth)/2;
  var wintop = (screen.height-wheight)/2;
  if (winleft < 0) winleft = 0;
  if (wintop < 0) wintop = 0;
  var settings = 'height=' + wheight + ',';
  settings += 'width=' + wwidth + ',';
  settings += 'top=' + wintop + ',';
  settings += 'left=' + winleft + ',';
  settings += 'location=no,status=yes,scrollbars=yes,resizable=1';
  picWindow = window.open("","PicViewer",settings);
  var content = "<html><head><title>" + caption + "</title>";
  content += "<link rel=stylesheet href=mwgs_styles.css type=text/css>";
  content += "</head><body><div id='gallery'";
  content += "<h2 align='center'>" + caption + "</h2>";
  content += "<p><img src=" + isrc + " border='0'" + " width='" + pwidth + "'" + " height='" + pheight + "'" + "></p>";
  content += "<br /></div></body></html>";
  picWindow.document.write(content);
  picWindow.document.close();
  picWindow.window.focus(); 
  return false;
 }

  function ShowNotes(sURL,sHeight,sWidth)
  {
    var sFeatures = "top=50,left=50,height="+ (sHeight) +",width="+ (sWidth) + ",location=yes,status=yes,scrollbars=yes,resizable=1";
    var oSampWin = window.open(sURL,"_blank",sFeatures)
  }
  // display sample within separate window, with status bar display, & size of window
  function ShowSamp(sURL,sHeight,sWidth)
  {
    var sFeatures = "top=50,left=50,height="+ (sHeight) +",width="+ (sWidth) + ",location=yes,status=yes,scrollbars=yes,resizable=1";
    var oSampWin = window.open(sURL,"_blank",sFeatures)
  }

  // Extended Tooltip Javascript
// copyright 9th August 2002, 3rd July 2005, 24th August 2008
// by Stephen Chapman, Felgall Pty Ltd

// permission is granted to use this javascript provided that the below code is not altered
function pw() {
return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth};
function mouseX(evt) {return evt.clientX ? evt.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) : evt.pageX;}
function mouseY(evt) {return evt.clientY ? evt.clientY + (document.documentElement.scrollTop || document.body.scrollTop) : evt.pageY}
function popUp(evt,oi) {
  if (document.getElementById) {
     var wp = pw();
     dm = document.getElementById(oi);
     ds = dm.style; st = ds.visibility;
     if (dm.offsetWidth)
         ew = dm.offsetWidth;
     else
        if (dm.clip.width)
           ew = dm.clip.width;
     if (st == "visible" || st == "show") {
        ds.visibility = "hidden";
      } else {
         tv = mouseY(evt) + 20;
         lv = mouseX(evt) - (ew/4);
         if (lv < 2) lv = 2;
         else
            if (lv + ew > wp)
               lv -= ew/2;
               lv += 'px';
               tv += 'px';
               ds.left = lv;
               ds.top = tv;
               ds.visibility = "visible";
       }}}
var dirWindow;
function showDetails(site,addr,city,directions) {
  var sFeatures = "height=350,width=350,scrollbars=no,resizable=no,copyhistory=yes";
  dirWindow = window.open("","_blank",sFeatures);
  dirWindow.document.open();
  dirWindow.document.bgColor = "silver";
  dirWindow.document.fgColor = "navy";
  dirWindow.document.write("<h2 align=center>" + site + "</h2>");
  dirWindow.document.write("<p><b> Address:</b> " + addr + ", " + city + "</p>");
  dirWindow.document.write("<p><b> Directions:</b> " + directions + "</p>");
  dirWindow.document.close();
  return false;
  }

