// --- two column function --- //
function twoCol()
{
	// TODO: not split up tags
	
	// Check for the two-col element.
	if ( document.getElementById('fp-entries') )
	{
		// Grab the two-col element and create
		// the two new column elements. As well
		// as a "clearer" element.
		var twoCol = document.getElementById('entry-text');
		var rightCol = document.createElement('div');
			
		//rightCol.setAttribute('style', 'float:right;width:49%;');
		// doesnt work in IE6 -jsc
		
		//rightCol.style.setAttribute('cssText', 'float:right;width:49%;');
		// works in IE6 but not Firefox -jsc
		
		rightCol.style.cssText = 'float:right;width:49%;';
		// works basically everywhere -jsc;
		
		var leftCol = document.createElement('div');
		
		//leftCol.setAttribute('style', 'float:left;width:49%;');
		//leftCol.style.setAttribute('cssText', 'float:left;width:49%;');
		leftCol.style.cssText = 'float:left;width:49%;';
		
		var clearCol = document.createElement('br');
		//clearCol.setAttribute("style", "");
		clearCol.style.cssText = 'clear:both;';
		
		// Split the words into two columns
		var leftWords = new String();
		var rightWords = new String();
		var ogHTML = twoCol.innerHTML;
		var words = ogHTML.split(' ');
		
		// Loop through all the words
		for (var i=0; i<words.length; i++)
		{
			// if we are in the first half of the array
			// store the words in the string leftWords
			if ( i < (words.length/2) )
				leftWords += words[i] +' ';
			
			// otherwise we are in the second half of the array
			// so store the words in the srting rightWords
			else
				rightWords += words[i] +' ';
		}
		
		leftCol.innerHTML = leftWords +"</p>";
		rightCol.innerHTML = "<p>"+ rightWords;
		
		// Put it all together
		twoCol.innerHTML = '';
		twoCol.appendChild(leftCol);
		twoCol.appendChild(rightCol);
		twoCol.appendChild(clearCol);
	}
	return;
}
window.onload = twoCol;