// user.js 
//
  function AddFavorite(this_page_title) {
  IE4=(document.all)? 1 : 0
  if (IE4) {
  theSite=window.location
  window.external.AddFavorite(theSite,this_page_title)
  }
  }
  //
  function page_print(printme) {
      function stopError() {
          return true;
      };
      window.onerror = stopError;
      if (window.print) {
          eval(printme + ".print()");
      } else {
          if (document.all) {
              var OLECMDID_PRINT = 6;
              var OLECMDEXECOPT_DONTPROMPTUSER = 2;
              var OLECMDEXECOPT_PROMPTUSER = 1;
              var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";
              document.body.insertAdjacentHTML("beforeEnd", WebBrowser);
              WebBrowser1.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER);
              WebBrowser1.outerHTML = "";
          } 
      }
  }
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// .../ltool.js ... start.dw
//
//
var principal=0.00;
var repayfreq=0;
var repayamt=0.00;
var repayamtcum=0.00;
var cumperiods=0;
var irate=0.00;
//
function estbypayment()
{
irate=setinterestrate();
if (!(irate)) {Return -1;}
intthisperiod=0.00;
loanbalance=0.00;
loancuminterest=0.00;
loancumrepaid=0.00;
loanrepayment=0.00;
principal=0.00;
repayamtcum=0.00;
cumperiods=0;
monthcount=0;

if (!parseinput()) {return;
}
loanbalance=loanbalance+principal;
do{if(repayfreq==52)
    {
calcintw(1);
}
 if(repayfreq==26)
    {
calcintw(2);
}
 if(repayfreq==12)
    {
monthcount= monthcount +1;
 ti=monthcount%3;
if (ti!=1) {calcintw(4);
}
 else {calcintw(5);
}
}

calcbalance();
//document.write ("<br> P: " +principal + " iw : " +intthisperiod  +" r: " +loanrepayment +" B: " +
//loanbalance +" R: " +loancumrepaid +" I: " + loancuminterest +" Rc: " +repayamtcum);
}
 while (loanbalance > 0) if(loanbalance < 0)
    {
updateform();
}
}

function calcbalance()
    {
loanrepayment=0.00;
 loanrepayment=1*(round(repayamt - intthisperiod));
 loanbalance =1*(round(loanbalance - loanrepayment));
 loancumrepaid=1*(round(loancumrepaid +loanrepayment));
repayamtcum=1*(round(repayamtcum +loanrepayment +intthisperiod));
if (loancumrepaid > principal)
    {
loanexcess=1*(round(loancumrepaid-principal));
 loancumrepaid=1*(round(loancumrepaid-loanrepayment));
 loanrepayment=1*(round(loanrepayment-loanexcess));
 repayamtcum=1*(round(repayamtcum-loanexcess));
 loancumrepaid=1*(round(loancumrepaid+loanrepayment));
 loancuminterest=1*(round(repayamtcum-principal));
}
cumperiods=cumperiods +1;
}

function calcintw(cweeks)
    {
irate=setinterestrate();
intthisperiod=0.0;
intthisperiod=roundf(loanbalance*irate);
intthisperiod=1*(round(intthisperiod*cweeks));
loancuminterest=1*(round(loancuminterest+intthisperiod));
}

function round(x) 
{valRounded=Math.round(x*100)/100;
valRounded="" +valRounded +"";
decLoc=valRounded.indexOf(".");
if(decLoc!=-1)
    {
array1=valRounded.split(".");
if (array1[1].length!=2) {valRounded=valRounded +"0";
}
}
else{valRounded=valRounded +".00";
}
return valRounded;
}
function roundf(x)
    {
return (Math.floor(x*100))/100;
}
function updateform()
    {
document.loandata.termcount2.value=cumperiods;
document.loandata.totalpayment2.value=round(repayamtcum);
document.loandata.totalinterest2.value=round(loancuminterest);
}

function parseinput()
    {
if(document.loandata.principal.value!="")
    {
principal=parseFloat(document.loandata.principal.value);
}
else{alert("Please enter a Loan Amount.");
document.loandata.principal.focus();
return (false);
}

if(document.loandata.period.value!="")
    {
repayfreq=parseFloat(document.loandata.period.value);
}
else{alert("Please enter a Repayment Period.");
document.loandata.period.focus();
 return (false);
}
paymodel=1;
if(document.loandata.usrpaymentamount.value!="")
    {
repayamt=parseFloat(document.loandata.usrpaymentamount.value);
}
else{alert("Please enter a Repayment Amount.");
document.loandata.usrpaymentamount.focus();
return (false);
}

if(((repayfreq==52)&&((principal/400)>=repayamt))||((repayfreq==26)&&((principal/200)>=repayamt))||((repayfreq==12)&&((principal/90)>=repayamt)))
    {
alert("The repayment amount suggested, " +repayamt +", is too low.");
document.loandata.usrpaymentamount.focus();
return (false);
}
irate=setinterestrate();
return 1;
}

function ClearForm()
    {
 document.loandata.principal.value="";
 document.loandata.termcount2.value="";
 document.loandata.usrpaymentamount.value="";
 document.loandata.totalpayment2.value="";
 document.loandata.totalinterest2.value="";
 }
function setinterestrate() {
//if(document.loandata.loantype.value==1) { return 0.0020698200; }
//if(document.loandata.loantype.value==2) { return 0.0017248500; }
//if(document.loandata.loantype.value==3) { return 0.0013798800; }
//if(document.loandata.loantype.value==4) { return 0.0011499000; }
//else { document.loandata.loantype.value="";
//       document.loandata.loantype.focus();
//       alert("Please enter a valid Loan Type.");       
//       return (false); }
var jIRhard=0.0017152635;
return jIRhard;
}
//
// .../ltool.js ... end.dw
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// .../showpics.js ... start.dw
//
var slide_refresh = 5000;
var fade_duration = 3;
var mypics= new Array();
mypics[0] = '/i/custom/hp3_offices.002.jpg';
mypics[1] = '/i/custom/homeimg-st-brigid-smrcmp-2009-prsntn.jpg';
mypics[2] = '/i/custom/hp6_mktg-1.000.jpg';
mypics[3] = '/i/custom/corduff-fc-prsntn-2009.jpg';
mypics[4] = '/i/custom/hp7_mktg-2.jpg';
mypics[5] = '/i/custom/mochtas-prsntn-2009.jpg';
mypics[6] = '/i/custom/hp8_bdcu-internal.jpg';
mypics[7] = '/i/custom/verona-fc-prsntn-2009.jpg';
mypics[8] = '/i/custom/hp9_mktg-grandad.jpg';
//
var t;
var j = 0;
var p = mypics.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = mypics[i];
}
function show_pics() {
if (document.all) {
document.images.show_pics_img.style.filter="blendTrans(duration=2)";
document.images.show_pics_img.style.filter="blendTrans(duration=fade_duration)";
document.images.show_pics_img.filters.blendTrans.Apply();
}
document.images.show_pics_img.src = preLoad[j].src;
if (document.all) {
document.images.show_pics_img.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('show_pics()', slide_refresh);
}
// .../showpics.js ... end.dw
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// .../vflymnu.js ... start.dw
//
/***********************************************
* AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
//Contents for menu: menu1a
var menu1a=new Array()
menu1a[0]='<a href="/p/content/content.php?content.9" target="_top">About Us</a>'
menu1a[1]='<a href="/p/content/content.php?content.10" target="_top">Board of Directors</a>'
menu1a[2]='<a href="/p/content/content.php?content.11" target="_top">What is a credit union?</a>'
//
var menu1m=new Array()
menu1m[0]='<a href="/p/content/content.php?content.13" target="_top">Joining</a>'
menu1m[1]='<a href="/p/content/content.php?content.14" target="_top">Member Benefits</a>'
menu1m[2]='<a href="/p/content/content.php?content.15" target="_top">Nomination Form</a>'
//

var menu1f=new Array()
menu1f[1]='<a href="/download.php?view.11" target="_top">Car Draw Entry Form [pdf]</a>'
menu1f[2]='<a href="/download.php?view.4"" target="_top">Form Of Nomination [pdf]</a>'
menu1f[3]='<a href="/download.php?view.3" target="_top">Joint Membership Application [pdf]</a>'
menu1f[4]='<a href="/download.php?view.5" target="_top">Loan Application [pdf]</a>'
menu1f[5]='<a href="/download.php?view.2" target="_top">Membership Application [pdf]</a>'
menu1f[6]='<a href="/download.php?view.10" target="_top">Standing Order Mandate [pdf]</a>'

//
var menu1sa=new Array()
menu1sa[0]='<a href="/p/content/content.php?content.17" target="_top">Saving</a>'
menu1sa[1]='<a href="/p/content/content.php?content.18" target="_top">Shares</a>'
menu1sa[2]='<a href="/p/content/content.php?content.19" target="_top">Savings and Loan Protection</a>'

//Contents for menu 1menu1s

var menu1s=new Array()
menu1s[0]='<a href="/p/content/content.php?content.24" target="_top">Services Overview</a>'
menu1s[1]='<a href="/p/content/content.php?content.26" target="_top">Paypoint/Bill-Pay</a>'
menu1s[2]='<a href="/p/content/content.php?content.27" target="_top">Bin Tags</a>'
menu1s[3]='<a href="/p/content/content.php?content.29" target="_top">Express Lodgements</a>'
menu1s[4]='<a href="/p/content/content.php?content.25" target="_top">Foreign Exchange</a>'
menu1s[5]='<a href="/p/content/content.php?content.28" target="_top">Insurance</a>'
menu1s[6]='<a href="/p/content/content.php?content.30" target="_top">Thrift Accounts</a>'
menu1s[7]='<a href="/p/content/content.php?content.31" target="_top">M.A.B.S.</a>'
//menu1s[8]='<a href="/p/content/content.php?content.26" target="_top">PayPoint</a>'
menu1s[8]='<a href="/p/content/content.php?content.32" target="_top">Standing Orders</a>'
menu1s[9]='<a href="/p/content/content.php?content.33" target="_top">Western Union</a>'

<!-- menu1s[3]='<a href="index.php?art=2218013" target="_top">CUCASH</a>' -->

//
//Contents for menu 1menu1s
var menu1l=new Array()
menu1l[0]='<a href="/p/content/content.php?content.20" target="_top">Loans</a>'
menu1l[1]='<a href="/p/content/content.php?content.22"  target="_top">Borrowing</a>'
menu1l[2]='<a href="/p/content/content.php?content.19" target="_top">Savings and Loan Protection</a>'
//menu1l[3]='<a href="/p/cpp/loan-etool.php" target="_top">Loan Estimation Tool</a>'

var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds) [default:250]
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)

var horizontaloffset=2 //horizontal offset of menu from default location. (0-5 is a good value) [default:2]
var horizontaloffset=2 //horizontal offset of menu from default location. (0-5 is a good value)

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width: 160px" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}
// .../vflymnu.js ... end.dw
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
function clearform() {
    document.lc_form.ctx.value=0;
    document.lc_form.loantype.value="Standard Loan";
    document.lc_form.loanrepay_freq.value="Weekly";
    document.lc_form.principal.value="";
    document.lc_form.myvarq.value="";
    document.lc_form.myvarq_ccy.value="";
    document.lc_form.myvarq_ans.value="";
    var nx1=document.getElementById("calc_option1");
    nx1.checked = false;
    var nx1=document.getElementById("calc_option2");
    nx1.checked = false;
    var nx1=document.getElementById("intpay_option1");
    nx1.checked = false;
    var nx1=document.getElementById("intpay_option2");
    nx1.checked = false;
    document.lc_form.submit();
}
//
function getCheckedValue(radioObj) {
// return the value of the radio button that is checked
// return an empty string if none are checked, or there are no radio buttons
    if(!radioObj) { return ""; }
    var radioLength = radioObj.length;
    if (radioLength == undefined) {
	if(radioObj.checked)
	return radioObj.value;
    } else {
        return "";
    }
    for(var i = 0; i < radioLength; i++) {
        if (radioObj[i].checked) {
            return radioObj[i].value;
	}
    }
    return "";
}
//
function radio_checker() {
    var m1=getCheckedValue(document.getElementById("calc_option1"));
    var m2=getCheckedValue(document.getElementById("calc_option2"));
//  alert('Method selection inputs: (m1) ' + m1 + ' (m2) ' +m2);
    if ('0'==m1) {
//     alert('Method selection inputs: (m1) ' + m1 + ' (m2) ' +m2 + 'specify repayment amount');
       document.lc_form.myvarq.value='';
       document.lc_form.myvarq.value='How much would you like each repayment to be?';
//       document.lc_form.myvarq_ccy.value='';
//     document.lc_form.myvarq_ccy.value='&#8364;';
       document.lc_form.myvarq_ccy.value='€';
       document.lc_form.myvarq_ans.value='';
       return 1;
    } else if ('1'==m2) {
//     alert('Method selection inputs: (m1) ' + m1 + ' (m2) ' +m2 + 'specify number of repayments');
       document.lc_form.myvarq.value='';
       document.lc_form.myvarq.value='How many repayments would you like to make?';
       document.lc_form.myvarq_ccy.value=' ';
       document.lc_form.myvarq_ans.value='';
       return 2;
    }
    else {
       alert('Method selection error.');
       return -1;
    }       
}
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
function PCSL_go()
{
location=document.forms['gowheref'].gowhere.value;
}


  function AddFavorite(this_page_title) {
  IE4=(document.all)? 1 : 0
  if (IE4) {
  theSite=window.location
  window.external.AddFavorite(theSite,this_page_title)
  }
  }
  //
  function page_print(printme) {
      function stopError() {
          return true;
      };
      window.onerror = stopError;
      if (window.print) {
          eval(printme + ".print()");
      } else {
          if (document.all) {
              var OLECMDID_PRINT = 6;
              var OLECMDEXECOPT_DONTPROMPTUSER = 2;
              var OLECMDEXECOPT_PROMPTUSER = 1;
              var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";
              document.body.insertAdjacentHTML("beforeEnd", WebBrowser);
              WebBrowser1.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER);
              WebBrowser1.outerHTML = "";
          } 
      }
  }
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// -->
