function showDiv(foo,bool) {
		document.getElementById(foo).style.visibility = ( bool ? 'visible' : 'hidden' );
}

function showNew() {
	if (document.getElementById('cat_id').value == 'new') {
		document.getElementById('newcat').style.visibility = 'visible';
	} else {
		document.getElementById('newcat').style.visibility = 'hidden';
	}
}

function checkPost() {
	if (document.getElementById('cat_id').value == 'null') {
		alert("\nPlease choose a category, or create a new one.");
		document.getElementById('cat_id').focus();
		return false;
	} else if (document.getElementById('cat_id').value == "new" && document.getElementById('cat_title').value == "") {
		alert("\nPlease enter a new category name.");
		document.getElementById('cat_title').focus();
		return false;	
	} else if (document.getElementById('title').value == "") {
		alert("\nPlease enter a title for your entry.");
		document.getElementById('title').focus();
		return false;	
	} else if (document.getElementById('entry').value == "") {
		alert("\nPlease type in your entry.");
		document.getElementById('entry').focus();
		return false;	
	} else {
		return true;
	}
}

function checkReg() {
	apos = document.getElementById('email').value.indexOf("@");
	dotpos = document.getElementById('email').value.lastIndexOf(".");
	if (document.getElementById('name').value == '') {
		alert("\nPlease type in a name.");
		document.getElementById('name').focus();
		return false;
	} else if (document.getElementById('password').value == "") {
		alert("\nPlease type in a password.");
		document.getElementById('password').focus();
		return false;	
	} else if (document.getElementById('password').value != document.getElementById('password2').value) {
		alert("\nPasswords do not match, please retype the confirm password.");
		document.getElementById('password2').focus();
		return false;	
	} else if (document.getElementById('email').value == '') {
		alert("\nPlease type in your email address.");
		document.getElementById('email').focus();
		return false;
	} else if (apos < 1 || dotpos-apos < 2) {
		alert("\nThat is not a valid email address, please try again.");
		document.getElementById('email').focus();
		return false;
	} else {
		return true;
	}
}

function checkContact() {
	apos = document.getElementById('email').value.indexOf("@");
	dotpos = document.getElementById('email').value.lastIndexOf(".");
	if (document.getElementById('firstname').value == '') {
		alert("\nPlease type in your first name.");
		document.getElementById('firstname').focus();
		return false;
	}
	if (document.getElementById('lastname').value == '') {
		alert("\nPlease type in your last name.");
		document.getElementById('lastname').focus();
		return false;
	}
	if (document.getElementById('email').value == '') {
		alert("\nPlease type in your email address.");
		document.getElementById('email').focus();
		return false;
	}
	if (apos < 1 || dotpos-apos < 2) {
		alert("\nThat is not a valid email address, please try again.");
		document.getElementById('email').focus();
		return false;
	}
	if (document.getElementById('enquiry').value == '') {
		alert("\nPlease type in your enquiry.");
		document.getElementById('enquiry').focus();
		return false;
	} else {
		return true;
	}
}

function showHelp(foo,bool) {
	if (foo == 'p') {
		text = 'Add this code before the start of a new paragraph.';
	} else if (foo == 'b') {
		text = 'Add this code around the text that you want to make bold.';
	} else if (foo == 'i') {
		text = 'Add this code around the text that you want to make italic.';
	} else if (foo == 'g') {
		text = 'Add this code around the filename of the image you want to insert. Make sure that the filename is the same as you are uploading!';
	} else if (foo == 'm') {
		text = 'Add this code around the filename of the movie you want to insert. Make sure that the filename is the same as you are uploading!';
	} else if (foo == 'l') {
		text = 'Links beginning with "http://" will be automatically converted to live links.';
	}  else if (foo == '') {
		text = '';
	}
	document.getElementById('help').style.visibility = ( bool ? 'visible' : 'hidden' );
	document.getElementById('htext').innerHTML = text;
}

function delImage(foo,bool) {
	document.fmEBlog.image.value = ( bool ? '' : foo );
	document.getElementById('imagetext').innerHTML = ( bool ? 'None' : foo );
}