//The order we want the tabs to be in.
// - elements are stated here in the form of their tab's HTML ID attribute without the xg_tab_
// - all items not in this list will be removed
// - all items in this list that aren't tabs will be ignored
var newTabOrder = new Array("main", "profile", "photo", "video", "members", "about", "forum", "groups", "manage");

//get the current nav bar
var currentNavBar = document.getElementById("xg_navigation");
//where we'll put the tabs
var currentTabs = Array();
var tabList = null;

//only update the nav bar if it's on this page
if(currentNavBar) {
    //grab all of the nav items now
    for(var x=0; x < currentNavBar.childNodes.length; x++) {
        if(currentNavBar.childNodes[x].nodeName && 
            currentNavBar.childNodes[x].nodeName.match("UL")) {
            //we've found the list of nodes, now extract
            tabList = currentNavBar.childNodes[x];
            for(var y=0; y < tabList.childNodes.length; y++) {
                //finally, grab the tabs
                if(tabList.childNodes[y].nodeName && 
                    tabList.childNodes[y].nodeName.match("LI")) {
                    currentTabs.push(tabList.childNodes[y]);
                }
            }
            //remove the current navigation links
            if ( tabList.hasChildNodes() ) {
                while ( tabList.childNodes.length >= 1 ) {
                    tabList.removeChild( tabList.firstChild );       
                } 
            }
            break;
        }
    }

    //now that it's empty, add the tabs back in the desired order
    //yes this is O(n^2), but if that's a problem you have too many tabs
    for(var x=0; x < newTabOrder.length; x++) {
        for(var y=0; y < currentTabs.length; y++) {
            if(currentTabs[y].id && 
                currentTabs[y].id.match(newTabOrder[x])) {
                //we found the tab for this position, add it
                tabList.appendChild(currentTabs[y]);
                break;
            }
        }
    }
}


</script>




<script type="text/javascript">
// JavaScript Document
/*
	Copyright Robert Nyman, http://www.robertnyman.com
	Free to use if this text is included
*/
function getElementsByAttribute(oElm, strTagName, strAttributeName, strAttributeValue){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var oAttributeValue = (typeof strAttributeValue != "undefined")? new RegExp("(^|\\s)" + strAttributeValue + "(\\s|$)") : null;
	var oCurrent;
	var oAttribute;
	for(var i=0; i<arrElements.length; i++){
		oCurrent = arrElements[i];
		oAttribute = oCurrent.getAttribute && oCurrent.getAttribute(strAttributeName);
		if(typeof oAttribute == "string" && oAttribute.length > 0){
			//alert(oAttribute.substr(0,38));
			if(typeof strAttributeValue == "undefined" || (oAttributeValue && oAttributeValue.test(oAttribute))){
				arrReturnElements.push(oCurrent);
			}
		}
	}
	return arrReturnElements;
}



//getElementsByAttribute(document.body, "a", "href", "http://www.atlanticrecords.com/ti/news/article/?articleId=8a0af82d1bd627f1011bfa3c872d22d3")[0].href="http://community.staind.com/events";
var top_link = getElementsByAttribute(document.body, "p", "id", "xg_sitename");
for (i=0; i<top_link.length; i++) {
	top_link[i].innerHTML="<a target='_blank' href='http://www.cwtv.com/shows/gossip-girl' id='top_link1'><img src='http://flash.atlrec.com/gossipgirl/blank.gif' /></a><a target='_blank' href='http://store.atlanticrecords.com/albumview.asp?idproduct=66369' id='top_link3'><img src='http://flash.atlrec.com/gossipgirl/blank.gif' /></a><a target='_blank' href='http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?id=289404099&s=143441' id='top_link2'><img src='http://flash.atlrec.com/gossipgirl/blank.gif' /></a>";
}

var music_module = getElementsByAttribute(document.body, "div", "class", "xg_module html_module");

	if (music_module[0]!=null) {
		if (music_module.length>1) {
			music_module[0].className = 'music_header xg_module';
			music_module[2].className = 'banner_header xg_module';
			music_module[4].className = 'widget_header xg_module';
		}
	} else {
		music_module = getElementsByAttribute(document.body, "div", "className", "xg_module html_module");
		if (music_module.length>1) {
			music_module[0].className = 'music_header xg_module';
			music_module[2].className = 'banner_header xg_module';
			music_module[4].className = 'widget_header xg_module';
		}
	}