/* blockquote.js - by dan sandler - http://dsandler.org/ */

function applyBlockquoteCites() {
 var quotes = document.getElementsByTagName('blockquote'); 
 for (var i = 0; i < quotes.length; i++) { 
   var cite = quotes[i].getAttribute('cite'); 
   if (cite != null && cite != '') { 
     var p = document.createElement('div'); 

     var a = document.createElement('a'); 
     a.setAttribute('href', cite); 
     a.setAttribute('title', cite);

	 var text = quotes[i].getAttribute('title');
	 if (text == null || text == '') {
		 text = 'Source';
	 } else {
		 p.appendChild(document.createTextNode('Source: '));
	 }
     a.appendChild(document.createTextNode(text)); 

     p.className = 'blockquotesource';
     p.appendChild(a);

     quotes[i].appendChild(p);
   } 
 } 
}

var bq_old_load = null;
if (window.onload) {
	bq_old_load = window.onload;
}

window.onload = function() {
	if (bq_old_load) { eval(bq_old_load); }
	applyBlockquoteCites();
}
