$(document).ready(function() {
	$('.tabs > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle', speed: 'fast' } });
	$('#comments .tabs > ul').tabs({ fx: { opacity: 'toggle', speed: 'fast' } });
	$('#submenu ul li a').click(function() {
		$(this).next().toggle('slow');
		return false;
	}).next().hide();

	$('.vid > ul').tabs();
		$('.contenttitle > ul').tabs({ selected: null, unselect: true, fx: { width: 'toggle', opacity: 'toggle' } });
	$('.video > ul').tabs();
		$('.contenttitle > ul').tabs({ selected: null, unselect: true, fx: { width: 'toggle', opacity: 'toggle' } });
});

$(document).ready(function () {
	$('#commentform input, #commentform textarea').each(function () {
		if ($(this).val() == '') {
			$(this).val($(this).attr('defaultvalue'));
		}
	}).focus(function () {
		$(this).removeClass('inputerror');
		if ($(this).val() == $(this).attr('defaultvalue')) {
			$(this).val('');
		}
	}).blur(function () {
		if ($(this).val() == '') {
			$(this).val($(this).attr('defaultvalue'));
		}
	});
	$('#commentform').submit(function () {
		$('#submiterror').remove();
		var errors = 0;
		$(this).find('textarea, input').each(function () {
			if ($(this).val() == $(this).attr('defaultvalue')) {
				$(this).val('');
			}
			if ($(this).hasClass('required') && $(this).val() == '') {
				$(this).addClass('inputerror');
				errors++;
			}
		});

		if (errors > 0) {
			$(this).find('textarea, input').each(function () {
				if ($(this).val() == '') {
					$(this).val($(this).attr('defaultvalue'));
				}
			});
			$(this).prepend('<div id="submiterror">Please complete the highlighted fields.</div>');
			return false;
		}
		return true;
	});
});