/** jQuery.mailme **/
  // Replaces all the matching elements with a <a href="mailto:..> tag
  // Automatically queries span.mailme
  jQuery.fn.mailme=function(){var a=/ at /;var b=/ dot /g;this.each(function(){var d=jQuery(this).text().replace(a,"@").replace(b,".");var c=jQuery(this).attr("title");$(this).after('<a href="mailto:'+d+'" title="'+c+'">'+d+"</a>").remove();});};jQuery(function(a){a("span.mailme").mailme();});

/** jQuery.phonelink **/
  // Wraps the inner content with a phone link <a> specific to userAgent
  // Automatically queries span.phonelink
  (function(c){c.fn.extend({phonelink:function(){var d=navigator.userAgent.toUpperCase();var e={country:"na"};if((/iPhone/i).test(d)){return this.each(function(){var g=c(this);var f=b[e.country](g.html());if(!f){return true;}g.wrapInner('<a href="tel:'+f+'"></a>');});}return this;}});function a(d){return d!==undefined&&d!==null;}var b={na:function(d,e){if(!a(d)||!typeof(d)=="string"){return d;}e=(a(e)&&typeof(d)=="string")?e:"-";var g=/^(?:\D*(\d{0,2})\D*([02-9]\d{2})\D*(\d{3})\D*(\d{4})\D*(\d*)\D*$){0,1}/;var h=d.match(g);if(h===null){return"";}var f=h[2]+e+h[3]+e+h[4];if(h[5]){f+=" x"+h[5];}if(!h[1]||h[1]==="0"){h[1]="1";}f="+"+h[1]+e+f;return f;}};})(jQuery);jQuery(function(a){a("span.phonelink").phonelink();});

/** jQuery.linkto **/
  (function(a){a.fn.extend({linkto:function(c){var b=this;b.o=a.extend({},{box:"#linkto",offsetX:4,offsetY:0,iframeHeight:350,iframeWidth:425},c);b.freeID=function(f,e){f=f||"linkto";e=e||"o";if(a(f).length>0){return arguments.callee(f+e,e);}return f;};b.encodeURL=function(e){return encodeURIComponent(e).replace(/\'/g,"%27").replace(/\%/g,"&#x");};b.$box=a(b.o.box);if(b.$box.length>0){b.isBoxAuto=false;b.$box=b.$box.eq(0);}else{b.isBoxAuto=true;b.$box=a("<div>").attr("id",b.freeID()).css({position:"absolute","z-index":"999"}).html("<a class='close' href='#'></a><div class='link'><div>Paste link in <b>email</b> or <b>IM</b></div><input></div><div class='embed'><div>Paste HTML to embed in <b>website</b></div><input></div>").appendTo("body");}b.$box.hide().css({position:"absolute","z-index":"999"});b.isVisible=false;b.currentLink=null;b.$link=b.$box.find("div.link");b.$link.$input=b.$link.find("input");b.$embed=b.$box.find("div.embed");b.$embed.$input=b.$embed.find("input");var d=b.$box.find(".close");if(d.length>0){d.click(function(){b.$box.hide();b.isVisible=false;b.currentLink=null;return false;});if(b.isBoxAuto){d.css({position:"absolute",display:"block",top:"2px",right:"2px","z-index":"999"});}}return this.each(function(){var e=this,f=a(e);f.each(function(){var j=this,i=a(j);var h=i.attr("href");j.__link=!h?null:h;var g=i.attr("embeddable");g=g!==undefined&&g?true:false;j.__embed=!j.__link||!g?null:"<iframe width='"+b.o.iframeWidth+"' height='"+b.o.iframeHeight+"' src='"+b.encodeURL(j.__link)+"' frameborder='0' scrolling='no' marginheight='0' marginwidth='0'></iframe>";});f.show();f.click(function(){var h=this,g=a(h);var i=g.offset();if(b.isVisible&&b.currentLink===h){b.$box.hide();b.isVisible=false;b.currentLink=null;return false;}b.$box.css({top:(i.top+b.o.offsetY)+"px",left:(i.left+f.width()+b.o.offsetX)+"px"});if(h.__link&&b.$link.length>0&&b.$link.$input.length>0){b.$link.$input.val(h.__link);b.$link.show();}else{b.$link.hide();}if(h.__embed&&b.$embed.length>0&&b.$embed.$input.length>0){b.$embed.$input.val(h.__embed);b.$embed.show();}else{b.$embed.hide();}b.isVisible=true;b.currentLink=h;b.$box.show();return false;});});}});})(jQuery);
