/*
	Web page support functions.
	
	Copyright © 2007, Jon Hughes. All rights reserved.

*/

/*
   Hides the right content column if it's empty. Expands the left
   content column to take up the extra space.
*/

function hideColumnR()
{
	var rc = document.getElementById('column_r');
	var lc = document.getElementById('column_l');
	var cleanString = rc.innerHTML;
	cleanString = cleanString.replace(/[\r\n\s]/g, '');
	if (cleanString == '<!--#BeginEditable"sidebar"--><!--#EndEditable-->')
	{
		rc.style.left = '-5000px';
		rc.style.visibility = 'hidden';
		lc.style.margin = '10px 10px 0 0';
	}
}

/*
   Inserts text into the result area of stylecheck.php.
*/

function insertText()
{
	var testcode = document.styleForm.inputTextArea.value;
	document.getElementById('resultsArea').innerHTML = testcode;
}

/*
   Resets the input and result area of stylecheck.php.
*/

function clearText()
{
	document.styleForm.inputTextArea.value = '';
	var s = '';
	for (i = 0; i < 9; i++)
	{
		s = s + '<p>&nbsp;</p>';
	}
	document.getElementById('resultsArea').innerHTML = s;
}

/*
   Hides or unhides the copy bulletin checkbox as needed.
*/

function checkForBulletin()
{
	var f = document.uploadForm.uploadedfile.value.toLowerCase();
	document.getElementById('copyCheckBox').style.visibility =
		((f.indexOf('bulletin.pdf') >= 0) && (f.indexOf('previousbulletin.pdf') < 0)) ?
		'visible' : 'hidden';
}
