﻿// JScript File

   
        
        var offsetxpoint=0 //Customize x offset of tooltip
        var offsetypoint=20 //Customize y offset of tooltip
        var ie=document.all
        var ns6=document.getElementById && !document.all
        var enabletip=false
        if (ie||ns6)
        var tipobj=document.all? document.all["tip"] : document.getElementById? document.getElementById("tip") : ""

        function ietruebody(){
        return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
        }

        function showtip(thetext, thecolor, thewidth){
        if (ns6||ie){
        if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
        if (typeof thecolor!="undefined" && thecolor!="") 
        {
        tipobj.style.backgroundColor=thecolor;
        }
        else
        {
        tipobj.style.backgroundColor='#D0D7DE';
        }
        if (typeof thetext=="undefined" ) thetext="You are leaving Wright-Patt Credit Union’s (WPCU) website. The site you are linking to is not operated by WPCU, and WPCU is not responsible for the content of this site. WPCU does not represent you or the third party if you enter into a transaction.  The privacy and security polices of this site may differ from those of WPCU."
        tipobj.innerHTML=thetext
        enabletip=true
        return false
        }
        }

        function positiontip(e){
        if (enabletip){
        var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
        var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
        //Find out how close the mouse is to the corner of the window
        var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
        var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

        var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

        //if the horizontal distance isn't enough to accomodate the width of the context menu
        if (rightedge<tipobj.offsetWidth)
        //move the horizontal position of the menu to the left by it's width
        tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
        else if (curX<leftedge)
        tipobj.style.left="5px"
        else
        //position the horizontal position of the menu where the mouse is positioned
        tipobj.style.left=curX+offsetxpoint+"px"

        //same concept with the vertical position
        if (bottomedge<tipobj.offsetHeight)
        tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
        else
        tipobj.style.top=curY+offsetypoint+"px"
        tipobj.style.visibility="visible"
        }
        }

        function hidetip(){
        if (ns6||ie){
        enabletip=false
        tipobj.style.visibility="hidden"
        tipobj.style.left="-1000px"
        tipobj.style.backgroundColor=''
        tipobj.style.width=''
        }
        }
        document.onmousemove=positiontip
        
function formatCurrency(clientID, displayCents) {
    txt = document.getElementById(clientID);
	num = txt.value.toString().replace(/\$|\,/g,'');
	if(isNaN(num)) { txt.value = ""; return; }
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10) cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
			num.substring(num.length-(4*i+3));
	txt.value = (((sign)?'':'-') + '$' + num + ((displayCents)?'.' + cents:''));
}

function formatPercent(clientID, displayCents) {
    txt = document.getElementById(clientID);
	num = txt.value.toString().replace(/\%/g,'');
	if(isNaN(num)) { txt.value = ""; return; }
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10) cents = "0" + cents;
	txt.value = (num + ((displayCents)?'.' + cents:'') + '%');
}



function noenter() 
    {
   // return !(window.event && window.event.keyCode == 13); 
    if(window.event.keyCode==13)
        {
        alert("testing");
        // document.getElementById('ctl00$login_control$LoginBT1').click();
         document.getElementById('ctl00$Search_Control1$SearchBT1').click();
        return !(window.event && window.event.keyCode == 13); 
        }
    }
    
 function noenterlogin() 
    {
    if(window.event.keyCode==13)
        {
        //butLogin
        //othersystem
        // document.getElementById('ctl00$login_control$LoginBT1').click();
         document.getElementById('butLogin').click();
        return !(window.event && window.event.keyCode == 13); 
        }
    }   
    
     function noentersearch() 
    {
    if(window.event.keyCode==13)
        {
        document.getElementById('ctl00$Search_Control1$SearchBT1').click();
        return !(window.event && window.event.keyCode == 13); 
        }
    }   
    
    
    function noenterseg() 
    {
    if(window.event.keyCode==13)
        {
        //butLogin
        //othersystem
        // document.getElementById('ctl00$login_control$LoginBT1').click();
         document.getElementById('ctl00$phContent$cn$ControlTemplate$btnSearch').click();
        return !(window.event && window.event.keyCode == 13); 
        }
    }   
    
   // if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {document.myForm.LoginBT1.click();return false;} else return true;
    
   

