function popwin(u)
{
window.open(u,"name","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,top=15,left=15,width=850,height=530,resizable=yes");        
}
function popwin3(u)
{
window.open(u,"name","toolbar=no,location=no,status=yes,menubar=yes,scrollbars=yes,top=10,left=10,width=1100,height=680,resizable=yes");        
}

//menu item handlers:
function boxOn(which) 
{
which.className = 'itmOn';
}
function boxOff(which) {
which.className = 'itmOff';
}

//add a bookmark
function addbookmark(url,title) { 
if (window.sidebar) { 
window.sidebar.addPanel(title, url,""); 
} 
else if( document.all) { 
window.external.AddFavorite( url, title); 
} 
else if( window.opera && window.print ) { 
return true; 
} 
} 

//mortgage calculator

function mggCalculator(theForm) {


     var rate = document.getElementById("rate").value;
     var term = document.getElementById("term").value;
     var loan = document.getElementById("loan").value;

     if (document.getElementById("downPay").value.length <= 0) {
           document.getElementById("downPay").value = "0.00";
     }
     else {
           if
(isNaN(parseFloat(document.getElementById("downPay").value))) {
                 document.getElementById("downPay").value = "0.00";
           }
           else
                 if
(parseFloat(document.getElementById("downPay").value) <= 0)
                       document.getElementById("downPay").value = "0.00";
     }

     if ( parseFloat(document.getElementById("downPay").value) > parseFloat(document.getElementById("loan").value) ) {
           document.getElementById("downPay").value = "0.00";
     }
     var loan = loan - document.getElementById("downPay").value;

     var numerator, denominator, nMonths, interestRate = 0;
     var i = rate;
     if (i > 1.0) {
           i = i * 0.01;
     }
     else {
     rate = 100 * rate;
   }

   interestRate = i / 12;

   nMonths = term * 12;
   numerator = loan * interestRate * Math.pow(1 + interestRate, nMonths);
   denominator = Math.pow(1 + interestRate, nMonths) - 1;
   var monthPay = numerator / denominator;
   document.getElementById("monthPay").value=to2DecimalFrm(monthPay);
   var totPay = monthPay * nMonths;
   document.getElementById("totPay").value=to2DecimalFrm(totPay);
   var totInt = totPay-loan;
//   document.getElementById("totInt").value=to2DecimalFrm(totInt);

     return true;
}  

function to2DecimalFrm(x) {
     if ((x== 0) && (x.length == null)) {
           x= "0.00";
     }

     var t = eval(x) + 0.005
     var d = "" + (100 + Math.floor((t - Math.floor(t)) * 100));
     var i = "" + Math.floor(t);

     return (i + "." + d.substring(1,3));
}



function send(){
self.status='msgsent';
var p;
if(navigator.appName=="Netscape")
p='cht';
else
p='cht_ie';
document.forms[0].prog.value=p; 
document.forms[0].mu.value='ulogin'; 

return true;
}

function replaceChars(entry) {
out = "&"; // replace this
add = "~"; // with this
temp = "" + entry.value;  

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out.length), temp.length));
entry.value=temp;
}
}







