// JavaScript Document

//==== Dynamicall swap out "Header/Nav" background images needed for css (.active) ======================//
window.onload = buildnav;

function buildnav() {
	if (document.getElementById) {
		refObj = document.getElementById("pgTop").className;
		targetObj = document.getElementById("navContainer");
		targetClass = targetObj.className;
		targetHTML = targetObj.innerHTML;
		switch (refObj) {
			case "hdr_home": 
				targetObj.parentNode.innerHTML = '<div id="navContainer" class="mainNav_home">' + targetHTML + '</div>';
				break;
			case "hdr_countrytour": 
				targetObj.parentNode.innerHTML = '<div id="navContainer" class="mainNav_countrytour">' + targetHTML + '</div>';
				break;
			case "hdr_guitarhero":
				targetObj.parentNode.innerHTML = '<div id="navContainer" class="mainNav_guitarhero">' + targetHTML + '</div>';
				break;
		}
	}
}

//=========================================================================================================//



// var ids=new Array('spot1','spot2','spot3','spot4','spot5','spot6');
//This array is being populated dynamically by the spotlight.aspx page.
var ids= new Array();

function addArtistBlock(id)
{
    var i = ids.length;
    ids[i] = id;
    if (ids.length == 1)
    {
        switchid(id);
    }
}

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function dTourPopUp(URL) {
//Had to change the name of this function since it was in conflict with the radWindow control
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=310,height=522,left=50,top=50');");
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
