	/*
		Owner Sign In
		------------------------------------------------------------------------------------------------------*/
		function owner_sign_in(event){
			var $owner_username		= $('input[name=owner_username]').val();
			var $owner_password		= $('input[name=owner_password]').val();
			
			$.post(
				'/owner/access.php?access=log_in',
				{
					owner_username	: $owner_username,
					owner_password	: $owner_password
				},
				function(data){
					if(data != 'fail'){
						epochAlert('Sign In Successful','Welcome!',data);
						update_owner();
					} else {
						epochAlert('Sign In Failed.','Sorry, your username/password combination is not correct.');
					}
					
				}
			)
			
			return false;
		}
		
	/*
		Owner Sign Out
		------------------------------------------------------------------------------------------------------*/
		function owner_sign_out(event){			
			$.post(
				'/owner/access.php?access=log_out',
				null,
				function(data){
					if(data != 'fail'){
						epochAlert('Sign Out Successful',"You've successfully signed out.",data);
						$('blockquote[type=dog_information]').slideDown();
						update_owner();
					} else {
						epochAlert('Sign Out Failed.','Sorry, please try again.');
					}
					
				}
			)
			
			return false;
		}
		
	
	
	/*
		Set Owner Access
		------------------------------------------------------------------------------------------------------*/
		function set_owner_access(event){
			$('a[href="/owner/access.php?access=log_in"]').bind('click',owner_sign_in);
			$('a[href="/owner/access.php?access=log_out"]').bind('click',owner_sign_out);
		}
	
	/*
		Set Owner Information
		------------------------------------------------------------------------------------------------------*/
		function set_owner_information(event){
			$('a[href="/includes/form/owner.inc.php?type=add"]').bind('click',add_owner_information);
			$('a[href="/includes/form/owner.inc.php?type=update"]').bind('click',update_owner_information);
		}
	
	/*
		Set Dog Information
		------------------------------------------------------------------------------------------------------*/
		function set_dog_information(event){
			$('select[name=dog]').bind('change',toggle_dogs);
		
			$('a[href="/includes/form/dog.inc.php?type=add"]').bind('click',add_dog_information);
			$('a[href="/includes/form/dog.inc.php?type=update"]').bind('click',update_dog_information);
		
			$('form#registration input,select,textarea').bind('blur',{override:'0'},test_fields);
			$('form#registration fieldset p cite').bind('click',epochEdit);
		}
		
		
		
	/*
		Update Owner Information
		------------------------------------------------------------------------------------------------------*/
		function update_owner(event){
			$('blockquote[type=owner_access]').load('/includes/owner/owner_access.inc.php',null,set_owner_access);
			$('blockquote[type=owner_information]').load('/includes/owner/owner_information.inc.php?owner_id='+$('#alert_overlay div').attr('owner_id'),null,set_owner_information);
			$('blockquote[type=dog_information]').load('/includes/owner/dog_information.inc.php?dog_id='+$('#alert_overlay div').attr('dog_id'),null,set_dog_information);
		}
		
		
		
		
		
$(document).ready(function(event){
	$('a[href="/owner/access.php?access=log_in"]').bind('click',owner_sign_in);
	$('a[href="/owner/access.php?access=log_out"]').bind('click',owner_sign_out);
});
