/*
 * MooTools
 * Łata z try' na bug  spodowodowany przez GarbageCollection
 */  
try{
window.addEvent('domready', function() {
	
  var last_art= $$('.news-single-item h2');
  
  if(last_art)
  {		
	last_art.each(function(item, index){
    if(last_art.length > 1){
      ++index;
      
   	  var rgxp = /(<([^>]+)>)/gi;
      var link= new Element('a',{
        'href':'#'+index,
        'html':item.innerHTML.trim().replace(rgxp,"")
      });
      
      item.setProperty('id',index);
      link.injectInside('article_menu');
    }    
  });	
  }

  if($$('.news-list-item')!=null){
    $$('.news-list-item').each(function(item,index){
     var div_img =item.getElement('div');
     
     if(div_img!=null){
      var href=div_img.getElement('a');
      if(href!=null)
      {
          if(href.getElement('img')==null)
            div_img.dispose();
      }
     }
    });
  }
  
  if($$('.news-single-item')!=null){
    $$('.news-single-item').each(function(item,index){
     var div_img =item.getElements('div');
     
     if(div_img[1]!=null){
      var href=div_img[1].getElement('a');
	  
      if(href==null)      
        document.getElementById("img").removeAttribute("id");   
     }
    });
  }


  if($('mail_send')!=null){
    $('mail_send').addEvent('click',function(){
  	 var email = prompt('E-mail address:');         
      if(email!=null && email.length>0)
      {          	    	
      	var req = new Request({url:'http://localhost:8505/?id=67',method:'post',        
         onSuccess: function(response) {
            alert(response);        
        }
        }).send('nid='+1+'&mail='+email);                
      }
  	});
  }

});

window.addEvent('unload',function(){});
}catch(Exception){}




