﻿
function popWindow(targetName, sURL, win_width, win_height) 
{
   var screen_width = (screen.availWidth) ? screen.availWidth : 800;
   var screen_height= (screen.availHeight)? screen.availHeight : 600;  
   initialX = (screen_width - win_width)/2;
   initialY = (screen_height <= 600) ? 0 : (screen_height - win_height)/2;  
   if (navigator.userAgent.toLowerCase().indexOf("opera") != -1) 
   {
        initialY = 0;
        if (screen_height <= 600)
        {
            win_height = 370;
        }
    }         
    if (navigator.appName == "Netscape"){
      contactWindow = window.open(sURL,targetName,'width=' + win_width + ',height=' + win_height + ',screenX=' + initialX + ',screenY=' + initialY + ',scrollbars,status');
      contactWindow.focus(); // make sure our new window is in front
    } 
    else 
    {
         contactWindow = window.open(sURL,targetName,'width=' + win_width + ',height=' + win_height + ',left=' + initialX + ',top=' + initialY + ',scrollbars=1,status=1');
         contactWindow.focus();  // make sure our new window is in front
    }

}


function showbuttons() {   
    var is_major = parseInt(navigator.appVersion); 
    var agt=navigator.userAgent.toLowerCase();
    var is_mac    = (agt.indexOf("mac")!=-1);
    var is_ie4up  = ((agt.indexOf("msie") != -1)  && (is_major >= 4 ));

    var is_win31  = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16=")!=-1) || (agt.indexOf("windows 16-bit")!=-1));
    if ((is_mac && is_ie4up) ||  is_win31) {
      return "<BR><B>Press enter to recalculate</B>";
    }

    return "<FORM><INPUT class='formButtons' TYPE='button' value='Calculate' Name='btnCallCalc' onClick='document.calculator.calculate()'>&nbsp;&nbsp;<INPUT class='formButtons' TYPE='button' value='View Report' Name='btnOpenNote' onClick='openNote()'></FORM>";
} 

function openNote()
 { 
 
 var agt=navigator.userAgent.toLowerCase(); 
 var is_aol   = (agt.indexOf("aol") != -1);

leftpos=0;
if (screen) {
 leftpos=screen.width/2 - 300;
} 

 if (is_aol) {
   var s = " ";
   s=document.calculator.sJavaScriptReport('HTML');
    document.write(s);
 }
 else {
   var OpenWindow=window.open("","newwin","toolbar=yes,menubar=yes,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=380,left="+leftpos+",top=20");
   var s = " ";
   if (navigator.appName == "Netscape")
     s=document.applets["calculator"].sJavaScriptReport('HTML');
   else
     s=document.calculator.sJavaScriptReport('HTML');
   OpenWindow.document.write(s);
   OpenWindow.document.close(); 
   OpenWindow.focus();
 }
}





