/**
 * @author Alhames
 * 
 * @param:
 * 
 */


/*
 * СТИЛИЗАЦИЯ ТАБЛИЦ *************************************************************************
 */
jQuery.fn.alhTable = function(options){
 
	// настройки по умолчанию
	var options = jQuery.extend({
		
		// var
		table:	$(this),					// таблица
		type:	1,							// тип таблицы
		zebra:	false,						// стилизация чередующихся строк
		
		// function
		show:	function(){
					
				}
	},options);
	 
	return this.each(function() {
		
		// расставляем классы
		options.table.addClass("alh-table");
		options.table.find("tr:first th").addClass("alh-th-center");
		options.table.find("tr:first th:first").removeClass("alh-th-center").addClass("alh-th-left");
		options.table.find("tr:first th:last").removeClass("alh-th-center").addClass("alh-th-right");
		
		// оборачиваем текст в <span>
		options.table.find("th").each(function(){
			$(this).css("padding", "0px");
			$(this).html("<span class=\"alh-th-padding\">" + $(this).html() + "</span>");
		});
		
		// добавляем стилизацию для заголовков таблицы
		options.table.find("tr:first th").each(function(){
			$(this).html("<div class=\"alh-border-left\"><div class=\"alh-border-right\">" +
			$(this).html() +
			"</div></div>");
			$(this).find("div").height($(this).height());
		});
		
		// убираем крайнии границы
		options.table.find("tr th:last").css({"border-right" : "0px"});
		options.table.find("tr th:first").css({"border-left" : "0px"});
		
		// раставляем чередующиеся строки
		if(options.zebra) {
			options.table.find("tr:odd").addClass("alh-alt");
		}
		
	});

};
