// 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]));
 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>');
}
function makeCaps(a) {
  if(a=="take_part"){
  return "Taking part";
  }
  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 {
  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;
		var myyear=document.results.syear.value;
		url = "http://blx1.bto.org/nbc/maps/species-locations.jsp?spcode=" + myvar + "&year=" + myyear;
		window.location.href = url;
	}
	else
	{
		alert("Select a species please!");
	}
}
function getyear(){
	var gyear = document.results.gyear.value;
	if(gyear.length>0){
		url = "http://blx1.bto.org/nbc-results/nbc_occupancy_" + gyear + ".html";
		window.location.href = url;
	}
	else{
		alert("Select a year please!");
	}
}
function getlocyear(){
	var glocyear = document.results.locyear.value;
	if(glocyear.length>0){
		url = "http://blx1.bto.org/nbc/maps/garden-locations.jsp?year=" + glocyear;
		window.location.href = url;
	}
	else{
		alert("Select a year please!");
	}
}

