function showAjaxAnim(b){if(b==null){b="ajaxanim"}if($(b)==null){return}Event.observe(window,"unload",function(){$(b).hide()});$(b).show();var a=$(b).src;setTimeout("changeSrc('"+b+"', '"+a+"')",500)}function changeSrc(b,a){$(b).src=a}function focusOnFormError(){var a=$$("form .error input");if(a.length>0){a[0].activate()}}function addCommas(b){b+="";x=b.split(".");x1=x[0];x2=x.length>1?"."+x[1]:"";var a=/(\d+)(\d{3})/;while(a.test(x1)){x1=x1.replace(a,"$1,$2")}return x1+x2}emailRe=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;function validateSubscription(){name=$F("news-sub-name");email=$F("news-sub-email");if(name.length==0&&email.length==0){return}result=email.match(emailRe);if(!result){alert("Invalid email address!");$("news-sub-email").focus();return}if(name.length==0){alert("Please enter your name");$("news-sub-name").focus();return}showAjaxAnim("ajaxanim-subscribe");new Ajax.Request(subscriptionUrl,{method:"post",parameters:"email="+email+"&name="+name,onSuccess:function(a){if($("ajaxanim-subscribe")!=null){$("ajaxanim-subscribe").hide()}alert("You've been subscribed! We've sent you an email explaining how to unsubscribe too...")}})}function newsSubBtn(){Event.observe(window,"load",function(){var a=new YAHOO.widget.Button("newsletter-subscription");$("newsletter-subscription").observe("click",validateSubscription)})};