first = 1;
last = 2;
current = 1;

function nextPicture() {
    // Hide current picture
    object = document.getElementById('slide' + current);
    object.style.display = "none";
    
    // Show next picture, if last, loop back to front
    if (current == last) { current = 1; }
    else { current++ }
    object = document.getElementById('slide' + current);
    object.style.display = "block";
}

function previousPicture() {
    // Hide current picture
    object = document.getElementById('slide' + current);
    object.style.display ="none";
    
    if (current == first) { current = last; }
    else { current--; }
    object = document.getElementById('slide' + current);
    object.style.display = "block";
}

function stopText() {
	clearTimeout(timer);
}

function changeText() {
	nextPicture()
	timer = setTimeout('changeText()',8000);
}

sfHover = function() {
	if (!document.getElementsByTagName) return false;
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function check_search(form)
{ 
	// input box
	if (form.searchTerm.value === "")
	{
	  alert("Please enter a search term.\r");
	  form.searchTerm.focus();
	  return (false);
	}
	// input box
	if (form.searchTerm.value == "Enter search term")
	{
	  alert("Please enter a search term.\r");
	  form.searchTerm.focus();
	  return (false);
	} 
		if (form.searchTerm.value.length < 2)
		{
	  	alert("Please enter at least 2 characters.");
	  	form.searchTerm.focus();
	  	return (false);
		}
}
