
function stringFilter (strinput) {
	s = strinput.value;
	filteredValues = "1234567890";     // Characters stripped out
	var i;
	var returnString = "";
	for (i = 0; i < s.length; i++) {  // Search through string and append to unfiltered values to returnString.
		var c = s.charAt(i);
		if (filteredValues.indexOf(c) == -1) returnString += c;
	}
	return returnString;
}


function addOnloadEvent(fnc){
	  if ( typeof window.addEventListener != "undefined" )
		window.addEventListener( "load", fnc, false );
	  else if ( typeof window.attachEvent != "undefined" ) {
		window.attachEvent( "onload", fnc );
	  }
	  else {
		if ( window.onload != null ) {
		  var oldOnload = window.onload;
		  window.onload = function ( e ) {
			oldOnload( e );
			window[fnc]();
		  }
		}
		else
		  window.onload = fnc;
	  }
	}

// ----------------------------------------------------------------------------
// HasClassName
//
// Description : returns boolean indicating whether the object has the class name
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to add
//
function HasClassName(objElement, strClass)
   {

   // if there is a class
   if ( objElement.className )
      {

      // the classes are just a space separated list, so first get the list
      var arrList = objElement.className.split(' ');

      // get uppercase class for comparison purposes
      var strClassUpper = strClass.toUpperCase();

      // find all instances and remove them
      for ( var i = 0; i < arrList.length; i++ )
         {

         // if class found
         if ( arrList[i].toUpperCase() == strClassUpper )
            {

            // we found it
            return true;

            }

         }

      }

   // if we got here then the class name is not there
   return false;

   }
// 
// HasClassName
// ----------------------------------------------------------------------------


// ----------------------------------------------------------------------------
// AddClassName
//
// Description : adds a class to the class attribute of a DOM element
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to add
//
function AddClassName(objElement, strClass, blnMayAlreadyExist)
   {

   // if there is a class
   if ( objElement.className )
      {

      // the classes are just a space separated list, so first get the list
      var arrList = objElement.className.split(' ');

      // if the new class name may already exist in list
      if ( blnMayAlreadyExist )
         {

         // get uppercase class for comparison purposes
         var strClassUpper = strClass.toUpperCase();

         // find all instances and remove them
         for ( var i = 0; i < arrList.length; i++ )
            {

            // if class found
            if ( arrList[i].toUpperCase() == strClassUpper )
               {

               // remove array item
               arrList.splice(i, 1);

               // decrement loop counter as we have adjusted the array's contents
               i--;

               }

            }

         }

      // add the new class to end of list
      arrList[arrList.length] = strClass;

      // add the new class to beginning of list
      //arrList.splice(0, 0, strClass);
      
      // assign modified class name attribute
      objElement.className = arrList.join(' ');

      }
   // if there was no class
   else
      {

      // assign modified class name attribute      
      objElement.className = strClass;
   
      }

   }
// 
// AddClassName
// ----------------------------------------------------------------------------


// ----------------------------------------------------------------------------
// RemoveClassName
//
// Description : removes a class from the class attribute of a DOM element
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to remove
//
function RemoveClassName(objElement, strClass)
   {

   // if there is a class
   if ( objElement.className )
      {

      // the classes are just a space separated list, so first get the list
      var arrList = objElement.className.split(' ');

      // get uppercase class for comparison purposes
      var strClassUpper = strClass.toUpperCase();

      // find all instances and remove them
      for ( var i = 0; i < arrList.length; i++ )
         {

         // if class found
         if ( arrList[i].toUpperCase() == strClassUpper )
            {

            // remove array item
            arrList.splice(i, 1);

            // decrement loop counter as we have adjusted the array's contents
            i--;

            }

         }

      // assign modified class name attribute
      objElement.className = arrList.join(' ');

      }
   // if there was no class
   // there is nothing to remove

   }
// 
// RemoveClassName
// ----------------------------------------------------------------------------
  


function checkedToParentClass(divid,boxid) {

var checkedvar = "checked";

if(document.getElementById && document.createTextNode) {
	var n=document.getElementById(divid);
	var box=document.getElementById(boxid);
	
	if (n) {
		if(box.checked) {
			AddClassName(n,checkedvar);
		}
		else {
			RemoveClassName(n,checkedvar);
		}
	}
}
}


function preLoad(){
			ivar = 39;
			randpics = new Array(ivar);
			for (i=0; i<inum; i++){
				randpics[i] = new Image();
				randpics[i].src = "../rands/" + i + ".jpg";
				window.status = i+1 + "/" + ivar + " IMAGES PRELOADED.";
			}
		}
		
		function changePics(pic, pic2, pic3){
			ivar = 39;
		
				orig = pic.src.charAt(0);
				orig2 = pic2.src.charAt(0);
				orig3 = pic3.src.charAt(0);
		
				rand = Math.floor(Math.random()*ivar);
				rand2 = Math.floor(Math.random()*ivar);
				rand3 = Math.floor(Math.random()*ivar);
				while (rand == orig || rand == orig2 || rand == orig3 || rand2 == orig || rand2 == orig2 || rand2 == orig3 || rand3 == orig || rand3 == orig2 || rand3 == orig3 || rand == rand2 || rand == rand3 || rand2 == rand3){
					rand = Math.floor(Math.random()*ivar);
					rand2 = Math.floor(Math.random()*ivar);
					rand3 = Math.floor(Math.random()*ivar);
				}
				pic.src = randpics[rand].src;
				pic2.src = randpics[rand2].src;
				pic3.src = randpics[rand3].src;
		
			window.setTimeout("changePics(pic1,pic2,pic3);", 2500);
		}
		
		function startAnim(){
			preLoad();
			pic1 = document.getElementById("r1");
			pic2 = document.getElementById("r2");
			pic3 = document.getElementById("r3");
			window.setTimeout("changePics(pic1,pic2,pic3);", 2500);
		}
		
		function change(el){
		thing = document.getElementById(el);
		thing.style.backgroundColor = "#0000ff";
		}
		
		function changeBack(el){
		thing = document.getElementById(el);
		thing.style.backgroundColor = "#003366";
		}
		
		function validate(){
		f = document.form;
		if (f.firstlast.value == "" || f.email.value == ""){
		return false;
		}
		else return true;
		}
		
		
		function clicked(){
		
		if (document.form.agree.checked == true){
		
		window.alert("Thanks!!");
		
		}
		
		if (document.form.agree.checked != true){
		
		window.alert("I strongly urge you to reconsider...");
		
		}
		
		}

function toggle( targetId ){
  if (document.getElementById){
        target = document.getElementById( targetId );
           if (target.style.display == "none"){
              target.style.display = "";
           } else {
              target.style.display = "none";
           }
     }
}


makeRounded = function(){
if(!NiftyCheck())
    return;
Rounded("DIV.aepi_head","all","#FFFFFF","#003366");
if (document.getElementById("sm")) {
	Rounded("DIV#sm","top","#FFFFFF","#004488");
}
else {Rounded("DIV#ct","top","#FFFFFF","#ffff00");}
Rounded("DIV.top_bar","all","#FFFFFF","#ffff00","small");
Rounded("DIV.menu","top","#FFFFFF","#003366");
if (document.getElementById("rd")) {
	Rounded("DIV#rd","all","#FFFFFF","transparent","border smooth");
}

}