function reloadFrame(framename)
{
window.parent.frames[framename].location.reload();
return;
}
function setCookie (name,value)
{
var today = new Date();
var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000);
window.document.cookie = name + "=" + escape (value) + "; expires=" + expiry.toGMTString() + "; path=/";
}
function getCookie (name)
{
var dcookie = window.document.cookie;
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
while (cbegin < clen)
{
var vbegin = cbegin + cname.length;
if (dcookie.substring(cbegin, vbegin) == cname)
{
var vend = dcookie.indexOf (";", vbegin);
if (vend == -1) vend = clen;
return unescape(dcookie.substring(vbegin, vend));
}
cbegin = dcookie.indexOf(" ", cbegin) + 1;
if (cbegin == 0) break;
}
return null;
}
function getRT(documentObject, sourceField, targetFieldName, targetFieldObject)
{
var form = documentObject.forms[0];
//this gets a handle to the form
if (documentObject.applets.length != 0 )
{
for(i=0;i
12 || year <=0) {
setFocus(fld, type);
alert("Incorrect value is found. month must be between 1 and 12.\n" + msg);
return false;
}
}
}
return true;
}
// fullTrim will remove ALL spaces - use for validation checking of fields
// to make sure an actual value has been entered...not just empty spaces.
function fullTrim(cstring)
{
var temp = "";
if (cstring == null)
{
return temp;
}
cstring = '' + cstring;
splitstring = cstring.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;
}
//trim() will trim all extra spaces on the left and right
function trim(cString)
{
len = cString.length;
if (len==0) return cString;
for (var n=0; n=0; n--){
rPos = n;
if (cString.charAt(n) != " ") break;
}
return cString.slice(lPos, rPos+1);
}
function compute(fld1, fld2, op, opt)
{
var form = document.forms[0];
fld1_tmp = eval("form." + fld1 + ".value");
fld2_tmp = eval("form." + fld2 + ".value");
if (isNaN(fld1_tmp) || isNaN(fld2_tmp) || (fld1_tmp=="") || (fld2_tmp=="")){
return ""
}else{
result = eval(fld1_tmp + op + fld2_tmp)
if (isNaN(result)) return ""
else {
if (op=="/" && opt=="100")
return result * 100
else if (op=="*" && opt=="100")
return result / 100
else
return result
}
}
}
function sum(fldname, n)
{
var form = document.forms[0];
var fld_tmp;
//handle single field and multiple fields in group
if (n==1)
fld_tmp = fldname;
else {
fld_len = fldname.length
if (fldname.charAt(fld_len-1)=="1")
fld_tmp = fldname.substring(0, fld_len-1)
else
fld_tmp = fldname;
}
var tmp = 0;
for (p=1; p<=n; p++){
//don't append serial number when checking for a single field
if (n==1) q = ""
else q = p;
fldvalue = eval("form." + fld_tmp + q + ".value");
if (fldvalue != "")
tmp = tmp + parseFloat(fldvalue)
}
return tmp;
}
function formatNumber(num, opt, factor)
{
//opt == -1 round up. ie, 58.15 gives 59
//opt == -2 round down. ie, 58.95 gives 58
//opt == -3 normal rounding, ie, 58.49 gives 58; 58.50 gives 59
//opt == n indicates number of decimal points will be kept. No rounding is carried out.
//factor to be rounded to. Assuming factor >= 1
tmp_num = parseInt(num);
tmp_opt = parseInt(opt);
tmp_factor = (factor=="") ? 1 : parseInt(factor);
if (isNaN(tmp_opt) || isNaN(tmp_num)) return num;
left_over = (tmp_factor==1) ? (num - tmp_num) : (tmp_num % tmp_factor);
switch (tmp_opt){
case -1:{
if (tmp_factor==1)
return (num>tmp_num) ? (tmp_num + 1) : tmp_num;
else
//return (num>=tmp_num) ? (tmp_num + tmp_factor - left_over) : tmp_num;
return (left_over != 0) ? (tmp_num + tmp_factor - left_over) : tmp_num;
break}
case -2:{
if (tmp_factor==1)
return tmp_num
else
return tmp_num - left_over;
break}
case -3:{
half_factor = factor / 2;
if (tmp_factor==1)
return (left_over>=half_factor) ? (tmp_num + tmp_factor) : tmp_num;
else
return (left_over>=half_factor) ? (tmp_num + tmp_factor - left_over) : (tmp_num - left_over);
//remaider = num - tmp_num;
//return (remaider>=0.5) ? (tmp_num + 1) : tmp_num;
break}
default:{ //deal with decimal points
remaider = num - tmp_num;
strTmp = new String(remaider);
new_remaider = strTmp.substring(0, tmp_opt + 2);
return tmp_num + parseFloat(new_remaider);
break}
}
}
//double click to clear radio button
function clearRadio(fld)
{
for (var p=0; p < fld.length; p++){
fld[p].checked = false;
}
}
function words(cString, cSep)
{
var cTmp = cString.split(cSep)
return cTmp.length;
}
function word(cString, cSep, n)
{
var cTmp = cString.split(cSep)
return (n <= cTmp.length) ? cTmp[n-1] : ""
}
function left(cString, n)
{
var cTmp = "";
for (var i=0; i < n; i++)
{
cTmp = cTmp + cString.charAt(i);
}
return cTmp
}
function right(cString, n)
{
var cTmp = "";
strLength = cString.length;
for (var i=0; i < n; i++)
{
cTmp = cString.charAt(strLength-i) + cTmp;
}
return cTmp
}
function instr(cString, subString)
{
if (cString.indexOf(subString) > 0)
{
return true;
}
else
{
return false;
}
}
function detectBrowser()
{
var oldOnError = window.onerror;
var element = null;
window.onerror = defaultOnError;
navigator.OS = '';
navigator.version = 0;
navigator.org = '';
navigator.family = '';
var platform;
if (typeof(window.navigator.platform) != 'undefined')
{
platform = window.navigator.platform.toLowerCase();
if (platform.indexOf('win') != -1)
navigator.OS = 'win';
else if (platform.indexOf('mac') != -1)
navigator.OS = 'mac';
else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
navigator.OS = 'nix';
}
var i = 0;
var ua = window.navigator.userAgent.toLowerCase();
if (ua.indexOf('opera') != -1)
{
i = ua.indexOf('opera');
navigator.family = 'opera';
navigator.org = 'opera';
navigator.version = parseFloat('0' + ua.substr(i+6), 10);
}
else if ((i = ua.indexOf('msie')) != -1)
{
navigator.org = 'microsoft';
navigator.version = parseFloat('0' + ua.substr(i+5), 10);
if (navigator.version < 4)
navigator.family = 'ie3';
else
navigator.family = 'ie4'
}
else if (typeof(window.controllers) != 'undefined' && typeof(window.locationbar) != 'undefined')
{
i = ua.lastIndexOf('/')
navigator.version = parseFloat('0' + ua.substr(i+1), 10);
navigator.family = 'gecko';
if (ua.indexOf('netscape') != -1)
navigator.org = 'netscape';
else if (ua.indexOf('compuserve') != -1)
navigator.org = 'compuserve';
else
navigator.org = 'mozilla';
}
else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))
{
var is_major = parseFloat(navigator.appVersion);
if (is_major < 4)
navigator.version = is_major;
else
{
i = ua.lastIndexOf('/')
navigator.version = parseFloat('0' + ua.substr(i+1), 10);
}
navigator.org = 'netscape';
navigator.family = 'nn' + parseInt(navigator.appVersion);
}
else if ((i = ua.indexOf('aol')) != -1 )
{
// aol
navigator.family = 'aol';
navigator.org = 'aol';
navigator.version = parseFloat('0' + ua.substr(i+4), 10);
}
navigator.DOMCORE1 = (typeof(document.getElementsByTagName) != 'undefined' && typeof(document.createElement) != 'undefined');
navigator.DOMCORE2 = (navigator.DOMCORE1 && typeof(document.getElementById) != 'undefined' && typeof(document.createElementNS) != 'undefined');
navigator.DOMHTML = (navigator.DOMCORE1 && typeof(document.getElementById) != 'undefined');
navigator.DOMCSS1 = ( (navigator.family == 'gecko') || (navigator.family == 'ie4') );
navigator.DOMCSS2 = false;
if (navigator.DOMCORE1)
{
element = document.createElement('p');
navigator.DOMCSS2 = (typeof(element.style) == 'object');
}
navigator.DOMEVENTS = (typeof(document.createEvent) != 'undefined');
window.onerror = oldOnError;
}
function validateEmail(checkAddress)
{
// Checking for the existence of "@" and ".".
// Length must >= 5 and the "." must not directly precede or follow the "@"
if (fullTrim(checkAddress) == "")
{
return true;
}
else if (checkAddress.indexOf("@") == -1)
{
return false;
}
else if (checkAddress.charAt(0) == ".")
{
return false;
}
else if (checkAddress.charAt(0) == "@")
{
return false;
}
else if (checkAddress.len < 6)
{
return false;
}
else if (checkAddress.indexOf(".") == -1)
{
return false;
}
else if (checkAddress.charAt(checkAddress.indexOf("@")+1) == ".")
{
return false;
}
else if (checkAddress.charAt(checkAddress.indexOf("@")-1) == ".")
{
return false;
}
else
{
return true;
}
}
function showProcess(profileUNID)
{
var boxWidth = (screen.width/3) * 2;
var boxHeight = (screen.height/3) * 2;
var winX = (screen.width - boxWidth) / 2;
var winY = (screen.height - boxHeight) / 2;
var windowoptions="menubar=no,scrollbars=yes,resizable=yes,toolbar=no,top="+winY+",left="+winX+",height="+boxHeight+",width="+boxWidth;
var href = window.location.href;
var newurl = href.substring(0,(href.lastIndexOf('.nsf')+5));
newWindowURL = newurl + "(WebOutputDistribForm)?OpenAgent&UNID=" + profileUNID;
window.open(newWindowURL,"_blank",windowoptions);
currentWindowURL = newurl + "ConfirmPayment?OpenForm&UNID=" + profileUNID;
window.open(currentWindowURL, '_self');
}
function showHelp(helpTopicURL)
{
var boxWidth = (screen.width/3)*2;
var boxHeight = (screen.height/3)*2;
var winX = (screen.width - boxWidth) / 2;
var winY = (screen.height - boxHeight) / 2;
var windowoptions="menubar=no,scrollbars=yes,resizable=yes,toolbar=no,top="+winY+",left="+winX+",height="+boxHeight+",width="+boxWidth;
windowURL = helpTopicURL + "&NoEdit=1&HideMenu=1&IsDialog=1";
window.open(windowURL ,"_blank",windowoptions)
}
function openLinkInWindow(urlValue)
{
if (urlValue == "")
{
return false;
}
var boxWidth = (screen.width/3)*2;
var boxHeight = (screen.height/3)*2;
var winX = (screen.width - boxWidth) / 2;
var winY = (screen.height - boxHeight) / 4;
if (urlValue.indexOf('.nsf') == -1)
{
var windowoptions="menubar=yes,scrollbars=yes,resizable=yes,toolbar=no,top="+winY+",left="+winX+",height="+boxHeight+",width="+boxWidth;
var windowURL = urlValue;
}
else
{
var windowoptions="menubar=no,scrollbars=yes,resizable=yes,toolbar=no,status=yes,top="+winY+",left="+winX+",height="+boxHeight+",width="+boxWidth;
var windowURL = urlValue + "&IsDialog=1";
}
window.open(windowURL,"_blank",windowoptions)
}
function openExternalURLLink(urlValue)
{
if (urlValue == "")
{
return false;
}
var boxWidth = (screen.width/3)*2;
var boxHeight = (screen.height/3)*2;
var winX = (screen.width - boxWidth) / 2;
var winY = (screen.height - boxHeight) / 4;
var windowoptions="menubar=yes,scrollbars=yes,resizable=yes,toolbar=no,top="+winY+",left="+winX+",height="+boxHeight+",width="+boxWidth;
window.open(urlValue,"_blank",windowoptions)
}