var $cart,initial_cart_offset,lower_boundary_height;function init_shopping_cart_widget(){0!=($cart=$("#shopping_cart_object")).length&&(initial_cart_offset=$cart.offset().top,lower_boundary_height=$("#shopping_cart_boundary").offset().top,$(window).scroll(function(e){var t=$cart.height();$(document).scrollTop()>=initial_cart_offset-parseInt($cart.css("marginTop"))?$(document).scrollTop()+t<lower_boundary_height?$cart.css({top:"0",position:"fixed",zIndex:9}):$cart.css({top:lower_boundary_height-t-initial_cart_offset-parseInt($cart.css("marginTop")),position:"relative"}):$cart.css({top:"10px",position:"relative"})}))}function init_shopping_cart(){$('select[id$="_domain_period"]').each(function(){var e=$(this),t=$(this).prop("id").replace("_domain_period",""),o=$(jquery_id(t+"_ten_year_reg")),r=$(this).get(0);e.change(function(){var e=parseInt($(this).val());0<o.length&&(10==e?(o.prop("checked",!0),disable_period_dropdown(r,!0)):(disable_period_dropdown(r,!1),o.prop("checked",!1)))}),o.click(function(){o.prop("checked")?(e.val(10),disable_period_dropdown(r,!0),e.change()):disable_period_dropdown(r,!1),r.sync_dropdown&&r.sync_dropdown()}),0<o.length&&(o.prop("checked")||10==parseInt($(this).val())?(e.val(10).prop("disabled",!0),o.prop("checked",!0)):(e.prop("disabled",!1),o.prop("checked",!1)),r.sync_dropdown&&r.sync_dropdown())}),$('select[id$="_product_period"]').each(function(){var e=$(this),t=$(this).prop("id").replace("_product_period",""),o=$(jquery_id(t+"_five_year_reg")),r=$(this).get(0),a=$(this).find("option:last"),d=a.val();e.change(function(){var e=parseInt($(this).val());0<o.length&&(e==d?(a.text(a.data("original-period")),o.prop("checked",!0),disable_period_dropdown(r,!0)):(a.text("5 Years"),disable_period_dropdown(r,!1),o.prop("checked",!1)),r.sync_dropdown&&r.sync_dropdown())}),o.click(function(){o.prop("checked")?(a.text(a.data("original-period")),e.val(d),disable_period_dropdown(r,!0),e.change()):(a.text("5 Years"),disable_period_dropdown(r,!1)),r.sync_dropdown&&r.sync_dropdown()}),0<o.length&&(o.prop("checked")||$(this).val()==d?(a.text(a.data("original-period")),e.val(d).prop("disabled",!0),o.prop("checked",!0)):(a.text("5 Years"),e.prop("disabled",!1),o.prop("checked",!1)),r.sync_dropdown&&r.sync_dropdown())}),$('[id$="_remove_from_cart"]').each(function(){var e=$(this).prop("id").replace("_remove_from_cart","");$(this).click(function(){remove_item(e)})}),"function"==typeof setup_tooltip_shopping_cart&&setup_tooltip_shopping_cart(),"function"==typeof initialise_promo_code_input&&initialise_promo_code_input()}function disable_period_dropdown(e,t){var o=$(e);e.dropdown?t?(e.set_disabled(!0),$('<input type="hidden" />').attr("name",o.attr("name")).addClass("period_select").val(o.val()).insertAfter(o)):(o.next("input.period_select").remove(),e.set_disabled(!1)):o.prop("disabled",t)}function load_shopping_cart_widget(){$.get("/ajax/shopping-cart/","display=1",function(e){$("#shopping_cart_object").html(e),$('#shopping_cart_object [id$="_remove_from_cart"]').each(function(){var e=$(this).prop("id").replace("_remove_from_cart","");$(this).click(function(){remove_item(e)})}),$(window).scroll()})}function load_shopping_cart(){$("#shopping_cart_form_holder").load("/ajax/cart_item_update/?output=1",function(){$("select.periodSelect.selectBox, select.periodSelect.selectBoxPreGenerated").each(function(){Dropdown.convert($(this).get(0))}),init_shopping_cart()})}function update_cart(e,t,a,d){$.post(e,t,function(e){if("add"==d?r=$(jquery_id(a+"_add_to_cart")):"remove"==d&&(r=$(jquery_id(a+"_remove_from_cart"))),"object"==typeof e&&e.errors){var t,o="The Following Errors Occurred:\n";for(t=0;t<e.errors.length;t++)o+=" -"+e.errors[t][1]+"\n";return r&&r.length&&r.data("state","normal").closest("tr").addClass("form_validation_error"),void alert(o)}if(r&&r.length&&r.closest("tr").removeClass("form_validation_error"),"add"==d)(r=$(jquery_id(a+"_add_to_cart"))).length&&(r.data("state","normal"),1==e||r.hasClass("added")?(r.removeClass("added"),$(jquery_id(a+"_checkbox")).prop("checked",!1),$(jquery_id(a+"_auth_key")).prop("disabled",!1)):(r.addClass("addedNoHover"),r.hover(function(){$(this).hasClass("addedNoHover")&&($(this).addClass("added"),$(this).removeClass("addedNoHover"))}),$(jquery_id(a+"_checkbox")).prop("checked",!0),$(jquery_id(a+"_auth_key")).prop("disabled",!0)));else if("remove"==d){var r;(r=$(jquery_id(a+"_add_to_cart"))).length&&(r.data("state","normal"),r.removeClass("added"),$(jquery_id(a+"_checkbox")).prop("checked",!1),$(jquery_id(a+"_auth_key")).prop("disabled",!1))}$("#shopping_cart_object").length?load_shopping_cart_widget():($("#shopping_cart_form_holder").html(e),$("#shopping_cart_form_holder table tr").length<=2&&(window.location="/"),$("#shopping_cart_form_holder select.periodSelect.selectBox, #shopping_cart_form_holder select.periodSelect.selectBoxPreGenerated").each(function(){Dropdown.convert($(this).get(0))}),init_shopping_cart(),$.get("/ajax/top-shopping-cart/",function(e){$("#cart_container").html(e.cart),update_top_cart_item_num(e.num_items),init_top_shopping_cart()}),"function"==typeof session_timeout_init&&session_timeout_init())})}function search_booster_quick_add(){-1!=$("#booster_quick_add").val().indexOf(".")?(post_data="key="+encodeURIComponent($("#booster_quick_add").val())+"&search_booster=1",$("#booster_quick_add").hasClass("redirect")&&(window.location="/ajax/cart-item-add/?"+post_data+"&redirect=1")):window.location="/search-submit/order-search-booster/?domain="+$("#booster_quick_add").val()}function certifed_domain_cart_toggle(e){1==$(jquery_id(e+"_certify_domain_reg"))[0].checked?update_cart("/ajax/cart-item-add/","key="+encodeURIComponent(e)+"&domain_certification=1&output=1",e,"add"):update_cart("/ajax/cart-item-remove/","key="+encodeURIComponent(e)+($("#shopping_cart_object").length?"":"&domain_certification=1&output=1"),e,"remove")}function add_item(e){var t=$(jquery_id(e+"_add_to_cart")),o="";t.length&&"clicked"===t.data("state")||(t.length&&t.data("state","clicked"),$(jquery_id(e+"_back_order")).length&&"none"!=$(jquery_id(e+"_back_order")).css("display")&&(o+="&back_order=1"),$(jquery_id(e+"_prereg")).length&&"none"!=$(jquery_id(e+"_prereg")).css("display")&&(o+="&prereg=1"),1==$(jquery_id(e+"_transfer_domain")).val()&&($(jquery_id(e+"_auth_key")).length&&"none"!=$(jquery_id(e+"_auth_key")).css("display")&&(o+="&auth_key="+encodeURIComponent($(jquery_id(e+"_auth_key")).val())),o+="&transfer_domain=1"),update_cart("/ajax/cart-item-add/","key="+encodeURIComponent(e)+($("#shopping_cart_object").length?"":"&output=1")+o,e,"add"))}function remove_item(e){var t=$(jquery_id(e+"_remove_from_cart"));t.length&&"clicked"===t.data("state")||(t.length&&t.data("state","clicked"),update_cart("/ajax/cart-item-remove/","key="+encodeURIComponent(e)+($("#shopping_cart_object").length?"":"&output=1"),e,"remove"))}function update_item(e,t){t="object"==typeof t?t.value:t,update_cart("/ajax/cart-item-update/","key="+encodeURIComponent(e)+"&period="+t+($("#shopping_cart_object").length?"":"&output=1"),e,"update")}function update_button_classes(e){$(".buttonDomainCartAdd").each(function(){$(this).removeClass("added addedNoHover")}),$.each(e,function(e,t){$(jquery_id(t)).addClass("added")})}function number_format(e){e+="","in"==site_locale&&(e=e.replace(/\.00/g,""));for(var t=e.split("."),o=/(\d+)(\d{3})/;o.test(t[0]);)t[0]=t[0].replace(o,"$1,$2");return t[0]+(1<t.length?"."+t[1]:"")}if($(function(){init_shopping_cart_widget(),init_shopping_cart(),$('[id$="_add_to_cart"]').not(".related_domain").each(function(){var e=$(this).prop("id").replace("_add_to_cart","");$(this).click(function(){add_item(e)})})}),void 0===jquery_id)function jquery_id(e){return"#"+e.replace(/(:|\.)/g,"\\$1")}