jQuery(function(){(function(n){typeof define=="function"&&define.amd?define(["jquery"],n):n(jQuery)})(function(n){function r(n){return n}function f(n){return decodeURIComponent(n.replace(u," "))}function i(n){n.indexOf('"')===0&&(n=n.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return t.json?JSON.parse(n):n}catch(i){}}var u=/\+/g,t=n.cookie=function(u,e,o){var p,c,s,y;if(e!==undefined)return o=n.extend({},t.defaults,o),typeof o.expires=="number"&&(p=o.expires,c=o.expires=new Date,c.setDate(c.getDate()+p)),e=t.json?JSON.stringify(e):String(e),document.cookie=[t.raw?u:encodeURIComponent(u),"=",t.raw?e:encodeURIComponent(e),o.expires?"; expires="+o.expires.toUTCString():"",o.path?"; path="+o.path:"",o.domain?"; domain="+o.domain:"",o.secure?"; secure":""].join("");var w=t.raw?r:f,b=document.cookie.split("; "),h=u?undefined:{};for(s=0,y=b.length;s<y;s++){var v=b[s].split("="),a=w(v.shift()),l=w(v.join("="));if(u&&u===a){h=i(l);break}u||(h[a]=i(l))}return h};t.defaults={},n.removeCookie=function(t,i){return n.cookie(t)!==undefined?(n.cookie(t,"",n.extend({},i,{expires:-1})),!0):!1}})}),function(n){n.localpatient=function(t,i){var r=this;r.settings={},r.defaults={base_url:"http://localpatient.my-online-check.com/lp_campaigns_get_did",cookie_key:function(){return this.account_id+"_lp_number"},default_number:"17273246283",account_id:"1139",referrer:document.referrer,formatter:null,didPrintNumber:null,isPremium:!1};var c={"google.[a-z.]+/url":"google_organic","google.[a-z.]+/aclk":"google_paid","google.[a-z.]+/maps":"google_places",existing:"ex_patient","bing.com":"bing_organic","yahoo.com":"yahoo_organic","yelp.com":"yelp"},h={"angieslist.com":"angies_list","facebook.com":"facebook","http://www.t.co":"twitter","http://t.co":"twitter","youtube.com":"youtube"},a=function(){var i=l("q"),t,r;return i.length===0&&(t=n.cookie("__utmz"),typeof t!="undefined"&&(r=t.split("|"),n.each(r,function(n,t){t.match(/utmctr/)!==null&&(i=t.split("=")[1])}))),i},f=function(){if(r.settings.referrer==="")return"direct_refer";var t=null;return n.each(c,function(n,i){if(r.settings.referrer.match(n)!==null){t=i;return}}),t===null&&r.settings.isPremium&&n.each(h,function(n,i){if(r.settings.referrer.match(n)!==null){t=i;return}}),t},l=function(n){var i="[\\?&]"+n+"=([^&#]*)",u=new RegExp(i),t=u.exec(r.settings.referrer);return t===null?"":decodeURIComponent(t[1].replace(/\+/g," "))},e=function(){var t=r.settings.base_url+"/"+r.settings.account_id+"/"+f()+"/?",n=a();return n!==null&&n!==""&&(t+="keyword="+n+"&"),t+="callback=?"},s=function(){n.getJSON(e(),function(t){t.did.length>0?(u(t.did,!0),n.cookie(r.settings.cookie_key(),t.did,{path:"/",expires:14})):u(r.settings.default_number,!0)})},u=function(t,i){r.settings.formatter!==null&&(t=r.settings.formatter(t)),n(r.el).html(t),r.settings.didPrintNumber!==null&&i&&r.settings.didPrintNumber(t)},o=function(){r.settings=n.extend({},r.defaults,i),r.el=t;var e=n.cookie(r.settings.cookie_key());typeof e=="undefined"&&f()!==null?(u(r.settings.default_number,!1),s()):typeof e=="undefined"?u(r.settings.default_number,!0):u(e,!0)};o()}}(jQuery);var ipapp=function(n,t,i,r,u){var f=this;f.changePhone=function(n,t){$.ajax({type:"POST",contentType:"application/json; charset=utf-8",dataType:"json",url:"/lssvc.asmx/flarephone",data:JSON.stringify({script:this.fs,number:n,phimg:this.phimg}),success:function(i){$("#"+t)[0].src=i.hasOwnProperty("d")?i.d:i,$("#"+t).parents("a")[0].protocol=="tel:"&&($("#"+t).parents("a")[0].href="tel:"+n),$("#phspan").show()},error:function(){$("#phspan").show()}})},f.fs=$("#"+n)[0].value,f.phimg=$("#"+t)[0].value,f.account_id=r,f.default_number=u,f.formatter=function(n){return n.substr(1,3)+"-"+n.substr(4,3)+"-"+n.substr(7,4)},f.elevenDigitPhone=function(){if(f.default_number.length==10)return"1"+f.default_number},new jQuery.localpatient(".number",{account_id:f.account_id,default_number:f.elevenDigitPhone(),formatter:f.formatter,isPremium:!0,didPrintNumber:function(){f.changePhone($("#fs")[0].innerHTML,i)}})},ipappText=function(n,t){var i=this;i.account_id=n,i.default_number=t,i.formatter=function(n){return n.substr(1,3)+"-"+n.substr(4,3)+"-"+n.substr(7,4)},i.elevenDigitPhone=function(){if(i.default_number.length==10)return"1"+i.default_number},new jQuery.localpatient(".number",{account_id:i.account_id,default_number:i.elevenDigitPhone(),formatter:i.formatter,isPremium:!0,didPrintNumber:function(){}})}