
var $w=$(window);var $d=$(document);if(!Date.now)Date.now=function(){return new Date().getTime();};$d.ready(function(){$('body').on('submit','form[class="form col-md-12"]',function(e){e.preventDefault();var $form=$(this);var type=this.el.value;var email=this.email.value;if(!/(.+)@(.+){2,}\.(.+){2,}/.test(email))
{$form.find("div:eq(2)").show();return false;}else{$form.find("div:eq(2)").hide();this.email.value="Processing...";$('input:last',$form).val('Sign Up').attr('disabled','disabled');}
$.post("/async/newsletters/subscribe/"+Date.now(),{"email":email,"lids[]":type,},function(response){$("input",$form).remove().end().append("<h2>Thank you!</h2>");ent.nlCookie(type,false);$form.parent().show().fadeTo(0,1);console.log(response);if(s){s.pageName='newsletters : subscribe article form - Subscribe to Entrepreneur Newsletters';s.server=window.location.hostname;s.eVar74=window.top.location.href;s.linkTrackVars='events,list1,eVar13';s.linkTrackEvents='event2';s.events='event2';s.list1=type;s.eVar13=00000;s.tl(this,'o','Newsletter Subscription');}},"json");return false;});$("img.lazy").lazyload({effect:"fadeIn",threshold:300});var popoverT=$('*[data-toggle="popover"]');$(document).on('click',function(e){var popover=$('.popover');if(!popoverT.is(e.target)&&popoverT.has(e.target).length===0&&!popover.is(e.target)&&popover.has(e.target).length===0)
{popover.fadeOut(200).removeClass('active').remove('.popover');}});$(popoverT).on('click',function(e){e.preventDefault();if($(this).hasClass('active')){$(this).removeClass('active').next('.popover').remove();}else{$(this).addClass('active');if($(this).attr('title')){var popoverTitle='<h3 class="popover-title">'+$(this).attr('title')+'</h3>';}else{var popoverTitle='';}
var popoverContent='<div class="arrow"></div><div class="popover-content">'+$(this).data('content')+'</div>';var popoverplacement=$(this).data('placement');$(this).after('<div class="popover '+popoverplacement+'" role="tooltip"><div class="arrow"></div>'+popoverTitle+popoverContent+'</div>');$('.popover').css({left:(($(this).position().left)+($(this).width()))+'px',top:($(this).position().top-($('.popover').outerHeight()/ 2)+($(this).height()/ 2))+'px'}).fadeIn(200);}});$('.show-more').click(function(e){e.preventDefault();var text=$(this).text();$(this).parent().next('.show-more-box').slideToggle(300);$(this).text(text==" Show less "?" Show more ":" Show less ");});$('.dropdown[data-id="ddlatest"]').on('click',function(){var ddId='#'+$('.dropdown').data('id');$(ddId).slideToggle(200);});$('#ddlatest a').click(function(e){e.preventDefault();var key=$(this).data('id');$.get('/async/homestream',{key:key},function(data){var container=$('<div>');console.log(data);for(i in data.links)
{container.append($('<h3>').append($('<a>').attr('href',data.links[i].canonicalUrl).html(data.links[i].headline)).append($('<time>').html(data.links[i].publicationDate)));}
container.append($('<a class="more">').attr('href',data.more).html('More'));$('.pl-headlines .block').html('').append(container);$('#ddlatest').slideUp(200);},'json');});var position=$(window).scrollTop();$(window).on('scroll',function(){var scroll=$(window).scrollTop();if(scroll>60){if($(window).width()<728){if(scroll>position){$('#nav-header').slideUp(100);}else{$('#nav-header').slideDown(100);}}}else{$('#nav-header').show();}
position=scroll;});var $header=$('#nav-header');var $flyout=$('#nav-flyout');var $blackout=$('.blackout');var $navmore=$('.nav-more');var $navsearch=$('.nav-search');var $navmorecontent=$('.nav-more-show');var $subnav=$('.nav-sub');var $siteFrame=$('#nav-header, #story-stream, #page-holder, footer');var $navpromo=$('#nav-promo');var $navpromolink=$('#nav-promo-link');var flyoutgroup=$('#headertopics,#nav-flyout');var flyouttopic=$('#nav-flyout ul li');var maxwidth=1100;var minwidth=1008;var widthoffset=(maxwidth+70);var listtopic=$('.li-navlist');var showmodal=$('.show-modal');var showmodalcontent=$('.show-modal-content');function hide_all(){for(i in ent)
ent[i].hide();}
ent={pnav:{visible:false,show:function(){ent.rnav.hide();ent.dnav.hide();$navpromo.slideDown(200);$navpromolink.addClass('active');this.visible=true;},hide:function(lights_on){$navpromo.slideUp(200);$navpromolink.removeClass('active');this.visible=false;},toggle:function(){this.visible?this.hide(1):this.show();},},dnav:{th:null,show:function(){ent.rnav.hide();ent.pnav.hide();$('body').addClass('of');$flyout.stop(1,1).animate({width:'show'},200);$siteFrame.animate({left:'251px'},200);$('#headertopic').addClass('active');},hide:function(lights_on){ent.navtopic.hide();$flyout.animate({width:'hide'},200);$siteFrame.animate({left:'0'},200);$('body').removeClass('of');$('.nav-sub').hide();$('#headertopic').removeClass('active');},},navtopic:{visible:false,shown:null,sindex:null,list:[],show:function($el){if($el.index()==this.sindex)return;id=$el.data('id');$self=this;if(typeof this.list[id]=='undefined'){$chelement=$el.children('.nav-sub');$chelement.html('');$.get('/async/links/'+id,function(reply){$self.list[id]=reply;for(i in reply){$chelement.append('<a href="'+i+'">'+reply[i]+'</a>');}},'json');}
$el.children('.nav-sub').slideDown(200);this.shown=$el.children('.nav-sub');this.sindex=$el.index();this.visible=true;},hide:function($el,callback){if(!$el)
{this.visible=false;this.shown=null;this.sindex=null;this.list=[]}
if(this.shown==null)return;},},rnav:{visible:null,shown:null,show:function($el){if(ent.dnav.visible)ent.dnav.hide();if(ent.pnav.visible)ent.pnav.hide();$navmorecontent.animate({width:'show'},100);this.shown=$el.index();if(this.shown==1)
$('#gsc-i-id1').focus();this.visible=true;},hide:function(lights_on){$navmorecontent.animate({width:'hide'},100);this.shown=this.visible=null;},toggle:function($el){if(this.shown!=null&&this.shown==$el.index())
return this.hide(1);if(this.visible)
this.hide();this.show($el);},},nlCookie:function(type,x){nTypesExp=cookie.get("nltrExpiration");if(!nTypesExp)
cookie.delete("newsletterTypes");nTypes=cookie.get("newsletterTypes");if(!nTypes)
{cookie.put('newsletterTypes',type,180);cookie.put('nltrExpiration',"1",15);this.hideNl([type],x);}else{types=nTypes.split(",");this.hideNl(types,x);types.push(type);cookie.put("newsletterTypes",types.join(","),180);}},hideNl:function(types,x){if(x===false){types.forEach(function(type){$(".email-signup.type"+type).fadeTo(0,0);});}else{types.forEach(function(type){$(".email-signup.type"+type).remove();});}},};$d.ready(function(){var mnavtimer=[];var showing=false;$('#headertopic, #nav-flyout').on('mouseenter',function(e){mnavtimer[0]=setTimeout(ent.dnav.show,300);clearTimeout(mnavtimer[1]);showing=true;}).on('mouseleave',function(e){mnavtimer[1]=setTimeout(function(){ent.dnav.hide();},200);clearTimeout(mnavtimer[0]);showing=false;});$("body").on("swiperight",function(e){if(e.swipestart.coords[0]<50){ent.dnav.show();}});$("body").on("swipeleft",function(e){ent.dnav.hide();});$('#headertopic').on('click',function(e){if(!showing){e.preventDefault();ent.dnav.show();showing=true;}
else{e.preventDefault();ent.dnav.hide();showing=false;}});htimer=null;$('.li-navlist').on('mouseenter click',function(e){if(e.type=='click'){clearTimeout(htimer);return ent.navtopic.show($(this));}
self=this;htimer=setTimeout(function(){ent.navtopic.show($(self));},600);}).on('mouseleave',function(){clearTimeout(htimer);});$('.li-navlist i.fa').on('click',function(e){e.preventDefault();$(this).siblings('.nav-sub').slideToggle(200);});$('.nav-more span a').bind('click',function(e){e.preventDefault();ent.rnav.toggle($navmorecontent);});var magtimer=null
$('#nav-promo-link, #nav-promo').hover(function(){clearTimeout(magtimer);ent.pnav.show();},function(){magtimer=setTimeout(ent.pnav.hide,200);});});});function throttle(fn,delay,trail){delay||(delay=100);var last=0,timeout,args,context,offset=(trail===false)?0:delay;return function(){var now=+new Date,elapsed=(now-last-offset),args=arguments,context=this;function exec(){timeout&&(timeout=clearTimeout(timeout));fn.apply(context,args);last=now;}
if(elapsed>delay)exec();else if(!timeout&&trail!==false)timeout=setTimeout(exec,delay);};};function debounce(func,threshold,execAsap){var timeout;return function debounced(){var obj=this,args=arguments;function delayed(){if(!execAsap)
func.apply(obj,args);timeout=null;};if(timeout)
clearTimeout(timeout);else if(execAsap)
func.apply(obj,args);timeout=setTimeout(delayed,threshold||100);};}
(function($){var $w=$(window);$.fn.visible=function(almost){if(this.length<1)
return;var $t=this.length>1?this.eq(0):this,t=$t.get(0),vpHeight=$w.height();bottom=(almost)?this.offset().top-almost<$w.scrollTop()+$w.height():false;if(almost){bottom=this.offset().top-almost<$w.scrollTop()+$w.height();}else{bottom=false;}
if(typeof t.getBoundingClientRect==='function'){var rec=t.getBoundingClientRect(),tViz=rec.top>=0&&rec.top<vpHeight,bViz=rec.bottom>0&&rec.bottom<=vpHeight;retval=(tViz||bViz);}else{var viewTop=$w.scrollTop(),viewBottom=viewTop+vpHeight,_top=$t.offset().top,_bottom=_top+$t.height();retval=(_top<=viewBottom)&&(_bottom>=viewTop);}
return retval||bottom;};})(jQuery);(function(){var t=[].indexOf||function(t){for(var e=0,n=this.length;e<n;e++){if(e in this&&this[e]===t)return e}return-1},e=[].slice;(function(t,e){if(typeof define==="function"&&define.amd){return define("waypoints",["jquery"],function(n){return e(n,t)})}else{return e(t.jQuery,t)}})(this,function(n,r){var i,o,l,s,f,u,c,a,h,d,p,y,v,w,g,m;i=n(r);a=t.call(r,"ontouchstart")>=0;s={horizontal:{},vertical:{}};f=1;c={};u="waypoints-context-id";p="resize.waypoints";y="scroll.waypoints";v=1;w="waypoints-waypoint-ids";g="waypoint";m="waypoints";o=function(){function t(t){var e=this;this.$element=t;this.element=t[0];this.didResize=false;this.didScroll=false;this.id="context"+f++;this.oldScroll={x:t.scrollLeft(),y:t.scrollTop()};this.waypoints={horizontal:{},vertical:{}};this.element[u]=this.id;c[this.id]=this;t.bind(y,function(){var t;if(!(e.didScroll||a)){e.didScroll=true;t=function(){e.doScroll();return e.didScroll=false};return r.setTimeout(t,n[m].settings.scrollThrottle)}});t.bind(p,function(){var t;if(!e.didResize){e.didResize=true;t=function(){n[m]("refresh");return e.didResize=false};return r.setTimeout(t,n[m].settings.resizeThrottle)}})}t.prototype.doScroll=function(){var t,e=this;t={horizontal:{newScroll:this.$element.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.$element.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};if(a&&(!t.vertical.oldScroll||!t.vertical.newScroll)){n[m]("refresh")}n.each(t,function(t,r){var i,o,l;l=[];o=r.newScroll>r.oldScroll;i=o?r.forward:r.backward;n.each(e.waypoints[t],function(t,e){var n,i;if(r.oldScroll<(n=e.offset)&&n<=r.newScroll){return l.push(e)}else if(r.newScroll<(i=e.offset)&&i<=r.oldScroll){return l.push(e)}});l.sort(function(t,e){return t.offset-e.offset});if(!o){l.reverse()}return n.each(l,function(t,e){if(e.options.continuous||t===l.length-1){return e.trigger([i])}})});return this.oldScroll={x:t.horizontal.newScroll,y:t.vertical.newScroll}};t.prototype.refresh=function(){var t,e,r,i=this;r=n.isWindow(this.element);e=this.$element.offset();this.doScroll();t={horizontal:{contextOffset:r?0:e.left,contextScroll:r?0:this.oldScroll.x,contextDimension:this.$element.width(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:r?0:e.top,contextScroll:r?0:this.oldScroll.y,contextDimension:r?n[m]("viewportHeight"):this.$element.height(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};return n.each(t,function(t,e){return n.each(i.waypoints[t],function(t,r){var i,o,l,s,f;i=r.options.offset;l=r.offset;o=n.isWindow(r.element)?0:r.$element.offset()[e.offsetProp];if(n.isFunction(i)){i=i.apply(r.element)}else if(typeof i==="string"){i=parseFloat(i);if(r.options.offset.indexOf("%")>-1){i=Math.ceil(e.contextDimension*i/100)}}r.offset=o-e.contextOffset+e.contextScroll-i;if(r.options.onlyOnScroll&&l!=null||!r.enabled){return}if(l!==null&&l<(s=e.oldScroll)&&s<=r.offset){return r.trigger([e.backward])}else if(l!==null&&l>(f=e.oldScroll)&&f>=r.offset){return r.trigger([e.forward])}else if(l===null&&e.oldScroll>=r.offset){return r.trigger([e.forward])}})})};t.prototype.checkEmpty=function(){if(n.isEmptyObject(this.waypoints.horizontal)&&n.isEmptyObject(this.waypoints.vertical)){this.$element.unbind([p,y].join(" "));return delete c[this.id]}};return t}();l=function(){function t(t,e,r){var i,o;r=n.extend({},n.fn[g].defaults,r);if(r.offset==="bottom-in-view"){r.offset=function(){var t;t=n[m]("viewportHeight");if(!n.isWindow(e.element)){t=e.$element.height()}return t-n(this).outerHeight()}}this.$element=t;this.element=t[0];this.axis=r.horizontal?"horizontal":"vertical";this.callback=r.handler;this.context=e;this.enabled=r.enabled;this.id="waypoints"+v++;this.offset=null;this.options=r;e.waypoints[this.axis][this.id]=this;s[this.axis][this.id]=this;i=(o=this.element[w])!=null?o:[];i.push(this.id);this.element[w]=i}t.prototype.trigger=function(t){if(!this.enabled){return}if(this.callback!=null){this.callback.apply(this.element,t)}if(this.options.triggerOnce){return this.destroy()}};t.prototype.disable=function(){return this.enabled=false};t.prototype.enable=function(){this.context.refresh();return this.enabled=true};t.prototype.destroy=function(){delete s[this.axis][this.id];delete this.context.waypoints[this.axis][this.id];return this.context.checkEmpty()};t.getWaypointsByElement=function(t){var e,r;r=t[w];if(!r){return[]}e=n.extend({},s.horizontal,s.vertical);return n.map(r,function(t){return e[t]})};return t}();d={init:function(t,e){var r;if(e==null){e={}}if((r=e.handler)==null){e.handler=t}this.each(function(){var t,r,i,s;t=n(this);i=(s=e.context)!=null?s:n.fn[g].defaults.context;if(!n.isWindow(i)){i=t.closest(i)}i=n(i);r=c[i[0][u]];if(!r){r=new o(i)}return new l(t,r,e)});n[m]("refresh");return this},disable:function(){return d._invoke.call(this,"disable")},enable:function(){return d._invoke.call(this,"enable")},destroy:function(){return d._invoke.call(this,"destroy")},prev:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){if(e>0){return t.push(n[e-1])}})},next:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){if(e<n.length-1){return t.push(n[e+1])}})},_traverse:function(t,e,i){var o,l;if(t==null){t="vertical"}if(e==null){e=r}l=h.aggregate(e);o=[];this.each(function(){var e;e=n.inArray(this,l[t]);return i(o,e,l[t])});return this.pushStack(o)},_invoke:function(t){this.each(function(){var e;e=l.getWaypointsByElement(this);return n.each(e,function(e,n){n[t]();return true})});return this}};n.fn[g]=function(){var t,r;r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[];if(d[r]){return d[r].apply(this,t)}else if(n.isFunction(r)){return d.init.apply(this,arguments)}else if(n.isPlainObject(r)){return d.init.apply(this,[null,r])}else if(!r){return n.error("jQuery Waypoints needs a callback function or handler option.")}else{return n.error("The "+r+" method does not exist in jQuery Waypoints.")}};n.fn[g].defaults={context:r,continuous:true,enabled:true,horizontal:false,offset:0,triggerOnce:false};h={refresh:function(){return n.each(c,function(t,e){return e.refresh()})},viewportHeight:function(){var t;return(t=r.innerHeight)!=null?t:i.height()},aggregate:function(t){var e,r,i;e=s;if(t){e=(i=c[n(t)[0][u]])!=null?i.waypoints:void 0}if(!e){return[]}r={horizontal:[],vertical:[]};n.each(r,function(t,i){n.each(e[t],function(t,e){return i.push(e)});i.sort(function(t,e){return t.offset-e.offset});r[t]=n.map(i,function(t){return t.element});return r[t]=n.unique(r[t])});return r},above:function(t){if(t==null){t=r}return h._filter(t,"vertical",function(t,e){return e.offset<=t.oldScroll.y})},below:function(t){if(t==null){t=r}return h._filter(t,"vertical",function(t,e){return e.offset>t.oldScroll.y})},left:function(t){if(t==null){t=r}return h._filter(t,"horizontal",function(t,e){return e.offset<=t.oldScroll.x})},right:function(t){if(t==null){t=r}return h._filter(t,"horizontal",function(t,e){return e.offset>t.oldScroll.x})},enable:function(){return h._invoke("enable")},disable:function(){return h._invoke("disable")},destroy:function(){return h._invoke("destroy")},extendFn:function(t,e){return d[t]=e},_invoke:function(t){var e;e=n.extend({},s.vertical,s.horizontal);return n.each(e,function(e,n){n[t]();return true})},_filter:function(t,e,r){var i,o;i=c[n(t)[0][u]];if(!i){return[]}o=[];n.each(i.waypoints[e],function(t,e){if(r(i,e)){return o.push(e)}});o.sort(function(t,e){return t.offset-e.offset});return n.map(o,function(t){return t.element})}};n[m]=function(){var t,n;n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[];if(h[n]){return h[n].apply(null,t)}else{return h.aggregate.call(null,n)}};n[m].settings={resizeThrottle:100,scrollThrottle:30};return i.load(function(){return n[m]("refresh")})})}).call(this);var cookie={put:function(name,value,expire){var expires="";if(expire){var date=new Date();date.setTime(date.getTime()+(expire*24*60*60*1000));expires="; expires="+date.toGMTString();}
document.cookie=name+"="+value+expires+"; path=/";},get:function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')
c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)
return c.substring(nameEQ.length,c.length);}
return null;},delete:function(name){this.put(name,'',-1);}};