function initOverLabels () {
  if (!document.getElementById) return;   

  var labels, id, field;

  // Set focus and blur handlers to hide and show 
  // LABELs with 'overlabel' class names.
  labels = document.getElementsByTagName('label');
  for (var i = 0; i < labels.length; i++) {
  
    if (labels[i].className == 'overlabel') {

      // Skip labels that do not have a named association
      // with another field.
      id = labels[i].htmlFor || labels[i].getAttribute('for');
      if (!id || !(field = document.getElementById(id))) {
        continue;
      }

      // Change the applied class to hover the label 
      // over the form field.
      labels[i].className = 'overlabel-apply';

      // Hide any fields having an initial value.
      if (field.value !== '') {
        hideLabel(field.getAttribute('id'), true);
      }

      // Set handlers to show and hide labels.
      field.onfocus = function () {
        hideLabel(this.getAttribute('id'), true);
      };
      field.onblur = function () {
        if (this.value === '') {
          hideLabel(this.getAttribute('id'), false);
        }
      };

      // Handle clicks to LABEL elements (for Safari).
      labels[i].onclick = function () {
        var id, field;
        id = this.getAttribute('for');
        if (id && (field = document.getElementById(id))) {
          field.focus();
        }
      };

    }
  }
};

function hideLabel (field_id, hide) {
  var field_for;
  var labels = document.getElementsByTagName('label');
  for (var i = 0; i < labels.length; i++) {
    field_for = labels[i].htmlFor || labels[i].getAttribute('for');
    if (field_for == field_id) {
      labels[i].style.position = (hide) ? 'absolute' : 'absolute';
      labels[i].style.zIndex = (hide) ? '-1' : '100';
      return true;
    }
  }
}

function initOver()
{
  // change the class of the submit buttons when hovered over
  var isie = (typeof document.all != 'undefined'
    && typeof window.opera == 'undefined'
    && navigator.vendor != 'KDE');
  if (
      typeof document.getElementById == 'undefined'
      || (navigator.vendor == 'Apple Computer, Inc.'
        && typeof window.XMLHttpRequest == 'undefined')
      || (isie && typeof document.uniqueID == 'undefined')
    )
  {
    return;
  }
  
//  var thisBtn = document.getElementById('logInButton');
//  attachEventListener(
//    thisBtn,
//    "mouseover",
//    function(e) {
//      var thisBtn = document.getElementById('logInButton');
//      thisBtn.setAttribute("src", "images/goButton_over.png");
//      
//      attachEventListener(
//        thisBtn,
//        "mouseout",
//        function(e) {
//          var thisBtn = document.getElementById('logInButton');
//          thisBtn.setAttribute("src", "images/goButton.png");
//        },
//        false
//      );
//      
//    },
//    false
//  );


  var thisBtn = document.getElementById('plc_lt_Search_SearchBox_btnImageButton');
  attachEventListener(
    thisBtn,
    "mouseover",
    function(e) {
      var thisBtn = document.getElementById('plc_lt_Search_SearchBox_btnImageButton');
      thisBtn.setAttribute("src", "/app_themes/bsi/images/goButton_over.png");
      
      attachEventListener(
        thisBtn,
        "mouseout",
        function(e) {
          var thisBtn = document.getElementById('plc_lt_Search_SearchBox_btnImageButton');
          thisBtn.setAttribute("src", "/app_themes/bsi/images/goButton.png");
        },
        false
      );
      
    },
    false
  );


  if (document.getElementById('solutionsContainer') != null) {

	  var thisBox = document.getElementById('solutionsContainer');
	  attachEventListener(
	    thisBox,
	    "mouseover",
	    function(e) {
	      var thisBox = document.getElementById('solutionsContainer');
	      //thisBox.className = "over";
	      thisBox.style.background = "url('~/app_themes/bsi/images/solutionsBg_over.png')";
	      
	      attachEventListener(
	        thisBox,
	        "mouseout",
	        function(e) {
	          var thisBox = document.getElementById('solutionsContainer');
	          //thisBox.className = "normal";
	          thisBox.style.background = "url('~/app_themes/bsi/images/solutionsBg.png')";
	        },
	        false
	      );
	      
	    },
	    false
	  );
  
  }
    
  
  if (document.getElementById('demo') != null) {


	  var thisBox = document.getElementById('demo');
	  attachEventListener(
	    thisBox,
	    "mouseover",
	    function(e) {
	      var thisBox = document.getElementById('demo');
	      //thisBox.className = "over";
	      thisBox.style.background = "url('~/app_themes/bsi/images/demoDiv_over.png')";
	      
	      attachEventListener(
	        thisBox,
	        "mouseout",
	        function(e) {
	          var thisBox = document.getElementById('demo');
	          //thisBox.className = "normal";
	          thisBox.style.background = "url('~/app_themes/bsi/images/demoDiv.png')";
	        },
	        false
	      );
	      
	    },
	    false
	  );

	}

	
	  if (document.getElementById('solutionsSearchButton') != null) {


    var thisBtn = document.getElementById('solutionsSearchButton');
    attachEventListener(
      thisBtn,
      "mouseover",
      function(e) {
        var thisBtn = document.getElementById('solutionsSearchButton');

        thisBtn.style.background = "#00467f";
        
        attachEventListener(
          thisBtn,
          "mouseout",
          function(e) {
            var thisBtn = document.getElementById('solutionsSearchButton');

            thisBtn.style.background = "#00aeef";
          },
          false
        );
        
      },
      false
    );

  }
	

}


window.onload = function () {
  setTimeout(initOverLabels, 50);
  
  // rollover listeners
  initOver();
};
