	/**
		* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
		* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
		* 
		* @param  f  onMouseOver function || An object with configuration options
		* @param  g  onMouseOut function  || Nothing (use configuration options object)
		* @author    Brian Cherne brian(at)cherne(dot)net
		*/
		(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);


function nav(what){
				$("#"+what+" .ic a").css("padding","5px 0px").width("auto");
				
				var count = $("#"+what+" .ic a").length;
				var listWidth = 0;
				$("#"+what+" .ic a").each(function(){
					var tW = Math.ceil($(this).width());
					$(this).width(tW)
					listWidth += tW;
					});
				var navWidth = $("#"+what+" .ic").width();
				
				
				var pAmt = Math.floor(((navWidth - listWidth)/count)/2);
				$("#"+what+" .ic a").not(":last").css("padding","5px "+pAmt+"px");
				
				var pAmtLast = pAmt+(navWidth-((pAmt*2*count)+listWidth))/2;
				$("#"+what+" .ic a:last").css("padding","5px "+pAmtLast+"px");
			}

/*	
 *	jQuery dotdotdot 1.1.2
 *	
 *	Copyright (c) 2011 Fred Heusschen
 *	www.frebsite.nl
 *
 *	Plugin website:
 *	dotdotdot.frebsite.nl
 *
 *	Dual licensed under the MIT and GPL licenses.
 *	http://en.wikipedia.org/wiki/MIT_License
 *	http://en.wikipedia.org/wiki/GNU_General_Public_License
 */

(function($) {
	if ($.fn.dotdotdot) return;

	$.fn.dotdotdot = function(o) {
		if (this.length == 0) {
			debug(true, 'No element found for "'+this.selector+'".');
			return this;
		}
		if (this.length > 1) {
			return this.each(function() {
				$(this).dotdotdot(o);
			});
		}


		var $dot = this,
			$tt0 = this[0];


		$dot.bind_events = function() {
			$dot.bind('update.dot'+serial, function(e, stop) {
				e.stopPropagation();

				var wrpHeight = getTrueInnerHeight($dot);
				opts.maxHeight = (typeof opts.height == 'number') ? opts.height : wrpHeight;

				$inr.empty();
				$inr.append(orgContent.clone(true));

				var after = false;
				if (opts.afterElement) {
					after = opts.afterElement.clone(true);
					opts.afterElement.remove();
				}

				if (test($inr, opts)) {
					ellipsis($inr, $inr, opts, after);
				}
			});
			$dot.bind('destroy.dot'+serial, function(e) {
				e.stopPropagation();
				$dot.unwatch();
				$dot.unbind_events();
				$dot.empty();
				$dot.append(orgContent);
			});
		};	//	/bind_events

		$dot.unbind_events = function() {
			$dot.unbind('.dot'+serial);
		};	//	/unbind_events
		
		$dot.watch = function() {
			$dot.unwatch();
			if (opts.watch == 'window') {
				$(window).bind('resize.dot'+serial, function() {
					if (watchInt) {
						clearInterval(watchInt);
					}
					watchInt = setTimeout(function() {
						$dot.trigger('update');
					}, 10);
				});
			} else {
				watchOrg = getSizes($dot);
				watchInt = setInterval(function() {
					var watchNew = getSizes($dot);
					if (watchOrg.width  != watchNew.width ||
						watchOrg.height != watchNew.height
					) {
						$dot.trigger('update');
						watchOrg = getSizes($dot);
					}
				}, 100);
			}
		};
		$dot.unwatch = function() {
			if (watchInt) {
				clearInterval(watchInt);
			}
		}



		if ($dot.find('> .dotdotdot').length > 0) {
			$dot.trigger('destroy');
		}

		var	opts 		= opts = $.extend(true, {}, $.fn.dotdotdot.defaults, o),
			serial 		= $.fn.dotdotdot.serial++,
			orgContent	= $dot.contents(),
			watchOrg	= {},
			watchInt	= null,
			$inr		= $dot.wrapInner('<'+opts.wrapper+' class="dotdotdot" />').find('> .dotdotdot');

		opts.afterElement = getElement(opts.after, $inr);

		$dot.bind_events();
		if (opts.watch) {
			$dot.watch();
		}
		$dot.trigger('update');

		return $dot;
	};



	//	public
	$.fn.dotdotdot.serial = 0;
	$.fn.dotdotdot.defaults = {
		'wrapper'	: 'div',
		'ellipsis'	: '... ',
		'wrap'		: 'word',
		'after'		: null,
		'height'	: null,
		'watch'		: false,
		'debug'		: false
	};
	

	//	private
	function ellipsis($elem, $i, o, after) {
		var $elements = $elem.contents(),
			isFilled = false;

		$elem.empty();

		for (var a = 0, l = $elements.length; a < l; a++) {
			if (isFilled) {
				break;
			}
			var e	= $elements[a],
				$e	= $(e);

			if (typeof e == 'undefined') {
				continue;
			}

			$elem.append($e);
			if (after) {
				$elem.append(after);
			}
			if (e.nodeType == 3) {
				if (test($i, o)) {
					isFilled = ellipsisElement($e, $i, o);
				}

			} else {
				isFilled = ellipsis($e, $i, o, after);
			}
			if (!isFilled) {
				if (after) {
					after.remove();
				}
			}
		}

		return isFilled;
	}
	function ellipsisElement($e, $i, o) {
		var isFilled	= false,
			e			= $e[0];

		if (typeof e == 'undefined') {
			return false;
		}

		var seporator	= (o.wrap == 'letter') ? '' : ' ',
			textArr		= getTextContent(e).split(seporator);

		setTextContent(e, textArr.join(seporator) + o.ellipsis);

		for (var a = textArr.length - 1; a >= 0; a--) {
			if (test($i, o)) {
				setTextContent(e, getTextContent(e).substring(0, getTextContent(e).length - (textArr[a].length + seporator.length + o.ellipsis.length)) + o.ellipsis);
			} else {
				isFilled = true;
				break;
			}
		}

		if (!isFilled) {
			var $w = $e.parent();
			$e.remove();
			isFilled = ellipsisElement($w.contents().last(), $i, o);
		}

		return isFilled;
	}
	function test($i, o) {
		return $i.innerHeight() > o.maxHeight;
	}
	function getSizes($d) {
		return {
			'width'	: $d.innerWidth(),
			'height': $d.innerHeight()
		};
	}
	function setTextContent(e, content) {
		if (e.innerText) {
			e.innerText = content;
		} else if (e.nodeValue) {
			e.nodeValue = content;
		} else if (e.textContent) {
			e.textContent = content;
		}
	}
	function getTextContent(e) {
		if (e.innerText) {
			return e.innerText;
		} else if (e.nodeValue) {
			return e.nodeValue;
		} else if (e.textContent) {
			return e.textContent;
		} else {
			return "";
		}
	}
	function getElement(e, $i) {
		if (typeof e == 'undefined') {
			return false;
		}
		if (!e) {
			return false;
		}
		if (typeof e == 'string') {
			e = $(e, $i);
			return (e.length) ? e : false;
		}
		if (typeof e == 'object') {
			return (typeof e.jquery == 'undefined') ? false : e;
		}
		return false;
	}
	function getTrueInnerHeight($el) {
		var h = $el.innerHeight(),
			a = ['paddingTop', 'paddingBottom'];

		for (z = 0, l = a.length; z < l; z++) {
			var m = parseInt($el.css(a[z]));
			if (isNaN(m)) m = 0;
			h -= m;
		}
		return h;
	}
	function debug(d, m) {
		if (!d) return false;
		if (typeof m == 'string') m = 'dotdotdot: ' + m;
		else m = ['dotdotdot:', m];

		if (window.console && window.console.log) window.console.log(m);
		return false;
	}

})(jQuery);			


function addBookmark(bookmarkurl,bookmarktitle)
{

if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
else if ( window.sidebar ) {
window.sidebar.addPanel(bookmarktitle, bookmarkurl,"");
}
}
function size(){
	$('img').load(function(){//images must be loaded
	$(".article").not(".read").each(function(){
		var i = $(this).children(".img").height();
		var t = $(this).children(".title").height();
		var Nh = i-t-25;
		$(this).children(".desc").height(Nh).dotdotdot();
		

		});
	});
}
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}
			
$(function(){
	
	if(!getCookie("sPop")){
			setCookie("sPop",true,636);
			$("#subscribe").fadeIn(444);
			}
	$("a[href='http://copddigest.org/draft/subscribe']").click(function(){$("#subscribe").fadeIn(444); return false;});	
	$("a[href='http://copddigest.org/subscribe']").click(function(){$("#subscribe").fadeIn(444); return false;});	
		
		
	$(".button.link").click(function(){
			var link = $(this).parent(".social").attr("href");
			$(this).html('<input type="text" value="'+link+'" />').select();
			});
			
	$(".button.save").click(function(){
			var link = $(this).parent(".social").attr("href");
			var title = $("title").text();
			addBookmark(link,title)
			});

	$(".button.print").mouseover(function(){
				$("#logo").attr("src","http://copddigest.org/draft/img/copdred.png");
				});

	$(".button.print").click(function(){window.print();});

				$(".button.print").mouseout(function(){
				$("#logo").attr("src","http://copddigest.org/draft/img/logo.png");
				});	
				

	$(".comment, [title=Comments]").click(function(){
				$('html,body').animate({
				scrollTop: $("a[name=comments]").offset().top
				}, 600);
				});
	
	
	$(".button.email").click(function(){
			$(".social").append("<div />", {"class":"pop"});
			});
	
	size();

	var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
	
	$(".more").live("click", function(){
		var obj = $(this);
		var href = $(this).children("a").attr("href");
		$.post(href, {"ajax":1}, function(data) {
		obj.parent("ul").html('<li class="break"></li>'+data);
		obj.remove();
		size();

		$('body').animate({scrollTop: $('.break:last').offset().top - $('body').offset().top},2500);
		});
		
		return false;
			
	
	});
	
	nav("nav");
	nav("nav2");

	$("#plus").click(function(){
			$("body").css("fontSize","120%");nav("nav");
	nav("nav2");
			});

	$("#min").click(function(){
			$("body").css("fontSize","100%");nav("nav");
	nav("nav2");
			});
	
	
	var searchEmpty = "Search";
		
	$("#search").val(searchEmpty).addClass("eSe");
	
	$("#search").focus(function(){
		if($(this).val() == searchEmpty){
			$(this).val("").removeClass("eSe");
			}
		});
	$("#search").blur(function(){
			if($(this).val() == ""){
			$(this).val(searchEmpty).addClass("eSe");
			}
			});		
			
	$(".slide").hoverIntent(
				function(){
					$(this).animate({"height":$(this).children("img").height()+"px"}, 500);
				},function(){
					$(this).animate({"height":90}, 500);
				});
	
	$(".sClose").click(function(){$("#subscribe").fadeOut(444);});
	
	});
