var ScanLbLinks = function( links ){
	
	var notimooManager = new Notimoo({
		locationHType: 'left',
		locationHBase: 630,
		locationVBase: 100
	});
	
	links.addEvents(
	{																 
		'click': function(e)
		{
			new Event(e).stop();
			
			var img = this.getParent().getElement('img');
			var h3 = this.getParent().getParent().getElement('h3');
			var src = img.src;
			img.src = '/templates/prosmebel/img/ajax-loader99.gif';
			var rel = this.get('rel').replace('lb_item_', '');
			var msg;
			if (rel.test(/^mebel/i))
				msg = 'стандартное рабочее место <strong>' + h3.get('text') + '</strong>';
			else /* if (rel.test(/^modul/i)) */
				msg = 'модуль <strong>' + h3.get('text') + '</strong>';
				
			new Request.JSON({
				url: Host + 'json/add_lightbox/' + rel, 
				onComplete: function(jsonObj) {
					
					this.getParent().set( { 'html': 'добавлено в блокнот', 'class' : 'sklad' } );
					
					notimooManager.show({
						message: [
'Вы добавили ', 
msg, 
' в <a href="', 
Host,
'lightbox#select/',
jsonObj.link,
'">блокнот</a>.'].join('')
					});			
					
					img.src = src;
					
				}.bind(this)
			}).send();
		}
	});

}


window.addEvent('domready',function()
{

	ScanLbLinks( $$('a.lb_add') );

});
