 function del()
	{
		$.cookie('noticiasL', null,  {path:"/"});
		$("#addedlist").click();
		$("#addedlist").hide(); 
		$(".EBarraSuperior").hide();
		$(".readlaterbar").remove();
	}
	function addnoteRD(idn)
	{
		var strid = idn.match('\\d+');
		if($.cookie('noticiasL'))
		{
			if(PreCheck(strid) == 0) 
			{
				var v = $.cookie('noticiasL') + ',' + strid;
				$.cookie('noticiasL', v, {path: "/", expires: 3 });
				AdAction();
				HandleMSJ('Nota agregada', '#8adff8');
				$('.rdhovermsj').mouseout();
			}
			else
			{
				HandleMSJ('Ya Existe', 'red');
			}
		}
		else
		{
			$.cookie('noticiasL', strid, { path: "/", expires: 3 });
			AdAction();
		}
	}
	
	function HandleMSJ(mensaje, colour)
	{
		var origcolor =  $('.rdAN').css("color");
		var orightml = $('.rdAN').html();
		$('.rdAN').css({ color:colour});
		$('.rdAN').html(mensaje);
		setTimeout(function()
		{
			$('.rdAN').css({ color:origcolor});
			$('.rdAN').html(orightml);
		}, 1000);
	}
	
	function togglerdform()
	{
		$('#rdform').slideToggle("slow");
	}
	function AdAction()
	{
		if($(".EBarraSuperior > ul").length > 0)
		{
			$(".EBarraSuperior ul").append('<li><img src="http://www.el-mexicano.com.mx/additional/imgs/added.gif" />&nbsp;<a href="javascript:void(0);">Nota actual Agregada</a></li>');
			if($(".EBarraSuperior").is(":hidden"))
			$("#addedlist").click();
			$("#addedlist").show();
		}else
		{
			$(".EBarraSuperior").append('<div class="readlaterbar"><img src="http://www.el-mexicano.com.mx/additional/imgs/readlatertab.png" class="rtab"/></div><ul><li><img src="http://www.el-mexicano.com.mx/additional/imgs/added.gif" />&nbsp;<a href="javascript:void(0);">Nota actual agregada</a></li></ul><div class="readlaterbar"><img src="http://www.el-mexicano.com.mx/additional/imgs/readlaterbararrow.gif" /></div>');
			$("#addedlist").show();
			if($(".EBarraSuperior").is(":hidden"))
			$("#addedlist").click();
		}
		setTimeout(function(){
			RequestList('http://www.el-mexicano.com.mx/controlpaginas/notassalvadas.aspx', null, '.EBarraSuperior');}, 2000);
	}
	function RequestList(PURL, param, listener)
	{
		$.ajax({type:"GET",dataType: "text",url: PURL,data: param,success: function(data)
		{
			$(listener).trigger('muestralista', [data]);
		},error: function()
		{
			$(listener).trigger('loaderror', [data]);
		},beforeSend: function()
		{
			$(listener).html('<div style="width:100%; padding:5px 0 5px 0; text-align:center;"><img src="http://www.el-mexicano.com.mx/additional/imgs/ajax-loader.gif" /></div>');
		}});
	}
	
	function rdsendmail()
	{
		$('#btnrdsend').html('Enviando...');
		$('#rdemail').attr("disabled", "disabled");
		$.get("http://www.el-mexicano.com.mx/handlers/leerdespues/rdsend.ashx", {email:$('#rdemail').val()}, function(data)
		{
			if(data != 'Fracaso')
			{
				$('#rdemail').val('');
				$('#btnrdsend').html('Enviado');
				setTimeout(function(){
				$('#btnrdsend').html('Enviar');
				setTimeout(function(){
					togglerdform();
					$('#rdemail').removeAttr("disabled");}, 1000);}, 2000);
			}
			else
			{
				$('#btnrdsend').html('Envio Fallido');
				setTimeout(function()
				{
					$('#btnrdsend').html('Enviar');
					setTimeout(function(){togglerdform();$('#rdemail').removeAttr("disabled");}, 1000);}, 2000);}});}function deleteFromList(idD){if($.cookie('noticiasL')){var num = idD.match("\\d+");var arrC = $.cookie('noticiasL').split(",");var arrS = "";for(c1=0; c1<arrC.length;c1++){if(arrC[c1] != num){if(arrS != "") arrS = arrS + ",";arrS = arrS + arrC[c1];}}$.cookie('noticiasL', arrS==""?null:arrS, { path: "/" });$('#'+idD).parent().slideUp("slow", function(){$('#'+idD).parent().remove();if($('#ulnotas > li').length == 0)$('#ulnotas').remove();if($('.EBarraSuperior > ul').length == 0) {$("#addedlist").hide(); $(".EBarraSuperior").hide(); $(".readlaterbar").remove();}});}}function hiderdList(){$("#addedlist").click();}function PreCheck(idnot){ if($.cookie('noticiasL')){var c1 = 0;var f = 0;var arr = [];arr = $.cookie('noticiasL').split(",");for(c1=0;c1 < arr.length; c1++){if(arr[c1] == idnot){return 1;}}return 0;}else{return 0;}}
		$(document).ready(function() 
		{
			if(!$.cookie('noticiasL'))
			{
				$("#addedlist").hide();
			}
			else
			{
				$("#addedlist").show();
			}
			$(".EBarraSuperior").bind("muestralista", function(event, data)
			{
				
				$(".EBarraSuperior").html(data);
				$(".EBarraSuperior ul li .delRL").each(function()
				{
					$(this).click(function()
					{
						deleteFromList(this.id);
					});
				});
			});
			$(".EBarraSuperior").bind("loaderror", function(event, data) 
			{
				alert('error');
			});
			RequestList('http://www.el-mexicano.com.mx/controlpaginas/notassalvadas.aspx', null, '.EBarraSuperior');
			$("#addedlist").click(function()
			{
				$(".EBarraSuperior").slideToggle("normal", function()
				{
				    
					if($(".EBarraSuperior").is(":hidden"))
						$("#addedlist").html('<img src="http://www.el-mexicano.com.mx/additional/imgs/readlatericonshow.png" style="vertical-align:middle;" /> Mis notas pendientes por leer');
					else
					{
						$("#addedlist").html('<img src="http://www.el-mexicano.com.mx/additional/imgs/readlatericon.png" style="vertical-align:middle;" /> ocultar');
					}
				});
			});
			
			$('.rdhovermsj').hover(function() 
			{
				$('.rdAN').attr("href","javascript:addnoteRD('"+this.id+"')");
				$(this).ezpz_tooltip({contentId:'msj-content-1',stayOnContent: true,contentPosition: 'belowStatic',offset: -10,showContent: function(content){content.fadeIn('slow');},hideContent: function(content){content.stop(true, true).fadeOut('slow');}});});
				$('.rdhovermsj').mouseout(function()
				{
					$('.tayuda').html("&#191;Que es esto?");
					$('.tayuda').attr("rel", "show");
					$('#rdhelphr').remove();
					$('#rdhelp').remove();
					$('.msj-content-div').css({"width":"160px", "height":"25px"});
				});
				$('.tayuda').click(function()
				{
					$('.tayuda').attr('disabled', 'disabled');
					if($('.tayuda').attr("rel") == 'show')
					{
						$('.tayuda').attr("rel", "hide");
						$('.tayuda').html("Ocultar");
						$.get("http://www.el-mexicano.com.mx/controlpaginas/help.htm", function(data){$('.msj-content-div').animate({width:250, height:200}, 1000, function() {$('.msj-content-div').append(data);
						$('.tayuda').attr('disabled','');});});
					}
					else
					{
						$('.tayuda').html("&#191;Que es esto?");
						$('.tayuda').attr("rel", "show");
						$('#rdhelphr').fadeOut('slow', function()
						{ 
							$('#rdhelphr').remove(); }
						);
						$('#rdhelp').fadeOut('slow', function(){
							$('#rdhelp').remove();
							$('.msj-content-div').animate({width:190, height:25}, 1000,function()
							{
								$('.tayuda').removeAttr('disabled');}
							);
						});
					}
				});
		});