﻿$(document).ready(function(){
// Pull-quotes
$('span.pullquote').each(function(index) {
	var $P=$(this).parent('p');
	$P.css('position','relative');
	var $C=$(this).clone();
	$C.addClass('pulledquote').removeClass('pullquote').find('span.drop').html('&hellip;').end().insertBefore($P);
	var cTxt= $C.text();
	$C.html(cTxt);

	
  }); 

// Document foot-notes
$("#content").append("<div id=\"footnotes\">");
$("#footnotes").append("<h2 class=\"footnote_header\">Notes</h2>");
$("#footnotes").append("<ol id=\"footnote_list\"></ol>");
$("#footnotes").append("<p id=\"au_current_url\">"+document.location.href+"</p>");
footnote=1;
$("div#content q[cite],div#content q[title],div#content blockquote[cite],div#content blockquote[title],div#content a[href]").addClass("footnote");
$(".footnote").each(function(){
    $(this).after("<sup class=\"footnote\">"+footnote+"</sup>");
    cite="<li>";url=$(this).attr("cite");
    var ltitle=$(this).attr("title");
    href=$(this).attr("href");
    if(ltitle && url) {
      cite+="<a href=\""+url+"\">"+ltitle+"</a>";
    }else if(ltitle) {
      cite+=ltitle;
    }else if(url){
      cite+="<a href=\""+url+"\">"+url+"</a>";
    }else if(href) {
      cite+="<a href=\""+href+"\">"+href+"</a>";
    }
    cite+="</li>";
    $("#footnote_list").append(cite);
    footnote++;
  });
});