var myForm = null;//override this variable to assign the document.form object in your JSP page
var vertical_position = "bottom";
var horizontal_position = "right";
var visible = false;
var overButton = false;
var field = null;
var myArray = new Array();
var keyboardFlag="small";
var alertFieldId;
var vkbFillElementSize;
var focusKey;
var moveflag=false;
var vkbName = "vkb";
var vkbShimName="vkbShim";
var curr_LeftPosition;
var curr_HeightPosition;
var initialize = false;
var vkbForm;
var myBrowser;
var ieOnWindows=true;
var largeMap = "largevkb", largeMapShim = "largevkbShim";
var smallMap = "vkb", smallMapShim = "vkbShim";
var compKBDisabled = true, keyTrapped = false;
function BrowserType()
{
var userAgent = navigator.userAgent;
this.isIE    = false;
this.isNS    = false;
this.version = null;
if (userAgent.indexOf("MSIE") >= 0) {//IE compatible browsers
this.isIE = true;
return;
}
if (userAgent.indexOf("Netscape6/") >= 0) {
this.isNS = true;
return;
}
if (userAgent.indexOf("Gecko") >= 0) { //firefox and other browsers
this.isNS = true;
return;
}
}
myBrowser = new BrowserType();
function done(val)
{
hideVkb(val);
}
function keyDown(e)
{
if(compKBDisabled)
{
var key;
if(myBrowser.isIE)
key=event.keyCode;
if((key==17) || (key==8))
{
keyTrapped = true;
//alert(keypressError);
return false;
}
}
}
function keyPress(e) 
{
if(compKBDisabled)
{
var key;
if(myBrowser.isIE)
key = event.keyCode
else if (myBrowser.isNS)
key = e.which
else if (ns4)	 
{
key = e.which
if(key == prevKey) 
{
key = 0;
prevKey=-100;
}
else 
{
prevKey=key;
}
}
if(key != 0 && key != 17 && key != 8) 
{
keyTrapped = true;
alert(keypressError);
return false;
}
}
}
function showCursor(cursorType){
if(cursorType=="hand"){overButton = true;}else{overButton = false;}
if(navigator.appName!="Netscape"){accessLayer(vkbName).cursor=cursorType;}
}
function add(val)
{
if(keyTrapped){ keyTrapped = false; return; }
var elPtr;
var i=0;
var foundField = false;
if(foundField == false)
{
elPtr = eval(vkbFillElement);
if(elPtr)
{
// this checks for length of field
var focusValue = new String(elPtr.value);
if(focusValue.length<vkbFillElementSize)
{
elPtr.value = focusValue + val;
}
else
{
if(pwdExceedMaxLength.length > 0){ alert(pwdExceedMaxLength);}
}
foundField = true;
}
}
if(foundField == false)
{
alert(focusError);
}
}
function del(val)
{
var elPtr;
var i=0;
var foundField = false;
if(foundField == false)
{
elPtr = eval(vkbFillElement);
if(elPtr)
{
// this checks for length of field
var focusValue = new String(elPtr.value);
if(focusValue.length >0)
{
focusValue = focusValue.substring(0,focusValue.length-1);
elPtr.value = focusValue
}
foundField = true;
}
}
if(foundField == false)
{
alert(focusError);
}
}
function clear(val)
{
var elPtr;
elPtr = eval(vkbFillElement);
elPtr.value = "";
}
var origMouseX, origMouseY;	// set global variables used later on
var myObj = new Object();
function startdrag(event, objID) //Netscape 4.x browsers are not supported
{
if(overButton)
return false;
if(objID)
{
if(document.getElementById)
myObj.elNode = document.getElementById(objID);
else if(document.all)
myObj.elNode = document.all[objID];
}
else
{
if (myBrowser.isIE)
myObj.elNode = window.event.srcElement;
else if (myBrowser.isNS)
myObj.elNode = event.target;
}
if (myBrowser.isIE) {
origMouseX = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
origMouseY = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
}
if (myBrowser.isNS) {
origMouseX = event.clientX + window.scrollX;
origMouseY = event.clientY + window.scrollY;
}
myObj.cursorStartX = origMouseX;
myObj.cursorStartY = origMouseY;
myObj.elStartLeft  = parseInt(myObj.elNode.style.left);
myObj.elStartTop   = parseInt(myObj.elNode.style.top);
if (myBrowser.isIE) {
document.attachEvent("onmousemove", dragit);
document.attachEvent("onmouseup",   stopdrag);
window.event.cancelBubble = true;
window.event.returnValue = false;
}
if (myBrowser.isNS) {
document.addEventListener("mousemove", dragit,   true);
document.addEventListener("mouseup",   stopdrag, true);
event.preventDefault();
}
}
function dragit(event){	// function that operates on mousemove.  It moves the layer that was selected in the startdrag() function
var mouseX, mouseY;
if (myBrowser.isIE) {
mouseX = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
mouseY = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
}
if (myBrowser.isNS) {
mouseX = event.clientX + window.scrollX;
mouseY = event.clientY + window.scrollY;
}
//Now drag to object to where the new mouse position is
//Save the new position to be used later
curr_LeftPosition =(myObj.elStartLeft + mouseX - myObj.cursorStartX);
curr_HeightPosition = (myObj.elStartTop  + mouseY - myObj.cursorStartY);
curr_LeftPosition = curr_LeftPosition < 0 ? 0 : curr_LeftPosition;
curr_HeightPosition = curr_HeightPosition < 0 ? 0 : curr_HeightPosition;
if(ieOnWindows)
{
accessLayer(vkbShimName).left = curr_LeftPosition; // moves the layer to the appropriate place (moves the X coordinate of the layer)
accessLayer(vkbShimName).top = curr_HeightPosition; // moves the layer to the appropriate place (moves the Y coordinate of the layer)
}
myObj.elNode.style.left = curr_LeftPosition;
myObj.elNode.style.top  = curr_HeightPosition;
moveflag = true; //next time display the object at the same location
if (myBrowser.isIE)
{
window.event.cancelBubble = true;
window.event.returnValue = false;
}
else if (myBrowser.isNS)
{
event.preventDefault();
}
}
function stopdrag(event){
if (myBrowser.isIE) {
document.detachEvent("onmousemove", dragit);
document.detachEvent("onmouseup",   stopdrag);
}
if (myBrowser.isNS) {
document.removeEventListener("mousemove", dragit,   true);
document.removeEventListener("mouseup",   stopdrag, true);
}
}
function check_cookies(cookiename)
{
var cookie_val = getCookie(cookiename);
if( (cookie_val != "large") && (cookie_val != "small"))
cookie_val="small";
keyboardFlag=cookie_val;
if(cookie_val = "large")
{
vkbName = largeMap;
vkbShimName = largeMapShim;
}
else
{
vkbName = smallMap;
vkbShimName= smallMapShim;
}
}
function getexpirydate( nodays)
{
var UTCstring;
Today = new Date();
nomilli=Date.parse(Today);
Today.setTime(nomilli+nodays*24*60*60*1000);
UTCstring = Today.toUTCString();
return UTCstring;
}
function set_cookie(name,value,duration)
{
cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration);
document.cookie=cookiestring;
if(!getCookie(name))
{
return false;
}
else
{
return true;
}
}
var global_availWidth;
var global_availHeight;
var global_LeftPosition;
var global_HeightPosition;
function fixinit_size()
{
check_cookies("capp_keyboard");
var temp_Lower_height;
var temp_Upper_height;
var temp_Lower_Limit;
var temp_Upper_Limit;
var height_randomFlag="false";
var width_randomFlag="false";
global_availWidth = document.body.clientWidth;
global_availHeight = document.body.clientHeight;
if(keyboardFlag=="small")
{
if(screen.width <= 800)
{
if(myBrowser.isIE)
{
temp_Lower_Limit = global_availWidth-(490);
temp_Upper_Limit = global_availWidth-(470);
temp_Lower_height = global_availHeight/4;
temp_Upper_height = global_availHeight/3;
}
else
{
temp_Lower_Limit = global_availWidth-(150);
temp_Upper_Limit = global_availWidth-(140);
temp_Lower_height = global_availHeight-200;
temp_Upper_height = global_availHeight-150;
}
global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);
}
else
{
if(myBrowser.isIE)
{
temp_Lower_Limit = global_availWidth-(500);
temp_Upper_Limit = global_availWidth-(450);
temp_Lower_height = global_availHeight/4;
temp_Upper_height = global_availHeight/3;
}
else
{
temp_Lower_Limit = global_availWidth-(250);
temp_Upper_Limit = global_availWidth-(200);
temp_Lower_height = global_availHeight/2;
temp_Upper_height = global_availHeight/1.8;
}
global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);
}
}
else
{
if(screen.width <= 800)
{
if(myBrowser.isIE)
{
temp_Lower_Limit = global_availWidth-(490);
temp_Upper_Limit = global_availWidth-(470);
temp_Lower_height = global_availHeight/4;
temp_Upper_height = global_availHeight/3;
}
else
{
temp_Lower_Limit = global_availWidth-(150);
temp_Upper_Limit = global_availWidth-(140);
temp_Lower_height = global_availHeight-200;
temp_Upper_height = global_availHeight-150;
}
global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);
}
else
{
if(myBrowser.isIE)
{
temp_Lower_Limit = global_availWidth-(500);
temp_Upper_Limit = global_availWidth-(450);
temp_Lower_height = global_availHeight/4;
temp_Upper_height = global_availHeight/3;
}
else
{
temp_Lower_Limit = global_availWidth-(250);
temp_Upper_Limit = global_availWidth-(200);
temp_Lower_height = global_availHeight/2;
temp_Upper_height = global_availHeight/1.8;
}
global_LeftPosition=Math.floor(Math.random()*(1+temp_Upper_Limit - temp_Lower_Limit) + temp_Lower_Limit);
global_HeightPosition=Math.floor(Math.random()*(1+temp_Upper_height - temp_Lower_height) + temp_Lower_height);
}
}
if( (global_LeftPosition >= temp_Lower_Limit) && (global_LeftPosition <= temp_Upper_Limit) )
{
global_availWidth =global_LeftPosition;
width_randomFlag="true";
}
else
{
width_randomFlag="false";
}
if( (global_HeightPosition >= temp_Lower_height) && (global_HeightPosition <= temp_Upper_height) )
{
global_availHeight =global_HeightPosition;
height_randomFlag="true";
}
else
{
height_randomFlag="false";
}
if(keyboardFlag=="small")
{
if(screen.width <= 800)
{
if(width_randomFlag=="false")
{
if(myBrowser.isIE)
global_availWidth=global_availWidth-(470);
else
global_availWidth=global_availWidth-(150);
}
if(height_randomFlag=="false")
{
if(myBrowser.isIE)
{
global_availHeight = global_availHeight/4;
}
else
{
global_availHeight = global_availHeight - 200;
}
}
}
else
{
if(width_randomFlag=="false")
{
if(myBrowser.isIE)
global_availWidth=global_availWidth-(450);
else
global_availWidth=global_availWidth-(450);
}
if(height_randomFlag=="false")
{
if(myBrowser.isIE)
global_availHeight = global_availHeight/3;
else
global_availHeight = global_availHeight/1.8;
}
}
}
else
{
if(screen.width <= 800)
{
if(width_randomFlag=="false")
{
if(myBrowser.isIE)
global_availWidth=global_availWidth-(450);
else
global_availWidth=global_availWidth-(140);
}
if(height_randomFlag=="false")
{
if(myBrowser.isIE)
global_availHeight = global_availHeight/2;
else
global_availHeight = global_availHeight-150;
}
}
else
{
if(width_randomFlag=="false")
{
if(myBrowser.isIE)
global_availWidth=global_availWidth-(500);
else
global_availWidth=global_availWidth-(200);
}
if(height_randomFlag=="false")
{
if(myBrowser.isIE)
global_availHeight = global_availHeight/4;
else
global_availHeight = global_availHeight/1.8;
}
}
}
initialize = true;
}
function showVkb(fieldRef,restop)
{
//if(!initialize){return;}
fixinit_size();
if(compKBDisabled){fieldRef.onkeypress=keyPress; fieldRef.onkeydown=keyDown;}
if (keyboardFlag == "large")
{
showVkbLarge(fieldRef,restop);
}
else
{
vkbName = smallMap;
vkbShimName = smallMapShim;
showVkbSmall(fieldRef,restop);
}
}
function showVkbSmall(fieldRef,restop)
{
vkbFillElement = fieldRef;
var availWidth;
var fromTop;
fromTop = fieldRef.offsetTop;
var availHeight;
var vkbRef = accessLayer(vkbName);
if(vkbRef.visibility == 'visible'){return}
if(!moveflag)
{
availWidth=global_availWidth;
availHeight=global_availHeight;
if (myBrowser.isIE && vkbRef)
{
if(screen.width <= 800)
{
if(horizontal_position == "middle")
{
vkbRef.left = availWidth/3;
}
else if(horizontal_position == "left")
{
vkbRef.left= 0;
}
else
{
vkbRef.left = availWidth;
}
}
else
{
vkbRef.left = availWidth;
}
if(screen.height <= 600 || availHeight <= 500 || restop == 1)
{
vkbRef.top = fromTop + availHeight ;
}
else
{
vkbRef.top= fromTop + availHeight;
}
}
else if (myBrowser.isNS && vkbRef)
{
if(screen.width <= 800)
{
if(horizontal_position == "middle")
{
vkbRef.left = availWidth/3;
}
else if(horizontal_position == "left")
{
vkbRef.left = 0;
}
else
{
vkbRef.left = availWidth-255;
}
}
else
{
vkbRef.left = availWidth-255;
}

if(screen.height <= 600 || availHeight <= 500 || restop == 1)
{

vkbRef.top = fromTop +  availHeight-140;
}
else
{

vkbRef.top = fromTop + availHeight/2;
}
}
}
else
{
vkbRef.left =curr_LeftPosition;
vkbRef.top =curr_HeightPosition;
}
if(vkbRef)
{
if(ieOnWindows)
{
var vkbShimRef = accessLayer(vkbShimName);
if(vkbShimRef)
{
vkbShimRef.top=vkbRef.top;
vkbShimRef.left=vkbRef.left;
vkbShimRef.visibility='visible';
vkbShimRef.zIndex=99;
}
}
vkbRef.visibility = 'visible';
vkbRef.zIndex = 100;
}
}
function showVkbLarge(fieldRef)
{
vkbFillElement = fieldRef;
var availWidth;
var availHeight;
var vkbRef = accessLayer(vkbName);
if(vkbRef.visibility == 'visible'){return}
if(!moveflag)
{
availWidth=global_availWidth;
availHeight=global_availHeight;
if (myBrowser.isIE && vkbRef)
{
if(screen.width <= 800)
{
if(horizontal_position == "middle")
{
vkbRef.left = availWidth/3;
}
else if(horizontal_position == "left")
{
vkbRef.left= 0;
}
else
{
vkbRef.left= availWidth;
}
}
else
{
vkbRef.left = availWidth;
}
if(screen.height <= 600 || availHeight <= 500)
{
vkbRef.top= availHeight ;
}
else
{
vkbRef.top=availHeight;
}
}
else if (myBrowser.isNS && vkbRef)
{
if(screen.width <= 800)
{
if(horizontal_position == "middle")
{
vkbRef.left = availWidth/3;
}
else if(horizontal_position == "left")
{
vkbRef.left = 0;
}
else
{
vkbRef.left = availWidth-255;
}
}
else
{
vkbRef.left = availWidth-255;
}
if(screen.height <= 600 || availHeight <= 500)
{
vkbRef.top = availHeight-140;
}
else
{
vkbRef.top = availHeight/2;
}
}
}
else
{
vkbRef.left =curr_LeftPosition;
vkbRef.top =curr_HeightPosition;
}
if(vkbRef)
{
if(ieOnWindows)
{
var vkbShimRef = accessLayer(vkbShimName);
if(vkbShimRef)
{
vkbShimRef.top=vkbRef.top;
vkbShimRef.left=vkbRef.left;
vkbShimRef.visibility='visible';
vkbShimRef.zIndex=100;
}
}
vkbRef.visibility = 'visible';
vkbRef.zIndex = 100;
}
}
function hideVkb(fieldRef)
{
if (keyboardFlag == "large")
{
hideVkbLarge(fieldRef);
}
else
{
vkbName = smallMap;
vkbShimName = smallMapShim;
hideVkbSmall(fieldRef);
}
}
function hideVkbSmall(fieldRef)
{
vkbFillElement = "";
var vkbRef = accessLayer(vkbName);
if(ieOnWindows)
{
var vkbShimRef = accessLayer(vkbShimName);
if(vkbShimRef){vkbShimRef.visibility = 'hidden'; vkbShimRef.zIndex=-1}
}
if(vkbRef){vkbRef.visibility = 'hidden'; vkbRef.zIndex=-1}
}
function hideVkbLarge(fieldRef)
{
vkbFillElement = "";
var vkbRef = accessLayer(vkbName);
if(ieOnWindows)
{
var vkbShimRef = accessLayer(vkbShimName);
if(vkbShimRef){vkbShimRef.visibility = 'hidden'; vkbShimRef.zIndex=-1}
}
if(vkbRef){vkbRef.visibility = 'hidden'; vkbRef.zIndex=-1}
}
function smallkeyboard(element)
{
hideVkb(element);
keyboardFlag="small";
vkbName = smallMap;
vkbShimName = smallMapShim;
set_cookie('capp_keyboard',keyboardFlag,2);
var pwdField = null;
if(focusKey=="password"){pwdField = vkbForm.password;}
else if (focusKey=="pwd"){pwdField=vkbForm.pwd;}
else if(focusKey=="passwordConfirm"){pwdField = vkbForm.passwordConfirm;}
else if(focusKey=="currentPassword"){pwdField = vkbForm.currentPassword;}
else if(focusKey=="pin"){pwdField = vkbForm.pin;}
else if(focusKey=="secretAnswer1"){pwdField = vkbForm.secretAnswer1;}
else if(focusKey=="secretAnswer2"){pwdField = vkbForm.secretAnswer2;}
else if(focusKey=="oldPin"){pwdField = vkbForm.oldPin;}
else if(focusKey=="newPin"){pwdField = vkbForm.newPin;}
else if(focusKey=="renewPin"){pwdField = vkbForm.renewPin;}
alertFieldId=pwdField;
showVkb(pwdField);
focusId="1";
}
function largekeyboard(element)
{
hideVkb(element);
keyboardFlag="large";
vkbName = largeMap;
vkbShimName = largeMapShim;
set_cookie('capp_keyboard',keyboardFlag,2);
var pwdField = null;
if(focusKey=="password"){pwdField = vkbForm.password;}
else if (focusKey=="pwd"){pwdField=vkbForm.pwd;}
else if(focusKey=="passwordConfirm"){pwdField = vkbForm.passwordConfirm;}
else if(focusKey=="currentPassword"){pwdField = vkbForm.currentPassword;}
else if(focusKey=="pin"){pwdField = vkbForm.pin;}
else if(focusKey=="secretAnswer1"){pwdField = vkbForm.secretAnswer1;}
else if(focusKey=="secretAnswer2"){pwdField = vkbForm.secretAnswer2;}

else if(focusKey=="oldPin"){pwdField = vkbForm.oldPin;}
else if(focusKey=="newPin"){pwdField = vkbForm.newPin;}
else if(focusKey=="renewPin"){pwdField = vkbForm.renewPin;}
alertFieldId=pwdField;
showVkb(pwdField);
focusId="1";
}
function accessLayer(layerID)
{
if(document.getElementById && document.getElementById(layerID))
return document.getElementById(layerID).style;
else if(document.all && document.all[layerID])
return document.all[layerID].style;
else if(document.layers && document.layers[layerID])
return document.layers[layerID];
}
var isSubappBusy;
var warnType = "";
var lockType = "";
var displayType = "";
var displayPhrase = "";
var displayPhrase2= "";
var LOCK = "lock";
var WARN = "warn";
var logOffWhenCancelled = "false";
var suppressWarn = "false";
var suppressLock = "false";
var isE2e = false;
var openWins = new Array();
var openWinsCount = 0;
function addWinToList(winHandle)
{
openWins[openWinsCount++] = winHandle;
}
function closeOpenWins()
{
var i = 0;
for(i = 0; i < openWins.length; i++)
{
if(openWins[i])
openWins[i].close();
}
}
function isSubappBusy()
{
return ((displayPhrase != null) && (displayPhrase != ""));
}
function confirmGo(sprWarn, sprLock)
{
suppressWarn = sprWarn;
if(typeof suppressWarn == 'undefined')
suppressWarn = "false";
suppressLock = sprLock;
if(typeof suppressLock == 'undefined')
suppressLock = "false";
return ConfirmGo()
}
function ConfirmGo()
{
var subappBusy = isSubappBusy();
if (subappBusy)
{
if (lockType == LOCK && suppressLock == "false")
{
alert (displayPhrase);
return false;
}
else if (warnType == WARN && suppressWarn == "false" )
{
if (!confirm(displayPhrase))
{
if(logOffWhenCancelled == "true")
{
logOff();
}
return false;
}
else
{
if (displayPhrase2 != "")
{
if (!confirm(displayPhrase2))
{
if(logOffWhenCancelled == "true")
{
logOff();
}
return false;
}
}
}
}
else
{
if(suppressWarn == "false" && suppressLock == "false")
alert("Dialog Error: ConfirmGo 'Type' not alert or confirm!");
}
}
//setSubappBusy("","","");
return true;
}
function setSubappBusy(dType, phrase1, phrase2)
{
if (dType == "")
{
lockType = dType;
warnType = dType;
displayPhrase = "";
displayPhrase2 = "";
}
else
{
if(dType == WARN)
warnType = dType;
else if(dType == LOCK)
lockType = dType;
displayPhrase = phrase1;
displayPhrase2 = phrase2;
logOffWhenCancelled = "false";
}
}
function setSubappBusy2(dType, phrase1, phrase2, logOffIfCancelled)
{
if (dType == "")
{
lockType = dType;
warnType = dType;
displayPhrase = "";
displayPhrase2 = "";
logOffWhenCancelled = "false";
}
else
{
if(dType == WARN)
warnType = dType;
else if(dType == LOCK)
lockType = dType;
displayPhrase = phrase1;
displayPhrase2 = phrase2;
logOffWhenCancelled = logOffIfCancelled;
}
}
function submitLinkPostForm(formName)
{
var myForm = document.forms[formName];
myForm.submit();
}
function submitLinkPostForm2(formName, actionURL)
{
var myForm = document.forms[formName];
myForm.action=actionURL;
myForm.submit();
}
function encryptE2e(form)
{
if (!document.e2e)
return;
e2eapplet = document.e2e;
if (form.pin) {
enc = e2eapplet.encryptPIN(form.pin.value,eid);
if (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 5)
form.pin.maxLength = enc.length();
form.pin.value = enc;
}
if (form.pwd) {
enc = e2eapplet.encryptPassword(form.pwd.value,eid);
if (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 5)
form.pwd.maxLength = enc.length();
form.pwd.value = enc;
}
}
function validateToken(form) {
return true;
}
function validateCredential(form) {
var isValid = true;
var focusField = null;
var i = 0;
var NO_SELECTION = '-1';
var fields = new Array();
oRequired = new credentials();
for (x in oRequired) {
var field = form[oRequired[x][0]];
if(typeof field != 'undefined') {
if(field.type != null) {
if(field != null && field.disabled == false) {
if (field.type == 'text' ||
field.type == 'password') {
if (field.type == 'text' || field.type == 'password') {
if (field.value == '' || field.value == null) {
focusField = field;
fields[i++] = oRequired[x][1];
isValid = false;
break;
}
}
}
}
}
}
}   
if (fields.length > 0 && focusField != null) {
alert(fields.join('\n'));
focusField.focus();
}
if (isValid && document.getElementById("reentry"))
disablePinPad();
if (isValid && (document.getElementById("vkb") || document.getElementById("largevkb")))
hideVkb('done');
if (isValid && isE2e)
encryptE2e(form);
return isValid;
}
function validateCredentialOnClient(form) {
var isValid = true;
var focusField = null;
var i = 0;
var NO_SELECTION = '-1';
var fields = new Array();
oRequired = new credentialsonclient();
for (x in oRequired) {
var field = form[oRequired[x][0]];
if(typeof field != 'undefined') {
if(field.type != null) {
if(field != null && field.disabled == false) {
if (field.type == 'text' ||
field.type == 'password') {
if (field.type == 'text' || field.type == 'password') {
if (field.value == '' || field.value == null) {
focusField = field;
fields[i++] = oRequired[x][1];
isValid = false;
break;
}
}
}
}
}
}  
}   
if (fields.length > 0 && focusField != null) {
alert(fields.join('\n'));
focusField.focus();
}
if (isValid && document.getElementById("reentry"))
disablePinPad();
if (isValid && isE2e)
encryptE2e(form);
return isValid;
}
function validateRequired(form) {
var isValid = true;
var focusField = null;
var i = 0;
var NO_SELECTION = '-1';
var fields = new Array();
oRequired = new required();
for (x in oRequired) {
var field = form[oRequired[x][0]];
if(typeof field != 'undefined') {
if(field.type != null) {
if(field != null &&  field.disabled == false && (typeof field.readOnly == 'undefined' || field.readOnly == false) ) {
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'file' ||
field.type == 'select-one' ||
field.type == 'radio' ||
field.type == 'password' ||
field.type == 'hidden' ||
field.type == 'checkbox') {
var value = NO_SELECTION;
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
}
}
else {
value = field.value;
}
if (field.type == "select-one" && value == NO_SELECTION) {
if (i == 0) {
focusField = field;
}
fields[i++] = oRequired[x][1];
isValid = false;
break;
}
if (field.type == 'text' 
|| field.type == 'password'
|| field.type == 'textarea'
|| field.type == 'hidden') {
if (field.value == '' || field.value == null) {
focusField = field;
fields[i++] = oRequired[x][1];
isValid = false;
break;
}
}
if (field.type == 'checkbox') {
var checked = false;
if (field.checked) {
checked=true;
}
if(checked==false){
focusField=field;
fields[i++] = oRequired[x][1];
isValid = false;
break;
}
}
}
}
}
else {
var checked = false;
var skipped = true;
var focusElem;
for(j=0;j<field.length;j++) {
temp = field[j];
if (temp == null
|| temp.disabled == true
|| typeof  temp.readOnly == 'undefined'
|| temp.readOnly == true) {
continue;
}
else {
skipped = false;
if (temp.type == 'radio') {
focusElem=temp;
if(temp.checked) {
checked=true;
}
}
if(temp.type == 'checkbox') {
focusElem=temp;
if(temp.checked) {
checked=true;
}
}
if(temp.type == 'text') {
focusElem=temp;
if(temp.value !='') {
checked=true;
}
}
}
}
if(checked==false && !skipped) {
focusField=focusElem;
fields[i++] = oRequired[x][1];
isValid = false;
break;
}
}
}
}
if (fields.length > 0 && focusField != null) {
if (focusField.type != "hidden")
focusField.focus();
alert(fields.join('\n'));
}
return isValid;
}
function validateRequired2(form) {
var isValid = true;
var focusField = null;
var i = 0;
var NO_SELECTION = '-1';
var fields = new Array();
oRequired = new required2();
for (x in oRequired) {
var field = form[oRequired[x][0]];
if(typeof field != 'undefined') {
if(field.type != null) {
if(field != null &&  field.disabled == false && (typeof field.readOnly == 'undefined' || field.readOnly == false) ) {
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'file' ||
field.type == 'select-one' ||
field.type == 'radio' ||
field.type == 'password' ||
field.type == 'hidden') {
var value = NO_SELECTION;
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
}
}
else {
value = field.value;
}
if (field.type == "select-one" && value == NO_SELECTION) {
if (i == 0) {
focusField = field;
}
fields[i++] = oRequired[x][1];
isValid = false;
break;
}
if (field.type == 'text' 
|| field.type == 'password'
|| field.type == 'textarea'
|| field.type == 'hidden') {
if (field.value == '' || field.value == null) {
focusField = field;
fields[i++] = oRequired[x][1];
isValid = false;
break;
}
}
}
}
}
else {
var checked = false;
var skipped = true;
var focusElem;
for(j=0;j<field.length;j++) {
temp = field[j];
if (temp == null
|| temp.disabled == true
|| typeof  temp.readOnly == 'undefined'
|| temp.readOnly == true) {
continue;
}
else {
skipped = false;
if (temp.type == 'radio') {
focusElem=temp;
if(temp.checked) {
checked=true;
}
}
if(temp.type == 'checkbox') {
focusElem=temp;
if(temp.checked) {
checked=true;
}
}
if(temp.type == 'text') {
focusElem=temp;
if(temp.value !='') {
checked=true;
}
}
}
}
if(checked==false && !skipped) {
focusField=focusElem;
fields[i++] = oRequired[x][1];
isValid = false;
break;
}
}
}
}
if (fields.length > 0 && focusField != null) {
if (focusField.type != "hidden")
focusField.focus();
alert(fields.join('\n'));
}
return isValid;}
function validateMaxLength(form) {
return true;
}
function validateInputText(form) {
return true;
}
function getCookie(name)
{
var c=""+document.cookie;
var index = c.indexOf(name + "=");
if (index == -1) return null;
var endstr = c.indexOf(";", index);
if (endstr == -1) endstr = c.length;
return unescape(c.substring(index+name.length+1, endstr));
}
function setCookie (name,value,expires,path,domain,secure) {
document.cookie = name + "=" + value + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}
function isEmpty(s){ return ((s == null) || (s.length == 0)) }
function isWhitespace (s)
{
var i;
var whitespace = " \t\n\r";
if (isEmpty(s)) return true; // Is s empty?
for (i = 0; i < s.length; i++)
{
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (whitespace.indexOf(c) == -1) return false;
}
return true;
}
function displayHelp(helpURL, windowName, openWinOptions)
{
var anchor = "";
if(helpURL.indexOf("#") != -1)
{
anchor = helpURL.substring(helpURL.indexOf("#") + 1);
}
if(!isWhitespace(applicationID))
{
helpURL += (helpURL.indexOf("?") != -1) ? "&" : "?";
helpURL += "appId=" + applicationID;
}
if(!isWhitespace(screenID))
{
helpURL += (helpURL.indexOf("?") != -1) ? "&" : "?";
helpURL += "screenId=" + screenID;
}
if(!isWhitespace(transactionTypeCode))
{
helpURL += (helpURL.indexOf("?") != -1) ? "&" : "?";
helpURL += "ttc=" + transactionTypeCode;
}
if(!isWhitespace(anchor))
helpURL += "#" + anchor;
var winHandle = showPopup_W_XY(helpURL, windowName,openWinOptions, 160, 80);
addWinToList(winHandle);
winHandle.focus();
}
function OnClickHandler() {
var el=null;
var flag=true;
el=event.srcElement;
while (flag && el) {
if (el.tagName=="A") {
flag=false;
if (el.protocol=="javascript:" || el.href.indexOf("javascript:")!=-1) {
execScript(unescape(el.href),"javascript");
window.event.returnValue=false;
}
}
else
el=el.parentElement;
}
}
if ((navigator.appName.indexOf("Microsoft")!=-1) && (navigator.appVersion.substring(0,1)>"3"))
if (navigator.userAgent.indexOf('Mac') == -1)
document.onclick=OnClickHandler;
function NS6OnClickHandler(event) {
var srcElement=event.target;
if (srcElement.nodeType==1 || srcElement.nodeType==3)
srcElement=srcElement.parentNode;
if (srcElement.tagName=="A") {
if (lockType==LOCK) {
alert(displayPhrase);
return false;
}
}
return true;
}
if (navigator.appName.indexOf("Netscape")!=-1  && document.getElementById  && navigator.userAgent.indexOf("Safari") == -1)
document.onclick = NS6OnClickHandler;
if(window.location.protocol.indexOf("https") != -1)
setCookie("JSESSIONID", getCookie("JSESSIONID"), null, "/", null, true);
if (document.captureEvents) 
{//non IE
if (Event.MOUSEDOWN)
{//NS 4, NS 6+, Mozilla 0.9+
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = winMouseDown;
}
}
var _evt = null;
function winMouseDown(e)
{
_evt = e;
}
function winSize() 
{
var wW = -1;
var wH = -1;
if (typeof(window.innerWidth) == 'number') 
{//Non-IE
wW = window.innerWidth;
wH = window.innerHeight;
} 
else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
{//IE 6+ in 'standards compliant mode'
wW = document.documentElement.clientWidth;
wH = document.documentElement.clientHeight;
} 
else if (document.body && (document.body.clientWidth || document.body.clientHeight)) 
{//IE 4 compatible
wW = document.body.clientWidth;
wH = document.body.clientHeight;
}
var win = new Object();
win.x = wW;
win.y = wH;
return win;
}
function popupWinSize(winProp)
{
var wW = -1;
var wH = -1;
var props = winProp.split(',');
for (var i = 0; i < props.length; i++)
{
var nv = props[i].split('=');
if (nv.length == 2)
{
var n = nv[0].replace(/^\s+/, '').replace(/\s+$/, '');
var v = nv[1].replace(/^\s+/, '').replace(/\s+$/, '');
if (n.toLowerCase() == "width" && !isNaN(parseInt(v,10))) wW = parseInt(v,10);	
else if (n.toLowerCase() == "height" && !isNaN(parseInt(v,10))) wH = parseInt(v,10);
}
}
var win = new Object();
win.x = wW;
win.y = wH;
return win;
}
function getClickPos()
{
var mouseX = 0;
var mouseY = 0;
if (!_evt) _evt=window.event||arguments.callee.caller.arguments[0];
if (_evt)
{
if (typeof(_evt.pageX) == 'number' ) 
{
mouseX = _evt.pageX;
mouseY = _evt.pageY;
}
else if(typeof(_evt.clientX) == 'number')
{
mouseX = _evt.clientX;
mouseY = _evt.clientY;
}
}
var mouse = new Object();
mouse.x = mouseX;
mouse.y = mouseY;
return mouse;	
}
function showPopup_W_XY(url, wn, winProp, X, Y)
{
var mouse = new Object();
mouse.x = X;
mouse.y = Y;
mouse.offsetX = 0;
mouse.offsetY = 0;
return doPopup(url, wn, winProp, mouse, 'W');
}
function showPopup_L_XY(url, wn, winProp, X, Y)
{
var mouse = getClickPos();
mouse.offsetX = X;
mouse.offsetY = Y;
return doPopup(url, wn, winProp, mouse, 'L');
}
function showPopup(url, wn, winProp)
{
var mouse = getClickPos();
mouse.offsetX = 25;
mouse.offsetY = 0;
return doPopup(url, wn, winProp, mouse, 'L');
}
function doPopup(url, wn, winProp, mouse, type)
{  
var x = 0;
var y = 0;
var offsetX = 0;
var offsetY = 0;
url+="";
wn+="";
winProp+="";
if (winProp == null) winProp = "";
if (document.getElementById) 
{
if (isNaN(window.screenX))
{// IE6
x=mouse.x+window.screenLeft
y=mouse.y+window.screenTop
}
else 
{// Mozilla Firefox 0.9
if (type=='L')
{
offsetX = window.pageXOffset;
offsetY = window.pageYOffset;
}
x=mouse.x+window.screenX+(window.outerWidth-window.innerWidth)-offsetX;
y=mouse.y+window.screenY+(window.outerHeight-24-window.innerHeight)-offsetY;
}
}
else if (document.all) 
{
x=mouse.x+window.screenLeft
y=mouse.y+window.screenTop	
}
else if (document.layers) 
{// NS 4.7x
if (type=='L')
{
offsetX = window.pageXOffset;
offsetY = window.pageYOffset;
}	
x=mouse.x+window.screenX+(window.outerWidth-window.innerWidth)-offsetX;
y=mouse.y+window.screenY+(window.outerHeight-24-window.innerHeight)-offsetY;
}
x += mouse.offsetX;
y += mouse.offsetY;
if (x<0) x=0;
if (y<0) y=0;
var popupWin = popupWinSize(winProp);
if (popupWin.x < 0 || popupWin.y < 0)
{
var win = winSize();
if (popupWin.x < 0) popupWin.x = win.x;
if (popupWin.y < 0) popupWin.y = win.y;	
}
if (screen && screen.availHeight)
{
if ((y + popupWin.y) > screen.availHeight)
y = screen.availHeight - popupWin.y;
}
if (screen && screen.availWidth)
{
if ((x + popupWin.x) > screen.availWidth)
x = screen.availWidth - popupWin.x;
}
return window.open (url, wn, winProp + ',screenX='+x+',left='+x+',screenY='+y+',top='+y);
}
function linkParentAndCloseSelf(url){
self.opener.location = url;
window.close();
}
function trim(str){
var reTrimRight = / +$/;
var reTrimLeft = /^ +/;
str = str.replace( reTrimRight, "" );
str = str.replace( reTrimLeft, "" );
return str;
}
function openPrintWin(url, wn, winProp)
{
var winHandle = window.open(url, wn, winProp);
addWinToList(winHandle);
winHandle.focus();
}
//function hlMenu() {
function hlMenu(BusinessId) {

var l = new Array("","A","B","C","D");
for (var i = 1; i <= L; i++) {
var className = "NavL"+l[i]+"On";
eval("var cellID = 'cell_link_'+L"+i);
eval("var linkID = 'link_'+L"+i);
if (document.getElementById(cellID) == null)
continue;		
document.getElementById(cellID).className = className;
document.getElementById(linkID).className = className;
if (i == 1) {
eval("var imgID = 'image_link_'+L"+i);	
document.getElementById(cellID+"L").className = className+"L";
document.getElementById(cellID+"R").className = className+"R";		
var imgR = document.getElementById(imgID+"R").src;
var imgL = document.getElementById(imgID+"L").src;
//var imgONR = imgR.substr(0,imgR.indexOf('spacer.gif')) + 'tab_r.gif';
//var imgONL = imgL.substr(0,imgL.indexOf('spacer.gif')) + 'tab_l.gif';
if(BusinessId=='RUGCB'){
var imgONR = imgR.substr(0,imgR.indexOf('spacer.gif')) + 'tab_r.gif';
var imgONL = imgL.substr(0,imgL.indexOf('spacer.gif')) + 'tab_l.gif';
}else{
var imgONR = imgR.substr(0,imgR.indexOf('spacer.gif')) + 'tab_gold_r.gif';
var imgONL = imgL.substr(0,imgL.indexOf('spacer.gif')) + 'tab_gold_l.gif';
}

document.images[imgID+"R"].src = imgONR;
document.images[imgID+"L"].src = imgONL;		
}
}
}
// Timeout processing
var TimerId=0;
var NumExt=0;
var bTimerId=false;
var img=new Image();
//var TimerMsg1="\nYou have not used the site for a while.You can extend your connection for 6 more minutes.\n\n(For your security, your connection will close if there is no activity within one minute.)\n\nWould you like to extend your connection?\n"
//var TimerMsg2="\nYou have not used the site for a while.\n\nFor your security, your connection has been closed.\n"
//var TmrWarn=6;
//var nAllowed=5;
//var SignOffLink="";
//var KeepAliveLink="";
function TimeStamp()
{
var zDate = new Date;
var zTime = zDate.getTime();
return zTime.toString();
}
function clrScrTOwinp()
{
if (bTimerId) { clearTimeout(TimerId); bTimerId = false }
}
function setScrTO(minutes)
{
clrScrTOwinp();
NumExt  = 0;
TmrWarn = minutes;
Begin = new Date();
TimerId = setTimeout('getmoretime(TmrWarn)', (TmrWarn-1)*60*1000);
bTimerId = true
}
function TerminateTO(sMsg)
{
clrScrTOwinp()	 
alert(sMsg);
SignOff = true;	
window.location = SignOffLink + "&_ts=" + TimeStamp();
}
function GetTimeDiff(begin)
{
var end = new Date();
return end.getTime() - begin.getTime();
}
function getmoretime(TmrWarn)
{
window.focus();
Begin = new Date();
NumExt++;
if (NumExt > nAllowed)
{
window.location = SignOffLink + "&_ts=" + TimeStamp();
TerminateTO(TimerMsg2)
return;
}
alert(TimerMsg1)
if (GetTimeDiff(Begin) < 55000)
{
img.src = KeepAliveLink + "?_ts=" + TimeStamp();
clrScrTOwinp()
TimerId = setTimeout('getmoretime(TmrWarn)', (TmrWarn-1)*60*1000);
bTimerId = true
Begin = new Date();
} 
else 
{
TerminateTO(TimerMsg2)
}
}
