function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
function show(id) {
	MM_showHideLayers(id,'','show');
}
function hide(id) {
	MM_showHideLayers(id,'','hide');
}
function swapOnOff( img ){
	var curSrc = ( img.src.search('_1_') != -1 ) ? '_1_' : '_0_' ;
	var newSrc = ( curSrc == '_1_' ) ? '_0_' : '_1_' ;
	img.src = img.src.replace(curSrc,newSrc);
}
function popWin( page, w, h ){
var page;
	if ( arguments.length == 0) return;
	
	if ( page=='' ){
		alert('No page specified!');
		return;
	} else {
		w = isNaN(w) ? '500' : w;
		h = isNaN(h) ? '500' : h;
		var wDef = 'titlebar,toolbar=0,scrollbars,resizable,width='+w+',height='+h;
		window.open( page, '', wDef );
	}
}
function getFolderDepth() {
  var _sA = (':'+document.location.pathname).split(':');
  var _u  = ((_sA.length>1)?_sA.pop():'').replace(/\\/g,'/');
  var _ln = _u.split('/').length - 1;
  var p = '';
  if(_ln==1){p='./'} else {for(var i=1;i<_ln;i++){p=p+'../'}}
	return p;
}
function popRace( race ){
  var p = getFolderDepth();
  popWin( p+'gazetteer/races/'+race+'.html', 480, 360 );
}
function popClass( pClass ){
  var p = getFolderDepth();
  popWin( p+'gazetteer/classes/'+pClass+'.html', 480, 360 );
}
function popMap( diocese ){
  var p = getFolderDepth();
	window.open( p+'images/dioceses/map_'+diocese+'.jpg', '', 'titlebar,toolbar=0,width=765,height=540' );
}

