//sets target of external links to _blank
function externalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
        anchor.getAttribute("rel") == "external")
      anchor.target = "_blank";
    }
}

//used for fading out the background
var color= new Array("#FAFCFE","#F6F8FD","#F2F5FC","#EDF1FB","#E9EEFA","#E4EBF8","#E0E7F7","#E0E7F7","#D7E1F5","#D3DDF4");

function fadeColor(index,location) {
    if (index >= 1) {
        document.getElementById(location).style.backgroundColor = color[index];
		  if (index > 1) {
			  index -= 1;
			  setTimeout("fadeColor("+index+",\""+location+"\")", 100);
			} else {
			  index -= 1;
			  setTimeout("fadeColor("+index+",\""+location+"\")", 100);
			  document.getElementById(location).style.backgroundColor = "white";
			}
    }
}

//This function is used on the locations page, highlights the location
//referenced in the url
function highlightLocation() {
  if(!document.getElementsByTagName) return;
  var location = document.URL.substr(document.URL.indexOf('#')+1);
	switch(location) {
		case "downtown":		
		case "jamesisland":
		case "mtpleasant":
		  document.getElementById(location).style.backgroundColor="#CFDAF3";
			setTimeout("fadeColor(10,\""+location+"\")", 2000);
			break;
		default:
		  break;
	}//end switch
		
}

// Function to allow multiple onload functions to be called
window.onload = function multipleOnload() {
  externalLinks();
	highlightLocation();
}