
YAHOO.example.LoadBg = function() {

	//create shortcut for YAHOO.util.Event:
	var e = YAHOO.util.Event;

	//the returned object here will be assigned
	//to YAHOO.example.Timing and its members will
	//then be publicly available:
	return {

		init: function() {

			//assign onDOMReady handler:
			e.on(window, "load", this.fnLoadHandler, "loginEmailInput");
			e.on(window, "load", this.fnLoadHandler, "loginEmailPassword");

		},
		
		//we'll use this handler for onAvailable, onContentReady,
		//and onDOMReady:
		fnLoadHandler: function(oEvent,boxName) {
		
		  var box = document.getElementById(boxName); 
		  if(box.value.length < 1) {
       box.style.backgroundPosition = '0px 0px';
       } else {
       return false; 
       }
		}
	}

}();

//initialize the example:
YAHOO.example.LoadBg.init();

(function() {
	
var changeBg = function() {
   this.style.backgroundPosition = '0px -20px';

}


/* we change on focus (click, tab) */
YAHOO.util.Event.addListener("loginEmailInput", "focus", changeBg);
YAHOO.util.Event.addListener("loginEmailPassword", "focus", changeBg);

/* we change on keyDown - in case the curser is already in the box on page load  */
YAHOO.util.Event.addListener("loginEmailInput", "keydown", changeBg);
YAHOO.util.Event.addListener("loginEmailPassword", "keydown", changeBg);

})();




