function makepullquote() 
{
    if(document.getElementById("articolContinut"))
    {
        parentDiv = document.getElementById("articolContinut");		// Node for inserting pullquote
        spans = parentDiv.getElementsByTagName('span');		// Get all Span elements from the parentDiv

        for (i = 0; i < spans.length; i++) {	// For each span

        	var span = spans[i];
        	var up = span.parentNode;	// Needed as a target for insertion.
        	
        		if(span.className == "pullquote") {	// Check if it's a pullquote and generate a pullquote

        		// Create the blockquote with a class of pullquote
        		var pullquote = document.createElement("blockquote");
        		pullquote.className = "";
        		
                var divi = document.createElement("div");
        		// Create the paragraph tag for the blockquote
        		var paragraph = document.createElement("p");
        		
        		// 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;
        		zspan.className = ""; // Insert class name here if desired
        		
        		// Sticks the span into the generated paragraph
        		paragraph.appendChild(zspan.cloneNode(true));
        		
                divi.appendChild(paragraph);
                
        		// Sticks the generated paragraph into the generated blockquote
        		pullquote.appendChild(divi);
        		
        		// Inserts the pullquote before the <p> that contains the <span class="pullquote">
        		parentDiv.insertBefore(pullquote,up);	
        	}
        }
     }   
}

window.onload = makepullquote;