jQuery(function() { jQuery('._NeverToday').click(function() { var popup = jQuery(this).parents('div._POPUP:first'); var popMeta = popup.metadata()||{}; Cookie.set(popMeta.articleId, popMeta.articleId, popMeta.viewDay); popup.dialog('close'); }); jQuery('._POPUP').each(function(index, element) { var popup = jQuery(this); var meta = popup.metadata()||{}; var width = meta.width; var height = meta.height + 37; if(meta .viewDay != null && meta .viewDay > 0) height += 16; popup.appendTo('body').css({position:'relative', width:width, height:height}); if(Cookie.get(meta.articleId) == null || meta .viewDay == null || meta .viewDay <= 0 ) { popup.dialog({ title : meta.title, position : [meta.pointX, meta.pointY], resizable : false, width: width, height : height }); } else { popup.remove(); } }); });