var ShadowLayers = new Class({
	
	Implements:[Options,Events],
	
	options: {
		/*		
		width: '100px',
		height: '100px',
		left: '100px',
		top: '100px',
		uchwyt_res: false,
		uchwyt_drag: false,
		MainLayer: false,
		container:false
		*/
		autoheight: false,
		resize: true,
		height: '100px',
		zindex: '0'
					
		
	},
	

	initialize: function(id,idk,options) {
		
		
		this.setOptions(options);
		this.id = id;
		this.idk = idk;
		
		this.alert ='aaaaaaa'
		
		this.MakeLayer();
		
		this.MakeBorders();
		this.MakeCorners();
		this.MakeContent();
		
		if(this.options.resize == true){
		this.MakeResizable();
		this.MakeDraggable();
		}
		
		if(id>0){
		this.MakeToolbox();
		this.MakeToolboxUser();
		//this.MakeAddMainButton();
		//this.MakeRemMainButton();
		//alert(this.MainLayer.getStyle('position'));
			
		//}
		}
		this.AddEvents();
		
		this.MakeRelative();
		
				
				
	},
	
	MakeStartDraggButton: function(){
		
		var textx = new Element('div', {
						'title':'Uwolnij',	
						
						'class':'lbuttons',	
								    			
		    			'styles': {
		        
			        		//'background': 'url(img/editcopy.png)',
			        		'background': 'rgb(230,230,230)',
			        		//'float':'left',
			        		'width':'15px',
			        		'height':'5px',
			        		'overflow':'hidden',
			        		'position':'absolute',
			        		'top':'4px',
			        		'right':'20px',
			        		'cursor':'pointer'
			        				        		
			        		
	    				},
	    				'events': {
        					'click': function(){
        						this.MainLayer.setStyle('position','absolute');
        						this.MainLayer.setStyle('margin','0px');
           						this.MakeResizable();
								this.MakeDraggable();
								textx.dispose();
							}.bindWithEvent(this),
							'mouseover': function(){
								this.set('morph', {duration: 'short', transition: 'bounce:out'});
								this.morph({
	              					'height':'15px'
	              					
	              			 	});
								
							},
							'mouseout': function(){
								this.set('morph', {duration: 'short', transition: 'bounce:out'});
								this.morph({
	              					'height':'5px'
	              					
	              			 	});
								
							}

    					}

							
				
							
							
							
							
		});
						
						
						
		this.textx = textx;
		this.textx.inject(this.MainLayer);
		
		},
		MakeAddMainButton: function(){
		
		var AddMainButton = new Element('div', {
						'title':'Dodaj do strony glownej',	
						'class':'lbuttons',			    			
		    			'styles': {
		        
			        		//'background': 'url(img/editcopy.png)',
			        		'background': 'rgb(245,188,51)',
			        		//'float':'left',
			        		'width':'15px',
			        		'height':'5px',
			        		'overflow':'hidden',
			        		'position':'absolute',
			        		'top':'4px',
			        		'right':'50px',
			        		'cursor':'pointer',
			        		'display':'none'
			        				        		
			        		
	    				},
	    				'events': {
        					'click': function(){
        						
								xajax_DodajMainProcess(this.id,'dodaj')
								
								
								
							}.bindWithEvent(this),
							'mouseover': function(){
								this.set('morph', {duration: 'short', transition: 'bounce:out'});
								this.morph({
	              					'height':'15px'
	              					
	              			 	});
								
							},
							'mouseout': function(){
								this.set('morph', {duration: 'short', transition: 'bounce:out'});
								this.morph({
	              					'height':'5px'
	              					
	              			 	});
								
							}

    					}

							
				
							
							
							
							
		});
						
						
						
		this.AddMainButton = AddMainButton;
		this.AddMainButton.inject(this.MainLayer);
		
		
	},
	
	MakeRemMainButton: function(){
		
		var RemMainButton = new Element('div', {
						'title':'Usun ze strony glownej',	
						'class':'lbuttons',			    			
		    			'styles': {
		        
			        		//'background': 'url(img/editcopy.png)',
			        		'background': 'rgb(220,0,0)',
			        		//'float':'left',
			        		'width':'15px',
			        		'height':'5px',
			        		'overflow':'hidden',
			        		'position':'absolute',
			        		'top':'4px',
			        		'right':'70px',
			        		'cursor':'pointer',
			        		'display':'none'
			        				        		
			        		
	    				},
	    				'events': {
        					'click': function(){
        						
								xajax_DodajMainProcess(this.id,'usun')
								
								
								
							}.bindWithEvent(this),
							'mouseover': function(){
								this.set('morph', {duration: 'short', transition: 'bounce:out'});
								this.morph({
	              					'height':'15px'
	              					
	              			 	});
								
							},
							'mouseout': function(){
								this.set('morph', {duration: 'short', transition: 'bounce:out'});
								this.morph({
	              					'height':'5px'
	              					
	              			 	});
								
							}

    					}

							
				
							
							
							
							
		});
						
						
						
		this.RemMainButton = RemMainButton;
		this.RemMainButton.inject(this.MainLayer);
		
		
	},
	
	
	MakeResizable: function(){
		
		
		
		this.MainLayer.makeResizable({
							limit: {y: [50, 1500],x:[50,990]},
							handle: this.uchwyt_res,
							"onStart": function(){
								
								this.SetIndex(this.MainLayer);
								
							}.bindWithEvent(this),
							
							"onDrag": function(){
    	   	 	
        						this.BorderTop.setStyle('width',(this.MainLayer.getStyle('width').toInt()-18)+'px');
        						this.BorderBottom.setStyle('width',(this.MainLayer.getStyle('width').toInt()-18)+'px');
        						this.BorderLeft.setStyle('height',(this.MainLayer.getStyle('height').toInt()-18)+'px');
        						this.BorderRight.setStyle('height',(this.MainLayer.getStyle('height').toInt()-18)+'px');
        						
        						this.Content.setStyle('width',(this.MainLayer.getStyle('width').toInt()-18)+'px');
        						this.Content.setStyle('height',(this.MainLayer.getStyle('height').toInt()-18)+'px');
        						
    						}.bindWithEvent(this),
    						
    						
    						"onComplete": function() {
																
								this.fireEvent("onCompleteResize");
								
																							
								
							}.bindWithEvent(this)
     				
                				
                			
							
					});	
			
	},
	
	
		
	
	
	MakeDraggable: function(){
		
		 	
		 						 				
		  this.MainLayer.makeDraggable({
							handle: this.uchwyt_drag,
							container: this.options.container_drag,
							"onStart": function(){
								
								this.SetIndex(this.MainLayer);
								
							}.bindWithEvent(this),
							
							"onComplete": function() {
																
								this.fireEvent("onCompleteDrag");
																							
								
							}.bindWithEvent(this)
					});
		
		
						
		
		
	},
	SetIndex:function(Layer){
		
			var xx=0;
                
                	var Elementy =new Array();
                		
                   		$$('.MainLayers').each(function(el) {
                			
                			
                			Elementy[ xx++]=el.getStyle('z-index').toInt();
                			
                			
                					
                		
                			
                			
                		});
                		
                		
						Elementy.sort(porownajLiczby);
						
						
						
						
						
                		              		
                	
                		if (Layer.getStyle('z-index').toInt()==1 || Layer.getStyle('z-index').toInt()<Elementy[Elementy.length-1]){
                		
                			Layer.setStyle('z-index',(Elementy[Elementy.length-1])+1);
                			
                				
                			
                		}
                		
                		//alert(Layer.getStyle('z-index').toInt());
                		
		
		
	},
	AddEvents: function(){
		
		
		
		
		
		
		
		this.MainLayer.addEvents({ 
                click: function(){
                	
                	//this.SetIndex(this.MainLayer);
                	
                	this.fireEvent("onClick");
                  	
                                   
	                               		
          		}.bindWithEvent(this),
          			
          			
          		mouseenter: function(){
                  	if(this.id>0 && this.RemMainButton && this.AddMainButton){
	                    this.RemMainButton.setStyle('display','block');
	                    this.AddMainButton.setStyle('display','block');
	                    
	                    
	                    

	                    
                  	}
                  	
                  	//this.MainLayer.store('z-index', this.MainLayer.getStyle('z-index'));
                  	//this.SetIndex(this.MainLayer);
                    
	                               		
          		}.bindWithEvent(this),
          			
          			
          		mouseleave: function(){
                  	if(this.id>0 && this.RemMainButton && this.AddMainButton){
	                    this.RemMainButton.setStyle('display','none');
	                    this.AddMainButton.setStyle('display','none');
                  	}
                  	
                  	 //this.MainLayer.setStyle('z-index',this.MainLayer.retrieve('z-index'));
                    
	                               		
          		}.bindWithEvent(this)
          			
          			
				
		});
		
		
		
		this.TopRight.addEvents({ 
					click: function(){
						/*
						if(typeof xajax_DisplayToolboxUser =='function'){			
											
						
						if (this.Toolbox.getStyle('margin-left')==this.start_toolbox && this.ToolboxUser.getStyle('margin-left')==this.start_toolbox_user){
	            				 this.Toolbox.morph({
	              					'margin-left':'0px'
	              			 	});
	              			 	
	              			 	if(!this.ToolboxContent.get('html')){
	              			 		
	              			 		xajax_DisplayToolbox(this.id,'toolbox_content');
	              			 		
	              			 		        			 		
	              			 		
	              			 	}
	              		}
						
						if (this.Toolbox.getStyle('margin-left')!=this.start_toolbox){
							
								this.Toolbox.morph({
	              					'margin-left':this.start_toolbox
	              		 		});
							
							
							    this.ToolboxUser.morph({
	              					'margin-left':'0px'
	              			 	});
	              			 	
	              			 	if(!this.ToolboxUserContent.get('html')){
	              			 		
	              			 		if(typeof xajax_DisplayToolboxUser =='function'){
	              			 		xajax_DisplayToolboxUser(this.id,'toolbox_user_content');
	              			 		}
	              			 		
	              			 	}
							
							
							
							
						}
						
						
						if (this.ToolboxUser.getStyle('margin-left')!=this.start_toolbox_user){
							
							this.ToolboxUser.morph({
	              					'margin-left':this.start_toolbox_user
	              		 	});
					
						}
						
						
						if (this.ToolboxEmpty.getStyle('margin-left')==this.start_toolbox_empty && this.ToolboxUserEmpty.getStyle('margin-left')==this.start_toolbox_user_empty){
	            				 this.ToolboxEmpty.morph({
	              					'margin-left':'0px'
	              			 	});
						}
						
						if (this.ToolboxEmpty.getStyle('margin-left')!=this.start_toolbox_empty){
								this.ToolboxEmpty.morph({
	              					'margin-left':this.start_toolbox_empty
	              			 	});
	              			 	
	              			 	 this.ToolboxUserEmpty.morph({
	              					'margin-left':'0px'
	              			 	});
						}
						
						if (this.ToolboxUserEmpty.getStyle('margin-left')!=this.start_toolbox_user_empty){
							
							this.ToolboxUserEmpty.morph({
	              					'margin-left':this.start_toolbox_user_empty
	              		 	});
										
						}
						
						}
						else{
							
							if(this.Toolbox.getStyle('margin-left')==this.start_toolbox){
	            				 this.Toolbox.morph({
	              					'margin-left':'0px'
	              			 	});
	              			 	 this.ToolboxEmpty.morph({
	              					'margin-left':'0px'
	              			 	});
	              			 	
	              			 	if(!this.ToolboxContent.get('html')){
	              			 		
	              			 		xajax_DisplayToolbox(this.id,'toolbox_content');
	              			 		
	              			 		        			 		
	              			 		
	              			 	}
	              			 	
	              			 		              			 	
							}
							else{
								 this.Toolbox.morph({
	              					'margin-left':this.start_toolbox
	              			 	});
	              			 	this.ToolboxEmpty.morph({
	              					'margin-left':this.start_toolbox
	              			 	});
	              			 	
								
							}
							
							
							
							
						}
						*/
						if(typeof xajax_DisplayToolboxUser =='function' && this.id>0) {
							if(this.ToolboxUser.getStyle('margin-left')==this.start_toolbox_user){
		            				 this.ToolboxUser.morph({
		              					'margin-left':'0px'
		              			 	});
		              			 	 this.ToolboxUserEmpty.morph({
		              					'margin-left':'0px'
		              			 	});
		              			 	
		              			 	if(!this.ToolboxUserContent.get('html')){
		              			 		
		              			 		xajax_DisplayToolboxUser(this.id,'toolbox_user_content');
		              			 		
		              			 		        			 		
		              			 		
		              			 	}
		              			 	
		              			 		              			 	
								}
								else{
									 this.ToolboxUser.morph({
		              					'margin-left':this.start_toolbox_user
		              			 	});
		              			 	this.ToolboxUserEmpty.morph({
		              					'margin-left':this.start_toolbox_user
		              			 	});
		              			 	
									
								}
						}
									
					}.bindWithEvent(this)
		});
		
		
		
		
		
		
	},
	
	MakeToolbox: function(){
		
		var Toolbox = new Element('div', {
	    
		    			'id': 'toolbox_'+this.id,
		    			'class': 'toolbox',
		    			
		    			'styles': {
		        
			        		'width': '300px',
			        		'height': '40px',
			        		'z-index': '2',
			        		'border': '0px solid rgb(255,0,0)',
			        		
			        		'position': 'absolute',
			        		'overflow': 'hidden',
			        		'top': '0px',
			        		'left': '0px'
	    				}
					});
					
		var ToolboxContent = new Element('div', {
	    
		    			'id': 'toolbox_content_'+this.id,
		    			'class': 'toolbox',
		    			
		    			'styles': {
		        
			        		'width': '300px',
			        		'height': '40px',
			        		'z-index': '3',
			        		'border': '0px solid rgb(255,0,0)',
			        		
			        		'position': 'absolute',
			        		'overflow': 'hidden',
			        		'top': '0px',
			        		'left': '0px'
	    				}
					});
					
		var ToolboxEmpty = new Element('div', {
	    
		    			'id': 'toolbox_empty_'+this.id,
		    			'class': 'toolbox',
		    			
		    			'styles': {
		        
			        		'width': '300px',
			        		'height': '40px',
			        		'z-index': '1',
			        		'border': '0px solid rgb(255,0,0)',
			        		'background-color': 'rgb(230,230,230)',
			        		'position': 'absolute',
			        		'overflow': 'hidden',
			        		'top': '0px',
			        		'background': 'url(img_style/toolsuser3.png) left top repeat-y',
			        		'left': '0px'
			        		
	    				}
					});
					
					
					
					Toolbox.inject(this.Content);
					ToolboxEmpty.inject(this.Content);
					ToolboxContent.inject(Toolbox);
					
		this.Toolbox = Toolbox;
		this.ToolboxEmpty = ToolboxEmpty;
		this.ToolboxContent = ToolboxContent;
		
		var widthtoolbox = Toolbox.getStyle('width').toInt();
		var widthtoolboxempty = ToolboxEmpty.getStyle('width').toInt();
		
		this.Toolbox.setStyle('margin-left',(-widthtoolbox)+'px');
		this.ToolboxEmpty.setStyle('margin-left',(-widthtoolboxempty)+'px');
				
		this.start_toolbox=(-widthtoolbox)+'px';
		this.start_toolbox_empty=(-widthtoolboxempty)+'px';
		
	},
	MakeToolboxUser: function(){
		
		var ToolboxUser = new Element('div', {
	    
		    			'id': 'toolbox_user_'+this.id,
		    			'class': 'toolbox',
		    			
		    			'styles': {
		        
			        		'width': '600px',
			        		'height': '30px',
			        		'z-index': '2',
			        		'border': '0px solid rgb(255,0,0)',
			        		
			        		'position': 'absolute',
			        		'overflow': 'hidden',
			        		'top': '0px',
			        		'left': '0px'
	    				}
					});
					
		var ToolboxUserContent = new Element('div', {
	    
		    			'id': 'toolbox_user_content_'+this.id,
		    			'class': 'toolbox',
		    			//'html':'toolbox user',
		    			'styles': {
		        
			        		'width': '600px',
			        		'height': '30px',
			        		'z-index': '3',
			        		'border': '0px solid rgb(255,0,0)',
			        		
			        		'position': 'absolute',
			        		'overflow': 'hidden',
			        		'top': '0px',
			        		'left': '0px'
	    				}
					});
					
		var ToolboxUserEmpty = new Element('div', {
	    
		    			'id': 'toolbox_user_empty_'+this.id,
		    			'class': 'toolbox',
		    			
		    			'styles': {
		        
			        		'width': '600px',
			        		'height': '30px',
			        		'z-index': '1',
			        		'border': '0px solid rgb(255,0,0)',
			        		'background-color': 'rgb(230,230,230)',
			        		'position': 'absolute',
			        		'overflow': 'hidden',
			        		'top': '0px',
			        		'background': 'url(img_style/toolsuser4.png) left top repeat-y',
			        		'left': '0px'
			        		
	    				}
					});
					
					
					
					ToolboxUser.inject(this.Content);
					ToolboxUserEmpty.inject(this.Content);
					ToolboxUserContent.inject(ToolboxUser);
					
		this.ToolboxUser = ToolboxUser;
		this.ToolboxUserEmpty = ToolboxUserEmpty;
		this.ToolboxUserContent = ToolboxUserContent;
		
		var widthtoolbox = ToolboxUser.getStyle('width').toInt();
		var widthtoolboxempty = ToolboxUserEmpty.getStyle('width').toInt();
		
		this.ToolboxUser.setStyle('margin-left',(-widthtoolbox)+'px');
		this.ToolboxUserEmpty.setStyle('margin-left',(-widthtoolboxempty)+'px');
				
		this.start_toolbox_user=(-widthtoolbox)+'px';
		this.start_toolbox_user_empty=(-widthtoolboxempty)+'px';
		
	},
	
	MakeRelative: function(){
		
		if(this.options.autoheight==true){
			this.Content.setStyle('height','auto');
			this.MainLayer.setStyle('position','relative');
			
			var heightC = this.Content.getCoordinates().height
			
			this.Content.setStyle('height',heightC+'px');
			
			this.MainLayer.setStyle('height',(heightC+18)+'px');
			
			
			this.MainLayer.setStyle('margin','10px');
			
			var cor_width =this.options.width.toInt()-(this.MainLayer.getStyle('margin-left').toInt()*2)+'px';
			
			this.MainLayer.setStyle('width',cor_width);
			
			//alert((this.options.width.toInt()-(this.MainLayer.getStyle('margin-left').toInt())*2)+'px');
			
			
			this.BorderLeft.setStyle('height',(heightC)+'px');
			this.BorderRight.setStyle('height',(heightC)+'px');
			
			this.BorderTop.setStyle('width',(cor_width.toInt()-18)+'px');
			this.BorderBottom.setStyle('width',(cor_width.toInt()-18)+'px');
			
			this.Content.setStyle('width',(cor_width.toInt()-18)+'px');
			
			this.MakeStartDraggButton();
			
			//alert(this.Content.getCoordinates().height);
		
		}
		
		
		
	},
			
	
	MakeLayer: function(){
		
		
		
		var MainLayer = new Element('div', {
	    
		    			'id': 'MainLayer_'+this.id,
		    			'class': 'MainLayers',
		    			//'html': $('rBC_60').get('html'),
		    			'styles': {
		        
			        		'width': this.options.width,
			        		'height': this.options.height,
			        		'z-index': this.options.zindex,
			        		'border': '0px solid rgb(255,0,0)',
			        		//'background-color': 'rgb(240,240,240)',
			        		'top': this.options.top,
			        		'left': this.options.left,
			        		'position': 'absolute',
			        		'overflow':'hidden'
			        		
	    				}
					});
					
					this.MainLayer = MainLayer;
				
					MainLayer.inject(this.options.container);
		/*			
		var MainLayer = $('Nazwa_'+this.id);
		
		MainLayer.setStyle('width',this.options.width);
		MainLayer.setStyle('height',this.options.height);
		//MainLayer.setStyle('z-index','0');
		MainLayer.setStyle('top',this.options.top);
		MainLayer.setStyle('left',this.options.left);
		MainLayer.setStyle('position','absolute');
		MainLayer.setStyle('overflow','hidden');
		
				this.MainLayer = MainLayer;
		*/
		
		
	},
	
	MakeContent: function(){
		
		
		//var Content = $('Nazwa_'+this.id);
		
		var Content = this.options.content;
		
		Content.setStyle('width',(this.options.width.toInt()-18)+'px');
		
		Content.setStyle('height',(this.options.height.toInt()-18)+'px');
		
		Content.setStyle('z-index','0');
		Content.setStyle('top','9px');
		Content.setStyle('left','9px');
		Content.setStyle('position','absolute');
		Content.setStyle('overflow','hidden');
		//Content.setStyle('background-color','rgb(255,255,255)');
					
					this.Content = Content;
					
					Content.inject(this.MainLayer);
					
				
		
	},
	
	MakeBorders: function(){
		
		var BorderT = new Element('div', {
	    
		    			'id': 'tb_'+this.id,
		    			'class': 'brns_top',
		    			'text': '',
		    			'styles': {
		        
			        		'width': (this.MainLayer.getStyle('width').toInt()-18)+'px',
			        		'height': '9px',
			        		'z-index': '0',
			        		'border': '0px solid rgb(0,0,255)',
			        		'background': 'url(img_style/new_bor_t.png) left top',
			        		'cursor':'move',
			        		'top': '0px',
			        		'left': '9px',
			        		'position': 'absolute',
			        		'overflow':'hidden'
	    				}
		});
		
		var BorderB = new Element('div', {
	    
		    			'id': 'bb_'+this.id,
		    			'class': 'brns_bottom',
		    			'text': '',
		    			'styles': {
		        
			        		'width': (this.MainLayer.getStyle('width').toInt()-18)+'px',
			        		'height': '9px',
			        		'z-index': '0',
			        		'border': '0px solid rgb(0,0,255)',
			        		
			        		'background': 'url(img_style/new_bor_b.png) left top',
			        		
			        		'bottom': '0px',
			        		'left': '9px',
			        		'position': 'absolute',
			        		'overflow':'hidden'
	    				}
		});
		
		
		var BorderL = new Element('div', {
	    
		    			'id': 'lb_'+this.id,
		    			'class': 'brns_left',
		    			'text': '',
		    			'styles': {
		        
			        		'height': (this.MainLayer.getStyle('height').toInt()-18)+'px',
			        		'width': '9px',
			        		'z-index': '0',
			        		'border': '0px solid rgb(0,0,255)',
			        		
			        		'background': 'url(img_style/new_bor_l.png) left top',
			        		
			        		'top': '9px',
			        		'left': '0px',
			        		'position': 'absolute',
			        		'overflow':'hidden'
	    				}
		});
		
		var BorderR = new Element('div', {
	    
		    			'id': 'rb_'+this.id,
		    			'class': 'brns_right',
		    			'text': '',
		    			'styles': {
		        
			        		'height': (this.MainLayer.getStyle('height').toInt()-18)+'px',
			        		'width': '9px',
			        		'z-index': '0',
			        		'border': '0px solid rgb(0,0,255)',
			        		
			        		'background': 'url(img_style/new_bor_r.png) left top',
			        		
			        		'top': '9px',
			        		'right': '0px',
			        		'position': 'absolute',
			        		'overflow':'hidden'
	    				}
		});
		
		BorderT.inject(this.MainLayer);
		BorderB.inject(this.MainLayer);
		BorderL.inject(this.MainLayer);
		BorderR.inject(this.MainLayer);
		
		
		
		this.BorderTop = BorderT;
		this.BorderBottom = BorderB;
		this.BorderLeft = BorderL;
		this.BorderRight = BorderR;
		
		this.uchwyt_drag = BorderT;
		
		
			
	},
	
	
	MakeCorners: function(){
		
		
		
		
		var TopLeft = new Element('div', {
	    
		    			'id': 'tl_'+this.id,
		    			'class': 'crns_top_left',
		    			'text': '',
		    			'styles': {
		        
			        		'width': '9px',
			        		'height': '9px',
			        		'z-index': '0',
			        		'border': '0px solid rgb(0,255,0)',
			        		
			        		'background': 'url(img_style/new_tl.png) left top',
			        		'top': '0px',
			        		'left': '0px',
			        		'position': 'absolute',
			        		'overflow':'hidden'
	    				}
					});
					
		this.TopLeft = TopLeft;	
					
		//TopLeft.inject(this.MainLayer);
		
		
		var TopRight = new Element('div', {
	    
		    			'id': 'tr_'+this.id,
		    			'class': 'crns_top_right',
		    			'text': '',
		    			'styles': {
		        
			        		'width': '9px',
			        		'height': '9px',
			        		'z-index': '0',
			        		'border': '0px solid rgb(0,255,0)',
			        		
			        		'background': 'url(img_style/new_tr.png) left top',
			        		'top': '0px',
			        		'right': '0px',
			        		'position': 'absolute',
			        		'overflow':'hidden'
	    				}
					});
					
		//TopRight.inject(this.MainLayer);
		
		this.TopRight = TopRight;
		
		
		var BottomRight = new Element('div', {
	    
		    			'id': 'br_'+this.id,
		    			'class': 'crns_bottom_right',
		    			'text': '',
		    			'styles': {
		        
			        		'width': '9px',
			        		'height': '9px',
			        		'z-index': '0',
			        		'border': '0px solid rgb(0,0,255)',
			        		'cursor':'nw-resize',
			        		'background': 'url(img_style/new_br.png) left top',
			        		'bottom': '0px',
			        		'right': '0px',
			        		'position': 'absolute',
			        		'overflow':'hidden'
	    				}
					});
					
		//BottomRight.inject(this.MainLayer);
		
		this.BottomRight = BottomRight;
		
		
		var BottomLeft = new Element('div', {
	    
		    			'id': 'bl_'+this.id,
		    			'class': 'crns_bottom_left',
		    			'text': '',
		    			'styles': {
		        
			        		'width': '9px',
			        		'height': '9px',
			        		'z-index': '0',
			        		'border': '0px solid rgb(0,255,0)',
			        		
			        		'background': 'url(img_style/new_bl.png) left top',
			        		'bottom': '0px',
			        		'left': '0px',
			        		'position': 'absolute',
			        		'overflow':'hidden'
	    				}
					});
					
		//BottomLeft.inject(this.MainLayer);
		
		
		this.MainLayer.adopt([TopLeft,TopRight,BottomLeft,BottomRight]);
		
		
		this.BottomLeft = BottomLeft;
		
		
		
		this.uchwyt_res = BottomRight;
		
	}
	
});
