// JScript File
function calPop(e)
{
var cal2 = new CalendarPopup('nn2');
cal2.select(e,e.id,'MM/dd/yyyy');
}
function SNFormUtils()
{
var me = this;
var holder = new Object();
var lastDateField;
init();
function init()
{
holder.inputs = document.getElementsByTagName("input");
holder.selects = document.getElementsByTagName("select");
holder.images = document.getElementsByTagName("img");
}
/**
* Gets an array of all elements on page */
this.documentInputs = function()
{
return holder.inputs;
}
/**
* Gets an array of all elements on page */
this.documentSelects = function()
{
return holder.selects;
}
/***
* if you have 3 radio/checkbox for a given value
* and you want to make sure that you can't
* choose 3 of the same value, use this with {s}
* being the radio/checkbox that was clicked.
*
* [ ][x][ ] [x][x][ ]
* [x][ ][ ] [ ][ ][x]
* [ ][ ][x] [ ][ ][ ]
*
* ok not ok
*
*
* works for any grid of n x m where n,m
* are natural numbers; this method is
* bigO(n) where n is number of inputs on a page
*
* usage:
*
*/
this.tripleRadioCheck = function(s)
{
var e = holder.inputs;
if (!s.id) return;
for (i = 0; i < e.length; i++)
if (e[i].type)
if ((e[i].type == "checkbox" || e[i].type == "radio") && e[i] != s)
if (e[i].checked && e[i].value == s.value) e[i].checked = false;
}
/**
* allows to make it so that when you click on an input field
* it hides [emptyText] and lets you type.
*
* Example (square bracket depict an input field):
*
* [ put your name here ]
*
* > visitor clicks on field, then "put your name here" disappears
*
* [ visitor's text ]
*
* > visitor's mouse moves exits the field, their text stays in field
* if it's not equal to [emptyText] or if that field is not blank;
* look at the search page for example;
*
*/
this.hideableInputText = function(inputField, emptyText)
{
inputField.value = emptyText;
if (inputField.className != "")
inputField.className += " sn_fadedInputText";
else
inputField.className = "sn_fadedInputText";
inputField.onfocus = function()
{
if (this.value == emptyText) this.value = "";
this.className = this.className.replace(/sn_fadedInputText/ig,"");
}
inputField.onblur = function()
{
if (this.value == "")
{
this.value = emptyText;
this.className += " sn_fadedInputText";
}
}
}
/**
* Usage:
* [n] string indicating the shared part of id's in all
* checkboxes (i.e substring)
* [b] boolean saying should we check the box (b=true)
* or don't (b=false)
*/
this.checkAllBoxes = function(n,b)
{
var values = new Array();
for (i =0; i < holder.inputs.length; i++)
if (holder.inputs[i].id)
if(holder.inputs[i].id.indexOf(n)!=-1)
{
holder.inputs[i].checked = b;
if (b) values.push(holder.inputs[i].value);
}
return values;
}
/**
* {el1} and {el2} are both