// JavaScript Document

function showProfile(buttonID, proID, profilearea) { // v1.0 - Zebedee Creations
	
	// clearall button classes
	var linkList = document.getElementById("pagegraph").getElementsByTagName("a");
	   for (i = 0; i < linkList.length; i++) {
		  linkList[i].className = "";
	   }
	   
	// clear all areas   
	var theArea = eval('document.getElementById(\''+profilearea+'\')');
	var areaOtherList;
	var otherButtonID; 
	var otherButton;
	
	if(theArea) {
		var areasList = theArea.getElementsByTagName("div");
		   for (i = 0; i < areasList.length; i++) {
			  if(areasList[i].className == "profile") {
				areasList[i].style.display = 'none';
			  }
		   }
	}
	//highlight this button and this area
	var button =  eval('document.getElementById(\''+buttonID+'\')');
	var profile =  eval('document.getElementById(\''+proID+'\')');

	if(profile) {
		profile.style.display = 'block';
	}
	if(button) {
		button.className = 'high';
	}	
	
	// Check all areas ang highlight any active ones on the other area
	
	if(profilearea == 'profilearearight')
	{
		areaOtherList = document.getElementById("profilearealeft").getElementsByTagName("div");
	} else {
		areaOtherList = document.getElementById("profilearearight").getElementsByTagName("div");
	}
	
	
	
   for (i = 0; i < areaOtherList.length; i++) {
	  
	  //alert(areaOtherList[i].style.display);
	  
	  if(areaOtherList[i].className == "profile" && areaOtherList[i].style.display == 'block') { // highlighted block
		otherButtonID = areaOtherList[i].id.replace('profile_','button_');
		//alert(otherButtonID);
		otherButton = eval('document.getElementById(\''+otherButtonID+'\')');
		
		if(otherButton) {
			otherButton.className = 'high';
		}
		
	  }
   }
	
	
}