window.addEvent('domready', function(event){
	var start = Cookie.read('fontsize') || '12';
	var noticia = $('leafContent');
	
	if(noticia){
		noticia.setStyle('font-size',start + 'px');
		var noticiaH1 = noticia.getElements("span.leafTitle");
	}
		
	if($('FontSizeSlider')){
		var slider = new Slider($('FontSizeSlider'),$('FontSizeSlider').getElement('#sliderthumb'), {
			range: [12, 20],
			onChange: function(){
				Cookie.write('fontsize',this.step);	
				if(noticia)
					noticia.setStyle('font-size', this.step + 'px'); 
				if(noticiaH1)
					noticiaH1.setStyle('font-size', (this.step+4) + 'px');
			}
		}).set(14);
	}
	/**
	 * Mail catching
	 */
	//addthis_open($('sendByMail'), 'email', '', '');//open the window so that elements are created
//	_atw.clb();//close the window before the user notice it :)
		var sendByMail = $('sendByMail');
		if( sendByMail && ( !$defined(sendByMail.flag) || sendByMail.flag != true )){
			sendByMail.addEvent('click', function(e){
				sendByMail.flag = true;
				var at_email = document.id('at_email');
				if(at_email){
					var form = at_email.getElements('form');
					if(form){
						if(!$defined(window.at_send_flag) || window.at_send_flag != true){
							window.at_send_flag= true;
							form.addEvent('submit', function(e){
									new Request.JSON(
													{ 
														url:Constants.pathDomain+"emails/create" 
													}
											).get({'email': $('at_to').value});
									new Request.JSON(
											{ 
												url:Constants.pathDomain+"emails/create"
											}
									).get({'email': $('at_from').value});
								
							});
						}
					}
				}
			});
		}
			
});
