// -----------------------------------------------------------
// Application:    ANSI Registration Forms
// File:           jslib.js
// Author:         ACS
// Date Written:   01/17/2007
// Description:    Shared functions for form processing.
// -----------------------------------------------------------

// -----------------------------------------------------------
// Enable the Check Box.
// -----------------------------------------------------------
function enableChk(myField) {
    for (var x = 0; x < myField.length; x++) {
        if (myField[x].disabled) {
            myField[x].disabled = false;
        }
    }
    return;
}
// -----------------------------------------------------------
// Disable the Check Box.
// -----------------------------------------------------------
function disableChk(myField) {
    for (var x = 0; x < myField.length; x++) {
        myField[x].checked = false;
        myField[x].disabled = true;
    }
    return;
}
//
// Turn other check boxes off.
//
function chkBoxesOff(myField) {
	var checkboxObj = document.forms[0].elements[myField.name];
    for (var x = 0; x < checkboxObj.length; x++) {
        if (checkboxObj[x].value != myField.value) {
            checkboxObj[x].checked = false;
        }
    }
}
// -----------------------------------------------------------
//  Check for valid numeric strings
// -----------------------------------------------------------
function IsNumeric(strString) {
	var strValidChars = "0123456789";
	var strChar;
	var blnResult = true;
	//  test strString consists of valid characters listed above
	for (var i = 0; i < strString.length && blnResult == true; i++) {
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1) {
			blnResult = false;
		}
	}
   return blnResult;
}
//
// 09/23/2002 - ACS - Added setFocus function.
// ---------------------------------------------------------------
// Help PopUp Window.
//
// JavaScript Version: Javascript
//
// Written By:  ACS
// Date:        07/31/2001
//
// ---------------------------------------------------------------
// win_location - The window you want to open.
//                Example:
//          showHelp('/swohelp.php3?help_file=swo.help&help_id=10002',
//                   400,
//                   400,
//                   1)
// ---------------------------------------------------------------
function showHelp(win_location, width, height, scrollbar) {
    this.DEFAULTWIDTH = 315;
    this.DEFAULTHEIGHT = 270;
    this.SCROLLBAR = 'no';
    var screen_width, screen_height;
    var win_top, win_left;

    if (width)
        this.width = width;
    else
        this.width = this.DEFAULTWIDTH;
    if (height)
        this.height = height;
    else
        this.height = this.DEFAULTHEIGHT;
    if (scrollbar)
        this.scrollbar = 'yes';
    else
        this.scrollbar = this.SCROLLBAR;

    screen_height = 0;
    screen_width = 0;
    win_top = 0;
    win_left = 0;

    screen_width  = document.body.clientWidth;
    screen_height = document.body.clientHeight;
   
    win_top  = screen_height - this.height - 30;
    win_left = screen_width  - this.width  - 30;

   this.windowHandle = window.open(
                win_location, 
                "HelpWin", 
                "toolbar=no," +
                "location=no," +
                "directories=no," +
                "status=no," +
                "menubar=no," +
                "scrollbars=" + this.scrollbar + "," +
                "resizable=yes," +
                "width=" + this.width + "," +
                "height=" + this.height + "," +
                "top=" + win_top + "," +
                "left=" + win_left);
}