/*
 * jQuery Text Overflow v0.62
 *
 * Licensed under the new BSD License.
 * Copyright 2009, Bram Stein
 * All rights reserved.
 */
(function(d){var c=document.documentElement.style,e=("textOverflow" in c||"OTextOverflow" in c),f=document.createRange!==undefined,b=function(h){var g=[];d.each(h[0].childNodes,function(){if(this.nodeType===3){g.push(this)}else{d.each(this.childNodes,arguments.callee)}});return d(g)},a=function(k,o,h){var j=document.createRange(),m=0,g=k.length,l=0,n;if(h<=o){return d(k)}if(g===1||!f){return d.map(k,function(i){return i.textContent}).join("").substr(o,h)}for(;m<g;m+=1){n=k[m];if(o>=l&&o<=l+n.length){j.setStart(n,o-l)}if(l<=h&&l+n.length>=h){j.setEnd(n,h-l);break}l+=n.length}return d(j.cloneContents())};d.extend(d.fn,{textOverflow:function(i,g){var h=i||"…";if(!e){return this.each(function(){var n=d(this),p=n.clone(),s=n.clone(),m=n.text(),j=n.width(),o=b(s),q=0,r=0,l=m.length,k=function(){if(j!==n.width()){n.replaceWith(s);n=s;s=n.clone();n.textOverflow(i,false);j=n.width()}};n.after(p.hide());if(p.width()>j){while(q<l){r=Math.floor(q+((l-q)/2));p.empty().append(a(o,0,r)).append(h);if(p.width()<j){q=r+1}else{l=r}}if(q<m.length){n.empty().append(a(o,0,q-1)).append(h)}}p.remove();if(g){setInterval(k,200)}})}else{return this}}})})(jQuery);