$(document).ready(function(){$("textarea").autoResize({extraSpace:15});$("#aboutbutton").click(function(){$(".contactbox").hide();$(".aboutbox").toggle("drop",200)});var a={over:function(){},timeout:1500,out:function(){$(".aboutbox").hide()}};$("#aboutbutton").hoverIntent(a);$("#contactbutton").click(function(){$(".aboutbox").hide();$(".contactbox").toggle("drop",100)});var a={over:function(){},timeout:1500,out:function(){$(".contactbox").hide()}};$("#contactbutton").hoverIntent(a);$("#tsbdayoffer").change(function(){if($("#tsbdayoffer").val()=="6"){$("#customfood").show()}else{$("#customfood").hide()}});$("#feedbackbox").click(function(){$("#feedbackbox").hide();$("#feedbackform").show();$("#feedbackform textarea").focus();$("#feedbackform textarea").autoResize({extraSpace:15});$.scrollTo("#feedbackform")});$("#thefeedbackform").submit(function(){var b=$("#thefeedbackform").serialize();$.ajax({type:"POST",url:"/processing/feedbackform.php",data:b,dataType:"json",success:function(c){if(c.noErrors==1){$("#feedbackerror").hide();$("#feedbackform").html("<p style='margin-bottom:5px;padding-top:40px;font-size:1.5em;color:#cc1100;'><b>Thank you for sending feedback.</b></p><p style='margin-bottom:36px;'>We'll get back to you with an answer/response as quickly as we can.</p>")}else{$("#feedbackerror").text("");$.each(c,function(d,e){$("#feedbackerror").append("<p>"+e+"</p>")});$("#feedbackerror p:last").remove();$("#feedbackerror").show()}}});return false});$("#showhideoptions").click(function(){$("#fobox").hide();$("#complexitysection").show()});$("#hideoptions").click(function(){$("#fobox").show();$("#complexitysection").hide()});$("#showhideoptions").hover(function(){$(this).css("border","solid #000000 1px")},function(){$(this).css("border","solid #BBBBBB 1px")});$("#hideoptions").hover(function(){$(this).css("border","solid #000000 1px")},function(){$(this).css("border","solid #BBBBBB 1px")});$("#opt-changebasic").hover(function(){$(this).css("border","solid #000000 1px")},function(){$(this).css("border","solid #BBBBBB 1px")});$("#opt-changeoffer").hover(function(){$(this).css("border","solid #000000 1px")},function(){$(this).css("border","solid #BBBBBB 1px")});$("#opt-viewemail").hover(function(){$(this).css("border","solid #000000 1px")},function(){$(this).css("border","solid #BBBBBB 1px")});$("#opt-addlogo").hover(function(){$(this).css("border","solid #000000 1px")},function(){$(this).css("border","solid #BBBBBB 1px")});$("#opt-emaillist").hover(function(){$(this).css("border","solid #000000 1px")},function(){$(this).css("border","solid #BBBBBB 1px")});$("#opt-changebasic").click(function(){window.location=$(this).find("a").attr("href");return false});$("#opt-changeoffer").click(function(){window.location=$(this).find("a").attr("href");return false});$("#opt-viewemail").click(function(){window.location=$(this).find("a").attr("href");return false});$("#opt-emaillist").click(function(){window.location=$(this).find("a").attr("href");return false});$("#opt-addlogo").click(function(){window.location=$(this).find("a").attr("href");return false});$("#showcustlists").toggle(function(){$("#custlists").toggle();$("#custlisttoggle").replaceWith('<span id="custlisttoggle">Hide upcoming/past customers.</span>')},function(){$("#custlists").toggle();$("#custlisttoggle").replaceWith('<span id="custlisttoggle">See upcoming/past customers.</span>')});$("#addemailform").submit(function(){var b=$("#addemailform").serialize();$.ajax({type:"POST",url:"/processing/addemailform.php",data:b,dataType:"json",success:function(c){if(c.noErrors==2){$("#addemaillast").hide();$("#addemailerror").hide();clearAddEmailForm();clearAddEmailMessages();$("#addemailidentical").slideDown();$("#addemailidentical").effect("highlight",{},6000);$("#identicalmembermsg").text(c.identicalmsg);$("#emailinput").focus()}else{if(c.noErrors==1){$("#addemailerror").hide();$("#addemailidentical").hide();clearAddEmailForm();clearAddEmailMessages();$("#addemaillast").slideDown();$("#addemaillast").effect("highlight",{},6000);var e=getMonthName(c.month);var d=getDaySuffix(c.day);$("#lastmembermsg").html("<b>You just added a member</b> with the email address <b>"+c.email+"</b> and a birthday on <b>"+e+" "+c.day+d+"</b>. &nbsp;&nbsp;<span id='lastmemberundo'>Click here to undo</span>");$("#dashmemnum").text(c.nummembers);$("#emailinput").focus()}else{$("#addemaillast").hide();$("#addemailidentical").hide();$("#addemailerror").slideDown();$("#addemailerrorlist").text("");$.each(c,function(f,g){$("#addemailerrorlist").append("<li>"+g+"</li>")});$("#addemailerror li:last").remove()}}}});return false});$("#lastmemberundo").live("click",function(){$("#lastmembermsg").load("/processing/undolastmember.php",function(){$("#lastmembermsg").text("We have removed the last member that you added.");$("#addemaillast").effect("highlight",{},6000);var b=$("#dashmemnum").text()-1;$("#dashmemnum").text(b)})});$("#monthinput").keypress(function(b){if(b.keyCode==47||b.charCode==47||b.keyCode==45||b.charCode==45){$("#dayinput").focus();return false}});$("#showmoreupcoming").click(function(){$("#upcomingcustbox").css("height","auto");$("#showmoreupcomingrow").hide()});$("#showmorerecent").click(function(){$("#latestcustbox").css("height","auto");$("#showmorerecentrow").hide()});$(".adjarrowup").click(function(){var j=$(this).closest(".recentrow").attr("id").slice(6);var d=parseInt($("#resrow"+j+" .recentguests").text());var e=d+1;$("#resrow"+j+" .recentguests").text(e);$(".numcustoption").load("/processing/adjustguests.php",{reservationID:j,upordown:"up"});var f=parseInt($("#dashtotalcust").text());var b=f+1;$("#dashtotalcust").text(b);var k=parseFloat($("#dashfundsnum").text());var g=parseFloat($("#resrow"+j+" .recentprice").text());var c=parseFloat(k-g).toFixed(2);$("#dashfundsnum").text(c);if(k>0&&c<=0){$(".snapfunds").addClass("redfunds")}if(k<=0&&c>0){$(".snapfunds").removeClass("redfunds")}var i=parseInt($("#dashresponses").text());var h=b-i;$("#fpcustomers").text(h)});$(".adjarrowdown").click(function(){var n=$(this).closest(".recentrow").attr("id").slice(6);var e=parseInt($("#resrow"+n+" .recentguests").text());var f=e-1;if(f>0){$("#resrow"+n+" .recentguests").text(f);$(".numcustoption").load("/processing/adjustguests.php",{reservationID:n,upordown:"down"});var h=parseInt($("#dashtotalcust").text());var b=h-1;$("#dashtotalcust").text(b);var q=parseFloat($("#dashfundsnum").text());var i=parseFloat($("#resrow"+n+" .recentprice").text());var d=parseFloat(q+i).toFixed(2);$("#dashfundsnum").text(d);if(q>0&&d<=0){$(".snapfunds").addClass("redfunds")}if(q<=0&&d>0){$(".snapfunds").removeClass("redfunds")}var l=parseInt($("#dashresponses").text());var j=b-l;$("#fpcustomers").text(j)}if(f==0){$("#resrow"+n+" .noshowrestore").show();$("#resrow"+n+" .recentnoshow").hide();$("#resrow"+n).addClass("markednoshow");$(".numcustoption").load("/processing/markasnoshow.php",{reservationID:n});var k=parseInt($("#dashtotalcust").text());var m=parseInt($("#resrow"+n+" .recentguests").text());var b=k-m;$("#dashtotalcust").text(b);var q=parseFloat($("#dashfundsnum").text());var i=parseFloat($("#resrow"+n+" .recentprice").text());var d=parseFloat(q+(m*i)).toFixed(2);$("#dashfundsnum").text(d);if(q>0&&d<=0){$(".snapfunds").addClass("redfunds")}if(q<=0&&d>0){$(".snapfunds").removeClass("redfunds")}var o=parseInt($("#dashresponses").text());var c=parseInt($("#dashsends").text());var g=o-1;var p=(g/c)*100;$("#dashresponses").text(g);$("#dashresponserate").text(p.toFixed(2));var j=b-g;$("#fpcustomers").text(j)}});$(".noshowimg").click(function(){var j=$(this).closest(".recentrow").attr("id").slice(6);$("#resrow"+j+" .noshowrestore").show();$("#resrow"+j+" .recentnoshow").hide();$("#resrow"+j).addClass("markednoshow");$(".numcustoption").load("/processing/markasnoshow.php",{reservationID:j});var h=parseInt($("#dashtotalcust").text());var i=parseInt($("#resrow"+j+" .recentguests").text());var b=h-i;$("#dashtotalcust").text(b);var m=parseFloat($("#dashfundsnum").text());var f=parseFloat($("#resrow"+j+" .recentprice").text());var d=parseFloat(m+(i*f)).toFixed(2);$("#dashfundsnum").text(d);if(m>0&&d<=0){$(".snapfunds").addClass("redfunds")}if(m<=0&&d>0){$(".snapfunds").removeClass("redfunds")}var k=parseInt($("#dashresponses").text());var c=parseInt($("#dashsends").text());var e=k-1;var l=(e/c)*100;$("#dashresponses").text(e);$("#dashresponserate").text(l.toFixed(2));var g=b-e;$("#fpcustomers").text(g)});$(".noshowrestore").click(function(){var j=$(this).closest(".recentrow").attr("id").slice(6);$("#resrow"+j+" .recentnoshow").show();$("#resrow"+j+" .noshowrestore").hide();$("#resrow"+j).removeClass("markednoshow");$(".numcustoption").load("/processing/restorenoshow.php",{reservationID:j});var h=parseInt($("#dashtotalcust").text());var i=parseInt($("#resrow"+j+" .recentguests").text());var b=h+i;$("#dashtotalcust").text(b);var m=parseFloat($("#dashfundsnum").text());var f=parseFloat($("#resrow"+j+" .recentprice").text());var d=parseFloat(m-(i*f)).toFixed(2);$("#dashfundsnum").text(d);if(m>0&&d<=0){$(".snapfunds").addClass("redfunds")}if(m<=0&&d>0){$(".snapfunds").removeClass("redfunds")}var k=parseInt($("#dashresponses").text());var c=parseInt($("#dashsends").text());var e=k+1;var l=(e/c)*100;$("#dashresponses").text(e);$("#dashresponserate").text(l.toFixed(2));var g=b-e;$("#fpcustomers").text(g)});$("#changebasicsform").submit(function(){var b=$("#changebasicsform").serialize();$.ajax({type:"POST",url:"/processing/changebasics.php",data:b,dataType:"json",success:function(c){if(c.noErrors==1){$("#changebasicsform").hide();$("#cri-title").text("Your changes have been saved!");$("#cri-title").css("margin-bottom","5px");$("#cri-goback").html("<a class='bluelink' style='text-decoration:none;' href='../../myclub/'>Click here to go back to your birthday club dashboard.</a>");$("#cri-goback").css("margin-top","10px")}else{$("#changebasicserror").slideDown();$("#changebasicserrorlist").text("");$.each(c,function(d,e){$("#changebasicserrorlist").append("<li>"+e+"</li>")});$("#changebasicserror li:last").remove()}}});return false});$("#cbo-restrictions").trigger("keydown",{which:37});checkBirthdayOffer();$("#changeofferform").submit(function(){var b=$("#changeofferform").serialize();$.ajax({type:"POST",url:"/processing/changeoffer.php",data:b,dataType:"json",success:function(c){if(c.noErrors==1){$("#changeofferform").hide();$("#cbo-title").text("Your changes have been saved!");$("#cbo-title").css("margin-bottom","5px");$("#cbo-goback").html("<a class='bluelink' style='text-decoration:none;' href='../../myclub/'>Click here to go back to your birthday club dashboard.</a>");$("#cbo-goback").css("margin-top","10px")}else{$("#changeoffererror").slideDown();$("#changeoffererrorlist").text("");$.each(c,function(d,e){$("#changeoffererrorlist").append("<li>"+e+"</li>")});$("#changeoffererror li:last").remove()}}});return false})});function hideExistingList(){if($("#emailinput").val()){$("#existlistbox").hide();$("#atcemailmsg").show();$("#atcemailmsg").html("&nbsp;");$("#showcustlists").css("margin-top","30px")}}function hideExistingList2(){if($("#emailinput").val()){$("#existlistbox").hide();$("#showcustlists").css("margin-top","30px")}}function afterTypingEmail(){$("#existlistbox").hide();$("#showcustlists").css("margin-top","30px");var a=/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i;if(!(a.test($("#emailinput").val()))&&$("#emailinput").val()){$("#atcemailmsg").text("Oops, typo alert! This email address is not valid.");$("#emailinput").css("border","3px solid #CC3333");$("#emailinput").css("height","22px");$("#emailinput").css("width","346px");$("#atcemailmsg").css("color","#CC3333");$("#atcemailmsg").show()}else{if(a.test($("#emailinput").val())&&$("#emailinput").val()){$("#atcemailmsg").html("&nbsp;");$("#emailinput").css("border","1px solid #282828");$("#emailinput").css("height","26px");$("#emailinput").css("width","350px");$("#atcemailmsg").css("color","#167344");$("#atcemailmsg").show()}else{$("#emailinput").css("border","1px solid #282828");$("#emailinput").css("height","26px");$("#emailinput").css("width","350px");$("#atcemailmsg").hide()}}}function greenMonth(){$("#atcmonthmsg").css("color","#167344");$("#monthinput").css("border","1px solid #282828");$("#monthinput").css("height","26px");$("#monthinput").css("width","60px")}function redMonth(){$("#atcmonthmsg").css("color","#CC3333");$("#monthinput").css("border","3px solid #CC3333");$("#monthinput").css("height","22px");$("#monthinput").css("width","56px")}function getMonthName(a){if(a==1){return"January"}else{if(a==2){return"February"}else{if(a==3){return"March"}else{if(a==4){return"April"}else{if(a==5){return"May"}else{if(a==6){return"June"}else{if(a==7){return"July"}else{if(a==8){return"August"}else{if(a==9){return"September"}else{if(a==10){return"October"}else{if(a==11){return"November"}else{if(a==12){return"December"}}}}}}}}}}}}}function getDaySuffix(a){if(a==1||a==21||a==31){return"st"}else{if(a==2||a==22){return"nd"}else{if(a==3||a==23){return"rd"}else{return"th"}}}}function dispMonth(){$("#existlistbox").hide();$("#showcustlists").css("margin-top","30px");var a=$("#monthinput").val();$("#atcmonthmsg").show();if(a=="1"){$("#atcmonthmsg").text("January");greenMonth()}else{if(a==2){$("#atcmonthmsg").text("February");greenMonth()}else{if(a==3){$("#atcmonthmsg").text("March");greenMonth()}else{if(a==4){$("#atcmonthmsg").text("April");greenMonth()}else{if(a==5){$("#atcmonthmsg").text("May");greenMonth()}else{if(a==6){$("#atcmonthmsg").text("June");greenMonth()}else{if(a==7){$("#atcmonthmsg").text("July");greenMonth()}else{if(a==8){$("#atcmonthmsg").text("August");greenMonth()}else{if(a==9){$("#atcmonthmsg").text("September");greenMonth()}else{if(a==10){$("#atcmonthmsg").text("October");greenMonth()}else{if(a==11){$("#atcmonthmsg").text("November");greenMonth()}else{if(a==12){$("#atcmonthmsg").text("December");greenMonth()}else{if(a==""){$("#atcmonthmsg").text("");greenMonth()}else{if(isNaN(a)){$("#atcmonthmsg").text("1 to 12 only");redMonth()}else{$("#atcmonthmsg").text("1 to 12 only");redMonth()}}}}}}}}}}}}}}}function greenDay(){$("#atcdaymsg").css("color","#167344");$("#dayinput").css("border","1px solid #282828");$("#dayinput").css("height","26px");$("#dayinput").css("width","60px")}function redDay(){$("#atcdaymsg").css("color","#CC3333");$("#dayinput").css("border","3px solid #CC3333");$("#dayinput").css("height","22px");$("#dayinput").css("width","56px")}function dispDay(){$("#existlistbox").hide();$("#showcustlists").css("margin-top","30px");var b=$("#dayinput").val();$("#atcdaymsg").show();var a="";if(b==1||b==21||b==31){a="st";greenDay()}else{if(b==2||b==22){a="nd";greenDay()}else{if(b==3||b==23){a="rd";greenDay()}else{if(b==""){a="";greenDay()}else{a="th";greenDay()}}}}var c=b+a;$("#atcdaymsg").text(c);if(b==""){$("#atcdaymsg").text("");greenDay()}else{if(isNaN(b)){$("#atcdaymsg").text("1 to 31 only");redDay()}else{if(b==0||b>31){$("#atcdaymsg").text("1 to 31 only");redDay()}}}}function clearAddEmailForm(){$("#emailinput").val("");$("#monthinput").val("");$("#dayinput").val("")}function clearAddEmailMessages(){$("#atcmonthmsg").text("");$("#atcdaymsg").text("");$("#atcemailmsg").text("")}function updateCustDelivered(){var a=$(".numcustoption").attr("id").slice(7);$("#dashtotalcust").load("/processing/updatecustdelivered.php",{optid:a})}function checkBirthdayOffer(){if($("#cbo-offer").val()=="6"){$("#cbo-customfood").show()}else{$("#cbo-customfood").hide()}}(function(b){b.fn.autoResize=function(c){var a=b.extend({onResize:function(){},animate:true,animateDuration:150,animateCallback:function(){},extraSpace:20,limit:1000},c);this.filter("textarea").each(function(){var l=b(this).css({resize:"none","overflow-y":"hidden"}),d=l.height(),j=(function(){var f=["height","width","lineHeight","textDecoration","letterSpacing"],g={};b.each(f,function(k,i){g[i]=l.css(i)});return l.clone().removeAttr("id").removeAttr("name").css({position:"absolute",top:0,left:-9999}).css(g).attr("tabIndex","-1").insertBefore(l)})(),e=null,h=function(){j.height(0).val(b(this).val()).scrollTop(10000);var g=Math.max(j.scrollTop(),d)+a.extraSpace,f=b(this).add(j);if(e===g){return}e=g;if(g>=a.limit){b(this).css("overflow-y","");return}a.onResize.call(this);a.animate&&l.css("display")==="block"?f.stop().animate({height:g},a.animateDuration,a.animateCallback):f.height(g)};l.unbind(".dynSiz").bind("keyup.dynSiz",h).bind("keydown.dynSiz",h).bind("change.dynSiz",h)});return this}})(jQuery);(function(a){a.fn.hoverIntent=function(k,j){var l={sensitivity:7,interval:100,timeout:0};l=a.extend(l,j?{over:k,out:j}:k);var n,m,h,d;var e=function(f){n=f.pageX;m=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-n)+Math.abs(d-m))<l.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return l.over.apply(f,[g])}else{h=n;d=m;f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return l.out.apply(f,[g])};var b=function(q){var o=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(o&&o!=this){try{o=o.parentNode}catch(q){o=this}}if(o==this){return false}var g=jQuery.extend({},q);var f=this;if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(q.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},l.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery);(function(c){var a=c.scrollTo=function(d,f,g){c(window).scrollTo(d,f,g)};a.defaults={axis:"xy",duration:parseFloat(c.fn.jquery)>=1.3?0:1};a.window=function(d){return c(window)._scrollable()};c.fn._scrollable=function(){return this.map(function(){var d=this,f=!d.nodeName||c.inArray(d.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!f){return d}var g=(d.contentWindow||d).document||d.ownerDocument||d;return c.browser.safari||g.compatMode=="BackCompat"?g.body:g.documentElement})};c.fn.scrollTo=function(f,e,d){if(typeof e=="object"){d=e;e=0}if(typeof d=="function"){d={onAfter:d}}if(f=="max"){f=9000000000}d=c.extend({},a.defaults,d);e=e||d.speed||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue){e/=2}d.offset=b(d.offset);d.over=b(d.over);return this._scrollable().each(function(){var n=this,l=c(n),m=f,j,k={},h=l.is("html,body");switch(typeof m){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(m)){m=b(m);break}m=c(m,this);case"object":if(m.is||m.style){j=(m=c(m)).offset()}}c.each(d.axis.split(""),function(q,r){var t=r=="x"?"Left":"Top",s=t.toLowerCase(),v="scroll"+t,p=n[v],g=a.max(n,r);if(j){k[v]=j[s]+(h?0:p-l.offset()[s]);if(d.margin){k[v]-=parseInt(m.css("margin"+t))||0;k[v]-=parseInt(m.css("border"+t+"Width"))||0}k[v]+=d.offset[s]||0;if(d.over[s]){k[v]+=m[r=="x"?"width":"height"]()*d.over[s]}}else{var u=m[s];k[v]=u.slice&&u.slice(-1)=="%"?parseFloat(u)/100*g:u}if(/^\d+$/.test(k[v])){k[v]=k[v]<=0?0:Math.min(k[v],g)}if(!q&&d.queue){if(p!=k[v]){i(d.onAfterFirst)}delete k[v]}});i(d.onAfter);function i(g){l.animate(k,e,d.easing,g&&function(){g.call(this,f,d)})}}).end()};a.max=function(g,j){var n=j=="x"?"Width":"Height",k="scroll"+n;if(!c(g).is("html,body")){return g[k]-c(g)[n.toLowerCase()]()}var o="client"+n,f=g.ownerDocument.documentElement,d=g.ownerDocument.body;return Math.max(f[k],d[k])-Math.min(f[o],d[o])};function b(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);
