(function(){window.WebFontConfig={google:{families:["Droid+Sans:400,700:latin"]}},$script(["http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js","http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"],function(){return $(document).ready(function(){$(window).resize(function(){var a,b,c,d;c=$(window).height(),d=$(window).width(),a=$(".page").outerHeight(),b=$(".page").outerWidth(),a>c&&(a=c),b>d&&(b=d);return $(".page").css("top",""+(c-a)/2.5+"px").css("left",""+(d-b)/2+"px")}).resize(),$("#main, #foot").show(),$('a[href$="@"]').each(function(){var a;a=""+$(this).attr("href")+"far.to",$(this).attr("href","mailto:"+a);if($(this).text()==="")return $(this).text(a)}),$('a[href^="#"]').click(function(a){var b;a.preventDefault(),b=$(this).attr("href"),$(".page").hide();return $(b).show()}),$("input.default").live("focus",function(){return $(this).removeClass("default").attr("value","")}),$("input").live("blur",function(){if($(this).val().trim()==="")return $(this).addClass("default").attr("value","type your address here and press [enter]")}),$("#origin").live("keypress",function(a){var b;if(a.which===13&&$(this).val().trim()!==""){$(this).attr("readonly","readonly"),b=$(this).val().trim();return $.getJSON("put.php",{address:b},function(a){var b;if(a.status==="success"){b=(new Number(a.id)).toString(36),$(document.createElement("a")).addClass("result").attr("href","http://far.to/"+b).text("http://far.to/"+b).replaceAll("#origin");return $("#main p").text("You can safely tweet or email this link so others can see how far away from you they are.  Your real address will never be visible.")}alert(a.message);return $("#origin").removeAttr("readonly")})}});return $("#destination").live("keypress",function(a){var b;if(a.which===13&&$(this).val().trim()!==""){$(this).attr("readonly","readonly"),b=$(this).val().trim();return $.getJSON("get.php",{address:b,id:origin_id},function(a){var b,c,d,e;a.status==="success"?(b=Math.round(a.distance*.00621371192)/10,b===0&&(b="less than 5"),d=Math.floor(a.duration/3600),e=Math.round(a.duration/60-d*60),c=[d>0?d+(d>1?" hours":" hour"):"",e>0?e+(e>1?" minutes":" minute"):""].join(" ").trim(),c===""&&(c="less than 10 minutes"),$("#main p").html("You are are <strong>"+b+" miles</strong> and <strong>"+c+"</strong> away from the original location.  Change the address below to recalculate."),$("#destination").attr("value",a.destination)):a.status==="rate_limited"?$("#main p").html("Oops! We're exceeded our query limit rate, please try again in a few minutes."):a.status==="not_ok"?$("#main p").html("We couldn't find a route&mdash;the original address may not be valid.  You can edit your address below try again."):alert(a.status+": "+a.message);return $("#destination").removeAttr("readonly")})}})})})}).call(this)
