function setMaxHeight(){var t=$(".viking-promotions"),n=".promo-flagship";t.each(function(){var i=$(this),t=0;i.find(n).each(function(){$(this).css("height","")});$(window).width()>"767"&&(i.find(n).each(function(){var i=$(this),n=i.outerHeight(!0);n>t&&(t=n)}),$(n).css("height",t-30))});$(".cta-group").css("opacity","1")}function initialisePromoForm(n){var t=typeof n!="undefined"?n:"#form_special_offers_promo";self.createBeacon=function(n){var t=$("#iTBW"),i=Math.random()+"",r=i*1e13;successHtml=$("<div><\/div>");successHtml.html('<iframe src="https://4361699.fls.doubleclick.net/activityi;src=4361699;type=promo-;cat='+n+";dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord="+r+'?" width="1" height="1" frameborder="0" style="display:none"><\/iframe>');t.empty().append(successHtml)};$(t).unbind("submit.vrc_modal_submit").bind("submit.vrc_modal_submit",function(n){n.preventDefault();var t=$(this).find(":submit,.psuedo-submit");$(this).valid()&&$.post($(this).attr("action"),$(this).serialize(),function(n){var r,i;if(EnableElement(t),viewModel.error(n),viewModel.error()!=null||viewModel.error()!=""){if(viewModel.error().status==0){if(viewModel.showPromoForm(!1),viewModel.showThankYou(!0),setMaxHeight(),typeof s!="undefined"&&viewModel.error().omnitureDTO!=="undefined"){viewModel.error().omnitureDTO.prop20=s.pageName;r=s.pageName.replace("vfv","thanks vfc");s.pageName=r;try{s.t(viewModel.error().omnitureDTO)}catch(u){}}i=document.getElementById("form_special_offers_promo").getAttribute("cat");i!=="undefined"&&i!=""&&self.createBeacon(i)}else postbackMessage(viewModel.error().message);$("html, body").animate({scrollTop:$("#panelPromotionForm").offset().top-($("#trd-header").height()+21)},100)}}).fail(function(){postbackMessage("Form submission failed!")})})}function postbackMessage(n){var t="",i;t+='<div class="modal-content">';t+='    <div class="modal-header">';t+='        <div class="custom-modal-close-button">';t+='            <button type="button" data-dismiss="modal" class="close">';t+='                <span class="icon icon-close" aria-hidden="true"><\/span>';t+="                &nbsp;";t+='                <span class="close-txt">CLOSE<\/span>';t+="            <\/button>";t+="        <\/div>";t+="    <\/div>";t+='    <div class="modal-body">';i="";i+="    <\/div>";i+="<\/div>";$("#bsModal .modal-dialog").html(t+'<h3 style="margin-top:10px">'+n+"<\/h3>"+i);$("#bsModal").modal("show")}function EnableElement(n){if(n.length){n.removeAttr("disabled");var t=n.next(".submit-busy");t.length&&t.remove()}}$(window).on("load",setMaxHeight);$(window).on("resize",setMaxHeight);var viewModel=new function(){var n=this;n.error=ko.observable("");n.showPromoForm=ko.observable(!0);n.showThankYou=ko.observable(!1)};$(function(){initialisePromoForm("#form_special_offers_promo");ko.applyBindings(viewModel,document.getElementById("panelPromotionForm"))})