var numArtists = 1675;
var numAlbums = 1394;
var numSongs = 13428;

 function over(src) {
   if ("B" == src.tagName && (src.id == "artist_name" || src.id == "album_name")) {
	 src.style.color = "rgb(0,0,255)";
	 src.style.cursor = (document.all) ? "hand" : "pointer";
   }
 }

 function out(src) {
   var child = null, parent;
   if ("B" == src.tagName && (src.id == "artist_name" || src.id == "album_name")) {
	  if (document.all) {
		parent = document.all[src.sourceIndex -1];
		child = document.all[src.sourceIndex + 1];
	  } else {
		parent = src.parentNode;
		child = getChildElement(parent, 1);
	  }
	  if (null != child && "LI" == parent.tagName && "UL" == child.tagName) {
		if(parent.className != "open") src.style.color = "rgb(0,0,0)";
		else {
		   if(src.id == "artist_name") src.style.color = "rgb(102,142,255)";
		   else                        src.style.color = "rgb(0,102,220)";
		}
	  }
	  src.style.cursor = "auto";
   }
 }

 function getChildElement(obj, childNum) {
   var child = 0;
  if (obj.hasChildNodes()) {
	 for (var i=0; i < obj.childNodes.length; i++) {
	   if (obj.childNodes[i].nodeType != 1) continue;
	   if (child != childNum) {
		  child++;
		  continue;
	   } else
		  return obj.childNodes[i];
	   }
   }
   return null;
 }

 function showIt(src) {
   var child = null, parent;
   if ("B" == src.tagName && (src.id == "artist_name" || src.id == "album_name")) {
	  if (document.all) {
		parent = document.all[src.sourceIndex -1];
		child = document.all[src.sourceIndex + 1];
	  } else {
		parent = src.parentNode;
		child = getChildElement(parent, 1);
	  }
	  if (null != child && "LI" == parent.tagName && "UL" == child.tagName) {
		parent.className = ("close" == parent.className ? "open" : "close");
		child.className = ('expanded' == child.className ? 'none' : 'expanded');
	  }
	  if(src.id == "artist_name") src.style.color = "rgb(102,142,255)";
	  else                        src.style.color = "rgb(0,102,220)";
   }
 }

 function byArtist() {
   var sortBy = document.getElementById("sortType");
   sortType.innerText = "artist";
   sortBy.firstChild.nodeValue="artist";
 }

 function byAlbum() {
   var sortBy = document.getElementById("sortType");
   sortType.innerText = "album";
   sortBy.firstChild.nodeValue="album";
 }
