// JavaScript Document var pwd = ""; function newImage(arg) { if (document.images) { rslt = new Image(); rslt.src = arg; return rslt; } } function changeImages() { if (pwd != changeImages.arguments[0]) { if (document.images && (preloadFlag == true)) { for (var i=0; i 2 ? '/' : '.'; var directory = document.location.pathname.split(delim); if (dirtest.length == 3) { pwd = directory[directory.length-2]}; if (dirtest.length == 4) { pwd = directory[directory.length-3]}; if (pwd == "market") { document.market.src = "/images/nav/market_down.gif" } if (pwd == "future") { document.future.src = "/images/nav/future_down.gif" } if (pwd == "accelerator") { document.accelerator.src = "/images/nav/accelerator_down.gif" } if (pwd == "plan") { document.plan.src = "/images/nav/plan_down.gif" } if (pwd == "success") { document.success.src = "/images/nav/success_down.gif" } if (pwd == "about") { document.about.src = "/images/nav/about_down.gif" } if (pwd == "news") { document.news.src = "/images/nav/news_down.gif" } if (pwd == "contactus") { document.contactus.src = "/images/nav/contactus_down.gif" } } function go_back(scr) { da = document.accel; da.pagetogo.value = "./Templates/screen_"+scr+".php"; da.submit(); } function start_determine_session(str){ if (str == 'start.f'){ alert("There is no session saved with that password and email address.\nPlease enter the password and email address of a saved session or choose to start a new session."); } if (str == 'new.f' || str == 'new'){ if (str == 'new.f'){ alert("A session already is saved for that email address and session.\nPlease enter a new pair of email address and passwords to open a new session, or chose to open an existing session, or to make a new session without password and email."); } session_focus('new'); } if (str == 'start'){ session_disable('working_hide'); session_focus('new'); } if (str == 'start.f'){ session_disable('working_hide'); session_focus('open'); } if (str == 'save'){ session_focus('working'); } if (str == 'look_up'){ session_focus('working'); } } function verify_email_address_on_enter(evt){ evt = (evt) ? evt : event; var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode); if (charCode == 13 || charCode == 3){ var elm = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if (elm){ var go_on = verify_email_address(elm.value); if (go_on){return true;} else{//continue to block event.keyCode = 32;return false } } else{return false;} }else{ return true; } } function verify_email_address(address){ if (address == null || address.length == 0){ alert("E-mail address is not filled in."); return false; } else{ var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/; if (! address.match(re)){ alert ("E-mail address is not in proper format."); return false; } else{ return true; } } } function empty_password(str){ if (str == null || str.length == 0){ alert("Password field is empty."); return false; }else{return true;} } function verify_email(address, password, password2){ if (! verify_email_address(address)){ return false; } if (! empty_password(password)){ return false; } if (password != password2){ alert("Passwords entered do not match.") return false; } return true; } function focus_on_enter(evt, id){ //this function blocks the form from submitting when the enter key is pressed in a field //an instead focuses on another field evt = (evt) ? evt : event; var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode); if (charCode == 13 || charCode == 3){ document.getElementById(id).disabled = false; document.getElementById(id).focus(); // return false; return true; } else{ return true; } } /* function lookup_on_enter(evt){ //this function blocks the form from submitting when the enter key is pressed in a field //an instead focuses on another field evt = (evt) ? evt : event; var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode); if (charCode == 13 || charCode == 3){ return lookup(); // return false; } else{ return true; } } /* function verify_email_on_enter(evt, em, pw1, pw2){ //this function blocks the form from submitting when the enter key is pressed in a field //an instead focuses on another field evt = (evt) ? evt : event; var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode); if (charCode == 13 || charCode == 3){ return verify_email(em, pw1, pw2); // return false; } else{ return true; } } function verify_email(address, password, password2){ if (! verify_email_address(address)){ return false; } if(password == null || password.length == 0){ warning += "Password is not entered.\n"; p_b = false; } if (a_b){ var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/; if (! address.match(re)){ warning += "E-mail address is not in proper format\n"; a_b = false; } } if (a_b && p_b){ return true; } else{ alert(warning + "\nPlease re-enter E-mail address and password"); return false; } } function verify_email_address(address){ if (address == null || address.length = 0){ alert("E-mail address is not filled in."); return false; } else{ var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/; if (! address.match(re)){ alert ("E-mail address is not in proper format."); return false; } else{ return true; } } }*/ function format_number(val,obj) { val = val.replace(/[\D]+/g, ''); x = val.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } val = x1 + x2; if (obj) { obj.value = val; } else { return val; } } function test_number(obj) { var nStr = obj.value; nStr = nStr.replace(/[,]+/g, ''); if (isNaN(nStr)) { alert("Please enter numbers only."); obj.value = obj.value.replace(/[\D]+/g, ''); } } function clear_zeros(obj) { if (obj.value == 0) { obj.value = ""; } } function set_zeros(obj) { if (obj.value == "") { obj.value = 0; } } function addCommas(nStr) { nStr = nStr.replace(/[,]+/g, ''); nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } function addComma(nStr) { // nStr = nStr.replace(/[,]+/g, ''); nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } function make_calculate(){ var acc = document.accel; var ta, pte, sal, bon, other, interest, dep, nr_exp; var td, r_own, nr_inc, other_income, ae; pte = acc.pre_tax_earnings.value; pte = pte.replace(/[,]+/g, ''); pte = parseInt(pte); if (isNaN(pte)){pte = 0;} sal = acc.ta_salaries.value; sal = sal.replace(/[,]+/g, ''); sal = parseInt(sal); if (isNaN(sal)){sal = 0;} bon = acc.ta_bonuses.value; bon = bon.replace(/[,]+/g, ''); bon = parseInt(bon); if (isNaN(bon)){bon = 0;} other = acc.ta_other.value; other = other.replace(/[,]+/g, ''); other = parseInt(other); if (isNaN(other)){other = 0;} interest = acc.ta_interest_exp.value; interest = interest.replace(/[,]+/g, ''); interest = parseInt(interest); if (isNaN(interest)){interest = 0;} dep = acc.ta_depreciation.value; dep = dep.replace(/[,]+/g, ''); dep = parseInt(dep); if (isNaN(dep)){dep = 0;} nr_exp = acc.ta_non_rec_exp.value; nr_exp = nr_exp.replace(/[,]+/g, ''); nr_exp = parseInt(nr_exp); if (isNaN( nr_exp)){nr_exp = 0;} ta = sal + bon + other + dep + interest + nr_exp; document.getElementById("ta").innerHTML = addComma(ta); r_own = acc.td_cost_to_repl.value; r_own = r_own.replace(/[,]+/g, ''); r_own = parseInt(r_own); if (isNaN(r_own)){r_own = 0;} nr_inc = acc.td_non_rec_income.value; nr_inc = nr_inc.replace(/[,]+/g, ''); nr_inc = parseInt(nr_inc); if (isNaN(nr_inc)){nr_inc = 0;} or_inc = acc.td_other_income.value; or_inc = or_inc.replace(/[,]+/g, ''); or_inc = parseInt(or_inc); if (isNaN(or_inc)){or_inc = 0;} td = r_own + nr_inc + or_inc; document.getElementById("td").innerHTML = addComma(td)+ " "; ae = pte + ta - td; document.getElementById("ae").innerHTML = addComma(ae)+ " "; /* var values_from_form = [acc.pre_tax_earnings, acc.ta_salaries, acc.ta_bonuses, acc.ta_other, acc.ta_interest_exp, acc.ta_non_rec_exp, acc.td_cost_to_repl, acc.td_non_rec_income]; for (var i=0; i < values_from_form.length ; i++){ if (values_from_form[i].value == '' || values_from_form[i].value == null){ values_from_form[i].setAttribute('value', 0); } }*/ return false; }