function clientMsgsDetails () {
	if ($(this).parent().children('.clientmsgs_full_message').html() == '') {
		$(this).parent().children('.clientmsgs_full_message').load ('clientmsgs-process.php?message_id=' + $(this).parent().attr('id'));
	} else {
		$(this).parent().children('.clientmsgs_full_message').html ('');
	}
}

$(function () {
	$('#login_password').hashmask();
	
	$('#login-h2-info').hover (function () {
		//  Text bubble, type thing
		$('#login-h2-info-bubble').show();
	}, function () {
		$('#login-h2-info-bubble').hide();
	});
	
	$('#contact-h2-info').hover (function () {
		//  Text bubble, type thing
		$('#contact-h2-info-bubble').show();
	}, function () {
		$('#contact-h2-info-bubble').hide();
	});
	
	$('#blog-h2-info').hover (function () {
		//  Text bubble, type thing
		$('#blog-h2-info-bubble').show();
	}, function () {
		$('#blog-h2-info-bubble').hide();
	});
	
	$('#messages_box .details').click (function () {
		if ($(this).parent().children('.full_message').html() == '') {
			$(this).parent().children('.full_message').load ('admin-messages-process.php?message_id=' + $(this).parent().attr('id'));
		} else {
			$(this).parent().children('.full_message').html ('');
		}
	});
	
	$('#project-list-projects .details').click (evntOnDetailsClick);
	
	$('#project-list-status-dropdown').change (function () {
		$('#project-list-projects').load ('project-list-populate.php?type=' + $(this).val(), function () {
			$('#project-list-projects .details').click (evntOnDetailsClick);
		});
	});
	
	$('#clientmsgs_messages .details').click (clientMsgsDetails);
	
	$('#newproject_customeremail,#admin_contact_email').autocomplete('customer-email-search.php');
	$('#newproject_deadline').datepicker();
	
	$('#loadinggif').ajaxStart(function() {
		$(this).show();
	}).ajaxComplete(function() {
		$(this).hide();
	});
});

function evntOnDetailsClick () {
	//  Restrict it to only being able to show one at a time
	$('.full_project_description').html ('');
	
	$(this).parent().children('.full_project_description').load ('project-list-process.php?project_id=' + $(this).parent().attr('id'));
}

function projectDetailsEdit (project_id) {
	console.log ($(this));
	$(this).parent().parent().load('project-list-edit.php?project_id=' + project_id, function () {
		$('#editproject_deadline').datepicker();
	});
}