//List enhancer mega plugin
//Will Stout
//
//
//

(function (jQuery) {
    jQuery.fn.extend({
        //plugin name - animatemenu
        enhance: function (options) {
						var tp;
            var defaults = {
                topPadding: '.8',
                imageURL: '/orangebullet48.png',
                listStartIndex: 1,
								itemHeight:'48px',
								ieFix:false,
								textColor:'white',
								textStyle:'Bold',
								fontfamily:'Arial',
								fontsize:'14pt'
            }

            var options = jQuery.extend(defaults, options);

            return this.each(function () {

                //Set some default styles for the list
								jQuery(this).attr('class','enhancedList');
                jQuery(this).css('list-style', 'none');
                jQuery(this).css('margin', '0 !important');
                jQuery(this).css('padding', '10px !important');

                var index = 1;
                jQuery(this).children().each(function () {
										//Re-structure the list
										var liContent = jQuery(this).html();
										jQuery(this).empty();
										/*jQuery(this).css('height',options.itemHeight);
										jQuery(this).css('margin-bottom','10px');*/
										jQuery(this).prepend("<div class='numDiv'></div>");
										jQuery(this).append("<div class='liContent'>"+liContent+"</div>");
										jQuery(this).append("<div style='clear:both;'></div>");
										
                    //Style the image div
                    if(jQuery.support.noCloneEvent == false)
										{
										tp = parseFloat(options.topPadding.substr(0,options.topPadding.indexOf("em")));
										tp = tp+.1;										
										}
										else
										{
										tp = options.topPadding;
										}
                    /*jQuery(this).children(":first").css('padding-top', tp+"em");
                    jQuery(this).children(":first").css('background-repeat', 'no-repeat');
                    jQuery(this).children(":first").css('float', 'left');
                    jQuery(this).children(":first").css('height', '2.7em');
                    jQuery(this).children(":first").css('width', '48px');
                    jQuery(this).children(":first").css('text-align', 'center');
					jQuery(this).children(":first").css('margin-right', '5px');
                    jQuery(this).children(":first").css('background-image', 'url(' + options.imageURL + ')');*/
                    jQuery(this).children(":first").append("<div style='color:"+options.textColor+";font-weight:"+options.textStyle+";font-family:"+options.fontfamily+";font-size:"+options.fontsize+"'>"+index+"</div>");
//jQuery(this).children(":first").css('height',jQuery(this).children(":last").css('height'));
                    //Style the content div
                    jQuery(this).children(":last").css('padding-top', options.topPadding+' !important');

                    index++;
                });
								/*jQuery('.liContent p').css('margin', '0');
								jQuery('.liContent').css('height','inherit');
								jQuery('.liContent').css('width','95%');								
								jQuery('.liContent').css('padding-top',tp+"em");*/
            });
        }
    });
})(jQuery);
