﻿
if (top.location != location) {top.location.href = location.href};
defaultStatus="";
if (document.all) {document.title="IMS-ESS"};

function reveal(i){
el=MM_findObj(i);if(el){
MM_showHideLayers(i,'','hide');
if(el.filters){el.filters[0].stop();el.filters[0].Apply()};
MM_showHideLayers(i,'','show');
if(el.filters){el.filters[0].Play();}}
}
function showDate(){
month = new Array("January","February","March","April","May","June",
"July","August","September","October","November","December");
dt = new Date();
return month[dt.getMonth()]+" "+dt.getDate()+", "+dt.getFullYear();
}

function blendit(i,img){
if (document.images && document[i]){
el=MM_findObj(i);theid=i;theimg="images/"+img;
if(el.filters){if(el.filters.blendTrans)el.filters.blendTrans.Apply()};
MM_swapImage(theid,'',theimg,1);
if(el.filters){if(el.filters.blendTrans)el.filters.blendTrans.Play();}}
}

function checkit(i){
if (i==1) {if (!oklen("Name",7)) return false;}
if (i!=1) {if (!oklen("FirstName",2)) return false;}
if (i!=1) {if (!oklen("LastName",3)) return false;}
if (!oklen("Address",8)) return false;
if (!oklen("City",4)) return false;
if (!oklen("State",2)) return false;
if (!oklen("ZipCode",5)) return false;
//if (!oklen("Phone",7)) return false;
//if (!okphone("Phone")) return false;
if (!okemail("Email")) return false;
if (i==1){if(confirm("Are you ready to send the form?")==false) return false;}
document.register.Valid.value="Valid";
document.register.Submit.value="Sending Now!";
document.register.Submit.disabled="true";
return true ;
}

function uppercase(thefield){
thefield.value = thefield.value.trim().toUpperCase();
return;
}

function lowercase(thefield){
thefield.value = thefield.value.trim().toLowerCase();
return;
}

function tonumeric(num){
return num.replace(/\D/g, "");
}

String.prototype.trim = function(){
i=this.replace(/(^\s*)|(\s*$)/g,'');
return i.replace(/\s\s+/g,' ') ;
}

function trimspaces(thefield){
thefield.value=thefield.value.trim();
}

function capitalize(thefield) {
val = thefield.value.trim().toLowerCase();
newVal = '';
val = val.split(' ');
for(var c=0;c<val.length;c++){newVal+=val[c].substring(0,1).toUpperCase()+val[c].substring(1,val[c].length)+' ';}
thefield.value=newVal.trim();
}

function xcapitalize(thefield){
thefield.value = thefield.value.trim().toLowerCase().replace(/\b[a-z]/g,function(w){return w.toUpperCase()});
}

function oklen(i,minlen) {
ii=eval("document.register."+i);
if (i=="FirstName"){i="first name"};
if (i=="LastName"){i="last name"};
if (ii.value.length<minlen) {
alert("Please enter a complete "+i.toLowerCase()+" on the form. Use the TAB Key to move between Fields.");ii.focus();return false}
return true ;
}

function okemail(i) {
ii=eval("document.register."+i);
trimspaces(ii);
ii.value = ii.value.toLowerCase();
if ( !ii.value.match(/^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i) ) {
alert("Please enter a complete Email Address on the form. Use the TAB Key to move between Fields.");ii.focus();return false}
return true ;
}

function okphone(i) {
ii=eval("document.register."+i);
if ( !ii.value.match(/^(\(?\d\d\d\)?)?[ -.]?\d\d\d[ -.]?\d\d\d\d$/) ) {
alert("Please enter a 10 Digit Phone Number or 000-0000. Use the TAB Key to move between Fields.");ii.focus();return false}
return true ;
}



function validateState (strValue ) {
/************************************************
DESCRIPTION: Validates that a string contains a 
  valid state abbreviation. 
  
 PARAMETERS:
   strValue - String to be tested for validity
   
RETURNS:
   True if valid, otherwise false.
*************************************************/

var objRegExp = /^(AK|AL|AR|AZ|CA|CO|CT|DC|DE|FL|GA|HI|IA|ID|IL|IN|KS|KY|LA|MA|MD|ME|MI|MN|MO|MS|MT|NB|NC|ND|NH|NJ|NM|NV|NY|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VA|VT|WA|WI|WV|WY)$/i; 

  return objRegExp.test(strValue);
}



function validateInteger( strValue ) {
/************************************************
DESCRIPTION: Validates that a string contains only 
    valid integer number.
    
PARAMETERS:
   strValue - String to be tested for validity
   
RETURNS:
   True if valid, otherwise false.
******************************************************************************/
  var objRegExp  = /(^-?\d\d*$)/;
 
  //check for integer characters
  return objRegExp.test(strValue);
}



function printpage() {
document.write("<form><input type=button "+"value=\"Print this page!\" onClick=\"window.print()\"></form>");
}
function moveobj(el,x,y){
obj=MM_findObj(el);if(obj){
if(!document.layers){obj=obj.style}
obj.left=x;obj.top=y}
}
function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); 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];}
}
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_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}


