var showLevels = Class.create(); showLevels.prototype = { initialize: function( main_container_id, list_class_name, catalogue_title, hide_class_name, title, content_container ) { this.wait = false; this.html_inserted = false; this.title = $( title ); this.content_container = $( content_container ); this.main_container = $(main_container_id); if(!this.main_container) return false; this.lists = $A( this.main_container.getElementsByClassName( list_class_name ) ); if(!this.lists) return false; this.catalogue_title = $(catalogue_title); this.list_class_name = list_class_name; this.hide_class_name = hide_class_name; this.first_click = false; this.current_obj = null; this.path = new Array(); this.first_product = null; this.init(main_container_id); return true; }, handleFirstClick: function() { if( !this.first_click ) { Element.addClassName( this.content_container, this.hide_class_name ); Element.addClassName( this.title, this.hide_class_name ); for( var i=0; i' );// this.html_inserted = true; } else Element.removeClassName( row_obj, this.hide_class_name ); } else { row_cell = 'cell_' + this.row_obj.id.split('_')[1] + '_'+cell_index; if( !$(row_cell) ) { td = document.createElement( 'td' ); this.row_obj.appendChild( td ); td.vAlign = 'top'; td.width = '50%'; td.border = 1; td.borderColor = 'black'; td.id = row_cell; //new Insertion.Bottom( this.row_obj, '' ) this.html_inserted = true; } } this.row_cell_obj = $( row_cell ); return true; }, displayOnPage: function ( request ) { this.json = eval( '(' + request.responseText + ')' ); if( this.json['result'] == 'false' ) { this.wait = false; return false; } this.handleFirstClick(); this.table_obj = this.current_obj.up('tbody'); this.cell_obj = this.current_obj.up('td'); this.row_obj = this.current_obj.up('tr'); if( this.cell_obj.id.split('_')[2] == 1 ) { this.insertRowOrCell( 2, 0 ); } else { this.insertRowOrCell( 1, 1 ); } /* if( this.row_cell_obj.id.split('_')[1] == 1 ) cell_class_name = 'top_'; else cell_class_name = 'bottom_'; if( this.row_cell_obj.id.split('_')[2] == 1 ) cell_class_name += 'left'; else cell_class_name += 'right'; Element.addClassName( this.row_cell_obj, cell_class_name ); */ if( this.row_cell_obj ) { if( Element.hasClassName( this.row_cell_obj, this.hide_class_name ) ) Element.removeClassName( this.row_cell_obj, this.hide_class_name ); new Insertion.Bottom( this.row_cell_obj, this.json['info'] ); if( this.json['result'] == 'product' ) { // обращаемся через переменную в класс корзины. передаём this.json['id'] по которому будем записывать товар в корзину cart.init( $('tocart_' + this.json['id']) ); } if( this.json['info'].indexOf('