function extractBlockquoteCitations(){
var quotes=document.getElementsByTagName('blockquote');
for(var i=0;i<quotes.length;i++){
var cite=quotes[i].getAttribute('cite');
var title=quotes[i].getAttribute('title');
if(cite||title){
var a=document.createElement('a');
a.setAttribute('href',cite);
if(! title){title='# '+cite;}
a.setAttribute('title',title);
a.appendChild(document.createTextNode(title));
var p=document.createElement('p');
p.className='blockquotesource';
p.appendChild(a);
quotes[i].appendChild(p);
}
}
}
function addEvent(obj,evType,fn){
if(obj.addEventListener){
obj.addEventListener(evType,fn,true);
return true;
}else if(obj.attachEvent){
var r=obj.attachEvent('on'+evType,fn);
return r;
}else{
return false;
}
}
addEvent(window,'load',extractBlockquoteCitations);