/*window.onbeforeunload = confirmExit;*/

function confirmExit()
{
	var form = window.document.getElementById('contrib');
	if (form.elements['dirty'].value == 1)
		return '\nAny changes you have made will be lost.\n';
	else
		return;
}

function setDirty()
{
	var form = window.document.getElementById('contrib');
	if (form.elements['dirty'].value != 1)
	{
		form.elements['dirty'].value = 1;
	}
}

function setClean()
{
	var form = window.document.getElementById('contrib');
	form.elements['dirty'].value = 0;
}

function contribTab(showTab)
{
	
	var table1 = window.document.getElementById('contrib_1');
	var table2 = window.document.getElementById('contrib_2');
	var tab1 = window.document.getElementById('contrib_tab1');
	var tab2 = window.document.getElementById('contrib_tab2');
	
	if (showTab == 2)
	{
		tab2.className= 'selected_tab';
		table2.className= 'contrib_tab_show';
		tab1.className= 'unselected_tab';
		table1.className= 'contrib_tab_hidden';
		
		var form = window.document.getElementById('contrib');
		var titleSpan = window.document.getElementById('show_title');
		//titleSpan.value = form.elements["contrib_title"].value;
		titleSpan.innerHTML= form.elements["contrib_title"].value;
		titleSpan.className= 'show_title';
		
		var textarea = window.document.getElementById('author_comment');
		textarea.focus();
	}
	else
	{
		tab2.className= 'unselected_tab';
		table2.className= 'contrib_tab_hidden';
		tab1.className= 'selected_tab';
		table1.className= 'contrib_tab_show';
	}	
}

function toggleAuthorComments()
{
	var commentDiv = window.document.getElementById('contrib_author_comment');
	var contribDiv = window.document.getElementById('contrib_content_div');
	var button = window.document.getElementById('show_author_comments');
	
	if (commentDiv.className == 'contrib_tab_hidden')
	{
		commentDiv.className = '';
		contribDiv.className = 'contrib_tab_hidden';
		button.innerHTML = 'Hide Notes';
	}
	else
	{
		commentDiv.className = 'contrib_tab_hidden';
		contribDiv.className = '';
		button.innerHTML = 'Show Notes';
	}
}

