var centarContentBlock = new Class({
	
	initialize: function(params) {
		
		this.content = $$('.content');
		this.tabHeader = $$('.tab-header');
		this.centarContent = $$('.centerContent');
		this.setup();

	},
	
	setup: function() {
		this.content.each(function(el, i) {

			if (this.tabHeader[i]) {
				ul = this.tabHeader[i].getChildren();
				tabs = ul.getChildren();
				mainDiv = this.centarContent[i].getChildren('.main');
				
				if (mainDiv.length > 1) { // if need do tabs
					tabs[0].each(function(elLi, j) { // this is LI element
						if (mainDiv[j]) {
							elLi.pageIndex = i;
							elLi.tabIndex = j;
							elLi.showIndex = function(pageIndex, tabIndex) {
								this.showIndex(pageIndex, tabIndex);
							}.bind(this);
							
							elLi.addEvent("click", function(event) { // add event onclick to each menu element with translate self index
								this.showIndex(this.pageIndex, this.tabIndex);
							});
						} else {
							elLi.style.display = "none";
						}
					}.bind(this));
				} else { // if exsist only one mine or if don`t exsist mine , hidde all tabs
					if (mainDiv[0]) {
						mainDiv[0].addClass('active'); // show first tab
						tabs[0].each(function(elLi, j) {
							elLi.style.display = "none";
						});
					}
				}

			}
		}.bind(this));
	},

	showIndex: function(pageIndex, tabIndex) {

		ul = this.tabHeader[pageIndex].getChildren();
		tabs = ul.getChildren();

		tabs[0].removeClass('active');
		tabs[0][tabIndex].addClass('active');
		
		mainDiv = this.centarContent[pageIndex].getChildren('.main');
		mainDiv.removeClass('active');
		mainDiv[tabIndex].addClass('active');
	}
});