	
// Function for Scrolling Text

		window.status="The #1 Place for Cleaning Supplies, Services and Paper Products                                                                   ";
	
	var iID=window.setInterval("scrollStatus()",100);
	
	function scrollStatus(){
		var stuff=window.status;
		var firstChar=stuff.substr(0,1)
		var row=stuff.substr(1);
		stuff=row + firstChar;
		window.status=stuff;
	}
	
/*	Creates Last Modified Stamp for Documents	*/
var a;
    a=new Date(document.lastModified);
    lm_year=a.getYear();lm_year=((lm_year<1000)?((lm_year<70)?2000:1900):0)+lm_year;
    lm_month=a.getMonth()+1;lm_month=((lm_month<10)?'0':'')+lm_month;
    lm_day=a.getDate();lm_day=((lm_day<10)?'0':'')+lm_day;
 
    monthName = new Array(12)
    monthName[0] = 'January'
    monthName[1] = 'February'
    monthName[2] = 'March'
    monthName[3] = 'April'
    monthName[4] = 'May'
    monthName[5] = 'June'
    monthName[6] = 'July'
    monthName[7] = 'August'
    monthName[8] = 'September'
    monthName[9] = 'October'
    monthName[10] = 'November'
    monthName[11] = 'December'
	

/*	Creates Calendar and Clock */	
function todaysDate(){ 
 var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); 
 var days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); 
 var now = new Date(); 
 var Today = months[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear(); 
 return Today; 
 } 


/*	Preloads Images	*/
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];}}
}


/*	Swaps Images that are Hovered over	*/
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_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_jumpMenu(targ,selObj,restore){ //v3.0 
   eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); 
   if (restore) selObj.selectedIndex=0; 
 } 

function MM_reloadPage(init) {  //reloads the window if Nav4 resized 
   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 for Lute Web Advertisement */
function adLute(){
	var newWin = window.open("../luteweb.html", "", "width=510,height=500,menubar=no,scrollbars");
	}
function adLuteMain(){
	var newWin = window.open("luteweb.html", "", "width=510,height=500,menubar=no,scrollbars");
	}
 
//Programs checks registration forms for completeness

/* *************************************************************
* set some global variables that will be checked later         *
***************************************************************/
var msg = "";                 	// an output message
var missing = "";             	// for missing required fields
var invNum = "";              	// for invalid numeric fields
var invZIP = "";              	// for invalid zip codes
var invPhone = "";            	// for invalid phone numbers
var invState = "";            	// for invalid state fields
var invAge = "";            	// for invalid age fields
var invBirth = "";            	// for invalid birth date fields
var invDate = "";            	// for invalid date fields
var invTime = "";            	// for invalid time fields
var invFirst4 = "";            	// for invalid First 4 credit card numbers
var invSecond4 = "";            // for invalid Second 4 credit card numbers
var invThird4 = "";            	// for invalid Third 4 credit card numbers
var invLast4 = "";            	// for invalid Last 4 credit card numbers
var invExpire = "";            	// for invalid Credit Card Expiration fields

/* *************************************************************
* The main validation function, calls other sub-functions      *
***************************************************************/
function validate(frm)
  {
  for(i=0; i<frm.elements.length; i++)            // loop through form elements
    {
    var el = frm.elements[i];
    if(el.required)                               // if element has required property
      {                                           // test to see if field is empty
      if(isEmpty(el))
        {
        missing += "\n   - " + el.name + " is a required field";
        }
      }
	  
    if(el.numeric)
      {
      if(!isNumeric(el))
        {
        invNum += "\n   - " + el.value + " is not a number";
        }
      }
	  
    if(el.zip && el.value.length !=0)
      {
      if(invalidZIP(el))
        {
        invZIP += "\n  - " + el.value + " is an invalid ZIP code";
        }
      }
	  
    if(el.phone && el.value.length !=0)
      {
      if(invalidPhone(el))
        {
        invPhone += "\n  - " + el.value + " is not a valid phone number";
        }
      }
	  
    if(el.state && el.value.length != 0)
      {
      if(invalidState(el))
        {
        invState += "\n  - " + el.value + " is not a valid two-letter state abbreviation";
        }
      }

    if(el.age && el.value.length !=0)
      {
      if(invalidAge(el))
        {
        invAge += "\n  - " + el.value + " is not a valid age";
        }
      }


    if(el.birth && el.value.length !=0)
      {
      if(invalidBirth(el))
        {
        invBirth += "\n  - " + el.value + " is not a valid birth date";
        }
      }
	  
    if(el.date && el.value.length !=0)
      {
      if(invalidDate(el))
        {
        invDate += "\n  - " + el.value + " is not a valid date";
        }
      }
	  
    if(el.time && el.value.length !=0)
      {
      if(invalidTime(el))
        {
        invTime += "\n  - " + el.value + " is not a valid time";
        }
      }
	  
	if(el.first_num && el.value.length !=0)
      {
      if(invalidFirst4(el))
        {
        invFirst4 += "\n  - " + el.value + " is not 4 valid numbers";
        }
      }

	if(el.second_num && el.value.length !=0)
      {
      if(invalidSecond4(el))
        {
        invSecond4 += "\n  - " + el.value + " is not 4 valid numbers";
        }
      }

	if(el.third_num && el.value.length !=0)
      {
      if(invalidThird4(el))
        {
        invThird4 += "\n  - " + el.value + " is not 4 valid numbers";
        }
      }

	if(el.last_num && el.value.length !=0)
      {
      if(invalidLast4(el))
        {
        invLast4 += "\n  - " + el.value + " is not 4 valid numbers";
        }
      }
  
	if(el.exp_date && el.value.length !=0)
      {
      if(invalidExpire(el))
        {
        invExpire += "\n  - " + el.value + " is not a valid expiration date";
        }
      }
    }
  
  // build output message
  if(missing.length !=0 || invNum.length != 0 || invZIP.length != 0 || invPhone.length != 0 || invState.length != 0 || invAge.length != 0 || invBirth.length != 0 || invDate.length != 0 || invTime.length != 0 || invFirst4.length != 0 || invSecond4.length != 0 || invThird4.length != 0 || invLast4.length != 0 || invExpire.length != 0)
    {
    if(missing.length !=0)
      {
      msg += "\n\nThe following required fields are missing:";
      msg += missing;
      }
    if(invNum.length !=0)
      {
      msg += "\n\nYou entered incorrect numeric data in this field:";
      msg += invNum;
      }
    if(invZIP.length !=0)
      {
      msg += "\n\nYou entered an incorrect ZIP code in this field:";
      msg += invZIP;
      }
    if(invPhone.length !=0)
      {
      msg += "\n\nYou entered an incorrect phone number in this field:";
      msg += invPhone;
      }
    if(invState.length !=0)
      {
      msg += "\n\nYou entered an incorrect state abbreviation";
      msg += invState;
      }
    if(invAge.length !=0)
      {
      msg += "\n\nYou entered an incorrect age";
      msg += invAge;
      }
    if(invBirth.length !=0)
      {
      msg += "\n\nYou entered an incorrect birth date";
      msg += invBirth;
      }
    if(invDate.length !=0)
      {
      msg += "\n\nYou entered an incorrect date";
      msg += invDate;
      }
    if(invTime.length !=0)
      {
      msg += "\n\nYou entered an incorrect time";
      msg += invTime;
      }
	if(invFirst4.length !=0)
      {
      msg += "\n\nYou entered incorrectly the first four credit card numbers in this field:";
      msg += invFirst4;
      }
	if(invSecond4.length !=0)
      {
      msg += "\n\nYou entered incorrectly the second four credit card numbers in this field:";
      msg += invSecond4;
      }
	if(invThird4.length !=0)
      {
      msg += "\n\nYou entered incorrectly the third four credit card numbers in this field:";
      msg += invThird4;
      }
	if(invLast4.length !=0)
      {
      msg += "\n\nYou entered incorrectly the last four credit card numbers in this field:";
      msg += invLast4;
      }
	if(invExpire.length !=0)
      {
      msg += "\n\nYou entered an incorrect credit card expiration date in this field:";
      msg += invExpire;
      }
    errMsg(msg);           // call the output function
    msg = ""; missing = ""; invNum = ""; invZIP = ""; invPhone = ""; invState = "" ; invAge = "" ; invBirth = "" ; invDate = "" ; invTime = "" ; invFirst4 = ""; invSecond4 = ""; invThird4 = ""; invLast4 = ""; invExpire = "" // reset all our variables
    return false;
    }
  else
    {
    return true;
    }
  }

/* *************************************************************
* Sub-functions follow from here to end of file                *
* All sub-functions return true if field is of invalid         *
* format and false if they are valid entries                   *
***************************************************************/
function isEmpty(field)
  {
  str = field.value;
  if(str == "") 
    {
    return true;
    }
  else
    {
    for(j=0; j<str.length; j++)
      {
      if(str.charAt(j) != " ") return false;
      }
    }
  return true;
  }

function isNumeric(field)
  {
  var errCount = 0;
  var numdecs = 0;              // number of decimal points
  var nummins = 0;              // number of minus signs
  for(j=0;j<field.value.length;j++)
    {
    c = field.value.charAt(j);        // short hand notation for character at position j
    if((c >= 0 && c <= 9) || (c=="." || c=="-"))
      {
      if(c==".") numdecs++;     // count the number of decimal points
      if(c=="-") nummins++;     // count the number of minus signs
      }
    else
      {
      errCount++;               // if it's none of those, increment error counter
      }
    }
  // error if count is non-zero or there are more than one decimal point or minus sign
  if(errCount > 0 || numdecs > 1 || nummins > 1)
    {
    return false;
    }
  return true;
  }

function stripNonDigits(str)
  {
  newStr = "";
  for(j=0; j<str.length; j++)
    {
    c = str.charAt(j);
    if(c >= "0" && c <= "9")
      {
      newStr += c;
      }
    }
  return newStr;
  }

function invalidZIP(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 5 || newStr.length== 9)
    {
    return false;
    }
  return true;
  }

function invalidPhone(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 10)
    {
    return false;
    }
  return true;
  }
  
function invalidAge(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length > 0)
    {
    return false;
    }
  return true;
  }
  
function invalidBirth(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 8)
    {
    return false;
    }
  return true;
  }

function invalidDate(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 6)
    {
    return false;
    }
  return true;
  }
  
function invalidTime(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 3 || newStr.length== 4)
    {
    return false;
    }
  return true;
  }
  
function invalidState(field)
  {
  var STATES = "AL/AK/AZ/AR/CA/CO/CT/DE/DC/FL/GA/HI/ID/IL/IN/IA/KS/LA/ME/MD/MA/MI/MN/MS/MO/MT/NV/NH/NJ/NM/NY/NC/ND/OH/OK/OR/PA/PR/RI/SC/TN/TX/UT/VT/VA/WA/WV/WI/WY";
  var newStr = field.value.toUpperCase();
  if(STATES.indexOf(newStr) == -1 || newStr.indexOf("/") != -1 || newStr.length != 2)
    {
    return true;
    }
  return false;
  }
  
function invalidFirst4(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 4)
    {
    return false;
    }
  return true;
  }

function invalidSecond4(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 4)
    {
    return false;
    }
  return true;
  }
  
function invalidThird4(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 4)
    {
    return false;
    }
  return true;
  }
  
function invalidLast4(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 4)
    {
    return false;
    }
  return true;
  }
  
function invalidExpire(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 6)
    {
    return false;
    }
  return true;
  }

function errMsg(msg)
  {
  var theMsg = "You entered some incorrect values into the form. ";
  theMsg += "Please correct your entries then re-submit the form.\n";
  theMsg += "____________________________________________________________________";
  theMsg += msg;
  theMsg += "\n____________________________________________________________________\n";
  alert(theMsg);
  }
