<!-- 
// Module:	iciframe.js
// Author:	William E. Lanier Jr
// Company:	InfoCode Corporation
// Purpose:	Provides a method to display a message while loading an IFrame
//-->


function IFrame_Load(sIFrame, sURL, sMsg, sMsgColor, sBGColor, nDelay, DoCenter, DoMessageOnly) {
  var oDoc = document.frames(sIFrame).document.open("text/html", "replace");

  if (typeof(sBGColor) != "string") sBGColor = "#ffffff"
  var CenterText = (DoCenter != null ? (DoCenter == true): false);
  var ShoMessageOnly = (DoMessageOnly != null ? (DoMessageOnly == true): false);

  oDoc.write("<html><head><style type='text/css'>\n");
  oDoc.write("body {font: normal normal bold 9pt Verdana;color: " + sMsgColor + ";padding:14px;background-color:" + sBGColor + ";}\n");
  oDoc.write("</style>\n");

  oDoc.write("<script language='javascript'>\n");
  oDoc.write("function OnLoad() {\n");
  oDoc.write("window.location.href=\"" + sURL + "\";\n");
  oDoc.write("}\n");
  oDoc.write("</script>\n");
  oDoc.write("</head>\n");

  if (ShoMessageOnly) {
      oDoc.write("<body TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll='no'>");
  }else{
    if (isNaN(nDelay)) {
      oDoc.write("<body onload=\"OnLoad();\" TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll='no'>");
    }else{
      oDoc.write("<body onload=\"setTimeout('OnLoad()'," + nDelay + ");\" TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll='no'>");
    }
  }

  if (CenterText) {
    oDoc.write("<table height='100%' width='100%'>");
    oDoc.write("<tr align='middle'><td style='font: normal normal bold 11pt Tahoma;color: " + sMsgColor + ";' align='center'>" + sMsg + "</td></tr>");
    oDoc.write("</table>");
  }else{
    oDoc.write(sMsg);
  }
  oDoc.write("</body></html>");
  oDoc.close();
}


function IFrame_Print(sIFrame) {
 var oFrame = null;
 try {
   oFrame = document.frames(sIFrame);
   oFrame.focus();
 } catch(e) {};

 try {
   if (typeof(oFrame.OnPrint) == "function") {
     oFrame.OnPrint();
   } else {
     oFrame.print();
   }
 } catch(e) {};
}
