
var cookie = {
	
	init: function(settings) {

		cookie.config = {
			cookieName: 'cookie',
			options: { path: '/', expires: 10 }
		}
		$.extend( cookie.config, settings );	
	
		var clicked = 0;
	
		// cookie setzen
		$('a#set').click(function(e) {
			e.preventDefault();
			clicked++;
			$.cookie(cookie.config.cookieName, 'clicked='+clicked, cookie.config.options);
			$("#msg").html("Cookie gesetzt");
		});
		
		// cookie lesen
		$('a#get').click(function(e) {
			e.preventDefault();
			clicked++;
			$("#msg").html("Cookie: "+ $.cookie(cookie.config.cookieName));
		});
		
		// cookie loeschen
		$('a#delete').click(function(e) {
			e.preventDefault();
			clicked++;
			$.cookie(cookie.config.cookieName, null, cookie.config.options);
			$("#msg").html("Cookie: "+ $.cookie(cookie.config.cookieName));
		});
	}
}
	
$(document).ready(cookie.init);