//global var set for tab url, set within home page
var thisUrl = "";
// function to show highlighted tabs on profile and profile index pages
function showSelectedTab(mode) {
	if(!document.getElementById('profiletabs_list')) { return false; }
	
	var tablist = document.getElementById('profiletabs_list');
	var tablinks = tablist.getElementsByTagName('a');
	
	for ( var i=0; i< tablinks.length; i++) {
		
		// the id's on each link are format: mode_profile
		
		var tab_part = tablinks[i].title.split(" ");
		var link_mode = tab_part[0];
		
		if (link_mode == mode ) {
			// highlighted state
			tablinks[i].setAttribute("class","hilite");
			tablinks[i].className="hilite"; //the above didn't seem to work in IE
			tablinks[i].setAttribute("href",thisUrl);
		}else{
			// normal state
			tablinks[i].setAttribute("class","normal");		
			tablinks[i].className="normal";
		}
	}
}



function changeTabLink(mode, url) {
	// change the tab url to the link to the random profile page
	if(!document.getElementById('profiletabs_list')) { return false; }
	
	var tablist = document.getElementById('profiletabs_list');
	var tablinks = tablist.getElementsByTagName('a');
	
	for ( var i=0; i< tablinks.length; i++) {		
		// the id's on each link are format: mode_profile		
		var tab_part = tablinks[i].title.split(" ");
		var link_mode = tab_part[0];
		alert(link_mode);
		if (link_mode == mode ) {		
			tablinks[i].setAttribute("href",url);
			tablinks[i].href = url;	
			alert(tablinks[i].href);
		
		}
	}
}