if(!this.JSON)JSON={};
(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=
/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=
gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function")value=value.toJSON(key);if(typeof rep==="function")value=rep.call(holder,key,value);switch(typeof value){case "string":return quote(value);case "number":return isFinite(value)?String(value):"null";case "boolean":case "null":return String(value);case "object":if(!value)return"null";gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=
1)partial[i]=str(i,value)||"null";v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v)partial.push(quote(k)+(gap?": ":":")+v)}}}else for(k in value)if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v)partial.push(quote(k)+(gap?": ":":")+v)}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+
gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function")JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number")for(i=0;i<space;i+=1)indent+=" ";else if(typeof space==="string")indent=space;rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number"))throw new Error("JSON.stringify");return str("",{"":value})};if(typeof JSON.parse!=="function")JSON.parse=
function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object")for(k in value)if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined)value[k]=v;else delete value[k]}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text))text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse");}})();
var twitterTimer;var jsBlogEntriesUrl=jQuery("#jsBlogEntriesUrl").val();var jsTweetsUrl=jQuery("#jsTweetsUrl").val();var servicesUrl="/lmiservice/service";var atsTeasersMethod="/ats/getAtsSubmissionTeasers";var atsTeasersByAreasMethod="/ats/getAtsSubmissionTeasersByAreas";var btaNamespace="";var btaStfipsPref="";var btaCountiesPref="";var btaTwitterShowPref="";var btaTwitterOedAcctPref="";var btaTwitterOedrAcctPref="";var btaBloggerShowPref="";var btaBloggerApiKeyPref="";
var btaBloggerBlogIdPref="";var btaBiznewsShowPref="";var btaAboutHtmlPref="";
function init_Bta_Portlet(btaNamespace){btaStfipsPref=jQuery("#"+btaNamespace+"btaStfipsPref").val();btaCountiesPref=jQuery("#"+btaNamespace+"btaCountiesPref").val();btaTwitterShowPref=jQuery("#"+btaNamespace+"btaTwitterShowPref").val();btaTwitterOedAcctPref=jQuery("#"+btaNamespace+"btaTwitterOedAcctPref").val();btaTwitterOedrAcctPref=jQuery("#"+btaNamespace+"btaTwitterOedrAcctPref").val();btaBloggerShowPref=jQuery("#"+btaNamespace+"btaBloggerShowPref").val();btaBloggerApiKeyPref=jQuery("#"+btaNamespace+
"btaBloggerApiKeyPref").val();btaBloggerBlogIdPref=jQuery("#"+btaNamespace+"btaBloggerBlogIdPref").val();btaBiznewsShowPref=jQuery("#"+btaNamespace+"btaBiznewsShowPref").val();btaAboutHtmlPref=jQuery("#"+btaNamespace+"btaAboutHtmlPref").val();init_Bta_View();init_Bta_EventBindings();init_Bta_Complete()}function init_Bta_View(){jQuery("#blog h4, #twitter h4, #biznews h4").css({marginTop:"0.5em",marginBottom:"0.5em"})}
function init_Bta_EventBindings(){if(btaTwitterShowPref==1)jQuery(window).resize(function(){setTwitterIframeDimensions()});jQuery("#blogRefresh").unbind("click").on("click",function(){getBlogEntries()});jQuery("#biznewsRefresh").unbind("click").on("click",function(){getAtsItems(false)});jQuery(document).unbind("keypress").on("keypress","#atsKeyword",function(evt){var keyPressed=evt.which||evt.keyCode;if(keyPressed==13){jQuery("#btaBiznewsLaunch").click();evt.cancel=true;return false}});jQuery("#btaBiznewsLaunch").unbind("click").on("click",
function(){var sDate=moment().subtract(4,"week").endOf("day").format("MM-DD-YYYY"),eDate=moment().format("MM-DD-YYYY");atsURL="biznews"+"?cn\x3d\x26ms\x3d\x26st\x3d"+jQuery("#biznewsKeyword").val()+"\x26sd\x3d"+sDate+"\x26ed\x3d"+eDate+"\x26rc\x3d4154000000\x26cc\x3d4101000000\x26ic\x3d00000000\x26etc\x3d0";window.location.href=atsURL});jQuery(".form-search").on("click",".form-text + .clear-text",function(e){e.preventDefault();jQuery(this).prev("input").val("");return false});jQuery(".form-search").on("input",
".form-text",function(e){e.preventDefault();if(jQuery(this).val().length)jQuery(this).addClass("valid-text");else jQuery(this).removeClass("valid-text")});jQuery(".form-search").on("click",".form-text + .clear-text",function(e){e.preventDefault();jQuery(this).prev("input").removeClass("valid-text");jQuery(this).prev("input").focus();return false});jQuery(".form-search input.form-text").on("keyup",function(e){if(e.key==="Enter"||e.keyCode===13)getAtsItems()})}
function init_Bta_Complete(){if(btaTwitterShowPref=="1");if(btaBloggerShowPref=="1")getBlogEntries();if(btaBiznewsShowPref=="1")getAtsItems();if(btaTwitterShowPref=="1")jQuery("#twitter-tab").click();else if(btaBloggerShowPref=="1")jQuery("#blogger-tab").click();else if(btaBiznewsShowPref=="1")jQuery("#biznews-tab").click()}
function getTweets(){var startTime=(new Date).getTime();twitterTimer=setInterval(function(){if((new Date).getTime()-startTime>4E4){clearInterval(twitterTimer);return}setTwitterIframeDimensions()},4E4)}function setTwitterIframeDimensions(){if(jQuery(".twitter-timeline").length>0){jQuery(".twitter-timeline").removeAttr("width");jQuery(".twitter-timeline").width("100%");jQuery(".twitter-timeline").height(515).css("height","515px")}}
function getBlogEntries(){jQuery("#blogItems").empty().hide().html('\x3cdiv style\x3d"verticle-align:top;margin-left:0.4em;"\x3eloading latest items...\x3c/div\x3e').fadeIn("fast");if(btaBloggerShowPref=="1"&&btaBloggerApiKeyPref.length>0&&btaBloggerBlogIdPref.length>0)jQuery.ajax({url:"https://www.googleapis.com/blogger/v3/blogs/"+btaBloggerBlogIdPref+"/posts",type:"GET",async:true,dataType:"json",data:"\x26key\x3d"+btaBloggerApiKeyPref,success:function(postList){var itemsHtml="";if(postList!=null){itemsHtml+=
'\x3cul class\x3d"blogItems" style\x3d"margin:0.3em;padding:0.3em;"\x3e';jQuery(postList.items).each(function(_index,post){var updatedDate=new Date(post.updated);itemsHtml+='\x3cli class\x3d"blogItem" style\x3d"list-style:none outside none;"\x3e';itemsHtml+="\x3cdiv\x3e";itemsHtml+='\x3ch5 class\x3d"m-0 mb-2"\x3e\x3ca href\x3d"'+post.url+'" style\x3d"color:inherit;"\x3e'+post.title+"\x3c/a\x3e\x3c/h5\x3e";itemsHtml+='\x3ch6 class\x3d"mb-1" style\x3d"font-weight: normal;"\x3e'+updatedDate.toDateString()+
"\x3c/h6\x3e";itemsHtml+='\x3cdiv style\x3d"font-size: 0.875rem;"\x3e'+post.content+"\x3c/div\x3e\x3chr/\x3e";itemsHtml+="\x3c/div\x3e";itemsHtml+="\x3c/li\x3e"});itemsHtml+="\x3c/ul\x3e";jQuery("#blogItems").html(itemsHtml);jQuery("#blogItems").find("a").css("margin","0px");jQuery("#blogItems").find("img").css({"max-width":"100%","height":"auto"});jQuery("#blogItems").find("iframe").css({"max-width":"100%","height":"auto"})}else jQuery("#blogItems").html('\x3cdiv style\x3d"verticle-align:top;"\x3eNo items available.\x3c/div\x3e')}});
else jQuery("#blogItems").html('\x3cdiv style\x3d"verticle-align:top;"\x3ePlease configure Blogger.\x3c/div\x3e')}
function getAtsItems(){jQuery("#items").empty().hide().html('\x3cdiv style\x3d"verticle-align:top;margin-left:0.4em;"\x3eloading latest items...\x3c/div\x3e').fadeIn("fast");if(btaCountiesPref==null||btaCountiesPref=="")jQuery.ajax({url:servicesUrl+atsTeasersMethod,async:true,method:"GET",dataType:"json",success:function(data){var itemsHtml="";if(data!=null){itemsHtml+='\x3cul class\x3d"biznewsItems"\x3e';jQuery(data.AtsSubmissionTeaser).each(function(_index,teaser){var jsArticleDate=moment(new Date(teaser.articleDate)).format("MM/DD/YYYY");
itemsHtml+='\x3cli class\x3d"biznewsItem"\x3e\x3cdiv\x3e\x3cspan\x3e'+teaser.summary;itemsHtml+=" \x3cem\x3e"+teaser.mediaSource;if(!isNaN(jsArticleDate)||jsArticleDate!=null||jsArticleDate!=undefined)itemsHtml+=" "+jsArticleDate.toString("M/d/yyyy");itemsHtml+="\x3c/em\x3e\x3c/span\x3e\x3c/div\x3e\x3c/li\x3e"});itemsHtml+="\x3c/ul\x3e";jQuery("#items").html(itemsHtml);jQuery("#biznews h1").html("Latest Items ("+data.AtsSubmissionTeaser.length+")")}else{jQuery("#items").html('\x3cdiv style\x3d"verticle-align:top;"\x3eNo items available.\x3c/div\x3e');
jQuery("#biznews h1").html("Latest Items (0)")}}});else jQuery.ajax({url:servicesUrl+atsTeasersByAreasMethod,async:true,method:"GET",dataType:"json",data:"\x26areas\x3d"+btaCountiesPref.slice(9).replace(/&counties=/g,","),success:function(data){var itemsHtml="";if(data!=null){itemsHtml+='\x3cul class\x3d"biznewsItems"\x3e';jQuery(data.AtsSubmissionTeaser).each(function(_index,teaser){var jsArticleDate=moment(new Date(teaser.articleDate)).format("MM/DD/YYYY");itemsHtml+='\x3cli class\x3d"biznewsItem"\x3e\x3cdiv\x3e\x3cspan\x3e'+
teaser.summary;itemsHtml+=" \x3cem\x3e"+teaser.mediaSource;if(!isNaN(jsArticleDate)||jsArticleDate!=null||jsArticleDate!=undefined)itemsHtml+=" "+jsArticleDate.toString("M/d/yyyy");itemsHtml+="\x3c/em\x3e\x3c/span\x3e\x3c/div\x3e\x3c/li\x3e"});itemsHtml+="\x3c/ul\x3e";jQuery("#items").html(itemsHtml);jQuery("#biznews h1").html("Latest Items ("+data.AtsSubmissionTeaser.length+")")}else{jQuery("#items").html('\x3cdiv style\x3d"verticle-align:top;"\x3eNo items available.\x3c/div\x3e');jQuery("#biznews h1").html("Latest Items (0)")}}})}
;
