
(function(A){A.modal=function(C,B){return A.modal.impl.init(C,B)};A.modal.close=function(){A.modal.impl.close(true)};A.fn.modal=function(B){return A.modal.impl.init(this,B)};A.modal.defaults={overlay:50,overlayId:"modalOverlay",overlayCss:{},containerId:"modalContainer",containerCss:{},close:true,closeTitle:"Close",closeClass:"modalClose",persist:true,onOpen:null,onShow:null,onClose:null};A.modal.impl={opts:null,dialog:{},init:function(C,B){if(this.dialog.data){return false}this.opts=A.extend({},A.modal.defaults,B);if(typeof C=="object"){C=C instanceof jQuery?C:A(C);if(C.parent().parent().size()>0){this.dialog.parentNode=C.parent();if(!this.opts.persist){this.dialog.original=C.clone(true)}}}else{if(typeof C=="string"||typeof C=="number"){C=A("<div>").html(C)}else{if(console){console.log("SimpleModal Error: Unsupported data type: "+typeof C)}return false}}this.dialog.data=C.addClass("modalData");C=null;this.create();this.open();if(A.isFunction(this.opts.onShow)){this.opts.onShow.apply(this,[this.dialog])}return this},create:function(){this.dialog.overlay=A("<div>").attr("id",this.opts.overlayId).addClass("modalOverlay").css(A.extend({opacity:this.opts.overlay/100,height:"100%",width:"100%",position:"fixed",left:0,top:0,zIndex:3000},this.opts.overlayCss)).hide().appendTo("body");this.dialog.container=A("<div>").attr("id",this.opts.containerId).addClass("modalContainer").css(A.extend({position:"fixed",zIndex:3100},this.opts.containerCss)).append(this.opts.close?'<a class="modalCloseImg '+this.opts.closeClass+'" title="'+this.opts.closeTitle+'"></a>':"").hide().appendTo("body");if(A.browser.msie&&(A.browser.version<7)){this.fixIE()}this.dialog.container.append(this.dialog.data.hide())},bindEvents:function(){var B=this;A("."+this.opts.closeClass).click(function(C){C.preventDefault();B.close()})},unbindEvents:function(){A("."+this.opts.closeClass).unbind("click")},fixIE:function(){var C=A(document.body).height()+"px";var B=A(document.body).width()+"px";this.dialog.overlay.css({position:"absolute",height:C,width:B});this.dialog.container.css({position:"absolute"});this.dialog.iframe=A('<iframe src="javascript:false;">').css(A.extend(this.opts.iframeCss,{opacity:0,position:"absolute",height:C,width:B,zIndex:1000,width:"100%",top:0,left:0})).hide().appendTo("body")},open:function(){if(this.dialog.iframe){this.dialog.iframe.show()}if(A.isFunction(this.opts.onOpen)){this.opts.onOpen.apply(this,[this.dialog])}else{this.dialog.overlay.show();this.dialog.container.show();this.dialog.data.show()}this.bindEvents()},close:function(B){if(!this.dialog.data){return false}if(A.isFunction(this.opts.onClose)&&!B){this.opts.onClose.apply(this,[this.dialog])}else{if(this.dialog.parentNode){if(this.opts.persist){this.dialog.data.hide().appendTo(this.dialog.parentNode)}else{this.dialog.data.remove();this.dialog.original.appendTo(this.dialog.parentNode)}}else{this.dialog.data.remove()}this.dialog.container.remove();this.dialog.overlay.remove();if(this.dialog.iframe){this.dialog.iframe.remove()}this.dialog={}}this.unbindEvents()}}})(jQuery);

var JKPlatform={DocumentReady:function(){$(".form-row > LABEL:not(.req)").prepend('<span class="not-required">&nbsp;</span>');$(".form-row > LABEL.req").prepend('<span class="required-star">*</span>')},Data:{cookieLifeTime:365,updateMemberProfile:false,memberId:null,Save:function(A,B){$.cookie(A,B,{expires:this.cookieLifeTime,path:"/"});if(this.updateMemberProfile){}}},Utilities:{StringAfterUnderscore:function(A){return A.substr(A.indexOf("_")+1)}},Customise:{currentColor:null,currentBackground:null,selectedColor:null,selectedBackground:null,Setup:function(){var A=new String($("body").attr("class"));var B=A.split(" ");for(var C=0;C<B.length;C++){if(B[C].substr(0,3)=="co-"){this.currentColor=B[C].substr(3)}else{if(B[C].substr(0,3)=="bg-"){this.currentBackground=B[C].substr(3)}}}$("#customise-link").click(function(){$("#customise-modal").modal({close:false,onShow:JKPlatform.Customise.ModalShow});return false});$("#color-choices a").click(function(){var D=JKPlatform.Customise;D.selectedColor=$(this).attr("rel").substr(3);$("body").attr("class","co-"+D.selectedColor+" bg-"+D.selectedBackground);$("#color-choices a").removeClass("active");$(this).addClass("active");return false});$("#background-choices a").click(function(){var D=JKPlatform.Customise;D.selectedBackground=$(this).attr("rel").substr(3);$("body").attr("class","co-"+D.selectedColor+" bg-"+D.selectedBackground);$("#background-choices a").removeClass("active");$(this).addClass("active");return false});$("#customise-cancel-button").click(function(){var D=JKPlatform.Customise;$("body").attr("class","co-"+D.currentColor+" bg-"+D.currentBackground);$.modal.close();return false});$("#customise-apply-button").click(function(){var D=JKPlatform.Customise;D.currentColor=D.selectedColor;D.currentBackground=D.selectedBackground;$("body").attr("class","co-"+D.currentColor+" bg-"+D.currentBackground);$.modal.close();JKPlatform.Data.Save("theme-color","co-"+D.currentColor);JKPlatform.Data.Save("theme-background","bg-"+D.currentBackground);return false})},ModalShow:function(){var A=JKPlatform.Customise;A.selectedColor=A.currentColor;A.selectedBackground=A.currentBackground;$("#color-choices a").removeClass("active");$("#color-choices a#color-"+A.selectedColor).addClass("active");$("#background-choices a").removeClass("active");$("#background-choices a#backg-"+A.selectedBackground).addClass("active")}}};function tabnav_select_tab(A){var C=$(A).parents(".tabnav");C.find("li").removeClass("tab_active");$($(A).parent()[0]).addClass("tab_active");var B=$($(A).parents()[1]).attr("id");$.each($.find(".tabs_holder"),function(){if($(this).hasClass(B)){$(this).hide()}});$("#"+$($(A).parent()[0]).attr("id")+"_holder").show()}function tabnav_add_behaviour(){$(".tabnav a").click(function(){tabnav_select_tab(this);return false})};function scrollScreenTo(selector,offset,delay){if(isNaN(selector))var targetOffset=$(selector).offset().top;else var targetOffset=selector;var topOffset=(offset)?offset:0;delay=(delay)?delay:1200;$('html,body').animate({scrollTop:(targetOffset-topOffset)},delay);}
function alertBox(selector,msg,offset){offset=(offset)?offset:70
$(selector+' .close a').click(function(){$(this).parents('.alert_box').hide();});$(selector+' .html').html(msg);$(selector).show();scrollScreenTo(selector,offset);}
$(function(){$('.form fieldset dl').hover(function(){$(this).addClass('open');},function(){$(this).removeClass('open');});});

