// JavaScript Document
/* aqMenu v1.0.1 - A very simple text menu.
   Copyright (C) 2008 Paul Pham <http://aquaron.com/~jquery/aqMenu>

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
(function($){
   $.fn.aqMenu = function(arry,options) {
      var opts = $.extend({ }, $.fn.aqMenu.defaults, options);

      return this.each(function() {
         if (!$('.aqMenu',this).length) {
            $.fn.aqMenu.defaults.currentID = opts.currentID;
            $('<div class="aqMenu"><\/div>').appendTo(this);

            var $menu = $('.aqMenu',this);
            for (var i=0;i<arry.length;i++)
               $menu.append('<a title="'+arry[i][0]
                  +'" href="javascript:void(0)" onclick="'
                  +arry[i][2]+'">'+arry[i][1]+'<\/a>');
            $menu.append('<br style="clear:both">');

            $menu.find('a').css({
               display: 'block', float: 'left', 
               padding: '0px', marginRight: '0px', 
               color: opts.hiColor, backgroundColor: opts.loColor
            }).hover(
               function(){ $(this).css({ 
                  backgroundColor: opts.hiColor, 
                  color: opts.loColor }) },
               function(){ 
                  if ($.fn.aqMenu.defaults.currentID != $(this).attr('title')) 
                     $(this).css({ 
                        backgroundColor: opts.loColor, 
                        color: opts.hiColor }) }
            );
         } else if (typeof arry != 'object')
            $.fn.aqMenu.defaults.currentID = arry;

         $('.aqMenu a',this)
            .css({ backgroundColor: opts.loColor, color: '#000000' });

         $('.aqMenu a[title="'+$.fn.aqMenu.defaults.currentID+'"]',this)
            .css({ backgroundColor: opts.loColor, color: '#f3b700' });
    
         return false;
      });
   };

$.fn.aqMenu.defaults = {
  hiColor: '#f3b700', loColor: '#FFFFFF', currentID: ''
};
})(jQuery);