/**
 * toggleBtn - jQuery plugin
 *
 * http://www.kreni.com
 *
 * Copyright (c) 2008 Zoran Juric
 * Licensed under the GPL license
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 0.1
 */
 
$.fn.toggleBtn = function(options) {
    var self = this;

    self.options = {
        value : 0
    }

    if(options) {
        $.extend(self.options, options);
    }

	self.readValue = function() {
		return self.options.value;
	};

	return this.each(function() {
        var links = $(this).find('a');
        var li_element = $(this).find('li');

		self.options.value = $(this).find('li.selected').find('span').text();
		
        links.click(function() {
			li_element.removeClass('selected');
			var li = $(this).parent();
			li.toggleClass('selected');
			self.options.value = li.find('span').text();
			return false;        
		});

    });
};