// JavaScript Document
// KAOSWEAVER breadcrumb facility
// Used in BBS Template by Iain Downie
// British Trust for Ornithology
function breadCrumbs(base,delStr,defp,cStyle,tStyle,dStyle,nl) { // by Paul Davis - http://www.kaosweaver.com
loc=window.location.toString();subs=loc.substr(loc.indexOf(base)+base.length+1).split("/");
 document.write('<a href="'+getLoc(subs.length-1)+defp+'" class="'+cStyle+'">Home</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');
 a=(loc.indexOf(defp)==-1)?1:2;
 for (i=0;i<(subs.length-a);i++) { 
 	subs[i]=makeCaps(unescape(subs[i]));
	if(subs[i]=="Latest results"){
  document.write('<a href="'+'http://blx1.bto.org/atlas-results/keystats.html'+'"class="'+cStyle+'">'+subs[i]+'</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');	
  }else{
  document.write('<a href="'+getLoc(subs.length-i-2)+defp+'" class="'+cStyle+'">'+subs[i]+'</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');
  }
 }
 if (nl==1) document.write("<br>");document.write('<font color="#339933">'+document.title+'</font>');
 // if (nl==1) document.write("<br>");document.write('<span class="'+tStyle+'">'+document.title+'</span>');
}

/*
  if(subs[i]=="Latest Results"){
  //subs[i]="Latest Results"
  document.write('<a href="http://blx1.bto.org/atlas-results/keystats.html"</a> '+'<span class="'+dStyle+'">'+delStr+'</span> ');}	
  }
  else{
  }

*/
function makeCaps(a) {
  if(a=="taking_part"){
  return "Taking part";
  }
  if(a=="latest_results"){
  return "Latest results";
  }
  else if(a=="eengland"){
  return "East England"; 
  }
  else if(a=="emidlands"){
  return "East Midlands"; 
  }
    else if(a=="neengland"){
  return "Northeast England"; 
  }
    else if(a=="nireland"){
  return "Northern Ireland"; 
  }
    else if(a=="nwengland"){
  return "Northwest England"; 
  }
    else if(a=="seengland"){
  return "Southeast England"; 
  }
    else if(a=="swengland"){
  return "Southwest England"; 
  }
    else if(a=="wmidlands"){
  return "West Midlands"; 
  }
    else if(a=="yorks"){
  return "Yorks and Humberside"; 
  }
  else if(a=="nbc"){
  return "Nest Box Challenge";
  } 
  else if(a=="birdatlas"){
  return "Bird Atlas";
  } 
  else {
  g=a.split(' ');for (l=0;l<g.length;l++) g[l]=g[l].toUpperCase().slice(0,1)+g[l].slice(1);
  return g.join(" ");
  }
}
function getLoc(c) {
  var d="";if (c>0) for (k=0;k<c;k++) d=d+"../"; return d;
}

function surfto() {
	if (document.results.species.options[document.results.species.selectedIndex].value != '')
	{
		var myvar=document.results.species.options[document.results.species.selectedIndex].value;
		url = "http://blx1.bto.org/nbc/maps/species-locations.jsp?spcode=" + myvar;
		window.location.href = url;
	}
	else
	{
		alert("Select a species please!");
	}
}