<!-- begin - Taken from the Dreamweaver generated HTML File //-->
function MM_swapImgRestore() 
{ //v3.0
  var i,x,a=document.MM_sr; 
  
  for(i=0; a && i<a.length && (x=a[i]) &&x.oSrc; i++) 
    x.src=x.oSrc;
}

function MM_preloadImages() 
{ //v3.0
    var d=document; 
    
    if (d.images)
    { 
        if(!d.MM_p) 
            d.MM_p=new Array();
    
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
        for(i=0; i<a.length; i++)
        {
            if (a[i].indexOf("#")!=0)
            { 
                d.MM_p[j]=new Image; 
                d.MM_p[j++].src=a[i];
            }
        }
    }
}

function MM_findObj(n, d) 
{ //v3.0
    var p,i,x;  
    
    if (!d) 
        d=document; 
        
    if ((p=n.indexOf("?"))>0&&parent.frames.length) 
    {
        d=parent.frames[n.substring(p+1)].document; 
        n=n.substring(0,p);
    }
    
    if(!(x=d[n])&&d.all) 
        x=d.all[n]; 
        
    for (i=0;!x&&i<d.forms.length;i++) 
        x=d.forms[i][n];
  
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
        x=MM_findObj(n,d.layers[i].document); 
        
    return x;
}   

function MM_swapImage() 
{ //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; 
    
    document.MM_sr=new Array; 
    
    for(i=0;i<(a.length-2);i+=3)
        if ((x=MM_findObj(a[i]))!=null)
        {
            document.MM_sr[j++]=x; 
            if(!x.oSrc) 
                x.oSrc=x.src; 
            x.src=a[i+2];
        }
}
<!-- end - Taken from the Dreamweaver generated HTML File //-->

<!-- SlideShow functionality //-->
function SlideShowImage() {}
SlideShowImage.prototype.id = "";
SlideShowImage.prototype.src = "";

var g_arySlideShowImages = new Array();
var g_arySlideShowStaticImages = new Array();
var g_nCurrentSlide = 1;
var g_oSlideShowIMG = null;
var g_nSlideShowTimerID = -1;
var g_nSlideShowInterval = 0;
var g_sSlideShowType = "";
var g_bRestarted = false;

function initSlideShow()
{
    startSlideShow(g_nSlideShowInterval);
}

function startSlideShow(nInterval)
{
    if (g_nSlideShowTimerID == -1)
        g_nSlideShowTimerID = window.setInterval(nextSlide, nInterval);
}

function stopSlideShow()
{
    if (g_nSlideShowTimerID == -1)
        return;
        
    window.clearInterval(g_nSlideShowTimerID);
    g_nSlideShowTimerID = -1;
}

function nextSlide()
{
    updateSlide();
    if (g_bRestarted)
    {
        stopSlideShow();
        g_bRestarted = false;
        startSlideShow(g_nSlideShowInterval);
    }
}

function updateSlide()
{
    if (g_nCurrentSlide >= g_arySlideShowImages.length)
        g_nCurrentSlide = 0;
        
    updateSlideByIdx(g_arySlideShowImages[g_nCurrentSlide++].src);
}

function swapSlide_Over(sId)
{
    stopSlideShow();
    
    var nImageDx = -1;
    
    <!-- check the static images first //-->
    nImageDx = findImageIndex(g_arySlideShowStaticImages, sId);
    if (nImageDx != -1)
    {
        updateSlideByIdx(g_arySlideShowStaticImages[nImageDx].src);
        return;
    }
    
    <!-- check the rotating images //-->
    nImageDx = findImageIndex(g_arySlideShowImages, sId);
    if (nImageDx != -1)
    {
        updateSlideByIdx(g_arySlideShowImages[nImageDx].src);
        return;
    }
}

function swapSlide_Out()
{
    if (g_nSlideShowTimerID == -1)
        stopSlideShow();
        
    g_bRestarted = true;
    startSlideShow(g_nSlideShowInterval / 2);
    
}

function updateSlideByIdx(sSrc)
{
    var oImage = findSlideShowIMG();
    if (!oImage)
        return;
        
    oImage.src = sSrc;
}

function findImageIndex(aryImages, sId)
{
    var nImageDx = -1;
    for (var nIdx = 0; nIdx < aryImages.length; nIdx++)
        if (aryImages[nIdx].id == sId)
        {
            nImageDx = nIdx;
            break;
        }
        
    return nImageDx;
}

function findSlideShowIMG()
{
    if (g_oSlideShowIMG)
        g_oSlideShowIMG;
        
    g_oSlideShowIMG = document.getElementById(g_sSlideShowType);
    return g_oSlideShowIMG;
}
<!-- SlideShow functionality //-->

<!-- Homepage Fader //-->
var g_nFaderTimerID = -1;
var g_nSegment = 0;
var g_nSegmentCount = 0;
var g_nTag = 1;

function startFader(nCount)
{
    g_nSegmentCount = nCount;
    if (g_nFaderTimerID == -1)
        g_nFaderTimerID = window.setInterval(nextFader, 250);
}

function stopFader()
{
    if (g_nFaderTimerID == -1)
        return;
        
    window.clearInterval(g_nFaderTimerID);
    g_nFaderTimerID = -1;
    
    initSlideShow();
}

function nextFader()
{
    var oTag = findFaderTag("WelcomeFader" + g_nTag);
    if (oTag == null)
    {
        g_nSegment = 0;
        stopFader();
        return;
    }
    
    if (g_nSegment < g_nSegmentCount)
    {
        oTag.className = "WelcomeHeadingText" + (g_nSegment + 1);
        g_nSegment++;
    }
    else
    {
        g_nTag++;
        g_nSegment = 0;
    }
}

function findFaderTag(sTag)
{
    return document.getElementById(sTag);
}
<!-- Homepage Fader //-->

<!-- Forms //-->
var g_CLIENTFORM_CHECK_TYPE_DATE = 0;
var g_CLIENTFORM_CHECK_TYPE_INTEGER = 1;
var g_CLIENTFORM_CHECK_TYPE_FLOAT = 2;
var g_CLIENTFORM_CHECK_TYPE_CURRENCY = 3;
var g_CLIENTFORM_CHECK_TYPE_EMAIL = 4;
var g_CLIENTFORM_CHECK_TYPE_TEXT = 5;
var g_CLIENTFORM_CHECK_TYPE_FILE = 6;
var g_CLIENTFORM_CHECK_TYPE_TEXTAREA = 7;
var g_CLIENTFORM_CHECK_TYPE_PASSWORD = 8;

function ClientValidCheck() {}
ClientValidCheck.prototype.type = -1;
ClientValidCheck.prototype.min;
ClientValidCheck.prototype.max;

function ClientControl() {}
ClientControl.prototype.id = "";
ClientControl.prototype.name = "";
ClientControl.prototype.required = false;
ClientControl.prototype.disabled = false;
ClientControl.prototype.altdecimal = "";
ClientControl.prototype.decimal = 0;
ClientControl.prototype.dateformat = "";
ClientControl.prototype.checks = new Array();
ClientControl.prototype.add = function(nType, oMin, oMax)
{
    var nCount = this.checks.length;
    if (nCount == 0)
        this.checks = new Array();
        
    var oCheck = new ClientValidCheck();
    oCheck.type = nType;
    
    if (!isEmpty(oMin))
        oCheck.min = oMin;
    if (!isEmpty(oMax))
        oCheck.max = oMax;
        
    this.checks[nCount] = oCheck;
    
    return oCheck;
}
ClientControl.prototype.get = function(nType)
{
    for (var nIdx = 0; nIdx < this.checks.length; nIdx++)
    {
        var oCheck = this.checks[nIdx];
        if (!oCheck)
            continue;
            
        if (oCheck.type == nType)
            return oCheck;
    }
    
    return null;
}

function ClientForm() {}
ClientForm.prototype.id = "";
ClientForm.prototype.controls = new Array();
ClientForm.prototype.add = function(sName, sDisplay, bRequired, bDisabled, dateformat)
{
    var nCount = this.controls.length;
    if (nCount == 0)
        this.controls = new Array();
        
    var oControl = new ClientControl();
    oControl.id = sName;
    
    if (!isEmpty(sDisplay))
        oControl.name = sDisplay;
    
    if (!isEmpty(bRequired))
        oControl.required = bRequired;
    if (!isEmpty(bDisabled))
        oControl.disabled = bDisabled;
   
    this.controls[nCount] = oControl;
    
    return oControl;
}
ClientForm.prototype.get = function(nId)
{
    if ((nId < 0) && (nId >= this.controls.length))
        return null;
        
    return this.controls[nId];
}
ClientForm.prototype.control = function(sId)
{
    if (isEmpty(sId))
        return null;

    for (var nIdx = 0; nIdx < this.controls.length; nIdx++)
    {
        var oControl = this.controls[nIdx];
        if (!oControl)
            continue;
        
        if (oControl.id == sId)
            return oControl;
    }
        
    return null;
}
ClientForm.prototype.isrequired = function(nId)
{
    var oControl = this.get(nId);
    if (!oControl)
        return false;
        
    return oControl.required;
}
ClientForm.prototype.setrequired = function(nId, bValue)
{
    var oControl = this.get(nId);
    if (!oControl)
        return;
        
    oControl.required = bValue;
}
ClientForm.prototype.isdisabled = function(nId)
{
    var oControl = this.get(nId);
    if (!oControl)
        return false;
        
    return oControl.disabled;
}
ClientForm.prototype.setdisabled = function(nId, bValue)
{
    var oControl = this.get(nId);
    if (!oControl)
        return;
        
    oControl.disabled = bValue;
}
ClientForm.prototype.setcheck = function(nId, nType, oMin, oMax)
{
    if (isEmpty(nType))
        return;
        
    var oControl = this.get(nId);
    if (!oControl)
        return;
        
    oControl.add(nType, oMin, oMax);
}
ClientForm.prototype.getcheck = function(nId, nType)
{
    var oControl = this.get(nId);
    if (!oControl)
        return;
        
    return oControl.get(nType);
}

function isEmpty(sValue)
{
	var bisEmpty = false;

    if (((sValue == "") && (sValue != "0")) ||
		(String(sValue) == "null") || 
		(String(sValue) == "undefined"))
		bisEmpty = true;

	return(bisEmpty);
} 

function doNothing()
{
}

function submitForm(oAnchor, oForm, sAction, bIsFileUpload, bValidateForm, bNoSubmit)
{
    if ((sAction != null) && (sAction != ""))
	    oForm.action = sAction;
	    
	//if (bIsFileUpload == true)
	//	oForm.encoding = "multipart/form-data";

    if ((bValidateForm) && !validateForm(oForm))
        if (bNoSubmit)
            return false;
        else
            return;
    
    if (oAnchor)
	    oAnchor.style.visibility = "hidden";

	if (!bNoSubmit)
	    oForm.submit();
	
	if (bNoSubmit)
        return true;
    else
        return;
}

function validateForm(oForm)
{       
    var eCurrent;         
    var eHidden;
    var eToFocus;
    
    var sRequiredErrors = "";
    var sNumericErrors = "";
    var sDateErrors = "";
    var sTextMessage = "";
    var sErrorMessage = "";
    var sDateFormat = "";
    var sTrimmedString = "";
    
    var nIdx;
    var nValue;
    
    var bSearchForm;
    var bIsValid;
    
    //  First we need to see if we have any specified date formats.
    sDefaultDateFormat = "mm/dd/yyyy"; 
    if (!oForm)
        return false;
           
    // Loop through the elements of the form, looking for all
    // all text and textarea elements that have the "required" 
    // property defined, and are empty. Display an error message
    // identifying the fields that have errors.
    for (nIdx = 0; nIdx < oForm.elements.length; nIdx++)
    {
        eCurrent = oForm.elements[nIdx];
        eClientControl = oServerToClientForm.control(eCurrent.name);
        if (!eClientControl)
            continue;
        
        if ((eClientControl.disabled) || (eCurrent.type == "hidden"))
            continue;
                            
        if (eCurrent.type == "text")
        {  
            // if the field is not empty, trim string
            if ((eCurrent.value != null) && (eCurrent.value != "") && !isBlank(eCurrent.value))
            {
                //sTrimmedString = trim(eCurrent.value);
                //eCurrent.value = sTrimmedString;
                eCurrent.value = trim(eCurrent.value);
            }
        }  
        
        if ((eCurrent.type == "text") || (eCurrent.type == "textarea") || (eCurrent.type == "password") || (eCurrent.type == "file"))
        {
            if (eClientControl.required)
            {
                // first check if the field is empty
                if ((eCurrent.value == null) || (eCurrent.value == "") || isBlank(eCurrent.value))
                {   
                    if (!eToFocus)
                        eToFocus = eCurrent;
                    
                    sRequiredErrors += "\n          " + eClientControl.name;
                    continue;
                }
            }

            sNumericErrors = validateNumeric(eCurrent, eClientControl, eToFocus);
            
            var oCheck = eClientControl.get(g_CLIENTFORM_CHECK_TYPE_PASSWORD);
            if (!isBlank(eCurrent.value) && oCheck)
            {
                for (nJdx = nIdx; nJdx < oForm.elements.length; nJdx++)
                {
                     var ePassword = oForm.elements[nJdx];
                     if (ePassword.name == (eCurrent.name + "Check"))
                     {
                        if (ePassword.value != eCurrent.value)
                        {
                            ePasswordControl = oServerToClientForm.control(ePassword.name);
                            sTextMessage += " - " + eClientControl.name + " " + g_sErrMsg_Password + " " + ePasswordControl.name + ".\n";
                        }
                        break;
                     }
                }
            }
            
            var oCheck = eClientControl.get(g_CLIENTFORM_CHECK_TYPE_EMAIL);
            if (!isBlank(eCurrent.value) && oCheck)
            {
                if (!isValidEmail(eCurrent.value))
                {
                    if (!eToFocus)
                        eToFocus = eCurrent;
                        
                    sTextMessage += " - " + eClientControl.name + " " + g_sErrMsg_Email + ".\n";//" - The field " + eClientControl.name + " is an invalid email address.\n";
                 }
            } 
            
            var oCheck = eClientControl.get(g_CLIENTFORM_CHECK_TYPE_FILE);
            if (!isBlank(eCurrent.value) && oCheck)
            {
                if (!isValidFilename(eCurrent.value, true, false))
                {
                    if (!eToFocus)
                        eToFocus = eCurrent;
                        
                    sTextMessage += " - " + eClientControl.name + " " + g_sErrMsg_File + ".\n";//" - The field " + eClientControl.name + " is an invalid file name.\n";
                }
            }
            
            var oCheck = eClientControl.get(g_CLIENTFORM_CHECK_TYPE_TEXTAREA);
            if (!isBlank(eCurrent.value) && oCheck)
            {
                if (String(eCurrent.value).length > oCheck.max)
                {
                    if (!eToFocus)
                        eToFocus = eCurrent;
                        
                    sTextMessage += " - " + eClientControl.name + " " + g_sErrMsg_TextArea + " " + oCheck.max + ".\n";//" - The field " + eClientControl.name + " is longer than the allowed characters, maximum of " + oCheck.max + ".\n";
                }
            }            
            
            oCheck = eClientControl.get(g_CLIENTFORM_CHECK_TYPE_DATE);
            if (!isBlank(eCurrent.value) && oCheck)
            {               
                sDateFormat = sDefaultDateFormat;
                if (!isEmpty(eClientControl.dateformat))
                    sDateFormat = eClientControl.dateformat;
                
                if (!isValidDate(eCurrent.value, sDateFormat))
                {
                    if (!eToFocus)
                        eToFocus = eCurrent;
    
                    sDateErrors += " - " + eClientControl.name + " " + g_sErrMsg_Date + " '" + sDateFormat + "'.\n";//" - The field " + eCurrent.name + " must be a valid date in the format of '" + sDateFormat + "'.\n";
                }
                else
                {
                    var dCurrent = new Date(eCurrent.value);
                    var dMin = null;
                    if (oCheck.min != null)
                        dMin = new Date(oCheck.min);
                    var dMax = null;
                    if (oCheck.max != null)
                        dMax = new Date(oCheck.max);
                        
                    if (((dMin != null) && (dCurrent < dMin)) ||
                        ((dMax != null) && (dCurrent > dMax)))
                    {
                        if (!eToFocus)
                            eToFocus = eCurrent;
                                
                        sDateErrors += " - " + eClientControl.name + " " + g_sErrMsg_Req + " ";//" - The field " + eClientControl.name + " must be a date ";
                        if ((oCheck.min != null) && (oCheck.min != null))
                            sDateErrors += " " + g_sErrMsg_DateMin + " " + oCheck.min;//" that is greater than or equal to " + oCheck.min;
                        if ((oCheck.max != null) && (oCheck.max != null))
                            sDateErrors += " " + g_sErrMsg_DateMax + " " + oCheck.max;//" and less than or equal to " + oCheck.max;
                        else if (oCheck.max != null)
                            sDateErrors += " " + g_sErrMsg_DateMin2 + " " + oCheck.max;//" that is less than or equal to " + oCheck.max;
                        sDateErrors += ".\n";
                    }
                }
            }
        }
    }
    
    // If there were any errors, display a message, and return false, to prevent the form from 
    // being submitted. Ohterwise return trueCurrent.
    return writeErrors(sRequiredErrors, sNumericErrors, sTextMessage, sDateErrors, eToFocus);
}

function validateNumeric(eNumeric, eClientControl, eToFocus)
{
    var sNumericErrors = "";
    
    if (!isBlank(eNumeric.value))
    {
        var bIsValid = false;
        
        var oCheck;
        var oIntCheck = eClientControl.get(g_CLIENTFORM_CHECK_TYPE_INTEGER);
        var oFloatCheck = eClientControl.get(g_CLIENTFORM_CHECK_TYPE_FLOAT);
        var oCurrencyCheck = eClientControl.get(g_CLIENTFORM_CHECK_TYPE_CURRENCY);
        
        var sNumericType = g_sErrMsg_NumInt;//"an integer";
        if (oIntCheck)
        {
            bIsValid = isValidInteger(eNumeric.value, true);
            oCheck = oIntCheck;
        }
        else if (oFloatCheck)
        {
            bIsValid = isValidFloat(eNumeric.value, 
                                    true, 
                                    (eClientControl.altdecimal != null), 
                                    (eClientControl.decimal != null ? eClientControl.decimal : 0));
            sNumericType = g_sErrMsg_NumNum;//"a number";
            oCheck = oFloatCheck;
        }
        else if (oCurrencyCheck)
        {
            bIsValid = isValidCurrency(eNumeric.value, 
                                        true, 
                                        (eClientControl.altdecimal != null));
            sNumericType = g_sErrMsg_NumNum;//"a valid currency amount";
            oCheck = oCurrencyCheck;
        }
        else
            return sNumericErrors;

        if (!bIsValid)
        {
            if (!eToFocus)
                eToFocus = eNumeric;
                    
            sNumericErrors += " - " + eClientControl.name + " " + g_sErrMsg_NumType + " " + sNumericType + ".\n";" - The field " + eClientControl.name + " must be " + sNumericType + ".\n";
        }
        else
        {
            nValue = parseFloat(eNumeric.value);
            if (isNaN(nValue) ||
                ((oCheck.min != null) && (nValue < oCheck.min)) ||
                ((oCheck.max != null) && (nValue > oCheck.max)))
            {
                if (!eToFocus)
                    eToFocus = eNumeric;
                        
                sNumericErrors += " - " + eClientControl.name + " " + g_sErrMsg_Req + " " + sNumericType;//" must be " + sNumericType;
                if (oCheck.min != null)
                    sNumericErrors += " " + g_sErrMsg_NumMin + " " + oCheck.min;//" that is greater than or equal to " + oCheck.min;
                if ((oCheck.max != null) && (oCheck.min != null))
                    sNumericErrors += " " + g_sErrMsg_NumMax + " " + oCheck.max;//" and less than or equal to " + oCheck.max;
                else if (oCheck.max != null)
                    sNumericErrors += " " + g_sErrMsg_NumMin2 + " " + oCheck.max;//" that is less than or equal to " + oCheck.max;
                sNumericErrors += ".\n";
            }
        }
    }
    
    return sNumericErrors;
}

function writeErrors(sRequiredErrors, sNumericErrors, sTextErrors, sDateErrors, eToFocus)
{
    if (sRequiredErrors || sNumericErrors || sTextErrors || sDateErrors)
    {
        sErrorMessage  = "___________________________________________________________\n" +
                         //"The following error(s) exist, please make the corrections\n" +
                         //"and resbumit the form.\n" +
                         g_sErrMsg_Message +
                         "___________________________________________________________\n\n";
            
        if (sRequiredErrors)
        {
            sErrorMessage += " - " + g_sErrMsg_Required + ":" + sRequiredErrors + "\n";//" - The following required field(s) are empty:" + sRequiredErrors + "\n";
            if ((sNumericErrors) || (sDateErrors))
                sErrorMessage += "\n";
        }

        if (sNumericErrors)
        {
            sErrorMessage += sNumericErrors;
            if (sTextErrors)
                sErrorMessage += "\n";
        }
        
        if (sTextErrors)
        {
            sErrorMessage += sTextErrors;
            if (sDateErrors)
                sErrorMessage += "\n";
        }

        if (sDateErrors)
            sErrorMessage += sDateErrors;

        alert(sErrorMessage);
        
        if (!isEmpty(eToFocus))
        {
            eToFocus.focus();
            eToFocus.select(); 
        }
    
        return false;
    }
    
    return true;
}

// This function returns true if a string contains only whitespace characters.
function isBlank(sText)
{       
    var cTest;
    var nIdx;
    
    for(nIdx = 0; nIdx < sText.length; nIdx++)
    {
        cTest = sText.charAt(nIdx);
        if ((cTest != ' ') && (cTest != '\n') && (cTest != '\t')) 
            return false;
    }
    return true;
}    

function isValidDate(sTestDate, sDateFormat)
{
    var sDate;
    var sDay;
    var sMonth;
    var sYear;
    
    sDate = new String(sTestDate);
   
    nSlashLeft = sDate.indexOf("/");
    if (nSlashLeft == -1) 
        return false;

    if (nSlashLeft == sDate.length)
        return false;

    nSlashRight = sDate.indexOf("/", nSlashLeft + 1);
    if (nSlashRight == -1) 
        return false;
    
    if (sDateFormat == "mm/dd/yyyy")
    {
        sMonth = sDate.substring(0, nSlashLeft);
        sDay = sDate.substring(nSlashLeft + 1, nSlashRight);
    }   
    else
    {
        sDay = sDate.substring(0, nSlashLeft);
        sMonth = sDate.substring(nSlashLeft+1,nSlashRight);
    }         
    sYear = sDate.substring(nSlashRight + 1);
    
    if (!isValidInteger(sDay))
        return false;
    nDay = parseInt(sDay);
    
    if (!isValidInteger(sMonth))
        return false;
    nMonth = parseInt(sMonth);
    
    if (!isValidInteger(sYear))
        return false;
    nYear = parseInt(sYear);
    
    if ((nMonth < 1) || (nMonth > 12))
        return false;    
        
    if (sYear.length != 4)
        return false;

    if (nYear < 1)
        return false;

    var aDaysInMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
        
    if ((nDay < 1) || (nDay > aDaysInMonth[nMonth - 1]))
        return false;
       
    return true;
}

function isValidNumericChar(cValue, bFloat, bAltDecimal, nPos)
{
    var sValues = "0123456789-";
    var cDecimal = '.';
	if (bAltDecimal)
	    cDecimal = ',';
    
    if ((sValues.indexOf(cValue) == -1) &&
    	!(bFloat && (cValue == cDecimal)))
    	return false;
    	
    if ((cValue == "-") && (nPos != 0))
    	return false;

   	return true;
}

function isValidNumeric(sValue, bFloat, bAltDecimal)
{
	for (nIdx = 0; nIdx < sValue.length; nIdx++)
	{
    	if (!isValidNumericChar(sValue.substr(nIdx, 1), bFloat, bAltDecimal, nIdx))
    		return false;
	}
	
	return true;
}

function isValidFloat(sValue, bNegative, bAltDecimal, nDecimalPlaces)
{
	var nDecimalCount = 0;
	var cDecimal = '.';
	if (bAltDecimal)
	    cDecimal = ',';
	
	sValue = removeCommas(sValue);
	
	if (!isValidNumeric(sValue, true, bAltDecimal))
		return false;
		
	//try
	//{
		if (sValue.indexOf(cDecimal) != sValue.lastIndexOf(cDecimal))
			return false;
	
		nValue = parseFloat(sValue);
		if (isNaN(nValue) == true)
    		return false;
    		
    	nPos = sValue.lastIndexOf(cDecimal);
    	if ((nDecimalPlaces > 0) && (nPos > -1))
    	{
    		sDecimal = sValue.substring(nPos + 1);
    		nLength = sDecimal.length;
    		if (nLength > nDecimalPlaces)
				return false;
		}
		
		if (nValue > 99999999999.99)
    		return false;
    	
    	if (nValue < -99999999999.99)
    		return false;
    		
    	if ((!bNegative) && (nValue < 0))
    		return false;
   	//}
   	//catch(NumericException)
   	//{
   	//	return false;
   	//}
    
    return true;
}

function isValidCurrency(sValue, bNegative, bAltDecimal)
{
    var nIdx;
    var sCurrency = "$";
    var nDollarSignCount = 0;
    var nRightMostCurrencySign = 0;
    
    sValue = removeCommas(sValue);
        
    if (!isValidFloat(sValue, bNegative, bAltDecimal, 2))
        return false;

    for(nIdx=0; nIdx <= sValue.length - 1; nIdx++)
    {
        if (sCurrency.indexOf(sValue.charAt(nIdx)) > -1)
        {
            nDollarSignCount = nDollarSignCount + 1;
            nRightMostCurrencySign = nIdx;
            if (nDollarSignCount > 1)
                return false;
        }
    }

    // Dollar sign must be in position 0
    if (nRightMostCurrencySign > 0)
        return false;

    return true;
}

function isValidInteger(sValue, bNegative)
{
    sValue = removeCommas(sValue);
    
    if (!isValidNumeric(sValue, false, false))
		return false;
    
    //try
	//{
		nValue = parseInt(sValue)
    	
    	if (isNaN(nValue) == true)
    		return false;
    		
    	if (nValue > 2147483647)
    		return false;
    		
        if (nValue < -2147483648)
    		return false;
    	
    	if ((!bNegative) && (nValue < 0))
    		return false;
   	//}
   	//catch(NumericException)
   	//{
   	//	return false;
   	//}
    
    return true;
}

// Only allow standard ASCII characters
function isValidEmailChar(cValue)
{
    // Characters below '0, except '-' and '.', are invalid.
    if ((cValue < 48) && !((cValue == 45) || (cValue == 46)))
        return false;
    
    // Characters above 'z' are invalid.
    if (cValue > 122)
        return false;
        
    // Characters between ':' and '?', inclusive, are invalid.
    if ((cValue >= 58) && (cValue <= 63))
        return false; 
        
    // Characters between '[' and '^', inclusive, are invalid.
    if ((cValue >= 91) && (cValue <= 94))
        return false; 
        
    // Character '`' is invalid.
    if (cValue == 96)
        return false; 
        
    return true;
}

function isValidEmailCharCheck(sValue)
{
    if (isEmpty(sValue))
        return false;
        
    if (sValue.charAt(0) == '.')
        return false;
        
    if (sValue.charAt(sValue.length - 1) == '.')
        return false;
        
    var nLastPos = -1;
    for (var nIdx = 0; nIdx < sValue.length; nIdx++)
    {
        if (!isValidEmailChar(sValue.charCodeAt(nIdx)))
            return false;
            
        if (sValue.charAt(nIdx) != '.')
            continue;
            
        if ((nLastPos > -1) && (nIdx - nLastPos == 1))
            return false;
            
        nLastPos = nIdx;
    }
    
    return true;
}

function isValidEmail(sValue)
{
    var sAT = "@";
    var sPeriod = ".";
    
    // we have to do this the old fashioned way because only IE is able to use a regular expression
    if (isEmpty(sValue))
        return false;
        
    // check @, if it is not in the string, at the first or end, its invalid.
    var nPosAT = sValue.indexOf(sAT);
    var nLastPosAT = sValue.lastIndexOf(sAT);
    if ((nPosAT == -1) || 
        (nPosAT == 0) || 
        (nPosAT == (sValue.length - 1)) ||
        (nPosAT != nLastPosAT))
        {
		   return false;
		}
	
	var sUser = sValue.substring(0, nPosAT);
	var sAddress = sValue.substring(nPosAT + 1);
	
	// check for . in user, if its at the first or end, its invalid.
    if (!isValidEmailCharCheck(sUser))
        return false;
		
    // check for . in address, if it is not in the string, at the first or end, its invalid.
    if (!isValidEmailCharCheck(sAddress))
        return false;
		
    return true;
}

function isValidFilename(sFilePath, bIllegalFileNameChars, bNoPathCheck)
{
	var sFileName = parseFileName(sFilePath);
    var sFileNameNoExtension = parseFileNameNoExtension(sFilePath);
    var sPath = parseFilePath(sFilePath);
    
    //alert("sFilePath=" + sFilePath + "\n" + 
    //      "sFileName=" + sFileName + "\n" + 
    //      "sFileNameNoExtension=" + sFileNameNoExtension + "\n" + 
    //      "sPath=" + sPath); 
    
    var sInvalidChars = "";
    
    if ((sFilePath == null) || (sFilePath == "") || (sFilePath.length == 0) ||
        (sFileName == null) || (sFileName == "") || (sFileName.length == 0) ||
        (sFileNameNoExtension == null) || (sFileNameNoExtension == "") || (sFileNameNoExtension.length == 0))
	    return false;
	
	var bValid = true;
	if (!bNoPathCheck)
	{
	    bValid = performFileValidation(sPath, true, true);
	    bValid &= performFileValidation(sFileName, false, true);
	}
	else
	    bValid = performFileValidation(sFilePath, false, true);
    
    return bValid;
}

function performFileValidation(sFilename, bPath, bIllegalFileNameChars)
{
    for (nIdx = 0; nIdx < sFilename.length; nIdx++)
    {
        if ((sFilename.charCodeAt(nIdx) < 32) || (sFilename.charCodeAt(nIdx) > 127))
            return false;

        if (bIllegalFileNameChars &&
            (((sFilename.charCodeAt(nIdx) == 92) && !bPath) ||
             ((sFilename.charCodeAt(nIdx) == 47) && !bPath) ||
             (sFilename.charCodeAt(nIdx) == 58) ||
             (sFilename.charCodeAt(nIdx) == 42) ||
             (sFilename.charCodeAt(nIdx) == 63) ||
             (sFilename.charCodeAt(nIdx) == 34) ||
             (sFilename.charCodeAt(nIdx) == 60) ||
             (sFilename.charCodeAt(nIdx) == 62)))
        {
            if (bPath && (sFilename.charCodeAt(nIdx) == 58))
            {
                if (nIdx != 1)
                    return false;
                    
                continue;
            }
            
            return false;
        }
    }
    
    return true; 
}

// This function strips the name off of the passed parm leaving only the Path.
function parseFilePath(sFilePath)
{
	nSepIndex = sFilePath.lastIndexOf("\\");
	if (nSepIndex > 0)
		return sFilePath.substring(0, nSepIndex);

	return sFilePath;
}

// This function strips the path off of the passed parm leaving only the FileName.
function parseFileName(sFilePath)
{
	nSepIndex = sFilePath.lastIndexOf("\\");
	if (nSepIndex > 0)
		sFileName = sFilePath.substring(nSepIndex + 1);
	else
		sFileName = sFilePath;	
	return sFileName;
}

// This function strips the path and the file extension off of the passed parm leaving only the FileName without extension.
function parseFileNameNoExtension(sFilePath)
{
	nSepIndex = sFilePath.lastIndexOf("\\");
	if (nSepIndex > 0)
		sFileName = sFilePath.substring(nSepIndex + 1);
	else
		sFileName = sFilePath;	

	nSepIndex = sFileName.lastIndexOf(".");
	if (nSepIndex > 0)
		sFileName = sFileName.substring(0, nSepIndex);
	else if (nSepIndex == 0)
	{
	    // then the filename is actually an extension, so get rid of it....
	    sFileName = "";
	}
	else // no extension was found at all, just a filename....
		sFileName = sFileName;	
	return sFileName;
}

function trim(sValue)
{  
    var cTrim = ' '; 
    var sReturn = sValue;
    
    // Remove the leading characters
    while (sReturn.charAt(0) == cTrim)
        sReturn = sReturn.substring(1, sReturn.length);
    
    // Remove the trailing characters
    while (sReturn.charAt(sReturn.length - 1) == cTrim)
        sReturn = sReturn.substring(0, sReturn.length - 1);
    
    return sReturn;
}

function removeCommas(sValue, bAltDecimal)
{
    //var reNoCommas = /,/g;
    //var reNoDecimalsAsCommas = /./g;
   
    if (bAltDecimal)
        sValue = String(sValue).replace(".", "");
    else
        sValue = String(sValue).replace(",", "");
        
    return sValue;
}

var bTAMLAlerted = false;
function verifyTextAreaMaxLength(oTextArea, nMaxSize)
{
    if ((oTextArea != null) && (oTextArea.value.length > nMaxSize - 1))
    {
        if (!bTAMLAlerted)
            alert("The supplied text is longer than the allowed characters, maximum of " + nMaxSize + ".");
        bTAMLAlerted = true;
        event.returnValue = false;
    }
    else
        bTAMLAlerted = false;
}
<!-- Forms //-->

<!-- Facility // -->
function ClientFacility() {}
ClientFacility.prototype.id = "";
ClientFacility.prototype.address = "";
ClientFacility.prototype.city = "";
ClientFacility.prototype.state = "";
ClientFacility.prototype.country = "";
ClientFacility.prototype.zip = "";
ClientFacility.prototype.phone = "";
ClientFacility.prototype.fulladdress = function()
{
    return this.address + "<BR>" + this.city + ", " + this.state + "<BR>" + this.zip + "<BR>" + this.country;
}

function getFacility(nId)
{
    if (isEmpty(nId))
        return null;
        
    if (nId >= g_aryFacilities.length)
        return null;

    return g_aryFacilities[nId];
}
<!-- Facility // -->

<!-- Language // -->
function chooseLanguage(oSelect, sKey)
{
    if (!oSelect)
        return;
 
    var sValue = oSelect.options[oSelect.selectedIndex].value;
    if (isEmpty(sValue))
        return;
        
    var sURL = window.location.href;
    if (sURL.indexOf("?" + sKey))
        sURL = sURL.substring(0, sURL.indexOf("?" + sKey));

    window.location.href = sURL + "?" + sKey + "=" + sValue;
}
<!-- Language //-->

function selectDateFromCalendar(sField)
{
    oField = document.getElementById(sField);
    if (oField == null)
        return;
        
    var sDate = showModalDialog("calendar.asp", oField.value, "dialogWidth:17;dialogHeight:16;center:yes;scroll:no;status:no;unadorned:yes");
    if (sDate != null)
        oField.value = sDate;
} 