/* 
 * All content copyright Mozzaiq, LLC
 * 
 * Plugin: Add User Account to Website
 * Version: 0.1
 * Author: Mike Quinn (Mozzaiq)
 * 
 * Last Modified: April 17, 2009
 * Date Created: April 17, 2009
 * 
 * Usage Instructions:
 * 
 * Assumptions:
 *   
 * Parameter Values:
 *   
 */

(function($){  
	$.fn.logout = function(options) {
		
		// set default parameter values
		var defaults = { 
				remoteScript: "users/logout.php",
				redirectURL: "login.php"
		};
		var options = $.extend(defaults, options);
				
		return this.each(function() {
			var obj = $(this);
			obj.click(function() {
				$.post(options.remoteScript, {}, function(response) {
					piece = response.split('*');
					if(piece[0] == 1) {
						document.location.href = options.redirectURL;
					}
				});
				return false;
				
				
			});		// end form submit
		});
	};
})(jQuery); 
