
oldBrdr="";
oldBg="";
function changeBgColor(obj){
	oldBg=obj.style.backgroundColor;
	obj.style.backgroundColor="#E2675F";
}

function restoreBgColor(obj){
	obj.style.backgroundColor=oldBg;
}

function calc(){
	b4=document.calculator.income.value;
	b5=document.calculator.family.value;
	proc=document.calculator.proc.value;
	dur=document.calculator.dur.value;
	document.calculator.dep.value=b4-b5*100;
	dep=document.calculator.dep.value;
	size=dep/((1/(dur*12))+(proc/12/100));
	document.calculator.size.value="$"+size;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function RTrim(s) { 
    return s.replace(/\s+$/,"")
}

function LTrim(s) {
    return s.replace(/^\s+/,"")
}  

function Trim(s) {
    return RTrim(LTrim(s))
}


function validEmail(elem) {
    var str = elem;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
//        alert("Wrong email format : "+elem);
        return false;
    } else {
        return true;
    }
}

function open_layer(id){
a = document.getElementById(id).style;
if(a.display == "block") {
	a.display = "none";
	} else {
		a.display="block";
	}

}

function isNumber(elem) {
	var str = elem;
    var re = /^[0-9]+$/;
    if (!str.match(re)) {
        return false;
    } else {
        return true;
    }
}
