
 function navOver(src, name)
 {
    if(src.search("-over.png") < 0 && src.search("-h.png") < 0)
    {
        src = src.substr(0, src.search(".png")) + "-h.png";
        if (pngAlpha) 
        {
            src = "/images/nav/" + name + src;
        }
        
    }
    return src;
 }
 function navOut(src, name)
 {
    if(src.search("-over.png") < 0 && src.search("-h.png") >= 0)
    {
        src = src.substr(0, src.search("-h.png")) + ".png";
    }
    if (pngAlpha) 
    {
       src = "/images/nav/" +  name + ".png";
    }    

    return src;                 
 }
 

// Browser Detect  v2.1.6
// documentation: http://www.dithered.com/javascript/browser_detect/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)


function BrowserDetect() {
   var ua = navigator.userAgent.toLowerCase(); 

   // browser engine name
   this.isGecko       = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
   this.isAppleWebKit = (ua.indexOf('applewebkit') != -1);

   // browser name
   this.isKonqueror   = (ua.indexOf('konqueror') != -1); 
   this.isSafari      = (ua.indexOf('safari') != - 1);
   this.isOmniweb     = (ua.indexOf('omniweb') != - 1);
   this.isOpera       = (ua.indexOf('opera') != -1); 
   this.isIcab        = (ua.indexOf('icab') != -1); 
   this.isAol         = (ua.indexOf('aol') != -1); 
   this.isIE          = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
   this.isMozilla     = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
   this.isFirefox     = (ua.indexOf('firefox/') != -1 || ua.indexOf('firebird/') != -1);
   this.isNS          = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
   
   // spoofing and compatible browsers
   this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE);
   this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla);
   
   // rendering engine versions
   this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
   this.equivalentMozilla = ( (this.isGecko) ? parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ) : -1 );
   this.appleWebKitVersion = ( (this.isAppleWebKit) ? parseFloat( ua.substring( ua.indexOf('applewebkit/') + 12) ) : -1 );
   
   // browser version
   this.versionMinor = parseFloat(navigator.appVersion); 
   
   // correct version number
   if (this.isGecko && !this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('/', ua.indexOf('gecko/') + 6) + 1 ) );
   }
   else if (this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
   }
   else if (this.isIE && this.versionMinor >= 4) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
   }
   else if (this.isKonqueror) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
   }
   else if (this.isSafari) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('safari/') + 7 ) );
   }
   else if (this.isOmniweb) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('omniweb/') + 8 ) );
   }
   else if (this.isOpera) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera') + 6 ) );
   }
   else if (this.isIcab) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab') + 5 ) );
   }
   
   this.versionMajor = parseInt(this.versionMinor); 
   
   // dom support
   this.isDOM1 = (document.getElementById);
   this.isDOM2Event = (document.addEventListener && document.removeEventListener);
   
   // css compatibility mode
   this.mode = document.compatMode ? document.compatMode : 'BackCompat';

   // platform
   this.isWin    = (ua.indexOf('win') != -1);
   this.isWin32  = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
   this.isMac    = (ua.indexOf('mac') != -1);
   this.isUnix   = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
   this.isLinux  = (ua.indexOf('linux') != -1);
   
   // specific browser shortcuts
   this.isNS4x = (this.isNS && this.versionMajor == 4);
   this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
   this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
   this.isNS4up = (this.isNS && this.versionMinor >= 4);
   this.isNS6x = (this.isNS && this.versionMajor == 6);
   this.isNS6up = (this.isNS && this.versionMajor >= 6);
   this.isNS7x = (this.isNS && this.versionMajor == 7);
   this.isNS7up = (this.isNS && this.versionMajor >= 7);
   
   this.isIE4x = (this.isIE && this.versionMajor == 4);
   this.isIE4up = (this.isIE && this.versionMajor >= 4);
   this.isIE5x = (this.isIE && this.versionMajor == 5);
   this.isIE55 = (this.isIE && this.versionMinor == 5.5);
   this.isIE5up = (this.isIE && this.versionMajor >= 5);
   this.isIE6x = (this.isIE && this.versionMajor == 6);
   this.isIE6up = (this.isIE && this.versionMajor >= 6);
   
   this.isIE4xMac = (this.isIE4x && this.isMac);
}

var browser = new BrowserDetect();


// =================================================================


// if IE5.5+ on Win32, then display PNGs with AlphaImageLoader
if ( (browser.isIE55 || browser.isIE6x) && browser.isWin32 )
{
	var pngAlpha = true;
}

// else, if the browser can display PNGs normally, then do that
else if ( (browser.isGecko) 
	|| (browser.isIE5up && browser.isMac) 
	|| (browser.isOpera && browser.isWin && browser.versionMajor >= 6) 
	|| (browser.isOpera && browser.isUnix && browser.versionMajor >= 6) 
	|| (browser.isOpera && browser.isMac && browser.versionMajor >= 5) 
	|| (browser.isOmniweb && browser.versionMinor >= 3.1) 
	|| (browser.isIcab && browser.versionMinor >= 1.9) 
	|| (browser.isWebtv) 
	|| (browser.isDreamcast) )
{
			var pngNormal = true;
}
// added to get safari in windows working
else
{
    var pngNormal = true;
}

function od_displayImage(strId, strPath, intWidth, intHeight, strClass, strAlt, returnContent) 
{
	var imgDiv = "";
	if (pngAlpha) 
	{
		imgDiv = '<div style="height:'+intHeight+'px; width:'+intWidth+'px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+strPath+'.png\', sizingMethod=\'scale\')" id="'+strId+'" class="'+strClass+'"></div>';
	} 
	
	else if (pngNormal) 
	{
		imgDiv = '<img src="'+strPath+'.png" width="'+intWidth+'" height="'+intHeight+'" name="'+strId+'" border="0" class="'+strClass+'" alt="'+strAlt+'" />';
	} 
	
	else 
	{
		imgDiv = '<img src="'+strPath+'.gif" width="'+intWidth+'" height="'+intHeight+'" name="'+strId+'" border="0" class="'+strClass+'" alt="'+strAlt+'" />';
	}
	
	// Write or return result.
	if(returnContent == true) {
		return imgDiv;
	}
	else {
		document.write(imgDiv);
	}
}

function od_displayImageUpdate(strId, strPath, intWidth, intHeight, strClass, strAlt) 
{
	if (pngAlpha) 
	{
		return '<div style="height:'+intHeight+'px; width:'+intWidth+'px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+strPath+'.png\', sizingMethod=\'scale\')" id="'+strId+'" class="'+strClass+'"></div>';
	} 
	
	else if (pngNormal) 
	{
		return '<img src="'+strPath+'.png" width="'+intWidth+'" height="'+intHeight+'" name="'+strId+'" border="0" class="'+strClass+'" alt="'+strAlt+'" />';
	} 
	
	else 
	{
		return '<img src="'+strPath+'.gif" width="'+intWidth+'" height="'+intHeight+'" name="'+strId+'" border="0" class="'+strClass+'" alt="'+strAlt+'" />';
	}
}



////////////////////////////////////////////////////////////////////////
function ensureSSNrightjobforyou(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "checkbox") 
        {
            if(el[i].id.toString().indexOf('chkSSNrightjobforyou') >= 0)
            {
                if( el[i].checked == true ) 
                    args.IsValid = true; 
                else 
                    args.IsValid = false; 
            }
        }
    } 
}

function ensureSubAbuserightjobforyou(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "checkbox") 
        {
            if(el[i].id.toString().indexOf('chkSubAbuserightjobforyou') >= 0)
            {
                if( el[i].checked == true ) 
                    args.IsValid = true; 
                else 
                    args.IsValid = false; 
            }
        }
    } 
}

function ensureHonestyrightjobforyou(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "checkbox") 
        {
            if(el[i].id.toString().indexOf('chkHonestyrightjobforyou') >= 0)
            {
                if( el[i].checked == true ) 
                    args.IsValid = true; 
                else 
                    args.IsValid = false; 
            }
        }
    }
}

function ensureSchedulerightjobforyou(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "checkbox") 
        {
            if(el[i].id.toString().indexOf('chkSchedulerightjobforyou') >= 0)
            {
                if( el[i].checked == true ) 
                    args.IsValid = true; 
                else 
                    args.IsValid = false; 
            }
        }
    }
}

function ensurePerAppearrightjobforyou(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "checkbox") 
        {
            if(el[i].id.toString().indexOf('chkPerAppearrightjobforyou') >= 0)
            {
                if( el[i].checked == true ) 
                    args.IsValid = true; 
                else 
                    args.IsValid = false; 
            }
        }
    }
}

function ensureCleaninessrightjobforyou(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "checkbox") 
        {
            if(el[i].id.toString().indexOf('chkCleanrightjobforyou') >= 0)
            {
                if( el[i].checked == true ) 
                    args.IsValid = true; 
                else 
                    args.IsValid = false; 
            }
        }
    }
}

function ensureAttituderightjobforyou(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "checkbox") 
        {
            if(el[i].id.toString().indexOf('chkAttituderightjobforyou') >= 0)
            {
                if( el[i].checked == true ) 
                    args.IsValid = true; 
                else 
                    args.IsValid = false; 
            }
        }
    }
}

//function ensureYesrightjobforyou(source, args)
//{
//    // set the form to look at (your form is called form1)
//    var frm = document.form1;
//    // get the form elements
//    var el = frm.elements;
//    // loop through the elements...
//    var i=0;
//    for(i=0; i < el.length; i++) 
//    {
//        // and check if it is a checkbox
//        if(el[i].type == "checkbox") 
//        {
//            if(el[i].id.toString().indexOf('chkIsThisrightjobforyou') >= 0)
//            {
//                if( el[i].checked == true ) 
//                    args.IsValid = true; 
//                else 
//                    args.IsValid = false; 
//            }
//        }
//    }
//}

function ensureFelonyTxt(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    var IsFelonySel=false;
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "select-one") 
            if(el[i].id.toString().indexOf('cmbFelony') >= 0)
                if( el[i].options[el[i].selectedIndex].value == '1' ) 
                    IsFelonySel = true; 
    }
    if(IsFelonySel)
    {
        args.IsValid = false;
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "textarea") 
                if(el[i].id.toString().indexOf('txtFelony') >= 0)
                    if(removeSpaces(el[i].value.toString()) != '')
                        args.IsValid = true;
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureDeptDesiredChecked(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "radio") 
        {
            if((el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) || (el[i].id.toString().indexOf('rdoManagement') >= 0) || (el[i].id.toString().indexOf('rdoStoreDirector') >= 0))
                if( el[i].checked == true ) 
                    args.IsValid = true; 
        }
    }
}

function ensurePositionDesiredChecked(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    var IsTeamMemberSel=false;
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "radio") 
            if(el[i].id.toString().indexOf('rdoTeamMember') >= 0)
                if( el[i].checked == true ) 
                    IsTeamMemberSel = true; 
    }
    if(IsTeamMemberSel)
    {
        args.IsValid = false;
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "checkbox") 
                if(el[i].id.toString().indexOf('grdTMPositions') >= 0)
                    if( el[i].checked == true ) 
                        args.IsValid = true; 
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureMonAvailability(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "radio") 
            {
                if((el[i].id.toString().indexOf('rdoMonOpen') >= 0) || (el[i].id.toString().indexOf('rdoMonNotAvail') >= 0) || (el[i].id.toString().indexOf('rdoMonFrom') >= 0))
                    if( el[i].checked == true ) 
                        args.IsValid = true; 
            }
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function enableDayTimes(dayName, IsEnabled)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "text") 
            if((el[i].id.toString().indexOf('txt'+dayName+'1StartTime') >= 0) || (el[i].id.toString().indexOf('txt'+dayName+'1EndTime') >= 0))
            {
                el[i].value='';
                el[i].disabled=IsEnabled;
            }
    }
}

function ensureMonFromTimes(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    var IsMonFrom=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if( el[i].type == "radio" ) 
                if( el[i].id.toString().indexOf('rdoMonFrom') >= 0 )
                    if( el[i].checked == true ) 
                        IsMonFrom = true; 
        }
        if(IsMonFrom)
        {
            var strStartTime="";
            var strEndTime="";
            for(i=0; i < el.length; i++) 
            {
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtMon1StartTime') >= 0)
                        strStartTime = removeSpaces(el[i].value.toString());
                }
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtMon1EndTime') >= 0)
                        strEndTime = removeSpaces(el[i].value.toString()); 
                }
            }
            var d = new Date();
            if((strStartTime != '') && (strEndTime != ''))
            {
                var startDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strStartTime);
                var endDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strEndTime);
                if(startDate <= endDate)
                {
                    args.IsValid = true;
                }
            }
            else
            {
                if(strStartTime != '')
                    args.IsValid = true;
            }
        }
        else
        {
            args.IsValid = true;
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureTueAvailability(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "radio") 
            {
                if((el[i].id.toString().indexOf('rdoTueOpen') >= 0) || (el[i].id.toString().indexOf('rdoTueNotAvail') >= 0) || (el[i].id.toString().indexOf('rdoTueFrom') >= 0))
                    if( el[i].checked == true ) 
                        args.IsValid = true; 
            }
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureTueFromTimes(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    var IsTueFrom=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if( el[i].type == "radio" ) 
                if( el[i].id.toString().indexOf('rdoTueFrom') >= 0 )
                    if( el[i].checked == true ) 
                        IsTueFrom = true; 
        }
        if(IsTueFrom)
        {
            var strStartTime="";
            var strEndTime="";
            for(i=0; i < el.length; i++) 
            {
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtTue1StartTime') >= 0)
                        strStartTime = removeSpaces(el[i].value.toString());
                }
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtTue1EndTime') >= 0)
                        strEndTime = removeSpaces(el[i].value.toString()); 
                }
            }
            var d = new Date();
            if((strStartTime != '') && (strEndTime != ''))
            {
                var startDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strStartTime);
                var endDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strEndTime);
                if(startDate <= endDate)
                {
                    args.IsValid = true;
                }
            }
            else
            {
                if(strStartTime != '')
                    args.IsValid = true;
            }
        }
        else
        {
            args.IsValid = true;
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureWedAvailability(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "radio") 
            {
                if((el[i].id.toString().indexOf('rdoWedOpen') >= 0) || (el[i].id.toString().indexOf('rdoWedNotAvail') >= 0) || (el[i].id.toString().indexOf('rdoWedFrom') >= 0))
                    if( el[i].checked == true ) 
                        args.IsValid = true; 
            }
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureWedFromTimes(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    var IsWedFrom=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if( el[i].type == "radio" ) 
                if( el[i].id.toString().indexOf('rdoWedFrom') >= 0 )
                    if( el[i].checked == true ) 
                        IsWedFrom = true; 
        }
        if(IsWedFrom)
        {
            var strStartTime="";
            var strEndTime="";
            for(i=0; i < el.length; i++) 
            {
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtWed1StartTime') >= 0)
                        strStartTime = removeSpaces(el[i].value.toString());
                }
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtWed1EndTime') >= 0)
                        strEndTime = removeSpaces(el[i].value.toString()); 
                }
            }
            var d = new Date();
            if((strStartTime != '') && (strEndTime != ''))
            {
                var startDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strStartTime);
                var endDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strEndTime);
                if(startDate <= endDate)
                {
                    args.IsValid = true;
                }
            }
            else
            {
                if(strStartTime != '')
                    args.IsValid = true;
            }
        }
        else
        {
            args.IsValid = true;
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureThuAvailability(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "radio") 
            {
                if((el[i].id.toString().indexOf('rdoThuOpen') >= 0) || (el[i].id.toString().indexOf('rdoThuNotAvail') >= 0) || (el[i].id.toString().indexOf('rdoThuFrom') >= 0))
                    if( el[i].checked == true ) 
                        args.IsValid = true; 
            }
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureThuFromTimes(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    var IsThuFrom=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if( el[i].type == "radio" ) 
                if( el[i].id.toString().indexOf('rdoThuFrom') >= 0 )
                    if( el[i].checked == true ) 
                        IsThuFrom = true; 
        }
        if(IsThuFrom)
        {
            var strStartTime="";
            var strEndTime="";
            for(i=0; i < el.length; i++) 
            {
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtThu1StartTime') >= 0)
                        strStartTime = removeSpaces(el[i].value.toString());
                }
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtThu1EndTime') >= 0)
                        strEndTime = removeSpaces(el[i].value.toString()); 
                }
            }
            var d = new Date();
            if((strStartTime != '') && (strEndTime != ''))
            {
                var startDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strStartTime);
                var endDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strEndTime);
                if(startDate <= endDate)
                {
                    args.IsValid = true;
                }
            }
            else
            {
                if(strStartTime != '')
                    args.IsValid = true;
            }
        }
        else
        {
            args.IsValid = true;
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureFriAvailability(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "radio") 
            {
                if((el[i].id.toString().indexOf('rdoFriOpen') >= 0) || (el[i].id.toString().indexOf('rdoFriNotAvail') >= 0) || (el[i].id.toString().indexOf('rdoFriFrom') >= 0))
                    if( el[i].checked == true ) 
                        args.IsValid = true; 
            }
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureFriFromTimes(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    var IsFriFrom=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if( el[i].type == "radio" ) 
                if( el[i].id.toString().indexOf('rdoFriFrom') >= 0 )
                    if( el[i].checked == true ) 
                        IsFriFrom = true; 
        }
        if(IsFriFrom)
        {
            var strStartTime="";
            var strEndTime="";
            for(i=0; i < el.length; i++) 
            {
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtFri1StartTime') >= 0)
                        strStartTime = removeSpaces(el[i].value.toString());
                }
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtFri1EndTime') >= 0)
                        strEndTime = removeSpaces(el[i].value.toString()); 
                }
            }
            var d = new Date();
            if((strStartTime != '') && (strEndTime != ''))
            {
                var startDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strStartTime);
                var endDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strEndTime);
                if(startDate <= endDate)
                {
                    args.IsValid = true;
                }
            }
            else
            {
                if(strStartTime != '')
                    args.IsValid = true;
            }
        }
        else
        {
            args.IsValid = true;
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureSatAvailability(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "radio") 
            {
                if((el[i].id.toString().indexOf('rdoSatOpen') >= 0) || (el[i].id.toString().indexOf('rdoSatNotAvail') >= 0) || (el[i].id.toString().indexOf('rdoSatFrom') >= 0))
                    if( el[i].checked == true ) 
                        args.IsValid = true; 
            }
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureSatFromTimes(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    var IsSatFrom=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if( el[i].type == "radio" ) 
                if( el[i].id.toString().indexOf('rdoSatFrom') >= 0 )
                    if( el[i].checked == true ) 
                        IsSatFrom = true; 
        }
        if(IsSatFrom)
        {
            var strStartTime="";
            var strEndTime="";
            for(i=0; i < el.length; i++) 
            {
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtSat1StartTime') >= 0)
                        strStartTime = removeSpaces(el[i].value.toString());
                }
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtSat1EndTime') >= 0)
                        strEndTime = removeSpaces(el[i].value.toString()); 
                }
            }
            var d = new Date();
            if((strStartTime != '') && (strEndTime != ''))
            {
                var startDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strStartTime);
                var endDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strEndTime);
                if(startDate <= endDate)
                {
                    args.IsValid = true;
                }
            }
            else
            {
                if(strStartTime != '')
                    args.IsValid = true;
            }
        }
        else
        {
            args.IsValid = true;
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureSunAvailability(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "radio") 
            {
                if((el[i].id.toString().indexOf('rdoSunOpen') >= 0) || (el[i].id.toString().indexOf('rdoSunNotAvail') >= 0) || (el[i].id.toString().indexOf('rdoSunFrom') >= 0))
                    if( el[i].checked == true ) 
                        args.IsValid = true; 
            }
        }
    }
    else 
    {
        args.IsValid = true;
    }
}

function ensureSunFromTimes(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    args.IsValid = false;
    var IsTeamMember=false;
    var IsSunFrom=false;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "radio") 
            if( (el[i].id.toString().indexOf('rdoTeamMember') >= 0) || (el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) )
                if( el[i].checked == true ) 
                    IsTeamMember = true; 
    } 
    if(IsTeamMember)
    {
        for(i=0; i < el.length; i++) 
        {
            if( el[i].type == "radio" ) 
                if( el[i].id.toString().indexOf('rdoSunFrom') >= 0 )
                    if( el[i].checked == true ) 
                        IsSunFrom = true; 
        }
        if(IsSunFrom)
        {
            var strStartTime="";
            var strEndTime="";
            for(i=0; i < el.length; i++) 
            {
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtSun1StartTime') >= 0)
                        strStartTime = removeSpaces(el[i].value.toString());
                }
                if(el[i].type == "text") 
                {
                    if(el[i].id.toString().indexOf('txtSun1EndTime') >= 0)
                        strEndTime = removeSpaces(el[i].value.toString()); 
                }
            }
            var d = new Date();
            if((strStartTime != '') && (strEndTime != ''))
            {
                var startDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strStartTime);
                var endDate=new Date(d.getMonth()+'/'+d.getDate()+'/'+d.getFullYear()+' '+strEndTime);
                if(startDate <= endDate)
                {
                    args.IsValid = true;
                }
            }
            else
            {
                if(strStartTime != '')
                    args.IsValid = true;
            }
        }
        else
        {
            args.IsValid = true;
        }
    }
    else
    {
        args.IsValid = true;
    }
}

//function ensureHoursPerWeek(source, args)
//{
//    // set the form to look at (your form is called form1)
//    var frm = document.form1;
//    // get the form elements
//    var el = frm.elements;
//    // loop through the elements...
//    var i=0;
//    args.IsValid = false;
//    for(i=0; i < el.length; i++) 
//    {
//        if(el[i].type == "radio") 
//        {
//            if((el[i].id.toString().indexOf('rdo0to10') >= 0) || (el[i].id.toString().indexOf('rdo10to20') >= 0) || (el[i].id.toString().indexOf('rdo20to30') >= 0) || (el[i].id.toString().indexOf('rdo30to40') >= 0) || (el[i].id.toString().indexOf('rdo40more') >= 0))
//                if( el[i].checked == true ) 
//                    args.IsValid = true; 
//        }
//    }
//}

function ensureHoursRequested(source, args)
{
    //TeamMember = 1
    //Supervisor = 2
    //DepartmentManager = 3
    //StoreDirector = 4
    //
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    var empAppLevel=0;
    var hourRequested=0;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "text") 
            if(el[i].id.toString().indexOf('txtHoursRequested') >= 0)
                if(IsNumeric(el[i].value.toString()))
                    hourRequested=removeSpaces(el[i].value.toString())*1; 
    }
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "radio") 
        {
            if((el[i].id.toString().indexOf('rdoTeamMember') >= 0) && (el[i].checked == true))
                empAppLevel=1; 
            if((el[i].id.toString().indexOf('rdoShiftSupervisor') >= 0) && (el[i].checked == true))
                empAppLevel=2; 
            if((el[i].id.toString().indexOf('rdoManagement') >= 0) && (el[i].checked == true))
                empAppLevel=3; 
            if((el[i].id.toString().indexOf('rdoStoreDirector') >= 0) && (el[i].checked == true))
                empAppLevel=4; 
        }
    }
    if(empAppLevel > 0)
    {
        args.IsValid = false;
        switch(empAppLevel)
        {
            case 1:
                if(hourRequested <= 40)
                    args.IsValid = true;
                break;
            case 2:
                if((hourRequested >= 32) && (hourRequested <= 40))
                    args.IsValid = true;
                break;
            case 3:
                if(hourRequested >= 50)
                    args.IsValid = true;
                break;
            case 4:
                if(hourRequested >= 50)
                    args.IsValid = true;
                break;
        }
    }
}

function ensureWorkedForJIPC(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    var IsStoreDateSel=false;
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "select-one") 
            if(el[i].id.toString().indexOf('cmbWorkedJIPC') >= 0)
                if( el[i].options[el[i].selectedIndex].value == '1' ) 
                    IsStoreDateSel = true; 
    }
    if(IsStoreDateSel)
    {
        args.IsValid = false;
        var IsStoreSel=false;
        var IsDateTyped=false;
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "select-one") 
            {
                if(el[i].id.toString().indexOf('cmbWorkedForStores') >= 0)
                    if( el[i].options[el[i].selectedIndex].value.toString() != '-2' ) 
                        IsStoreSel=true;
            }
            if(el[i].type == "text") 
            {
                if(el[i].id.toString().indexOf('txtWorkedJIPCDate') >= 0)
                    if(removeSpaces(el[i].value.toString()) != '')
                        IsDateTyped=true; 
            }
        }
        if(IsStoreDateSel && IsDateTyped)
        {
            args.IsValid = true;
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureReferedByChecked(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    var IsEEFReferredBy=false;
    var IsOtherReferredBy=false;
    args.IsValid = false;
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "radio") 
            if((el[i].id.toString().indexOf('rdoInternet') >= 0) || (el[i].id.toString().indexOf('rdoWalkIn') >= 0) || (el[i].id.toString().indexOf('rdoEFF') >= 0) || (el[i].id.toString().indexOf('rdoOtherReferredBy') >= 0))
                if( el[i].checked == true ) 
                {
                    args.IsValid = true;
                    if(el[i].id.toString().indexOf('rdoOtherReferredBy') >= 0)
                        IsOtherReferredBy=true;
                    if(el[i].id.toString().indexOf('rdoEFF') >= 0)
                        IsEEFReferredBy=true;
                }
    }
    if(IsOtherReferredBy)
    {
        args.IsValid=false;
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "text") 
                if(el[i].id.toString().indexOf('txtOtherReferredBy') >= 0)
                    if(removeSpaces(el[i].value.toString()) != '')
                        args.IsValid=true;
        }
    }
    if(IsEEFReferredBy)
    {
        args.IsValid=false;
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "text") 
                if(el[i].id.toString().indexOf('txtReferredByEEF') >= 0)
                    if(removeSpaces(el[i].value.toString()) != '')
                        args.IsValid=true;
        }
    }
}

function ensureHighSchoolChecked(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    var IsHighSchoolSel=false;
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "text") 
            if(el[i].id.toString().indexOf('txtHighSchoolName') >= 0)
                if(removeSpaces(el[i].value.toString()) != '')
                    IsHighSchoolSel=true;
    }
    if(IsHighSchoolSel)
    {
        args.IsValid = false;
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "radio") 
                if((el[i].id.toString().indexOf('rdoHighSchool1') >= 0) || (el[i].id.toString().indexOf('rdoHighSchool2') >= 0) || (el[i].id.toString().indexOf('rdoHighSchool3') >= 0) || (el[i].id.toString().indexOf('rdoHighSchool4') >= 0))
                    if( el[i].checked == true ) 
                        args.IsValid = true; 
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureHighSchoolGraduated(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    var IsHighSchoolSel=false;
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "text") 
            if(el[i].id.toString().indexOf('txtHighSchoolName') >= 0)
                if(removeSpaces(el[i].value.toString()) != '')
                    IsHighSchoolSel=true;
    }
    if(IsHighSchoolSel)
    {
        args.IsValid = false;
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "select-one") 
                if(el[i].id.toString().indexOf('cmbHighSchool') >= 0)
                    if( el[i].options[el[i].selectedIndex].value != '' ) 
                        args.IsValid = true; 
        }
    }
    else
    {
        args.IsValid = true;
    }
}

//function ensureHighSchoolDegree(source, args)
//{
//    // set the form to look at (your form is called form1)
//    var frm = document.form1;
//    // get the form elements
//    var el = frm.elements;
//    // loop through the elements...
//    var i=0;
//    var IsHighSchoolSel=false;
//    for(i=0; i < el.length; i++) 
//    {
//        if(el[i].type == "text") 
//            if(el[i].id.toString().indexOf('txtHighSchoolName') >= 0)
//                if(removeSpaces(el[i].value.toString()) != '')
//                    IsHighSchoolSel=true;
//    }
//    if(IsHighSchoolSel)
//    {
//        args.IsValid = false;
//        for(i=0; i < el.length; i++) 
//        {
//            if(el[i].type == "text") 
//                if(el[i].id.toString().indexOf('txtHighScoolDegree') >= 0)
//                    if( removeSpaces(el[i].value.toString()) != '' ) 
//                        args.IsValid = true; 
//        }
//    }
//    else
//    {
//        args.IsValid = true;
//    }
//}

function ensureCollegeChecked(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    var IsHighSchoolSel=false;
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "text") 
            if(el[i].id.toString().indexOf('txtCollegeName') >= 0)
                if(removeSpaces(el[i].value.toString()) != '')
                    IsHighSchoolSel=true;
    }
    if(IsHighSchoolSel)
    {
        args.IsValid = false;
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "radio") 
                if((el[i].id.toString().indexOf('rdoCollege1') >= 0) || (el[i].id.toString().indexOf('rdoCollege2') >= 0) || (el[i].id.toString().indexOf('rdoCollege3') >= 0) || (el[i].id.toString().indexOf('rdoCollege4') >= 0) || (el[i].id.toString().indexOf('rdoCollege5') >= 0))
                    if( el[i].checked == true ) 
                        args.IsValid = true; 
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureCollegeGraduated(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    var IsCollegeSel=false;
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "text") 
            if(el[i].id.toString().indexOf('txtCollegeName') >= 0)
                if(removeSpaces(el[i].value.toString()) != '')
                    IsCollegeSel=true;
    }
    if(IsCollegeSel)
    {
        args.IsValid = false;
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "select-one") 
                if(el[i].id.toString().indexOf('cmbCollege') >= 0)
                    if( el[i].options[el[i].selectedIndex].value != '' ) 
                        args.IsValid = true; 
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureCollegeDegree(source, args)
{
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    var IsCollegeSel=false;
    for(i=0; i < el.length; i++) 
    {
        if(el[i].type == "text") 
            if(el[i].id.toString().indexOf('txtCollegeName') >= 0)
                if(removeSpaces(el[i].value.toString()) != '')
                    IsCollegeSel=true;
    }
    if(IsCollegeSel)
    {
        args.IsValid = false;
        for(i=0; i < el.length; i++) 
        {
            if(el[i].type == "text") 
                if(el[i].id.toString().indexOf('txtCollegeDegree') >= 0)
                    if( removeSpaces(el[i].value.toString()) != '' ) 
                        args.IsValid = true; 
        }
    }
    else
    {
        args.IsValid = true;
    }
}

function ensureIHaveReadChecked(source, args) 
{ 
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "checkbox") 
        {
            if(el[i].id.toString().indexOf('chkIHaveRead') >= 0)
            {
                if( el[i].checked == true ) 
                    args.IsValid = true; 
                else 
                    args.IsValid = false; 
            }
        }
    } 
}

function ensureIUnderstandAuthz(source, args) 
{ 
    // set the form to look at (your form is called form1)
    var frm = document.form1;
    // get the form elements
    var el = frm.elements;
    // loop through the elements...
    var i=0;
    for(i=0; i < el.length; i++) 
    {
        // and check if it is a checkbox
        if(el[i].type == "checkbox") 
        {
            if(el[i].id.toString().indexOf('chkApplicantUnderstandAuthz') >= 0)
            {
                if( el[i].checked == true ) 
                    args.IsValid = true; 
                else 
                    args.IsValid = false; 
            }
        }
    } 
}

function removeSpaces(string) 
{
    var tstring = "";
    string = '' + string;
    splitstring = string.split(" ");
    for(i = 0; i < splitstring.length; i++)
        tstring += splitstring[i];
	    
    return tstring;
}

function IsNumeric(stringReceived)
{
    var blnResult=true;
    if ( removeSpaces( stringReceived ) == "" )
        blnResult=false;
    else
        if ( isNaN( removeSpaces( stringReceived ) ) )
            blnResult=false;
        
    return blnResult;
}

function openAppSummary()
{
    var mWin = window.open('onlineapp/appsummary.aspx', 'ApplicationSummary', '');
    if( (mWin == null) || (typeof(mWin)=="undefined") )
        window.location='onlineapp/appsummary.aspx';
//    var mWin = window.open('onlineapp/appsummary2.aspx', 'ApplicationSummary', '');
//    if( (mWin == null) || (typeof(mWin)=="undefined") )
//        window.location='onlineapp/appsummary2.aspx';
}
 
//////////////////////////////////////////////////////////////
function ValidatePhone(m)
{
	var i = 0
	var p
	p=m.value

	i = 0
	while (i < p.length)
	{
		switch (i)
		{
			case 0:
			case 1:
			case 2:
			case 4:
			case 5:
			case 6:
			case 8:
			case 9:
			case 10:
			case 11:
				if (IsDigit(p.substring(i,i+1)))
				{
					
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 3:
			case 7:
				if (p.substring(i,i+1) != '-')
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + '-' + p.substring(i,p.length));
					}
					else
					{
						p = p + '-';
					}
				}
				i=i+1;
				break;
			default:
			p = p.substring(0,12);
			i=i+1;
	    }
    }
    m.value = p;
}
function ValidateTime(m){
	var i = 0
	var p
	p=m.value

	i = 0
	while (i < p.length)
	{
		switch (i)
		{
			case 0:
			case 1:
			case 3:
			case 4:
			    if (IsDigit(p.substring(i,i+1)))
				{
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 2:
				if (p.substring(i,i+1) != ':')
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + ':' + p.substring(i,p.length));
					}
					else
					{
						p = p + ':';
					}
				}
				i=i+1;
				break;
			default:
			p = p.substring(0,5);
			i=i+1;
	    }
    }
    m.value = p;
}
function IsDigit(sChar)
{
    var ValidChars = "0123456789";
    var IsDigit=true;

    if (ValidChars.indexOf(sChar) == -1)
    {
	    IsDigit = false;
    }
    return IsDigit;
}
function IsDigit2(sChar,sValidChars)
{
    var ValidChars = sValidChars;//"123456789";
    var IsDigit=true;

    if (ValidChars.indexOf(sChar) == -1)
    {
	    IsDigit = false;
    }
    return IsDigit;
}
function ValidateDate(m){
	var i = 0
	var p
	p=m.value

	i = 0
	while (i < p.length)
	{
		switch (i)
		{
			case 0:
				if (p.substring(i,i+1) == '0' || p.substring(i,i+1) == '1')
				{
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 1:
				if (p.substring(i-1,i) == '0')
				{
					if (p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2' || p.substring(i,i+1) == '3' || p.substring(i,i+1) == '4' || p.substring(i,i+1) == '5' || p.substring(i,i+1) == '6' || p.substring(i,i+1) == '7' || p.substring(i,i+1) == '8' || p.substring(i,i+1) == '9')
					{
						i=i+1;
					}
					else
					{
						if (p.length > i)
						{
							p = (p.substring(0,i) + p.substring(i+1,p.length));
						}
						else
						{
							p = p.substring(0,i);
						}
					}
				}
				else
				{
					if (p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2' || p.substring(i,i+1) == '0')
					{
						i=i+1;
					}
					else
					{
						if (p.length > i)
						{
							p = (p.substring(0,i) + p.substring(i+1,p.length));
						}
						else
						{
							p = p.substring(0,i);
						}
					}
				}
				break;
			case 3:
				if (p.substring(i,i+1) == '0' || p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2' || p.substring(i,i+1) == '3')
				{
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 4:
			    if (p.substring(i-1,i) == '0' || p.substring(i-1,i) == '1' || p.substring(i-1,i) == '2')
				{
					if (p.substring(i,i+1) == '0' || p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2' || p.substring(i,i+1) == '3' || p.substring(i,i+1) == '4' || p.substring(i,i+1) == '5' || p.substring(i,i+1) == '6' || p.substring(i,i+1) == '7' || p.substring(i,i+1) == '8' || p.substring(i,i+1) == '9')
					{
						i=i+1;
					}
					else
					{
						if (p.length > i)
						{
							p = (p.substring(0,i) + p.substring(i+1,p.length));
						}
						else
						{
							p = p.substring(0,i);
						}
					}
				}
				else
				{
					if (p.substring(i,i+1) == '1' || p.substring(i,i+1) == '0')
					{
						i=i+1;
					}
					else
					{
						if (p.length > i)
						{
							p = (p.substring(0,i) + p.substring(i+1,p.length));
						}
						else
						{
							p = p.substring(0,i);
						}
					}
				}
				break;
			case 2:
			case 5:
				if (p.substring(i,i+1) != '/')
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + '/' + p.substring(i,p.length));
					}
					else
					{
						p = p + '/';
					}
				}
				i=i+1;
				break;
			case 6,7,8,9:
				if (p.substring(i,i+1) == '0' || p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2' || p.substring(i,i+1) == '3' || p.substring(i,i+1) == '4' || p.substring(i,i+1) == '5' || p.substring(i,i+1) == '6' || p.substring(i,i+1) == '7' || p.substring(i,i+1) == '8' || p.substring(i,i+1) == '9')
				{
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			default:
				p = p.substring(0,10);
				i=i+1;
	    }
    }
    m.value = p;
}
function ValidateDate2(m){
	var i = 0
	var p
	p=m.value

	i = 0
	while (i < p.length)
	{
		switch (i)
		{
			case 0:
				if (p.substring(i,i+1) == '0' || p.substring(i,i+1) == '1')
				{
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 1:
				if (p.substring(i-1,i) == '0')
				{
					if (p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2' || p.substring(i,i+1) == '3' || p.substring(i,i+1) == '4' || p.substring(i,i+1) == '5' || p.substring(i,i+1) == '6' || p.substring(i,i+1) == '7' || p.substring(i,i+1) == '8' || p.substring(i,i+1) == '9')
					{
						i=i+1;
					}
					else
					{
						if (p.length > i)
						{
							p = (p.substring(0,i) + p.substring(i+1,p.length));
						}
						else
						{
							p = p.substring(0,i);
						}
					}
				}
				else
				{
					if (p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2' || p.substring(i,i+1) == '0')
					{
						i=i+1;
					}
					else
					{
						if (p.length > i)
						{
							p = (p.substring(0,i) + p.substring(i+1,p.length));
						}
						else
						{
							p = p.substring(0,i);
						}
					}
				}
				break;
			case 3:
				if (p.substring(i,i+1) == '0' || p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2' || p.substring(i,i+1) == '3')
				{
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 4:
			    if (p.substring(i-1,i) == '0')
			    {
			        if (IsDigit2(p.substring(i,i+1),"123456789"))
				    {
					    i=i+1;
				    }
				    else
				    {
					    if (p.length > i)
					    {
						    p = (p.substring(0,i) + p.substring(i+1,p.length));
					    }
					    else
					    {
						    p = p.substring(0,i);
					    }
				    }
				}
				else
				{
				    if (p.substring(i-1,i) == '1' || p.substring(i-1,i) == '2')
				    {
					    if (p.substring(i,i+1) == '0' || p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2' || p.substring(i,i+1) == '3' || p.substring(i,i+1) == '4' || p.substring(i,i+1) == '5' || p.substring(i,i+1) == '6' || p.substring(i,i+1) == '7' || p.substring(i,i+1) == '8' || p.substring(i,i+1) == '9')
					    {
						    i=i+1;
					    }
					    else
					    {
						    if (p.length > i)
						    {
							    p = (p.substring(0,i) + p.substring(i+1,p.length));
						    }
						    else
						    {
							    p = p.substring(0,i);
						    }
					    }
				    }
				    else
				    {
					    if (p.substring(i,i+1) == '1' || p.substring(i,i+1) == '0')
					    {
						    i=i+1;
					    }
					    else
					    {
						    if (p.length > i)
						    {
							    p = (p.substring(0,i) + p.substring(i+1,p.length));
						    }
						    else
						    {
							    p = p.substring(0,i);
						    }
					    }
				    }
				}
				break;
			case 2:
			case 5:
				if (p.substring(i,i+1) != '/')
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + '/' + p.substring(i,p.length));
					}
					else
					{
						p = p + '/';
					}
				}
				i=i+1;
				break;
			case 6:
				if (p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2')
				{
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
		    case 7:
				if (p.substring(i-1,i) == '1')
				{
					if (p.substring(i,i+1) == '9')
				    {
					    i=i+1;
				    }
				    else
				    {
					    if (p.length > i)
					    {
						    p = (p.substring(0,i) + p.substring(i+1,p.length));
					    }
					    else
					    {
						    p = p.substring(0,i);
					    }
				    }
				}
				else
				{
					if (p.substring(i,i+1) == '0')
				    {
					    i=i+1;
				    }
				    else
				    {
					    if (p.length > i)
					    {
						    p = (p.substring(0,i) + p.substring(i+1,p.length));
					    }
					    else
					    {
						    p = p.substring(0,i);
					    }
				    }
				}
				break;
			case 8,9:
				if (p.substring(i,i+1) == '0' || p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2' || p.substring(i,i+1) == '3' || p.substring(i,i+1) == '4' || p.substring(i,i+1) == '5' || p.substring(i,i+1) == '6' || p.substring(i,i+1) == '7' || p.substring(i,i+1) == '8' || p.substring(i,i+1) == '9')
				{
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			default:
				p = p.substring(0,10);
				i=i+1;
	    }
    }
    m.value = p;
}
function ValidateLongTime(m){
	var i = 0
	var p
	p=m.value

	i = 0
	while (i < p.length)
	{
		switch (i)
		{
			case 0:
			case 1:
			case 3:
			case 4:
			    if (IsDigit(p.substring(i,i+1)))
				{
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 2:
				if (p.substring(i,i+1) != ':')
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + ':' + p.substring(i,p.length));
					}
					else
					{
						p = p + ':';
					}
				}
				i=i+1;
				break;
			case 5:
			    if (p.substring(i,i+1) != ' ')
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + ' ' + p.substring(i,p.length));
					}
					else
					{
						p = p + ' ';
					}
				}
				i=i+1;
				break;
			case 6:
			    if (p.substring(i,i+1) == 'P' || p.substring(i,i+1) == 'p' || p.substring(i,i+1) == 'A' || p.substring(i,i+1) == 'a')
				{
					if (p.length > i)
					{
					    p = p.substring(0,i) + p.substring(i,i+1).toUpperCase() + p.substring(i+1,p.length);
					}
					else
					{
					    p = p.substring(0,i) + p.substring(i,i+1).toUpperCase();
					}
					i=i+1;
				}
				else
				{
				    if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 7:
			    if (p.substring(i,i+1) != 'M')
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + 'M' + p.substring(i,p.length));
					}
					else
					{
						p = p + 'M';
					}
				}
				i=i+1;
				break;
			default:
			    p = p.substring(0,8);
			    i=i+1;
	    }
    }
    m.value = p;
}
function ValidateLongTime2(m){
	var i = 0
	var p
	p=m.value

	i = 0
	while (i < p.length)
	{
		switch (i)
		{
			case 0:
			    if (p.substring(i,i+1) == '0' || p.substring(i,i+1) == '1')
				{
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 1:
			    if (p.substring(i-1,i) == '0')
				{
					if (IsDigit2(p.substring(i,i+1),"123456789"))
				    {
					    i=i+1;
				    }
				    else
				    {
					    if (p.length > i)
					    {
						    p = (p.substring(0,i) + p.substring(i+1,p.length));
					    }
					    else
					    {
						    p = p.substring(0,i);
					    }
				    }
				}
				else
				{
					if (p.substring(i,i+1) == '0' || p.substring(i,i+1) == '1' || p.substring(i,i+1) == '2')
				    {
					    i=i+1;
				    }
				    else
				    {
					    if (p.length > i)
					    {
						    p = (p.substring(0,i) + p.substring(i+1,p.length));
					    }
					    else
					    {
						    p = p.substring(0,i);
					    }
				    }
				}
				break;
			case 3:
			    if (IsDigit2(p.substring(i,i+1),"012345"))
			    {
				    i=i+1;
			    }
			    else
			    {
				    if (p.length > i)
				    {
					    p = (p.substring(0,i) + p.substring(i+1,p.length));
				    }
				    else
				    {
					    p = p.substring(0,i);
				    }
			    }
			    break;
			case 4:
			    if (IsDigit(p.substring(i,i+1)))
				{
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 2:
				if (p.substring(i,i+1) != ':')
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + ':' + p.substring(i,p.length));
					}
					else
					{
						p = p + ':';
					}
				}
				i=i+1;
				break;
			case 5:
			    if (p.substring(i,i+1) != ' ')
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + ' ' + p.substring(i,p.length));
					}
					else
					{
						p = p + ' ';
					}
				}
				i=i+1;
				break;
			case 6:
			    if (p.substring(i,i+1) == 'P' || p.substring(i,i+1) == 'p' || p.substring(i,i+1) == 'A' || p.substring(i,i+1) == 'a')
				{
					if (p.length > i)
					{
					    p = p.substring(0,i) + p.substring(i,i+1).toUpperCase() + p.substring(i+1,p.length);
					}
					else
					{
					    p = p.substring(0,i) + p.substring(i,i+1).toUpperCase();
					}
					i=i+1;
				}
				else
				{
				    if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 7:
			    if (p.substring(i,i+1) != 'M')
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + 'M' + p.substring(i,p.length));
					}
					else
					{
						p = p + 'M';
					}
				}
				i=i+1;
				break;
			default:
			    p = p.substring(0,8);
			    i=i+1;
	    }
    }
    m.value = p;
}
function ValidateSSN(m)
{
	var i = 0
	var p
	p=m.value

	i = 0
	while (i < p.length)
	{
		switch (i)
		{
			case 0:
			case 1:
			case 2:
			case 4:
			case 5:
			case 7:
			case 8:
			case 9:
			case 10:
				if (IsDigit(p.substring(i,i+1)))
				{
					
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			case 3:
			case 6:
				if (p.substring(i,i+1) != '-')
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + '-' + p.substring(i,p.length));
					}
					else
					{
						p = p + '-';
					}
				}
				i=i+1;
				break;
			default:
			p = p.substring(0,11);
			i=i+1;
	    }
    }
    m.value = p;
}
function ValidateZip(m)
{
	var i = 0
	var p
	p=m.value

	i = 0
	while (i < p.length)
	{
		switch (i)
		{
			case 0:
			case 1:
			case 2:
			case 3:
			case 4:
				if (IsDigit(p.substring(i,i+1)))
				{
					
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			default:
			p = p.substring(0,5);
			i=i+1;
	    }
    }
    m.value = p;
}

function ValidateNumber(m)
{
	var i = 0
	var p
	p=m.value

	i = 0
	while (i < p.length)
	{
		switch (i)
		{
			case 0:
			case 1:
			case 2:
			case 3:
			case 4:
			case 5:
			case 6:
			case 7:
			case 8:
			case 9:
				if (IsDigit(p.substring(i,i+1)))
				{
					
					i=i+1;
				}
				else
				{
					if (p.length > i)
					{
						p = (p.substring(0,i) + p.substring(i+1,p.length));
					}
					else
					{
						p = p.substring(0,i);
					}
				}
				break;
			default:
			    p = p.substring(0,3);
			    i=i+1;
	    }
    }
    m.value = p;
}
