var Netscape, MSIE, Opera, Unknown;
var Win, Mac, Other;
var NetscapeVer, MSIEVer, OperaVer;

Netscape = navigator.appName == "Netscape";
MSIE = navigator.appName == "Microsoft Internet Explorer";
Opera = navigator.userAgent.indexOf("Opera") > -1;
Unknown = !(Netscape || MSIE || Opera);

Win = navigator.userAgent.indexOf("Win") > -1;
Mac = navigator.userAgent.indexOf("Mac") > -1;
Other = !(Win || Mac);

if(Netscape) {
  NetscapeVer = parseFloat(navigator.appVersion);
}
else if(MSIE) {
  n = navigator.userAgent;
  MSIEVer = n.substr(n.indexOf("MSIE ")+("MSIE ").length, 4);
  MSIEVer = parseFloat(MSIEVer); 
  
  if(Opera) {
    OperaVer = n.substr(n.indexOf("Opera ")+("Opera ").length, 4);
    OperaVer = parseFloat(OperaVer);
  }
}

function addbookmark() {
  if(Opera) {
    alert("Press Ctrl+T to bookmark this site!");
  }
  else if(Win && MSIE && MSIEVer >= 5) {
    window.external.AddFavorite(document.location.href, 'Definitive tours: '+document.title);
  }
  else {
    alert("Press Ctrl+D to bookmark this site!");
  }
}

/*function openWindow(theURL,winName,features) {
	window.name = 'opener';
	window.open(theURL,winName,features);
}*/
/*function PopupPic(sPicURL, aComment) { 
	openWindow("PopupImage.htm?"+sPicURL, "", "resizable=0,HEIGHT=200,WIDTH=200");
}*/

/*function ChangeLargeImage(aLargeImagePath){//, aHugeImagePath, aComment
  with (document.getElementById("divImage"))
  {
	document.images.imgLarge.src = aLargeImagePath;
  }
  return true;
}*/
// new window engine 
var _POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,width=500,height=400,resizable=Yes,scrollbars=Yes';

function isUndefined(v) {
    var undef;
    return v===undef;
}

function raw_popup(url, target, features) {
  if (isUndefined(features)) {
    features = _POPUP_FEATURES;
  }
  if (isUndefined(target)) {
    target = '_blank';
  }
  var theWindow = window.open(url, target, features);
  theWindow.focus();
  return theWindow;
}

function link_popup(src, features) {
	return raw_popup(src.getAttribute('href'),src.getAttribute('target') || '_blank', features);
}

sfHover = function() {
	if (document.getElementById("navtop")){
		var sfEls = document.getElementById("navtop").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 (document.getElementById("navleft")){
		var sfEls = document.getElementById("navleft").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 (document.getElementById("sideobjects")){
		var sfEls = document.getElementById("sideobjects").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {this.className+=" sfhover2";}
			sfEls[i].onmouseout=function() {this.className=this.className.replace(new RegExp(" sfhover2\\b"), "");}
		};
	};	
}
if (window.attachEvent) window.attachEvent("onload", sfHover);