go_off = new Image();
go_off.src = "images/button.go.gif";
go_on = new Image();
go_on.src = "images/button.go.on.gif";

links_off = new Image();
links_off.src = "images/button.links.off.gif";
links_on = new Image();
links_on.src = "images/button.links.on.gif";

forrent_off = new Image();
forrent_off.src = "images/button.forrent.off.gif";
forrent_on = new Image();
forrent_on.src = "images/button.forrent.on.gif";

forsale_off = new Image();
forsale_off.src = "images/button.forsale.off.gif";
forsale_on = new Image();
forsale_on.src = "images/button.forsale.on.gif";

regionalinfo_off = new Image();
regionalinfo_off.src = "images/button.regionalinfo.off.gif";
regionalinfo_on = new Image();
regionalinfo_on.src = "images/button.regionalinfo.on.gif";

icon_leftphoto_off = new Image();
icon_leftphoto_off.src = "images/icon.photo_left.jpg";
icon_leftphoto_on = new Image();
icon_leftphoto_on.src = "images/icon.photo_leftON.jpg";

icon_rightphoto_off = new Image();
icon_rightphoto_off.src = "images/icon.photo_right.jpg";
icon_rightphoto_on = new Image();
icon_rightphoto_on.src = "images/icon.photo_rightON.jpg";

function popwindow(imageurl, winname, winfeatures) {
  window.open(imageurl,winname,winfeatures); 
}
function setLocation(url) {
  window.location=url; 
}
function setPhoto(imgName, newStateImage){
  document.getElementById(imgName).src = eval(newStateImage+".src");
}
function setElementClass(ele_id, changeto_class) {
  document.getElementById(ele_id).className = changeto_class;
}
sfHover = function() {
	var sfEls = document.getElementById("menu").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 galleryOver(id_num) {
  var doc_id =  "photo" + id_num;
  document.getElementById(doc_id).className  = 'link_thumb_over';
}
function galleryOut(id_num) {
  var doc_id =  "photo" + id_num;
  document.getElementById(doc_id).className = 'link_thumb';
}

function setGalleryPhoto(id_num, newSource, newTitle){
  galleryOver(id_num);
  // set photo
  document.getElementById("gallery_photo_image").src = newSource;
  // set title
  var title_span = document.getElementById("gallery_photo_title");
  var oldText = title_span.childNodes.item(0);
  var newText = document.createTextNode(newTitle);
  var replaced = title_span.replaceChild(newText,oldText);
  // set caption
  // set current photo to white border
  //var doc_id =  "photo" + id_num;
  //document.getElementById(doc_id).className  = 'white_border';
}
function updateSearchFormAction(search_type) {
  var the_form = document.getElementById("search_form");
  the_form.action = search_type;
  document.getElementById('search_form').submit();
}
