/*
 * Pull Quotes
 * 
 * Create pull quotes from a block of span text
 * 
 * Author: Teon @ Ooi Kheng Teong (teon.ooi@pixl8.co.uk/gmail.com)
 *
 * 17 Aug 2009 - Created this plugin
 */

// Matches spans with class that have starts with "pullquote".
$(document).ready(function() {
	var oParent = null;
	var sText = '';
	
	$("span[class^='pullquote']").each(function() {
		oParent = $(this).parent().get(0);
		if(oParent.tagName != 'SPAN') { // Ignore nested quote if it has already quoted
	    	sText = $(this).text();
			sText = sText.replace( /\((.*)\)/gi, " "); // Get rid of uneccessary characters
			$(this).parent().before('<blockquote class="'+$(this).attr('class')+'"><p>'+ sText +'</p><div class="blockquote-close"/></blockquote>');
		}
	});
});
