var Queue=[];
function queue(){
	while(Queue.length)
	{
		var f=Queue.shift();
		if( 'function'==typeof(f) )
		{
			f();
		}
	}
}
window.onload=queue;
function highlightCurrentPage(){
        var loc=location.pathname;
	   var loc2= location.protocol+"//"+location.hostname+loc + (true==/[\/]$/.test(loc)?"index.html":"");
	   loc=location.protocol+"//"+location.hostname+loc;
	   //alert( loc + "\n"+loc2);
        var ul=document.getElementById("sidemenu");
        var lnks=ul.getElementsByTagName("a");
        var i=-1,limit=lnks.length;
        while( ++i!=limit)
        {
//                if( lnks[i].href==loc || lnks[i].href==loc2 || String(lnks[i].href).toLowerCase().indexOf('accessibilityonline.org/index.php')>-1 )
                if( lnks[i].href==loc || lnks[i].href==loc2 || (loc.indexOf('accessibilityonline.org/index.php')>-1 && lnks[i].innerHTML=='Home') )
                {
                        //this will add the currentPage class to the A tag
                        lnks[i].className="currentPage";
 
                        //the line below will add the currentPage class to the LI tag
                        //lnks[i].parentNode.className="currentPage";
				    
				    //this break is required. Otherwise when user is on homepage
				    // the condition "... || loc.indexOf('accessibilityonline.org/index.php')>-1"
				    //will be true for all the links, so we must break as soon as the first is encountered
				    //Update: the explanation above does not apply when you check for the value of "Home" as
				    //the link's text. But it is still a good idea to break out as early as possible			    
				    break;
                }
        }
}

Queue[Queue.length]=highlightCurrentPage;