/*
*	pullQuote.js

*	Note: The resulting inserted pullquote has the following markup:
*	<blockquote>
*	<p>
*	<span class="">
*	This is some text in a pull quote.
*	</span>
*	</p>
*	</blockquote>
*

*/
function makepullquote(PullFromID,PlaceInID,PullQuoteClass,PlaceQuoteClass)
{
	parentDiv = document.getElementById(PullFromID);		// Node for locating pullquotes
	targetDiv = document.getElementById(PlaceInID);		// Node for placing pullquote
	spans = parentDiv.getElementsByTagName('span');		// Get all Span elements from the parentDiv
	//loop through all the spans but cutoff at 200.
	for (i = 0; i < spans.length && i < 200; i++) 
	{

		var span = spans[i];
		var up = span.parentNode;	// Needed as a target for insertion.

		// if it's a pullquote
		if(span.className == PullQuoteClass)
		{

			// I ran into some trouble when cloning the node, Opera went into an infinite loop,
			// a result of, I suppose, having the 'pullquote' class in the span.
			// The folliowing two lines solve the problem by removing the class from the span.
			var zspan = span.cloneNode(true);
			zspan.className = PlaceQuoteClass; // Insert class name here if desired

			// Inserts the pullquote in the target div
			targetDiv.appendChild(zspan);
		}
	}
}
window.onload = function(){ makepullquote("mainContainer","rightContainer","pullquote","placeQuote");}
