// JavaScript Document
/**
 * RandomValueFromSet
 * This function will return, at random, one of the values from the setOfValues.
 * @param setOfValues - an Array of values ordered by index from 0 to setOfValues.length-1.
 * @return a value from the set of values
 */
function RandomValueFromSet(setOfValues){
   return setOfValues[Math.round(Math.random()*(setOfValues.length-1))];
}
/**
 * AddARandomClass
 * This function will add a class randomly from the setOfClassNames to all the elements described in the query.
 * For additional information about '$.fn.' see JQuery Plugin <http://jquery.com/docs/Plugin/>
 * Credit goes to John Resig <http://ejohn.org/> for informing me about making it more intuitive
 * @param setOfClassNames - an Array of strings of the class names 
 */
$.fn.addRandomClass = function (setOfClassNames){
return this.addClass(RandomValueFromSet(setOfClassNames));
};
// The array to hold the multple classnames to be picked at random
var setOfRandomClassNames = new Array("aa", "bb", "cc");
//var queryForElementsToAddRandomClassTo = "body"; // adds the class name to the body
var queryForElementsToAddRandomClassTo = "#banner"; // adds the class name to an element with the id of cow
// The element(s), to which we will add a class name, have not loaded, hence do not exist,
// at this point in time when executing the script.  Since they do not exist, we cannot 
// add the class name to them. But if we wait until after all the elements have loaded, we
// can then safely and succesfully add the class name. To do this, our statement is 
// encapsulated in an anonymous function will be executed after all the elements have
// loaded by passing it to $(document).ready().
 $(document).ready(function(){$(queryForElementsToAddRandomClassTo).addRandomClass(setOfRandomClassNames);});