// JavaScript Document
var currentProfile = null; // the profile div currently displayed

// get the element that was clicked to raise the event
function getEventTarget(e) {
	// overcome browser differences (IE uses window.event, not e)
   e = e || window.event;
	
	// more browser differences (IE uses srcElement instead of target)
   return e.target || e.srcElement;
} // end getEventTarget

// display the profile for the selected artist
function selectProfile( e )
{
	// get the element that was clicked (artist name in table)
	var target = getEventTarget( e );
	//var targetClass = target.className;
	
	if(target.id != ""){
		var artistName = target.id.replace(/artist/, "");
		changeProfileTo( artistName );
	}
} // end selectService


// display the description for the given service
function changeProfileTo( artistName )
{
	// get the div containing the artist's profile
	var profile = document.getElementById(artistName);
	
	// don't do anything if the selected profile is the same as the current profile
	if(profile == currentProfile)
		return;
	
	if(profile == null) {
		if(currentProfile.id != "No_Profile")
			profile = document.getElementById("No_Profile");
		else
			return;
	}
	
	// swap the classes of the current profile with this profile
	profile.className = "profile active";
	currentProfile.className = "profile";
	
	// set currentProfile to the new profile
	currentProfile = profile;
} // end displayServiceDescription