/* thanks to brainjar.com for sharing knowledge */

function synchTab(frameName) {

var elList, i, sActiveName;

// Exit if no frame name was given.

if (frameName == null)
	return;

// Check all links.

elList = document.getElementsByTagName("a");
for (i = 0; i < elList.length; i++)

// Check if the link's target matches the frame being loaded.

if (elList[i].target == frameName || elList[i].tgt != null) {


sActiveName = (frameName == "bodypart" || frameName == "stcIframe" || (frameName == "stcIframe" && window.frames[frameName].location.href.indexOf("app_studs_") > -1) || frameName == "ctrlIframe") ? frameName + "activeTab" : "activeTab";

// If the link's URL matches the page being loaded, activate it.
// Otherwise, make sure the tab is deactivated.

	if (elList[i].href == window.frames[frameName].location.href || (elList[i].href.indexOf("javascript:") > -1 && specialCase(elList[i],window.frames[frameName].location.href)) || (elList[i].href.indexOf("app_studs.asp") > -1 && window.frames[frameName].location.href.indexOf("app_studs_") > -1)) {
		elList[i].className += " " + sActiveName;
		elList[i].blur();
	}
	else removeName(elList[i], sActiveName);
	}
}

function specialCase(oElRef, sHref)
{
	return sHref.indexOf(oElRef.sourcePrefix) > -1;
}

function removeName(el, name) {

var i, curList, newList;

// Remove the given class name from the element's className property.

newList = new Array();
curList = el.className.split(" ");
for (i = 0; i < curList.length; i++)
if (curList[i] != name)
newList.push(curList[i]);
el.className = newList.join(" ");
}

