$(document).ready(function(){
  $('html').addClass('j');
  $(".tabContent .t01").tabs();
  $('#map').jmap('init', {mapType:'hybrid', mapCenter:[53.191636,-2.894897], mapZoom: 14});
});  

$(window).load(function(){
  $('p a.fnLink').each(function(){ 
    var fnId = $(this).attr('href').substr(1);
    var fnSubStr = $('dt#' + fnId).next().html().toLowerCase().indexOf('class="back') - 4;
// in IE7 jquery.html()strips quotes off class attributes
    if(!jQuery.support.htmlSerialize) { var fnSubStr = $('dt#' + fnId).next().html().toLowerCase().indexOf('class=back') - 3; }
    var fnLabel = "Footnote ";
    $(this).attr('title', '');
    if (fnId.substring(0,3) == 'app') {fnLabel = "Apparatus Criticus "};
    $(this).qtip({
    style: { 
      width: 350,	
      name: 'light',
      tip: 'topLeft',
      border: {
        width: 3,
        radius: 3
      }
	},
    position: { adjust: { screen: true } },
    content: { text: "<h3>" + fnLabel + $('dt#' + fnId ).html() + "</h3><div>" + $('dt#' + fnId).next().html().substring(0,(fnSubStr)) + "</div>" },
    show: {delay: 50, effect: {type: 'grow',length: 400}},
    hide: {delay: 400, fixed: true, effect: {length: 400}}
  });
});

$('dl dd a.hasMapIdx').each(function(){ 
var locId = $(this).parents('dd:first').prev('dt').children('label').attr('id');
  $(this).attr('title', '');
  $(this).qtip({
    style: { 
	  width: 325,	
      name: 'light',
      tip: 'topLeft',
      border: {
        width: 3,
        radius: 3
      }
	},
    position: { adjust: { screen: true } },
	content: { url: '/popup_locIdx_'+locId +'.html' },
	show: {delay: 50, effect: {type: 'grow', length: 400}},
	hide: {delay: 400, fixed: true, effect: { length: 400}}
  });
});

$('div.hybridText p a.place, div.transText p a.place').each(function(){ 
var locId = $(this).attr('id').substr(0,$(this).attr('id').indexOf('-'));
//var locId = "blah";
  $(this).attr('title', '');
  $(this).qtip({
    style: { 
	  width: 325,	
      name: 'light',
      tip: 'topLeft',
      border: {
        width: 3,
        radius: 3
      }
	},
    position: { adjust: { screen: true } },
	content: { url: '/popup_loc_'+locId +'.html' },
	show: {delay: 50, effect: {type: 'grow', length: 400}},
	hide: {delay: 400, fixed: true, effect: {length: 400}}
  });
});

$('div.hybridText p a.person, div.transText p a.person').each(function(){ 
 var perId = $(this).attr('id').substr(0,$(this).attr('id').indexOf('-'));
  $(this).attr('title', '');
  $(this).qtip({
    style: { 
	  width: 325,	
      name: 'light',
      tip: 'topLeft',
      border: {
        width: 3,
        radius: 3
	    }
	  },
	  position: { adjust: { screen: true } },
	  content: { url: '/popup_pers_'+perId +'.html' },
	  show: {delay: 50, effect: {type: 'grow', length: 400}},
	  hide: {delay: 400, fixed: true, effect: {length: 400}}
    });
  });
});  