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;
}
}

//drop down menu
function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{
ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}
function getAbsolutePosition(element) {
    var r = { x: element.offsetLeft, y: element.offsetTop };
    if (element.offsetParent) {
      var tmp = getAbsolutePosition(element.offsetParent);
      r.x += tmp.x;
      r.y += tmp.y;
    }
    return r;
 };

function replaceAll(str,from,to)
{
	var temp = str;
	while(temp.indexOf(from)>-1)

	{
		temp = temp.replace(from,to);
	}
	return temp;
}


function submitWithEncode(varList)
{
	var t,x,i,u;
	var v =varList.split(",");
	for (i=0; i < v.length; i++)
	{
		x=v[i];
		u=document.getElementById(x);
		u.value=replaceAll(u.value,"+","%2B");
	}
}
function disable(me)
{	
	var f=document.forms['f1'].elements['submit'];
	f.disabled=true;
}
function enable(me)
{
 	document.forms['f1'].elements['submit'].disabled=false;
 
}





