function log(a){if(typeof(console)!="undefined"&&typeof(console.log)=="function"){console.log(a)}}$(function(){$(".basic-form input, .basic-form textarea").focus(function(){$(".basic-form").find("div").removeClass("active");$(".basic-form").find("div.help>span.arrow").remove();$(this).parent().parent().prev("div.help").addClass("active").prepend('<span class="arrow"></span>')});$(".payment-options input[type=radio]").click(function(){$(".payment-options").removeClass("selected");$(this).parent().parent().addClass("selected")});$(".filter-checks input[type=checkbox]").click(function(){if($(this).is(":checked")){$(this).parent().addClass("active")}else{$(this).parent().removeClass("active")}});$(".autoclear-refill").each(function(b){var a=new GlobalHelper();$(b).focus(function(){a.clear_field(this)});$(b).blur(function(){a.fill_field(this)})})});$.fn.clearForm=function(){return this.each(function(){var b=this.type,a=this.tagName.toLowerCase();if(a=="form"){return $(":input",this).clearForm()}if(b=="text"||b=="password"||a=="textarea"){this.value=""}else{if(b=="checkbox"||b=="radio"){this.checked=false}else{if(a=="select"){this.selectedIndex=-1}}}})};function FormHelper(a){if(a){this.__form=$("#"+a)}else{this.__form=$("form")}}FormHelper.prototype.ajax_submit=function(b,c){this.__clear_errors();var a=this;$.post(this.__form.attr("action"),this.__form.serialize(),function(d){if(d.success){b(d)}else{if(c!=undefined){c(d)}else{a.__fill_errors(d)}}},"json")};FormHelper.prototype.__fill_errors=function(a){if(a.form!=undefined){for(var b in a.form.errors){if(b!="non_field_errors"){this.__form.find("#id_error_container_"+b).html(a.form.errors[b]);this.__form.find("#id_"+b+"_container").addClass("errorRow").addClass("errRow")}else{this.__form.prepend('<div id="id_non_field_errors" class="err"><p class="hed">Oops.</p>'+a.form.errors.non_field_errors+"</div>")}}}if(a.errors.length>0){this.__form.prepend('<div id="id_non_field_errors" class="err"><p class="hed">Oops.</p>'+a.errors+"</div>")}if(this.__after_fill_errors){this.__after_fill_errors(a)}};FormHelper.prototype.__clear_errors=function(){this.__form.find("div.error_container").empty();this.__form.find("div.formRow").removeClass("errorRow").removeClass("errRow");$("#id_non_field_errors").remove()};function GlobalHelper(){}GlobalHelper.prototype.clear_field=function(a){var b=$(a).attr("title");if($(a).val()==b){$(a).val("");$(a).css({color:"#000"})}};GlobalHelper.prototype.fill_field=function(a){var b=$(a).attr("title");if($(a).val()==""){$(a).val(b);$(a).css({color:"#ccc"})}};GlobalHelper.prototype.redirect_to_self=function(){var a=location.href;var b=a.indexOf("#");if(b!=-1){a=a.substring(0,b)}location.href=a};$(function(){$(".badge, .hover-title").each(function(){var a=$(this).attr("title");$(this).attr({title:""});$(this).simpletip({content:a}).show()})});$(document).ready(function(){if(!$.cookie("browser_warning")){if(jQuery.browser.msie){var a=parseInt(jQuery.browser.version,10);if(a==6){$("#browser_name").html("Internet Explorer 6");$("#supported_browsers").click()}}if(jQuery.browser.opera){$("#browser_name").html("Opera");$("#supported_browsers").click()}}});function AutoComplete(b,a){this.VALUES=[];this._form=$(b);this.exclude_fields=a||[];this.update_from_form(true);this.hookup_events()}AutoComplete.prototype.hookup_events=function(){var a=this;this._form.find("input[type=text], textarea").live("focus",function(){$(this).autocomplete(a.VALUES)});this._form.find("input[type=text], textarea").live("change",function(b){a.update_from_form()})};AutoComplete.prototype.send=function(){var b=this;var a=this.VALUES.join("|");$.ajax({url:"/do-my-taxes/autocomplete-values/",cache:false,dataType:"json",type:"POST",data:{new_values:a},success:function(c){b.VALUES=c.autocomplete_values}})};AutoComplete.prototype.get=function(){var a=this;$.ajax({url:"/do-my-taxes/autocomplete-values/",cache:false,dataType:"json",type:"GET",success:function(b){a.VALUES=b.autocomplete_values}})};AutoComplete.prototype.update_from_form=function(c){var b=this;var d=this._form.find("input[type=text], textarea").serializeArray();var a=this.VALUES.length;$.each(d,function(e,g){if(g.value&&$.inArray(g.name,b.exclude_fields)<0){if($.inArray(g.value,b.VALUES)==-1){var f=$("*[name="+g.name+"]").attr("title");if(g.value!=f){b.VALUES.push(g.value)}}}});if(a!=this.VALUES.length||c){this.send()}};function clear_help_text(a){var b=$(a).attr("title");if($(a).val()==b){$(a).val("");$(a).removeClass("gry")}}function fill_help_text(a){var b=$(a).attr("title");if($(a).val()==""){$(a).val(b);$(a).addClass("gry")}}function activate_help_text(b){var b=$(b);var a="input, textarea";b.find(a).focus(function(){clear_help_text(this)});b.find(a).blur(function(){fill_help_text(this)});b.find(a).each(function(c,d){fill_help_text(d)})};