/**********************************************************
 *             Popup Window Definition Part                *
 *                                                         *
 * To add a popup window, add a string definition below.   *
 * To include the item in the printing friendly page,      *
 * modify the longStr by adding the item to it.            *
 * Don't change anything else.                             *
 **********************************************************/

// xTurnToStoneUSAMonoSingleVersion_popupplus = "xTurnToStoneUSAMonoSingleVersion_popupplus"
// xTurnToStone_popupplus = "xTurnToStone_popupplus"

 var popupWin
 var wholeWin
  function popup(term)  // write corresponding content to the popup window
  {
    var strURL = "popup.php?data=" + term
    popupWin = window.open(strURL, "puWin",  "width=800,height=620,scrollBars,toolbar=no,menubar=no,resizable");
    popupWin.focus();  // bring the popup window to the front
  }

  function closeDep() {
  if (popupWin && popupWin.open && !popupWin.closed) popupWin.close();
  if (wholeWin && wholeWin.open && !wholeWin.closed) wholeWin.close();

  }

function replaceSubstring(inputString, fromString, toString) {
   // Goes through the inputString and replaces every occurrence of fromString with toString
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
} // Ends the "replaceSubstring" function

/***********************END OF FUNCTION POPUP******************************/

  function printwhole()
  {
        longStr ="<center><h2>Annotated Output for Proc Univariate</h2></center>";
        longStr += demo1 + demo2 + demo3;

        wholeWin = window.open("","wWin", "width=800,height=500,dependent=yes,scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes");
        wholeWin.document.open("text/html","replace");
        wholeWin.document.write(htmlOpener);
        wholeWin.document.write(longStr);
        wholeWin.document.write(htmlCloser);
        wholeWin.document.close();
        wholeWin.focus();}

/*******End of popup window stuff*********/


/***************************Tooltip Part Begins***************************/
  var style = ((NS4 && document.test) || IE4) ? 1 : 0;
  var timerID = null;
  var padding = 3; // < 4 recommended
  var bgcolor = "beige";
  var borWid = 1; // for no border, assign null
  var borCol = "#0000cc";
  var borSty = "solid";
  var str = "<STYLE TYPE='text/css'>";

  str += ".jlscrip7 {";
  str += "position: absolute;";
  str += "visibility: hidden;";
  str += "left: 0; top: 0;";

  if (borWid > 0) { // if a border is specified

  str += "border-width: " + borWid + ";";
  str += "border-color: " + borCol + ";";
  str += "border-style: " + borSty + ";";

}

  if (NS4) {

  if (borWid > 0 && padding <= 3) {
    str += "padding: 0;";
    str += "layer-background-color: " + bgcolor + ";"; }

    else if (borWid > 0 && padding > 3) {
    str += "padding: " + (padding - 3) + ";";
    str += "background-color: " + bgcolor + ";";

  } else if (borWid == 0) {
    str += "padding: " + padding + ";";
    str += "layer-background-color: " + bgcolor + ";";

  }

} else {
  str += "padding: " + padding + ";";
  str += "background-color: " + bgcolor + ";";
}

  str += "}";
  str += "</STYLE>";


  if (style) {
  document.write(str);
  if (NS4) window.onload = init;
}

/**************************************************
*        Making your tooltip text here            *
* This is the only place that need to be modified.*
* The first argument is the name of the tooltip.  *
* The second argument is the width and last one   *
* is the content of the tooltip.                  *
**************************************************/


