function submitForm(form, action) {
	form.action = action;
	form.submit();
}

function submitFormThin(form) {
	form.submit();
}

function fieldFocus(element) {
	document.getElementById(element).focus();
}

function isDefined(variable) {
	if(typeof(variable) !="undefined")
		return true;
	else
		return false;
}

function checkUncheckAll(theElement) {
	var theForm = theElement.form, z = 2;
	while(isDefined(theForm[z]) && theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') {
		if(theForm[z].type == 'checkbox') {
			theForm[z].checked = theElement.checked;
		}
		z++;
	}
}

function cancelForm(action) {
	window.location.href = action;
}

function toggleDiv(id) {
	element = document.getElementById(id);
	element.className = (element.className.toLowerCase() == 'show'?'hide':'show');
}

function showDiv(id) {
	element = document.getElementById(id);
	element.className = 'show';
}

function hideDiv(id) {
	element = document.getElementById(id);
	element.className = 'hide';
}
function showHideDiv(idshow,idhide){
	element = document.getElementById(idshow);
	element.className = 'show';
	element = document.getElementById(idhide);
	element.className = 'hide';
}

function articlePreviewReplace(replaceID, grabWhat) {
	if(window.opener.document.getElementById(grabWhat)) {
		document.getElementById(replaceID).innerHTML = '<div class="article"><h3>' + window.opener.document.getElementById('articleTitle').value + "</h3>" + window.opener.document.getElementById(grabWhat).value + "</div>";
	}
}