function showcase(divToShow) {
document.getElementById('ExpeditionChooser2010').className = "expedSummary";
document.getElementById('ExpeditionChooser2011').className = "expedSummary";
document.getElementById('ExpeditionChooser2012').className = "expedSummary";
document.getElementById('ExpeditionChooser' + divToShow).className = "expedShowCase";
document.getElementById('BSES-2010-Expeditions').style.backgroundPosition = "0px 24px";
document.getElementById('BSES-2011-Expeditions').style.backgroundPosition = "0px 24px";
document.getElementById('BSES-2012-Expeditions').style.backgroundPosition = "0px 24px";
document.getElementById('BSES-' + divToShow + '-Expeditions').style.backgroundPosition = "0px 0px";
}

function slideShow(theDiv,theSlide,slideShowMode) {
	setTimeout('showNextSlide(\'' + theDiv + '\',\'' + theSlide + '\')',6000);
}
function showNextSlide(theDiv,theSlide) {
if(slideShowMode =="normal") {
	theSlide = 1*theSlide + 1;
	if(theSlide > slideTotal) { theSlide = slideMinimum;}
	document.getElementById(theDiv).innerHTML = '<a href="javascript:showDetail(\'slideShowDiv\',\'' + theSlide + '\');" onMouseOver="showDetail(\'slideShowDiv\',\'' + theSlide + '\');" >'+"<img src=\"/assets/template/spacer.gif\" class=\"slideShowFront\"></a>";
	document.getElementById(theDiv).style.backgroundImage = "url(/assets/homepage/expeditionHomepage-" + theSlide + ".jpg)";
	setTimeout('showNextSlide(\'' + theDiv + '\',\'' + theSlide + '\')',6000);
}
}

function returnToShow(theDiv,theSlide) {
	document.getElementById(theDiv).innerHTML = '<a href="javascript:showDetail(\'slideShowDiv\',\'' + theSlide + '\');" onMouseOver="showDetail(\'slideShowDiv\',\'' + theSlide + '\');" >'+"<img src=\"/assets/template/spacer.gif\" class=\"slideShowFront\"></a>";
	slideShowMode = "normal";
	setTimeout('showNextSlide(\'' + theDiv + '\',\'' + theSlide + '\')',6000);
}

function showDetail(theDiv,theContent) {
slideShowMode = "paused";
document.getElementById(theDiv).style.backgroundImage = "url(/assets/homepage/expeditionHomepage-" + theContent + ".jpg)";
var subDiv = "<div id=\"floatDetailDiv\" onMouseOut=\"returnToShow('slideShowDiv','" + theContent + "');\">";
subDiv = subDiv + "<div class=\"expedDetailText\" >";
subDiv = subDiv + expedContent[theContent] + "</div></div>";
document.getElementById(theDiv).innerHTML = subDiv ;
}

function pauseDetail(theDiv,theContent) {
slideShowMode = "paused";
var subDiv = "<div id=\"floatDetailDiv\" onMouseOut=\"returnToShow('slideShowDiv','" + theContent + "');\">";
subDiv = subDiv + "<div class=\"expedDetailText\" >";
subDiv = subDiv + expedContent[theContent] + "</div></div>";
document.getElementById(theDiv).innerHTML = subDiv ;
}

function rhsSwitchOn(thediv) {
document.getElementById(thediv).style.backgroundPosition = "0px -24px";
}
function rhsSwitchOff(thediv) {
document.getElementById(thediv).style.backgroundPosition = "0px 0px";
}

function checkBody() {
var innerHeight = document.getElementById('bsesHeader').style.height;
// alert("The inner body height is: " + innerHeight + "px");
}
function buttonOn(thediv) {
document.getElementById(thediv).style.backgroundPosition = "0px 50px";
}
function buttonOff(thediv) {
document.getElementById(thediv).style.backgroundPosition = "0px 0px";
}

function setHeader(theImage) {
document.getElementById('bsesHeader').style.backgroundImage="url(/assets/template/220-header-" + theImage + ".jpg)";
}
function preFooter(newContent,theDiv) {
var newhtml = document.getElementById(newContent).innerHTML;
document.getElementById(theDiv).innerHTML = newhtml;
// show divs in prefooter
  cn = document.getElementById('buttons').getElementsByTagName('div');
  var liveButton = "none";
  for (var i = 0; i < cn.length; i++) {
    // alert( "Found '" + i + "', with id of='" + cn[i].id + "', class of ='" + cn[i].className + "'" );  
    if ( cn[i].className=="preFooterButtonOn" ) {
      // alert( "So this needs to be turned off! '" + cn[i].id + "'");
      cn[i].className = "preFooterButtonOff";
      }
  }
 // now turn on the relevant one
 document.getElementById('link_' + newContent).className = "preFooterButtonOn";
}


function clearMe(theField) {
var oldVar = document.searchForm.query_string.value;
document.searchForm.query_string.value="";
}

function openSearch() {
var myDiv = document.getElementById('searchDiv');
var divContent = "<form action=\"/index.php\" method=\"post\" name=\"searchForm\" class=\"inlineForm\">";
divContent = divContent + '<input type="hidden" name="view" value="search">';
divContent = divContent + '<input type="hidden" name="template_demo" value="simple.html">';
divContent = divContent + '<input type="hidden" name="site" value="">';
divContent = divContent + '<input type="hidden" name="limite" value="10">';
divContent = divContent + "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\">";
divContent = divContent + "<input type=\"text\" name=\"query_string\" onfocus=\"clearMe('query_string');\" class=\"searchInput\"></td><td valign=\"top\">";
divContent = divContent + "<a href=\"javascript:document.searchForm.submit();\" title=\"Search BSES\"><img src=\"/assets/template/searchGo.jpg\" class=\"searchSubmit\"></a>";
divContent = divContent + "</td></tr></table></form>";
myDiv.style.width = "175px";
myDiv.style.margin = "-2px 6px 0px 6px";
myDiv.innerHTML = divContent;
}
function closeSearch() {
var myDiv = document.getElementById('searchDiv');
divContent = "<a href=\"\" onMouseOver=\"openSearch()\">Search</a>";
myDiv.style.width = "auto";
myDiv.style.margin = "0px 6px 0px 6px";
myDiv.innerHTML = divContent;
}
