/* ***************************************

DOCUMENT INFO:
Author: Mike Hatcher
Company: Developed by Bullet Creative on behalf of HarperCollins 
Copyright 2008: Bullet Creative & Mike Hatcher

*************************************** */


/* ******************************************************************
POSITIONS LABELS OVER FORM FIELDS IN LOGIN FORM
Script courtesy of Mike Brittain
http://www.alistapart.com/articles/makingcompactformsmoreaccessible
******************************************************************* */
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.textIndent = (hide) ? '-1000px' : '0px';
      return true;
    }
  }
}




/* ******************************************************************
ADDS A CLASS TO THE LINK OF THE CURRENT PAGE IN THE MAIN & SIDEBAR NAV
******************************************************************* */
// GET CURRENT PAGE'S URL AND SPLIT IT INTO AN ARRAY
/*function selectLink() {
var pageParts = window.location.href.split("/");

	// Get the current page's module and file name
	if (pageParts.length > 0) {
		// Get file name (including optional parametres)
		var pageName = pageParts[pageParts.length - 1];
	}

	// Iterate through all the main nav links and create an array
	var nestedULs = document.getElementById("nav-main").getElementsByTagName("ul");
	for (var j=0; j < nestedULs.length; j++) {	
		var tags = nestedULs[j].getElementsByTagName("a");	
		for (var i=0; i < tags.length; i++) {
			var navParts = tags[i].href.split("/");
			
			// Isolate the file name of each link (includes parametres if there are any!)	
			if (navParts.length > 0) {
				var page = navParts[navParts.length - 1];
			} 
			else {
				var page = tags[i].href; 
			}
			
			// Assign a class of "selected" to the current page's link
			if (pageName == page) { 
				tags[i].parentNode.className += " " + "selected"; 
			}
		}
	}
}*/


/* ******************************************************************
LOAD ALL EVENTS
******************************************************************* */

window.onload =  function() { 
	//selectLink();
	setTimeout(initOverLabels, 50);
}		



/* ******************************************************************
LANGUAGE PAGES OVERLAY SCRIPT
******************************************************************* */


<!--
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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
