var preloadImgs = [], img; var left = 1, right = 0, NONE = 2; function Login(params) { this.currStory = 0; this.maxStories = 0; this.names = []; this.testimonialsShort = []; this.testimonialsLong = []; this.beforePics = []; this.afterPics = []; this.built = false; /*this.currStory = 2; this.maxStories = 2; this.names = ['Hiram', 'Doug']; this.testimonialsShort = ['I entered the Coast Guard in 1967, and for the first 20 years of my 30-year career, I didn't have any weight problems. The work I did was hard, so my weight stayed well within the required limits. In my last 10 years, however, I was assigned to a training command where all my time was spent in a classroom or traveling around the world to train others. I gained weight and found it hard to keep it off. Even though I exercised and tried to be active, my weight slowly increased. I started a walking plan and was able to stay within the required weight limit - but I was always at the top end...', 'I hated being an overweight child. People either made fun of me or (worse) tried to be polite and said, "He's just plump." What adolescent boy wants to hear that? In grade school I was so big they made me play on the upper grades' football team. By middle school, I had grown out of my heaviness, and by the time I graduated high school, I was 6 feet tall and skinny at 145 pounds. Life was good, and I swore I'd never be fat again...']; this.testimonialsLong = ['
I entered the Coast Guard in 1967, and for the first 20 years of my 30-year career, I didn't have any weight problems. The work I did was hard, so my weight stayed well within the required limits. In my last 10 years, however, I was assigned to a training command where all my time was spent in a classroom or traveling around the world to train others. I gained weight and found it hard to keep it off. Even though I exercised and tried to be active, my weight slowly increased. I started a walking plan and was able to stay within the required weight limit - but I was always at the top end.
\
\
When I retired from the Coast Guard in 2004, I weighed 212 pounds. As I moved from job to job over the next eight years, I kept gaining weight until I weighed in at the Veterans Affairs (VA) Medical Center at 256 pounds. My wife noticed and started to worry about my health. She also has a chronic disease, and I am her primary-care provider. It was becoming difficult to help in some areas. In January, I weighed in on my scale at 260 pounds. I knew it was time to start losing weight. I started on a self-developed plan and used Jillian's DVDs, and by May when I went back to the VA Medical Center and entered their MOVE! national weight-loss program for veterans I had dropped 14 pounds and several inches from my waist. I combined parts of Jillian's DVDs, her Web site, and the VA MOVE! program and created a program that really focused on improving my body and my mind.
\
\
I've had amazing results! I now weigh 190 pounds went from a pants size 46 to 34, I no longer take blood-pressure medication, and my doctor has reduced my diabetes-pill dosage to one-fourth of what it was. I started working again, but I don't let that interfere with my workouts. I block off time on my calendar at work from 11:30 a.m. to 1 p.m. every day so meetings cannot be planned. I walk, jog, or sprint in intervals for about 45 minutes and usually carry two 18-ounce water containers wrapped in 1-kilo wrist weights. I'll stop at benches along the way and alternate sets of push-ups on one bench and then dips at the next. The people around me are very supportive and they constantly remind me if I am running late for my exercise period. They now EXPECT me to be gone and don't plan anything for me to do during that time, which motivates me to keep going and helps me make that change permanent.
\
\
Even though I'm 37, I feel as if I'm 21. I have gone from 29 percent body fat to 19 percent body fat in the past year, and I have a goal of 15 percent body fat. I have changed my priorities in life to reflect how I can better support myself and my family. In the past my priorities were God, family, and then me. I realized that I needed to have the order as God, me, and then family, because if I am not fit and able I could not properly support my family.
I hated being an overweight child. People either made fun of me or (worse) tried to be polite and said, "He's just plump." What adolescent boy wants to hear that? In grade school I was so big they made me play on the upper grades' football team. By middle school, I had grown out of my heaviness, and by the time I graduated high school, I was 6 feet tall and skinny at 145 pounds. Life was good, and I swore I'd never be fat again.
\
\
Over the years, I filled out. At 30, when I married my wife, I was at a muscular and comfortable 185 pounds. Over the next 15 years, I slowly gained another 20 pounds. I was still active, so I got used to it, and nobody would've guessed I weighed over 200 pounds - I just had a little bit of paunch around the middle. It was September of last year, after I quit smoking, when I really started to blow up. I gained 25 pounds in four months, and I was speeding through clothes sizes: The people at J. C. Penney knew me by name. I was out of control and in denial every step of the way.
\
\
In May 2008, my wife and I went to Cancún for our yearly five-day sabbatical. When I was shopping for beach clothes, I realized I was at least four inches bigger around the waist than I had been the summer before. The size 38 shorts I bought were tight, but I couldn't stand the thought of going to a size 40. Still, we had a great time on our trip, lounging on the beach with a cold drink in one hand and a plate in the other (all-inclusive hotels are handy but not very health-friendly).
\
\
At home, when I started downloading the pictures from the trip, I was shocked to see a strange fat guy next to my wife in every picture. I knew I wasn't in the best shape, but that was a serious gut and set of chins I was looking at! While I was sitting there trying to decide whether to delete all those pictures, I got an e-mail; it was one of Jillian's newsletters. The timing was perfect - it had to be a sign. I immediately logged on to her site and signed up, and then I picked up the equipment I would need to work out and started planning my meals.
\
\
A couple of weeks after I started working out and eating the meals from the site's plan, I began reading the Message Boards to find some like-minded people for additional information and support, and those ladies set me straight on my eating habits. It turns out I wasn't eating enough, and after a few adjustments, I started losing in a big way.
\
\
In just 19 weeks, I lost 47 pounds, an average of almost 2.5 pounds per week - even better than the plan said I'd do. I attribute my speedy success to sticking strictly to Jillian's exercise and meal plans. I occasionally had a bad food day or missed a workout, but for the most part I was right there. I love the meal plan; counting calories isn't my thing, so the ease of printing shopping lists and getting all the daily recipes was right up my alley. The planner made staying within my 1600-1900 calories-a-day limit automatic. Even now that I've lost the weight, I still use the plan and just substitute some higher-calorie ingredients or have a larger serving.
\
\
For the first few months, I stuck to the circuits on the site, and that's when I posted the biggest losses. In August, one of the ladies from the "Fearless," a group that had formed on the Message Boards, challenged me to run a half marathon. What was she thinking? Me, a runner? I was the defensive lineman and shot-putter - the big guy in school who never had to run. I still don't know what made me accept the challenge, but I'm glad I did. The first time I ran 10 miles without stopping or walking, I almost cried (don't tell anyone). My oldest daughter ran the November 2 race with me, and we finished it together. My next race is a 10K in Fort Worth, and I think I've talked one of my friends from the site into joining me. This running stuff seems to be contagious!
' + nl2br(htmlencode(win.testimonialsLong[win.currStory-1])) + '
'); widget.renderIntoPopup('80%', '80%', $(this), function() { win.storyTimer = null; win.setStoryTimer(); }); }); domObj.find("a#left-arrow").bind(hitEvent, function (e) { if (win.storyTimerFade) { clearTimeout(win.storyTimerFade); win.storyTimerFade = -1; } if (win.storyTimer) { clearTimeout(win.storyTimer); win.storyTimer = -1; } win.setSuccessStory(right); }); domObj.find("a#right-arrow").bind(hitEvent, function (e) { if (win.storyTimerFade) { clearTimeout(win.storyTimerFade); win.storyTimerFade = -1; } if (win.storyTimer) { clearTimeout(win.storyTimer); win.storyTimer = -1; } win.setSuccessStory(left); }); win.setSuccessStory(NONE); $(window).trigger('resize'); } Login.prototype.destroy=function() { if (this.storyTimerFade) { clearTimeout(this.storyTimerFade); this.storyTimerFade = null; } if (this.storyTimer) { clearTimeout(this.storyTimer); this.storyTimer = null; } //$("#previews,#nusers").remove(); } Login.prototype.isBuilt=function() { return this.built; } Login.prototype.resize=function() { //$("#previews").width(1); //console.log("" + window.innerWidth + " - " + $("#content").outerWidth()); $("#previews").width(window.innerWidth-20); } Login.prototype.contentSet=function(){ this.setSuccessStory(NONE); var obj = this; /* $.ajax( { url: "/service/GetNewUsers.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { }, success: function( datafr ) { if (! datafr) return; //var str = ''; var str2 = ''; for (var i = 0; i < datafr.results.length; i++) { //str += '' + htmlencode(datafr.results[i].firstname + ' ' + datafr.results[i].lastname) + 'Label | \Dropdown | \Multiselect | \Text Block | \Text Input | \Radio Buttons | \Checkboxes | \Module | \
No exercise scheduled today!
'); } } }); } Feed.prototype.updateLocStats=function() { var obj = this; var datestr = this.d.toYMD(); $.ajax({ url: "/service/GetLocStats.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", notWhenTracking: true, data: { b4b_id: g_userInfo.b4b_id, datestr: datestr }, retryCnt: -1, success: function (data) { obj.domObj.find("#distance").text(parseFloat(data.distance).toFixed(1)); obj.domObj.find("#speed").text(parseFloat(data.speed).toFixed(1)); obj.domObj.find("#uphill").text(parseInt(data.uphill * 3.28084)); obj.domObj.find("#downhill").text(parseInt(data.downhill * 3.28084)); } }); } Feed.prototype.getStepCount = function (notimer) { var obj = this; var datestr = this.d.toYMD(); $.ajax({ url: "/service/GetUserStepCount.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", notWhenTracking: true, data: { b4b_id: g_userInfo.b4b_id, datestr: datestr }, retryCnt: -1, success: function (data) { if (!obj.destroyed) { if (obj.d.toYMD() == datestr) { var steps = data.stepcnt || 0; if (typeof(obj.lastSteps) == 'undefined' || obj.lastSteps != steps || notimer) { obj.updateTotals(); obj.updateAdherence(); obj.getBarChartData(); } obj.lastSteps = steps; var dist = parseFloat(data.dist).toFixed(2); $(".STEPS").html('' + parseInt(steps).toLocaleString() + ' / ' + dist + "mi"); obj.updateGoalSteps(); obj.updateLocStats(); } if (!notimer) { setTimeout(function () { obj.getStepCount(); }, STEPCOUNT_UPDATE_TIME); } } } }); } Feed.prototype.setChartData = function(chart, $show, shouldshow) { var obj = this; var show = false; for (var j = 0; j < obj.lineChartData.datasets[0].data.length; j++) { if (obj.lineChartData.datasets[0].data[j] > 0) { show = true; break; } } if (show) { if (shouldshow) $show.show(); //obj.domObj.find("#chartlargeitem").show(); } else { $show.hide(); return; //obj.domObj.find("#chartlargeitem").hide(); } var thedata = {}; //alert(JSON.stringify(this.lineChartData)); var data = obj.lineChartData.datasets[0].data; var c = 0; for (var i = data.length-1; i >= 0; i--) { if (i > 0) { thedata[c] = [data[i]-data[i-1]]; } else { thedata[c] = [data[i]]; } c++; } if (obj.d.toDateString() === new Date().toDateString()) { chart.infichart.labelmode = 'todayhours'; } else { chart.infichart.labelmode = 'hours'; } chart.infichart.curri = obj.lineChartData.curr || 0; //chart.infichart.curri--; //alert(JSON.stringify(obj.lineChartData.labels)); chart.infichart.labels = obj.lineChartData.labels; chart.setChartValues(thedata, 0, data.length, chart.infichart.currval); //$(window).triggerHandler('resize'); //setChartOptions(chart); chart.refreshInfiChart(); } Feed.prototype.setChart = function($canvas, $show, shouldshow, height) { var obj = this; var grabData = function(){} var show = false; for (var j = 0; j < obj.lineChartData.datasets[0].data.length; j++) { if (obj.lineChartData.datasets[0].data[j] > 0) { show = true; break; } } if (show && shouldshow) { $show.show(); //obj.domObj.find("#chartlargeitem").show(); } else { $show.hide(); //obj.domObj.find("#chartlargeitem").hide(); } var thedata = {}; //alert(JSON.stringify(this.lineChartData)); var data = obj.lineChartData.datasets[0].data; var c = 0; for (var i = data.length-1; i >= 0; i--) { if (i > 0) { thedata[c] = [data[i]-data[i-1]]; } else { thedata[c] = [data[i]]; } c++; } $canvas.height(height).width(Math.max($canvas.parent().width(), 100)); obj.barChart = new infidaychart($canvas[0], infichart.BAR_CHART, 1, 0, data.length, 0); if (obj.d.toDateString() === new Date().toDateString()) { obj.barChart.infichart.labelmode = 'todayhours'; } else { obj.barChart.infichart.labelmode = 'hours'; } obj.barChart.infichart.numbars = 1; obj.barChart.infichart.curri = obj.lineChartData.curr || 0; obj.barChart.labels = obj.lineChartData.labels; obj.barChart.setChartValues(thedata, 0, data.length, 0); //$(window).triggerHandler('resize'); setChartOptions(obj.barChart); obj.barChart.refreshInfiChart(); return obj.barChart; } Feed.prototype.setChartOptions=function(chart, w) { w = chart.getInfiChartWidth()*chart.infichart.scale; chart.infichart.unitpadding = 1; chart.infichart.barpadding = 1; var padding = chart.infichart.barpadding; //var bw = -chart.infichart.numbars*(chart.infichart.barwidth+padding+padding)/2; var bw = 12; chart.infichart.barwidth = 2; chart.infichart.barwidth = w / (8 * 50); //w -= (24 * 2);// * PIXEL_RATIO; // subtract bar padding //w -= 30; //w -= 180;///PIXEL_RATIO; // scale clip //chart.infichart.barwidth = Math.max(1, Math.floor(w*PIXEL_RATIO/4/(24*2))); // 4 = scale, 24 = hours //chart.infichart.barwidth = Math.max(1.0, (w/(24*2*bw))); // 4 = scale, 24 = hours //chart.infichart.barwidth = 0.5; //chart.infichart.barwidth = w / this.infichart.numintervals / 3.5; } Feed.prototype.resizeCharts = function() { var obj = this; if (obj.lineChartData) { var show = false; for (var j = 0; j < obj.lineChartData.datasets[0].data.length; j++) { if (obj.lineChartData.datasets[0].data[j] > 0) { show = true; break; } } if (show) { if (window.innerWidth >= 1002) { $("#chartlargeitem").show(); $("#chart").hide(); } else { $("#chartlargeitem").hide(); $("#chart").show(); } } } //obj.barChartLarge.infichart.unitpadding = 2; //obj.barChartSmall.infichart.unitpadding = 2; //obj.barChartLarge.infichart.barwidth = 10; //obj.barChartSmall.infichart.barwidth = 10; $canvas1 = $("#chartlargeitem").find("#infichart"); $canvas2 = $("#chart").find("#infichart"); obj.setChartOptions(obj.barChartLarge, Math.max($canvas1.parent().width(), 100)); obj.setChartOptions(obj.barChartSmall, Math.max($canvas2.parent().width(), 100)); $canvas1.hide(); $canvas1.height(250).width(Math.max($canvas1.parent().width(), 100)); //obj.barChart.refreshInfiChart(); $canvas2.hide(); $canvas2.height(250).width(Math.max($canvas2.parent().width(), 100)); //obj.barChartSmall.refreshInfiChart(); obj.setChartData(obj.barChartLarge, $("#chartlargeitem")); obj.setChartData(obj.barChartSmall, $("#chart")); $canvas1.show(); $canvas2.show(); obj.setChartOptions(obj.barChartLarge); obj.setChartOptions(obj.barChartSmall); obj.barChartLarge.refreshInfiChart(); obj.barChartSmall.refreshInfiChart(); //setTimeout(function() { //obj.barChartLarge.setInfiChartRez(); // obj.barChartSmall.setInfiChartRez(); //obj.barChartLarge.drawInfiChart(); //obj.barChartSmall.drawInfiChart(); //}, 60); } Feed.prototype.getBarChartData = function () { var obj = this; var datestr = this.d.toYMD(); $.ajax({ url: "/service/GetTodaysStepChunks.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { datestr: datestr }, notWhenTracking: true, retryCnt: -1, success: function (data) { if (obj.d.toYMD() != datestr) return; if (!data || !data.datasets.length) { return; } obj.lineChartData = data; //obj.resize(); if (obj.lineChartData) { if (obj.barChartLarge) { obj.setChartData(obj.barChartLarge, $("#chartlargeitem"), window.innerWidth >= 1200); obj.setChartData(obj.barChartSmall, $("#chart"), window.innerWidth < 1200); } else { obj.barChartLarge = obj.setChart($("#chartlargeitem").find("#infichart"), $("#chartlargeitem"), window.innerWidth >= 1200, 340); obj.barChartSmall = obj.setChart($("#chart").find("#infichart"), $("#chart"), window.innerWidth < 1200, 180); } obj.last_win_size = 0; $(window).trigger('resize'); //obj.resizeCharts(); } /*if (typeof(obj.barChart) != 'undefined') { obj.barChart.destroy(); } obj.lineChartData = data; obj.barChart = new Widget('BarChart', { }); obj.barChart.widget.setData(obj.lineChartData); obj.barChart.render(obj.domObj.find("#chart"));*/ //obj.barChart.widget.setData({}); //obj.barChart.render(obj.domObj.find("#chart")); } }); } Feed.prototype.updateFeed = function (top, feed_id, viewed) { var obj = this; if (this.ajaxRunning) { return; } this.ajaxRunning = true; $.ajax({ url: "/service/GetFeed.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", retryCnt: -1, notWhenTracking: true, data: { top: top, feed_id: feed_id, viewed: viewed }, success: function (data) { if (!obj.gotInitFeed) { obj.gotInitFeed = true; //obj.startGettingComments(); //obj.startUpdatingComments(); obj.startUpdatingCommentsAll(); obj.startUpdatingLikesAll(); obj.getScheduleExercise(); obj.updateAdherence(); obj.getStepCount(); obj.getBarChartData(); } obj.ajaxRunning = false; obj.built = true; var profilepicurl = '/images/feedpics/nopic.png'; //var pics = [ '/images/feedpics/img1.jpg', '/images/feedpics/img2.png', '/images/feedpics/img3.jpg', '/images/feedpics/img1.jpg', '/images/feedpics/img2.png', '/images/feedpics/img3.jpg' ]; var str = ''; if (top && data.length > 0) { obj.posted = false; } for (var i = 0; i < data.length; i++) { if (top && i == 0) { obj.topmostFeedId = data[i].feed_id; } var numpics = data[i].fids.length; var pics = []; for (var j = 0; j < data[i].fids.length; j++) { pics.push("/service/GetFile.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode + "&pic=" + data[i].fids[j]); } if (obj.domObj.find('.feeditem[feedid="' + data[i].feed_id + '"]').length != 0) { continue; } str += getFeedString(data[i], numpics, pics); str += ''; } var dobj = $(str); dobj.find("img").unveil(); if (top) { obj.domObj.find("#feedupdates").prepend(dobj); } else { obj.domObj.find("#feedupdates").append(dobj); } if (shouldTriggerScroll()) $(window).triggerHandler("scroll"); obj.scroll(); obj.updateTimes(); updateMaps(); } }); return false; } function days_between(date1, date2) { // The number of milliseconds in one day var ONE_DAY = 1000 * 60 * 60 * 24 // Convert both dates to milliseconds var date1_ms = date1.getTime() var date2_ms = date2.getTime() // Calculate the difference in milliseconds var difference_ms = Math.abs(date1_ms - date2_ms) // Convert back to days and return return Math.round(difference_ms / ONE_DAY) } Feed.prototype.updateDateLabels = function () { var labelstr = ''; var today = new Date(); if (this.d.getFullYear() == today.getFullYear() && this.d.getDate() == today.getDate() && this.d.getMonth() == today.getMonth()) { labelstr = "Today's"; } else { var days = ["Sunday's", "Monday's", "Tuesday's", "Wednesday's", "Thursday's", "Friday's", "Saturday's"]; if (Math.abs(days_between(today, this.d)) < 7 && this.d.getTime() < today.getTime()) { if (today.getDay() == 0) { labelstr = days[this.d.getDay()]; } else { if (this.d.getDay() > today.getDay()) { labelstr = 'Last '; labelstr += days[this.d.getDay()]; } else { labelstr = days[this.d.getDay()]; //labelstr = this.d.getMonth() + '/' + this.d.getDate() + '/' + this.d.getFullYear(); } } } else { labelstr = (this.d.getMonth()+1) + '/' + this.d.getDate() + '/' + this.d.getFullYear(); } } $(".datelbl").text(labelstr); } Feed.prototype.getMutualFriends = function () { var obj = this; obj.domObj.find("#mutual_friends").fadeOut(); return; $.ajax({ url: "/service/GetMutualFriends.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: {}, notWhenTracking: true, success: function (datafr) { if (!datafr || !datafr.results.length) { obj.domObj.find("#mutual_friends").fadeOut(); return; } var str = ''; var profilepicurl = '/images/feedpics/nopic.png'; for (var i = 0; i < datafr.results.length; i++) { if (!datafr.results[i].b4b_id) { continue; } str += '' + ('Today Totals:') + ' |
Calories Burned: | 0 kCal |
' + ('Today Adherence Grade:') + ' |
' + ('Today Totals:') + ' |
' + ('Today Intake:') + ' |
Calories Burned: | 0 kCal |
Today Location Totals:
Distance:0.00 / mi | Speed:0.00 / mph |
Max Elevation:0.00 / ft | Min Elevation:0.00 / ft |
Today Intake:
Calories: | 0 kCal |
Protein: | 0 g |
Fat: | 0 g |
Saturated Fat: | 0 g |
Polyunsaturated Fat: | 0 g |
Monounsaturated Fat: | 0 g |
Carbohydrate: | 0 g |
Dietary Fiber: | 0 g |
Sugars: | 0 g |
Cholesterol: | 0 mg |
Sodium: | 0 mg |
Potassium: | 0 mg |
' + extra[i] + ': | 0 |
Adherence to Plan:
View Details
No pending team requests.
'); } obj.domObj.find(".sendmsgto").click(function(e) { if (! $(e.target).hasClass("unfriend")) { e.preventDefault(); userClicked($(this).attr('username')); } }); } }); } }); } Friends.prototype.build = function(mode, submode) { var obj = this; var str = ''; //str+=''; obj.isOwn = false; if (submode) { obj.start = parseInt(submode); } obj.username = (g_userInfo.username || g_userInfo.b4b_id); obj.username_text = 'your'; if (mode && (String(mode).toLowerCase() != g_userInfo.b4b_id && String(mode).toLowerCase() != g_userInfo.username)) { obj.username = mode; str += ''; } else { obj.isOwn = true; str += ''; } this.domObj = $(str); obj.domObj.find(".backtoprofile").click(function(e) { e.preventDefault(); setWindow("Profile-" + obj.username); }); this.getUserInfo(function() { obj.update(); }); this.domObj.find("#prevfriendpage").click(function(e) { e.preventDefault(); obj.start--; setWindow("Friends-" + obj.username + "-" + obj.start); obj.update(); }); this.domObj.find("#nextfriendpage").click(function(e) { e.preventDefault(); obj.start++; setWindow("Friends-" + obj.username + "-" + obj.start); obj.update(); }); this.domObj.on("click", ".unfriend", function(e) { e.preventDefault(); if (confirm("Are you sure want remove this teammate?")) { $.ajax( { url: "/service/RemoveFriend.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { friend_id: $(this).attr('friendid') }, success:function(datareq) { obj.update(); } }); } }); return false; } Friends.prototype.getDomObj=function() { return this.domObj; } Friends.prototype.setMode=function(mode) { } Friends.prototype.setHooks=function() { var obj = this; } Friends.prototype.destroy=function() { $(window).unbind('scroll', this.updateScroll); this.destroyed = true; } Friends.prototype.isBuilt=function() { return this.built; } Friends.prototype.contentSet=function(){ var obj = this; } function Search(params) { this.loginRequired = false; this.destroyed = false; this.built = false; this.usersearch = new Widget('UserSearch'); this.autoSearch = params.autoSearch || ''; } Search.prototype.build = function(mode) { var obj = this; var str = ''; // str+='No messages.
'); } $("html, body").animate({ scrollTop: 0 }, "slow"); obj.domObj.find(".sendreplymsg").click(function(e) { e.preventDefault(); var reply_to_id = $(this).attr('replymsgid'); var msgtxt = obj.domObj.find('.replytxt[replymsgid="' + reply_to_id + '"]').val(); var toid = $(this).attr('toid'); if (msgtxt.trim() != '') { blockWindow(); $.ajax( { url: "/service/SendMessage.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { to_id: toid, msgtxt: msgtxt, reply_to_id: reply_to_id }, success: function() { unblockWindow(); obj.start = 0; obj.domObj.find('.replytxt[replymsgid="' + reply_to_id + '"]').val(''); obj.updateConversations(); } }); } }); obj.domObj.find(".convo").each(function() { //alert(this.scrollHeight); this.scrollTop = this.scrollHeight; }); } }); } Messages.prototype.build = function(mode) { var obj = this; var str = ''; //str+=''; str += 'No plan chosen.
'); obj.domObj.find(".userswitchplan").css("border", "2px solid #ff0000").text("Choose Plan"); } if (obj.userInfo.b4b_id == g_userInfo.b4b_id) { obj.domObj.find(".switchuserplan").show(); obj.domObj.find(".userswitchplan").click(function (e) { e.preventDefault(); blockWindow(); $.ajax({ url: "/service/SetPlanSessionData.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: {}, success: function (data) { unblockWindow(); setWindow("ChangePlan"); } }); }); } } }); } Profile.prototype.getUserInfo = function () { var obj = this; if (g_userInfo.b4b_id == obj.username.toLowerCase()) { obj.userInfo = g_userInfo; obj.updateInfo(); obj.domObj.find("#displaystr").hide(); return; } $.ajax({ url: "/service/UserSearch.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { searchfor: obj.username, type: 'username', start: '0', end: '1' }, success: function (data) { if (data && data.results.length > 0) { obj.userInfo = data.results[0]; obj.updateInfo(); if (data.results[0].status == 2) { var str = "You and " + htmlencode(ucfirst(data.results[0].firstname) || ucfirst(data.results[0].username)) + ' are teammates. Send a message'; } else if (data.results[0].status == 1) { var str = 'Team request has been sent. Send a message'; } else { var str = "Do you know " + htmlencode(ucfirst(data.results[0].firstname) || ucfirst(data.results[0].username)) + '? Send a message or Add to your team'; } obj.domObj.find("#displaystr").html(str); } } }); } Profile.prototype.getStepsBox = function () { var obj = this; var str = ''; str += 'We have received your removal request and have begun processing it.
\You will receive an email at ' + htmlencode(g_userInfo.email) + ' when the request is complete.
\'; str += '
Carbs 0gFat 0gProtein 0g
'; str += '' + meals[i] + ' | ';
if (i != 0 && i != meals.length - 1 && (i + 1) % 3 == 0) {
str += '||
Breakfast | \
Breakfast | \
Breakfast | \
Breakfast | \
Breakfast | \
Breakfast | \
*/
str += '
Calories 0Carbs 0gFat 0gProtein 0g
\ //alert(calories); obj.domObj.find(".bucket_calories").text(calories); obj.domObj.find(".bucket_carb_val").text(carbs); obj.domObj.find(".bucket_protein_val").text(protein); obj.domObj.find(".bucket_fat_val").text(fat); obj.domObj.find("#loggedfoods").html(str); obj.domObj.find("#loggedfoods").find(".addfood").click(function(e) { e.preventDefault(); e.stopPropagation(); var food_id = $(this).parent().parent().attr('food_id'); if (!food_id) return; if (!obj.results[obj.getri()][food_id]) return; if ($(this).parent().attr('ajax')) return; $(this).attr('ajax', true); var servdata = obj.getFoodServing(food_id, 0, 1); //LogFood.prototype.addFood=function(id, name, servings, servingDesc, calories, protein, carbs, sugar, fiber, fat, satFat, monoFat, polyFat, cholesterol, sodium, potassium, food_log_type, servingG, food_id, meal_id, servid, callback) { var fooditem = $(this).parent(); $.ajax({ url: "/service/RemoveFoodLog.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { food_log_id: $(fooditem).attr('food_log_id') }, success: function(data) { $(fooditem).parent().fadeOut('slow', function() { obj.getBucketFood(); }); } }); }); for (var i = 0; i < data.results.length; i++) { var food_id = data.results[i].food_id; obj.setFoodDetails(food_id, viewmode); } //alert(JSON.stringify(data)); //alert(JSON.stringify(data)); //obj.request = null; //if (obj.setTimer) return; //obj.processResults(data, obj.domObj.find("#foodresults"), clickfirst, viewmode); } }); } LogFood.prototype.setServing = function() { var obj = this; var food_id = obj.food_id; if (!food_id) return; var s = obj.domObj.find("#unit").val(); if (obj.domObj.find("#unit").val() == 'g') { var num = obj.domObj.find("#weight").val() || 0; } else { var num = (this.getInfiRangeCurrentValue() / obj.infirange.incby + obj.infirange.startval); } if (s == 'g') { if (obj.domObj.find("#weight_unit").val() == 'lb') { num *= 453.592000004704; } else if (obj.domObj.find("#weight_unit").val() == 'oz') { num *= 28.3495; } } var data = this.getFoodServing(food_id, s, num, parseFloat(obj.domObj.find("#weight").val()), obj.domObj.find("#weight_unit").val()); /*var def_g = obj.results[food_id].serving1_g; var g; if (s == 'g') { g = num; } else if (s == 'cal') { g = def_g / obj.results[food_id].calories * num; } else if (s == '-1') { g = def_g * num; } else { g = obj.servings[obj.food_id][parseInt(s)].grams_per_serving * num; } var f = g / def_g;*/ // https://www.fda.gov/Food/IngredientsPackagingLabeling/LabelingNutrition/ucm274593.htm if (obj.domObj.find("#unit").val() == 'g') { var g = obj.domObj.find("#weight").val() || 0; var u = 'grams'; var unit = obj.domObj.find("#weight_unit").val(); if (unit == 'lb') { u = 'lbs'; } else if (unit == 'oz') { u = 'oz'; } obj.domObj.find(".serving_txt").text(g + ' ' + u); } else { var curr_num = (this.getInfiRangeCurrentValue() / obj.infirange.incby + obj.infirange.startval); if (isNaN(curr_num)) curr_num = 0; var numstr = '' + curr_num; numstr += ' ' + (curr_num == 1 ? obj.infirange.labels.single : obj.infirange.labels.multi); obj.domObj.find(".serving_txt").text(numstr); } /*obj.domObj.find(".carbs").text(Math.round(obj.results[food_id].carb_g * f) + ' g'); obj.domObj.find(".satfat").text(Math.round(obj.results[food_id].fat_sat_g * f) + ' g'); obj.domObj.find(".sugar").text(Math.round(obj.results[food_id].sugar_g * f) + ' g'); obj.domObj.find(".fat").text(Math.round(obj.results[food_id].fat_g * f) + ' g'); obj.domObj.find(".protein").text(Math.round(obj.results[food_id].protein_g * f) + ' g'); obj.domObj.find(".sodium").text(Math.round(obj.results[food_id].sodium_mg * f) + ' mg'); obj.domObj.find(".cholesterol").text(Math.round(obj.results[food_id].cholesterol_mg * f) + ' mg'); obj.domObj.find(".fiber").text(Math.round(obj.results[food_id].fiber_g * f) + ' g'); obj.domObj.find(".calories").text(Math.round(obj.results[food_id].calories * f)); var servdetails = []; servdetails.push(Math.round(obj.results[food_id].calories * f) + ' cal'); servdetails.push(Math.round(obj.results[food_id].carb_g * f) + 'g carbs'); servdetails.push(Math.round(obj.results[food_id].fat_g * f) + 'g fat'); servdetails.push(Math.round(obj.results[food_id].protein_g * f) + 'g protein');*/ obj.domObj.find(".carbs").text(data.carb_g + ' g'); obj.domObj.find(".satfat").text(data.fat_sat_g + ' g'); obj.domObj.find(".sugar").text(data.sugar_g + ' g'); obj.domObj.find(".fat").text(data.fat_g + ' g'); obj.domObj.find(".protein").text(data.protein_g + ' g'); obj.domObj.find(".sodium").text(data.sodium_mg + ' mg'); obj.domObj.find(".cholesterol").text(data.cholesterol_mg + ' mg'); obj.domObj.find(".fiber").text(data.fiber_g + ' g'); obj.domObj.find(".calories").text(data.calories); var servdetails = []; servdetails.push(data.calories + ' cal'); servdetails.push(data.carb_g + 'g carbs'); servdetails.push(data.fat_g + 'g fat'); servdetails.push(data.protein_g + 'g protein'); obj.domObj.find("#servdetails").text(servdetails.join(', ')); var carb_f = 300 / 2000; var fat_f = 65 / 2000; var satfat_f = 20 / 2000; var sodium_f = 2400 / 2000; var cholesterol_f = 300 / 2000; var fiber_f = 25 / 2000; var max_cal = 2000; // todo set this to calorie limit //alert(obj.results[food_id].fat_sat_g); //alert(Math.round(obj.results[food_id].fat_sat_g * f / (satfat_f * max_cal) * 100) ); obj.domObj.find(".carbs-percent").text(Math.round(data.carb_g / (carb_f * max_cal) * 100) + '%'); obj.domObj.find(".fat-percent").text(Math.round(data.fat_g / (fat_f * max_cal) * 100) + '%'); obj.domObj.find(".satfat-percent").text(Math.round(data.fat_sat_g / (satfat_f * max_cal) * 100) + '%'); obj.domObj.find(".sodium-percent").text(Math.round(data.sodium_mg / (sodium_f * max_cal) * 100) + '%'); obj.domObj.find(".cholesterol-percent").text(Math.round(data.cholesterol_mg / (cholesterol_f * max_cal) * 100) + '%'); obj.domObj.find(".fiber-percent").text(Math.round(data.fiber_g / (fiber_f * max_cal) * 100) + '%'); } LogFood.prototype.repositionBars = function(feedright) { var obj = this; var hh = 0; //$("#header").height(); var st = $(window).scrollTop(); var h = Math.max(hh - st, 0); feedright.css("top", st + h + 'px'); } LogFood.prototype.scroll = function() { var obj = this; //obj.repositionBars($("#searchbar")); //obj.repositionBars($("#servingbar")); } LogFood.prototype.getri = function() { var obj = this; return obj.viewmode; if (obj.viewmode == 0) { return 1; } else if (obj.viewmode == 1) { return 2; } else if (obj.viewmode == 2) { return 3; } return 0; } LogFood.prototype.processResults = function(data, $results, clickfirst, viewmode, myfood) { var obj = this; $results.empty(); if (data && data.results.length > 0) { var str = ''; //obj.domObj.find(".mealbuilderresult:not(#addcustomfood)").remove(); var str = ''; obj.results[viewmode] = data.data; obj.servings[viewmode] = data.servings; obj.added[viewmode] = data.added; obj.recent_food_servings[viewmode] = data.recent_food_servings; //alert(JSON.stringify(obj.results[viewmode])); for (var i = 0; i < data.results.length; i++) { //str += 'No results found...
'); if (clickfirst && $results.find(".foodresult:first").length == 0) { //obj.showDash(); //setWindow('LogFood'); unblockWindow(function() { setTimeout(function() { alert("Unable to find food matching barcode!"); }, 500); }); } } } LogFood.prototype.getIndexFromServId = function(food_id, viewmode, serv_id) { var obj = this; var i = 0; var servid = serv_id; if (obj.servings[obj.getri()][food_id] && obj.servings[obj.getri()][food_id].length) { for (i = 0; i < obj.servings[obj.getri()][food_id].length; i++) { if (serv_id == obj.servings[obj.getri()][food_id][i].food_serving_id) { servid = i; break; } } } return servid; } LogFood.prototype.setFoodDetails = function(food_id, viewmode) { var obj = this; obj.viewmode = viewmode || obj.viewmode; //alert(viewmode); //alert(obj.viewmode); var f = 1; var g = 100; var serving = '1 serving'; var descstr = '1 serving'; if (food_id && obj.results[obj.getri()][food_id]) { //alert(obj.servings[obj.food_id][0].grams_per_serving); if (typeof(obj.added[obj.getri()][food_id]) == 'undefined') { if (food_id && obj.servings[obj.getri()][food_id] && obj.servings[obj.getri()][food_id][0]) { //alert(obj.servings[obj.food_id][0].grams_per_serving); var num = 1; var def_g = obj.results[obj.getri()][food_id].serving1_g; g = obj.servings[obj.getri()][food_id][0].grams_per_serving * num; var f = g / def_g; serving = obj.servings[obj.getri()][food_id][0].serving_desc; //alert(Math.round(obj.results[obj.food_id].calories * f)); //setCenter(); } if (viewmode == 2) { // recent /*var num = obj.recent_food_servings[2][food_id].servings || 1; var servi = obj.getIndexFromServId(food_id, viewmode, obj.recent_food_servings[2][food_id].food_serving_id || 0); if (food_id && obj.servings[obj.getri()][food_id] && obj.servings[obj.getri()][food_id][servi]) { //var num = 1; var def_g = obj.results[obj.getri()][food_id].serving1_g; g = obj.servings[obj.getri()][food_id][servi].grams_per_serving * num; var f = g / def_g; serving = obj.servings[obj.getri()][food_id][servi].serving_desc; } else if (servi == 'cal') { } else if (servi == 'g') { } else { // 0 } */ // alert("here1"); var servi = obj.getIndexFromServId(food_id, viewmode, obj.results[2][food_id].food_serving_id || 0); var servdata = obj.getFoodServing(food_id, servi, (obj.results[2][food_id].servings || 1), obj.results[2][food_id].weight_input, obj.results[2][food_id].weight_unit); //obj.addFood(obj.bucke var cal = Math.round(servdata.calories); var protein = Math.round(servdata.protein_g); var fat = Math.round(servdata.fat_g); var carb = Math.round(servdata.carb_g); var ar = []; ar.push(servdata.servingname); ar.push(cal + ' calories'); ar.push(protein + 'g protein'); ar.push(carb + 'g carbs'); ar.push(fat + 'g fat'); descstr = ar.join(', '); } else { //alert("here2"); var cal = Math.round(obj.results[obj.getri()][food_id].calories * f); var protein = Math.round(obj.results[obj.getri()][food_id].protein_g * f); var fat = Math.round(obj.results[obj.getri()][food_id].fat_g * f); var carb = Math.round(obj.results[obj.getri()][food_id].carb_g * f); var ar = []; ar.push(serving); ar.push(cal + ' calories'); ar.push(protein + 'g protein'); ar.push(carb + 'g carbs'); ar.push(fat + 'g fat'); descstr = ar.join(', '); } } else { var i = 0; var servid = obj.added[obj.getri()][food_id].food_serving_id; if (obj.servings[obj.getri()][food_id] && obj.servings[obj.getri()][food_id].length) { for (i = 0; i < obj.servings[obj.getri()][food_id].length; i++) { if (obj.added[obj.getri()][food_id].food_serving_id == obj.servings[obj.getri()][food_id][i].food_serving_id) { servid = i; break; } } } var servings = obj.added[obj.getri()][food_id].servings; /*if (viewmode == 2) { // recent var num = obj.recent_food_servings[2][food_id].servings || 1; servings = num; var servi = obj.getIndexFromServId(food_id, viewmode, obj.recent_food_servings[2][food_id].food_serving_id || 0); if (food_id && obj.servings[obj.getri()][food_id] && obj.servings[obj.getri()][food_id][servi]) { //var num = 1; var def_g = obj.results[obj.getri()][food_id].serving1_g; g = obj.servings[obj.getri()][food_id][servi].grams_per_serving * num; var f = g / def_g; serving = obj.servings[obj.getri()][food_id][servi].serving_desc; } }*/ //alert(servid); var servdata = obj.getFoodServing(food_id, servid, servings, parseFloat(obj.added[obj.getri()][food_id].weight_input), obj.added[obj.getri()][food_id].weight_unit); //obj.addFood(obj.bucke var cal = Math.round(servdata.calories); var protein = Math.round(servdata.protein_g); var fat = Math.round(servdata.fat_g); var carb = Math.round(servdata.carb_g); var ar = []; ar.push(servdata.servingname); ar.push(cal + ' calories'); ar.push(protein + 'g protein'); ar.push(carb + 'g carbs'); ar.push(fat + 'g fat'); descstr = ar.join(', '); //if (obj.added[food_id].food_serving_id) { /*if (obj.added[food_id].food_serving_id == 'cal') { } else if (obj.added[food_id].food_serving_id == 'g') { } else if (obj.added[food_id].food_serving_id == '-1') { } else { for (var j = 0; j < obj.servings[food_id].length; j++) { if (obj.servings[food_id][j].food_serving_id == obj.added[food_id].food_serving_id) { //alert(data.added[data.results[i].food_id].food_serving_id); var num = obj.added[food_id].servings; var def_g = obj.results[food_id].serving1_g; g = obj.servings[food_id][j].grams_per_serving * num; var f = g / def_g; serving = obj.servings[food_id][j].serving_desc; break; } } }*/ //} } obj.domObj.find('.foodresult[food_id="' + food_id + '"]').find(".fooddetail").text(descstr); } } LogFood.prototype.doSearch = function(clickfirst) { var obj = this; if (obj.viewmode == 1 || obj.viewmode == 4 /*obj.domObj.find("#searchfoodscontainer").is(':visible')*/ ) { var txt = obj.domObj.find("#searchinputfood").val(); if (txt === obj.lastSearch) { return; } } var cat = ''; //obj.domObj.find(".searchmealfilter").val(); var restrict = obj.domObj.find("[name=restrictfoods]:checked").length != 0; if (obj.request !== null) { /*if (!obj.setTimer) { obj.setTimer = setTimeout(function() { obj.setTimer = null; obj.doSearch(clickfirst); }, 20); } return;*/ //obj.requestc.onreadystatechange = null; obj.request.abort(); //console.log(obj.request); obj.request = null; } //alert(obj.viewmode ); if (obj.viewmode == 1 || obj.viewmode == 4 /*obj.domObj.find("#searchfoodscontainer").is(':visible')*/ ) { var viewmode = 1; obj.viewmode = 1; var txt = obj.domObj.find("#searchinputfood").val(); //alert(txt); if (txt.trim().length < 2) { obj.domObj.find("#foodresults").empty(); return; } obj.domObj.find("#foodresults").empty(); obj.lastSearch = txt; obj.request = window.$oldAjax({ url: "/service/SearchFoods.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { bucket_id: obj.bucket_id, logday: obj.d.toYMD(), plan_id: 1, search: txt, cat: cat, restrict: restrict, foods: 1, recent: 0, myfoods: 1 }, success: function(data) { //alert(JSON.stringify(data)); obj.request = null; if (obj.setTimer) return; obj.processResults(data, obj.domObj.find("#foodresults"), clickfirst, viewmode); } }); } else if (obj.viewmode == 2 /*obj.domObj.find("#searchrecentcontainer").is(':visible')*/ ) { var txt = obj.domObj.find("#searchinputrecent").val(); var viewmode = 2; obj.viewmode = 2; obj.request = window.$oldAjax({ url: "/service/SearchFoods.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { bucket_id: obj.bucket_id, logday: obj.d.toYMD(), plan_id: 1, search: txt, cat: cat, restrict: restrict, foods: 0, recent: 1, myfoods: 1 }, success: function(data) { //alert(JSON.stringify(data)); obj.request = null; if (obj.setTimer) return; obj.processResults(data, obj.domObj.find("#recentresults"), clickfirst, viewmode); } }); } else if (obj.viewmode == 3 /*obj.domObj.find("#searchmyfoodcontainer").is(':visible')*/ ) { var viewmode = 3; obj.viewmode = 3; var txt = obj.domObj.find("#searchinputmyfood").val(); obj.request = window.$oldAjax({ url: "/service/SearchFoods.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { bucket_id: obj.bucket_id, logday: obj.d.toYMD(), plan_id: 1, search: txt, cat: cat, restrict: restrict, foods: 0, recent: 0, myfoods: 1 }, success: function(data) { //alert(JSON.stringify(data)); obj.request = null; if (obj.setTimer) return; obj.processResults(data, obj.domObj.find("#myfoodresults"), clickfirst, viewmode, true); } }); } } LogFood.prototype.getDomObj = function() { return this.domObj; } LogFood.prototype.setMode = function(mode) { var obj = this; } LogFood.prototype.setHooks = function() {} LogFood.prototype.destroy = function() { $(window).unbind('scroll', this.updateScroll); $("#content").addClass("page_width"); $("#navbar,#navmenu").show(); setMinHeight(); var obj = this; if (obj.resizeHandler) { $(window).off('resize', obj.resizeHandler); } this.destroyed = true; } LogFood.prototype.isBuilt = function() { return this.built; } LogFood.prototype.scannedFood = function(code) { var obj = this; blockWindow(); obj.domObj.find("#searchinputfood").val('BARCODE:' + code); obj.viewmode = 1; obj.showSearch(true); //setWindow('LogFood-' + obj.bucket_id + '-search-' + code); //this.domObj.find("#searchinputfood").val(code); //this.doSearch(true); } LogFood.prototype.contentSet = function() { $("#content").removeClass("page_width"); var obj = this; obj.resizeHandler = function() { obj.domObj.find("#foodname").width(window.innerWidth-30); obj.domObj.find("#unit").width(window.innerWidth-30); } $(window).on('resize', obj.resizeHandler).triggerHandler('resize'); this.drawInfiRange(); if (obj.autosearch != '') { blockWindow(); obj.domObj.find("#searchinputfood").val('BARCODE:' + obj.autosearch); obj.viewmode = 1; obj.showSearch(true); // setWindow('LogFood-' + obj.bucket_id + '-search-' + obj.autosearch); //obj.doSearch(true); } } function LogExercise(params) { this.loginRequired = true; this.destroyed = false; this.built = false; this.request = null; } LogExercise.prototype.appendExercise=function(id, exercise_id, units, inputs) { var obj = this; var str = ''; obj.domObj.find('[logid="' + id + '"]').remove(); var strhtml = ''; strhtml += inputs.name + 'No Results
'); } } }); this.domObj.find(".blurform").submit(function(e) { e.preventDefault(); obj.domObj.find("input[type=text]").blur(); }); this.getScheduled(); this.domObj.find("#searchinputexercise").keyup(function() { if (obj.searchtimer != null) { clearTimeout(obj.searchtimer); obj.searchtimer = null; } if (obj.request) { obj.request.abort(); obj.request = null; } obj.searchtimer = setTimeout(function() { obj.searchtimer = null; obj.doSearch(); }, 600); }); this.domObj.find('[name=restrictex]').change(function() { obj.doSearch(); obj.getScheduled(); }); this.domObj.find("#searchtype").change(function() { obj.domObj.find('[name=searchfor][value="' + $(this).val() + '"]').prop('checked', true); if ($(this).val() == 'recent') { //obj.domObj.find(".restrict").css("visibility", "hidden"); } else { //obj.domObj.find(".restrict").css("visibility", "visible"); } obj.doSearch(); }); obj.domObj.find('[name=searchfor]').change(function() { if ($(this).prop('checked')) { obj.domObj.find("#searchtype").val($(this).val()); if ($(this).val() == 'recent') { //obj.domObj.find(".restrict").css("visibility", "hidden"); } else { //obj.domObj.find(".restrict").css("visibility", "visible"); } obj.doSearch(); } }); obj.domObj.on("click", ".removelog", function(e) { e.preventDefault(); e.stopPropagation(); var id = $(this).attr('logid'); //if (confirm("Are you sure you want to remove this log entry?")) { $.ajax( { url: "/service/RemoveExerciseLog.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { id: id }, success: function( data ) { obj.domObj.find('[logid="' + id + '"]').remove(); } }); //} }); obj.domObj.on("click", ".exercise", function(e) { e.preventDefault(); var cal_formula = $(this).attr('cal_formula'); var name = $(this).attr('ename'); var exercise_id = $(this).attr('eid'); var units = $(this).attr('units'); var calories = $(this).attr('calories') || 0; var reps = $(this).attr('reps') || 0; var sets = $(this).attr('sets') || 0; var weight = $(this).attr('weight') || 0; var distance = $(this).attr('distance') || 0; var time = $(this).attr('time') || 0; var inputs = { calories: calories, reps: reps, sets: sets, weight: weight, distance: distance, time: time }; var id = $(this).attr('logid') || 0; var widget = new Widget("InputExerciseData", { callback: function(id, exercise_id, units, inputs ) { obj.addExercise(id, exercise_id, units, inputs); }, id: id, cal_formula: cal_formula, name: name, exercise_id: exercise_id, units: units, inputs: inputs }); widget.renderIntoPopup('100%', '100%', $(this)); }); obj.domObj.find(".inpcals").click(function(e) { e.preventDefault(); var cal_formula = $(this).attr('cal_formula'); var name = ''; var exercise_id = ''; var units = ''; var calories = 0; var reps = 0; var sets = 0; var weight = 0; var distance = 0; var time = 0; var inputs = { calories: calories, reps: reps, sets: sets, weight: weight, distance: distance, time: time }; var id = 0; var widget = new Widget("InputExerciseData", { callback: function(id, exercise_id, units, inputs ) { obj.addExercise(id, exercise_id, units, inputs); }, id: id, cal_formula: cal_formula, name: name, exercise_id: exercise_id, units: units, inputs: inputs }); widget.renderIntoPopup('100%', '100%', $(this)); }); obj.getLoggedExercise(); return false; } LogExercise.prototype.doSearch=function() { var obj = this; var txt = obj.domObj.find("#searchinputexercise").val(); var cat = '';//obj.domObj.find(".searchmealfilter").val(); var restrict = obj.domObj.find("[name=restrictex]:checked").length != 0; if (obj.request != null) { obj.request.abort(); } obj.domObj.find("#results").empty(); if (obj.domObj.find("#searchtype").val() == 'exercises') { if (txt.trim() == '') { return; } obj.request = $.ajax( { url: "/service/GetPlanExercise.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { search: txt, type: obj.type, restrict: restrict }, success: function( data ) { //alert(JSON.stringify(data)); var search_parts = txt.split(' '); if (data && data.length > 0) { var str = 'No Results
'); } } }); } else if (obj.domObj.find("#searchtype").val() == 'recent') { obj.request = $.ajax( { url: "/service/SearchRecentExercises.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { search: txt, type: obj.type, restrict: restrict }, success: function( data ) { //alert(JSON.stringify(data)); //var search_parts = txt.split(' '); if (data && data.length > 0) { var str = ''; var lastcat = -1; for (var i = 0; i < data.length; i++) { var catname = data[i].catname; var name = data[i].name; if (lastcat != data[i].catid) { //str += 'No Results
'); } } }); } } LogExercise.prototype.getDomObj=function() { return this.domObj; } LogExercise.prototype.setMode=function(mode) { var obj = this; } LogExercise.prototype.setHooks=function() { } LogExercise.prototype.destroy=function() { this.destroyed = true; } LogExercise.prototype.isBuilt=function() { return this.built; } LogExercise.prototype.contentSet=function(){ var obj = this; } function LogProgress(params) { this.loginRequired = true; this.destroyed = false; this.built = false; } LogProgress.prototype.getMetric = function(attrib) { switch (attrib) { case 'weight': return 'lbs'; default: return ''; } } LogProgress.prototype.getProgressHistory = function(attrib) { var obj = this; blockWindow(); var metric = this.getMetric(attrib); obj.domObj.find(".metric").text(metric); obj.domObj.find("[name=input]").val(''); $.ajax({ url: "/service/GetPlanAttributeHistory.php?session_id=" + g_sessionId + "&access_code=" + g_accessCode, cache: false, dataType: "json", data: { attrib: attrib }, success: function(data) { obj.domObj.find("table tr:not(.heading)").remove(); if (data) { var str = ''; for (var i = 0; i < data.length; i++) { if (i == 0) { obj.domObj.find("[name=input]").val(data[i].value); } var Days = 0; var t1 = data[i].logged_date.split(/[- :]/); var log_d1 = new Date(t1[0], t1[1] - 1, t1[2], t1[3], t1[4], t1[5]); var d1 = new Date(t1[0], t1[1] - 1, t1[2], 0, 0, 0); if (data[i].logged_date && data[i].last_logged_date) { // var t1 = data[i].logged_date.split(/[- :]/); // var d1 = new Date(t1[0], t1[1] - 1, t1[2], t1[3], t1[4], t1[5]); var t2 = data[i].last_logged_date.split(/[- :]/); var d2 = new Date(t2[0], t2[1] - 1, t2[2], 0, 0, 0); var Difference_In_Time = d1.getTime() - d2.getTime(); // To calculate the no. of days between two dates Days = parseInt(Difference_In_Time / (1000 * 3600 * 24)); } var last = ''; if (Days && data[i].value != data[i].last_value) { if (data[i].value > data[i].last_value) { last = 'History:
\Date/Time | \Input | \Delete | \
' + data.plans[k].description.substr(0, 200) + '...
\ \ \ '; } str += '\ '; str += ''; str += '< Prev Plans | More Plans > |
\ | \
\ | \
\ | \
\ | \
Enter Nutrients | \
||
\ | ||
Calories | kCal | \|
Protein | g | \|
Carbs | g | \|
Sugar | g | \|
Fiber | g | \|
Fat | g | \|
Saturated Fat | g | \|
Mono Fat | g | \|
Poly Fat | g | \|
Cholesterol | mg | \|
Sodium | mg | \|
Potassium | mg | \
Add | \||
Serving Size | \ | |
Calories | kCal | \|
Protein | g | \|
Carbs | g | \|
Sugar | g | \|
Fiber | g | \|
Fat | g | \|
Saturated Fat | g | \|
Mono Fat | g | \|
Poly Fat | g | \|
Cholesterol | mg | \|
Sodium | mg | \|
Potassium | mg | \
Ingredients:
' + htmlencode(namestr) + ' | \
||
Add | \
Welcome to Fit-Stepper
Use Back and Next to walk through tutorial and Close to exit it.
' }, { module: "Feed", menu: false, notice: "#usettings", txt: 'Settings is where you set up your personal information.
' }, { module: "Feed", menu: false, notice: "#msgcnt", txt: 'This is where you can see messages from your team members.
' }, { module: "Feed", menu: false, notice: "#friendscnt", txt: 'This is where team member requests can be found.
' }, { module: "Feed", menu: false, notice: "#feedad:visible", txt: 'This is a list of your top team members.
' }, { module: "Feed", menu: false, notice: "#chartlargeitem:visible,#chart:visible", txt: 'This is a chart of your daily step progress.
' }, { module: "Feed", menu: false, notice: ".STEPPER:visible", txt: 'This box shows the current tally of your steps.
' }, { module: "Feed", menu: false, notice: ".EXBURNED:visible>td", border: true, txt: 'This is the count of calories burned from activity.
' }, { module: "Feed", menu: false, notice: ".INTAKE:visible>td", border: true, txt: 'This is tally of nutrients you have consumed today.
This can be logged via MY LOG > Log Food.
' }, { module: "Feed", menu: false, notice: ".schedtoday:visible", txt: 'This is a list of all exercises you have scheduled today.
This can logged via MY PLAN > Schedule Strength/Cardio.
' }, { module: "Feed", menu: false, notice: ".ADHERECALC:visible", txt: 'This is a display of how well you have been adhereing to your plan.
A plan is a list of rules each of which gets graded to give you a total score of how you are doing.
A is the best and F is a failing grade.
' }, { module: "Feed", menu: false, notice: ".postfeed:visible", txt: 'This allows you to post text and pictures to your feed so team members can view, like and share.
' }, { module: "Feed", menu: false, notice: "#mutual_friends:visible", txt: 'This is a list of members connected to your team members.
' }, { module: "Feed", menu: false, notice: "#feedupdates:visible", glow:true, txt: 'This is where all feed updates will be displayed.
' }, { module: "Feed", menu: false, notice: "#mynetwork", txt: 'This module contains a list of views that relate to you, your team and live feed.
' }, { module: "Feed", menu: "#mynetwork" }, { module: "Feed", menu: "#mynetwork", notice: "#feed", txt: 'This view contains your live feed, a list of your top team members, your current activity, intake and plan adherence.
' }, { module: "Feed", menu: "#mynetwork", notice: "#friends", txt: 'This view contains a list of all your team members and team requests.
' }, { module: "Feed", menu: "#mynetwork", notice: "#profile", txt: 'This view contains your profile and your live wall feed.
' }, { module: "Feed", menu: "#mynetwork", notice: "#search", txt: 'This view allows you to search and invite people to join your team.
' }, { module: "Feed", menu: "#mynetwork", notice: "#messages", txt: 'This view contains a list of all your private messages.
' }, { module: "Feed", menu: false, notice: "#myplan", txt: 'This module contains everything pertaining to your plan, such as exercises and group discussion.
' }, { module: "Feed", menu: "#myplan" }, { module: "Feed", menu: "#myplan", notice: "#strengthoutline", txt: 'This view allows you to view and schedule strength exercises.
' }, { module: "Feed", menu: "#myplan", notice: "#cardiooutline", txt: 'This view allows you to view and schedule cardio exercises.
' }, { module: "Feed", menu: "#myplan", notice: "#discussion", txt: 'This view is a live discussion allowing everyone on your plan type to participate.
' }, { module: "Feed", menu: "#myplan", notice: "#changeplan", txt: 'This view allows you to change to a plan that will help you reach your goals.
' }, { module: "Feed", menu: false, notice: "#mylog", txt: 'This module allows you to log your dietary intake, your exercise, your weight and custom plan attributes.
' }, { module: "Feed", menu: "#mylog" }, { module: "Feed", menu: "#mylog", notice: "#logfood", txt: 'This view allows you to search our food database and record your food intake.
It allows you to create custom foods as well.
' }, { module: "Feed", menu: "#mylog", notice: "#logstrength", txt: 'This views allows you to search our exercise database and record exercises pertaining to strength building.
' }, { module: "Feed", menu: "#mylog", notice: "#logcardio", txt: 'This view allows you to search our exercise database and record exercises that pertain to cardiovascular endurance.
' }, { module: "Feed", menu: "#mylog", notice: "#logprogress", txt: 'This view allows you to record your weight and custom plan attributes that can be reported on in the MY PROGRESS module.
' }, { module: "Feed", menu: false, notice: "#myprogress", txt: 'This is a reporting module that allows you to see graphs on your plan adherence, your weight trend, your exercise progress and your daily steps.
' }, { module: "Feed", menu: "#myprogress" }, { module: "Feed", menu: "#myprogress", notice: "#viewplanadherence", txt: 'This view allows you to see a chart showing your adherence to the plan.
' }, { module: "Feed", menu: "#myprogress", notice: "#viewweighttrend", txt: 'This view displays a chart showing your weight trend.
' }, { module: "Feed", menu: "#myprogress", notice: "#viewprogress", txt: 'This view allows you to report on exercise and plan progression.
' }, { module: "Feed", menu: "#myprogress", notice: "#viewsteps", txt: 'This view displays a chart measuring your daily steps.
' }, { module: "Feed", menu: false, txt: 'That is the end of this tutorial.
' }, ], /* "Profile": [ { module: "Profile", menu: false }, { module: "Profile", menu: false, notice: ".profilepic" }, { module: "Profile", menu: false, notice: ".writemsg:visible" }, { module: "Profile", menu: false, notice: ".friendreq:visible" }, { module: "Profile", menu: false, notice: "#feedad:visible" }, { module: "Profile", menu: false, notice: ".planbox:visible" }, { module: "Profile", menu: false, notice: "article.totals:not(.planbox):visible" }, { module: "Profile", menu: false, notice: ".writeonwall:visible" }, { module: "Profile", menu: false, notice: "#feedupdates:visible", glow:true }, { module: "Profile", menu: false }, ], "LogFood": [ { module: "LogFood", menu: false, txt: 'This view allows you log your food intake.
Simply use Back and Next to move through tutorial.
' }, { module: "LogFood", menu: false, notice: "label[for=restrictfoods]", txt: 'If checked this will only show foods that your plan allows.
' }, { module: "LogFood", menu: false, notice: "#searchinputfood", txt: 'This is where you input a food to search for.
' }, { module: "LogFood", menu: false, notice: "#searchinputfood", val: "Rib-Eye", txt: 'We will enter "Rib-Eye" as an example.
' }, { module: "LogFood", menu: false, notice: "#results>.foodresult:first", unblock: true, txt: 'A list of search results is displayed. We will select the first as an example.
' }, { module: "LogFood", menu: false, notice: "#results>.foodresult:first", click: true, txt: 'This popup allows you to enter a number of servings to log.
' }, { module: "LogFood", menu: false, notice: "#numservings", blocked: true,txt: 'In this input we will enter number of servings.
' }, { module: "LogFood", menu: false, notice: "#numservings", blocked: true,val: "2", txt: 'We will input 2 servings as an example.
' }, { module: "LogFood", menu: false, notice: "#logit", blocked: true,txt: 'This button will log the food.
' }, { module: "LogFood", menu: false, notice: "#logit", gonext:true,click: true }, { module: "LogFood", menu: false, notice: "#addedfoods>.foodresult:first", unblock: true, txt: 'This is the food we haved logged for today.
As an example we shall edit the number of servings by clicking on it.
' }, { module: "LogFood", menu: false, notice: "#addedfoods>.foodresult:first", click: true }, { module: "LogFood", menu: false, notice: "#numservings", blocked: true,txt: 'We will change number of servings to 3.
' }, { module: "LogFood", menu: false, notice: "#numservings", blocked: true,val: "3" }, { module: "LogFood", menu: false, notice: "#logit", blocked: true,txt:'We will now confirm the change.
' }, { module: "LogFood", menu: false, notice: "#logit", blocked: true,gonext:true,click: true }, { module: "LogFood", menu: false, notice: "#addedfoods>.foodresult:first" }, { module: "LogFood", menu: false, notice: "#addedfoods>.foodresult:first .removelog", txt: 'As this is an example we shall remove the food we logged.
' }, { module: "LogFood", menu: false, notice: "#addedfoods>.foodresult:first .removelog", click: true }, { module: "LogFood", menu: false, notice: ".inpcals", unblock: true, txt: 'This button allows you to manually input nutrients.
You can create your own custom foods or meals with this button.
' }, { module: "LogFood", menu: false, notice: ".inpcals", blocked: true,click: true }, { module: "LogFood", menu: false, notice: "[name=nname]", blocked: true,txt: 'We shall name this custom log as Dinner.
' }, { module: "LogFood", menu: false, notice: "[name=nname]",blocked: true, val: "Dinner" }, { module: "LogFood", menu: false, notice: "[name=calories]",blocked: true, txt: 'We shall log this as 500 calories.
' }, { module: "LogFood", menu: false, notice: "[name=calories]",blocked: true, val: "500" }, { module: "LogFood", menu: false, notice: "#logit",blocked: true,gonext:true, click: true }, { module: "LogFood", menu: false, notice: "#addedfoods>.foodresult:first" }, { module: "LogFood", menu: false, notice: "#addedfoods>.foodresult:first .removelog", txt: 'As this is an example we shall remove the food we logged.
' }, { module: "LogFood", menu: false, notice: "#addedfoods>.foodresult:first .removelog", click: true }, { module: "LogFood", menu: false, notice: "#searchinputfood" }, { module: "LogFood", menu: false, notice: "#searchinputfood", val: "", run: '$("#searchtype").val("foods").triggerHandler("change");' }, { module: "LogFood", menu: false, notice: "#searchtype:visible,label[for=srecent]:visible", txt: 'You can also search your recent entries.
' }, { module: "LogFood", menu: false, notice: "#searchtype", val: "recent" }, { module: "LogFood", menu: false, notice: "#searchtype", val: "foods", txt: 'That is the end of this tutorial.
' } ], "LogProgress": [ { module: "LogProgress", menu: false }, ], "LogExercise": [ { module: "LogExercise", menu: false, txt: 'This view allows you log your exercise.
Simply use Back and Next to move through tutorial.
' }, { module: "LogExercise", menu: false, notice: "label[for=restrictex]", txt: 'If checked this will only show exercises that your plan allows.
' }, { module: "LogExercise", menu: false, notice: "#searchinputexercise", txt: 'This is where you input an exercise to search for.
' }, { module: "LogExercise", menu: false, notice: "#searchinputexercise", val: "A", txt: 'We will enter "A" as an example.
' }, { module: "LogExercise", menu: false, notice: "#results a:first", unblock: true, txt: 'A list of search results is displayed. We will select the first as an example.
' }, { module: "LogExercise", menu: false, notice: "#results a:first", blocked: true,click: true, txt: 'This popup allows you to enter exercise stats.
' }, { module: "LogExercise", menu: false, notice: "#sets",blocked: true, txt: 'This input allows you to input the number of sets.
' }, { module: "LogExercise", menu: false, notice: "#sets",blocked: true, val: "2", txt: 'We will enter 2 as an example.
' }, { module: "LogExercise", menu: false, notice: "#reps",blocked: true, txt: 'This input allows you to input the number of reps.
' }, { module: "LogExercise", menu: false, notice: "#reps",blocked: true, val: "3", txt: 'We will enter 3 as an example.
' }, { module: "LogExercise", menu: false, notice: "#weight",blocked: true, txt: 'This input allows you to input the amount of weight.
' }, { module: "LogExercise", menu: false, notice: "#weight",blocked: true, val: "50", txt: 'We will enter 50 lbs as an example.
' }, { module: "LogExercise", menu: false, notice: "#distance",blocked: true, txt: 'This input allows you to input the distance.
' }, { module: "LogExercise", menu: false, notice: "#distance", blocked: true,val: "4", txt: 'We will enter 4 miles as an example.
' }, { module: "LogExercise", menu: false, notice: "#time",blocked: true, txt: 'This input allows you to input the durations.
' }, { module: "LogExercise", menu: false, notice: "#time",blocked: true, val: "60", txt: 'We will enter 60 mins as an example.
' }, { module: "LogExercise", menu: false, notice: "#logit",blocked: true, txt: 'We will now confirm the log entry.
' }, { module: "LogExercise", menu: false, notice: "#logit",blocked: true, click: true, gonext:true }, { module: "LogExercise", menu: false, notice: "#addedex>.exercise:first", txt: 'This is our new log entry.
' }, { module: "LogExercise", menu: false, notice: "#addedex>.exercise:first .removelog", txt: 'We will now remove the example log entry.
' }, { module: "LogExercise", menu: false, notice: "#addedex>.exercise:first .removelog", click: true }, { module: "LogExercise", menu: false, notice: ".inpcals", txt: 'This button allows us to manually enter a custom exercise log and stats.
' }, { module: "LogExercise", menu: false, notice: ".inpcals",blocked: true, click: true }, { module: "LogExercise", menu: false, notice: "#name",blocked: true, txt: 'We will create this log entry as Gardening.' }, { module: "LogExercise", menu: false, notice: "#name",blocked: true, val: "Gardening" }, { module: "LogExercise", menu: false, notice: "#calories",blocked: true, txt: '
As an example will enter 200 calories burned.
' }, { module: "LogExercise", menu: false, notice: "#calories",blocked: true, val: "200" }, { module: "LogExercise", menu: false, notice: "#logit",blocked: true,gonext:true, click: true }, { module: "LogExercise", menu: false, notice: "#addedex>.exercise:first", txt: 'This is our custom exercise log entry.
' }, { module: "LogExercise", menu: false, notice: "#addedex>.exercise:first .removelog", txt: 'We will now remove the example log entry.
' }, { module: "LogExercise", menu: false, notice: "#addedex>.exercise:first .removelog", click: true }, { module: "LogExercise", menu: false, notice: "#searchinputexercise" }, { module: "LogExercise", menu: false, notice: "#searchinputexercise", val: "", run: '$("#searchtype").val("exercises").triggerHandler("change");' }, { module: "LogExercise", menu: false, notice: "#searchtype,label[for=srecent]:visible", txt: 'You can also search your recent entries.
' }, { module: "LogExercise", menu: false, notice: "#searchtype", val: "recent" }, { module: "LogExercise", menu: false, notice: "#searchtype", val: "exercises", txt: 'That is the end of this tutorial.
' } ], "Outline" : [ { module: "Outline", menu: false, notice: "#showtypeselector>p" }, { module: "Outline", menu: false, notice: "a.exercise:first" }, { module: "Outline", menu: false, notice: "a.exercise:first", click: true }, { module: "Outline", menu: false, notice: ".sched-btn:visible" }, { module: "Outline", menu: false, notice: ".sched-btn:visible", click: true }, { module: "Outline", menu: false, notice: ".fc-agenda-view" }, { module: "Outline", menu: false, notice: ".backinfo:visible" }, { module: "Outline", menu: false, notice: ".backinfo:visible", click: true }, { module: "Outline", menu: false, notice: ".back:visible" }, { module: "Outline", menu: false, notice: ".back:visible", click: true }, { module: "Outline", menu: false, notice: "#addexercise" }, ], "Discussion": [ { module: "Discussion", menu: false }, { module: "Discussion", menu: false, notice: "#newdiscuss" }, { module: "Discussion", menu: false, notice: "#newdiscuss", click: true }, { module: "Discussion", menu: false, notice: "#msgsubject" }, { module: "Discussion", menu: false, notice: "#msgtxt" }, { module: "Discussion", menu: false, notice: "#searchfilter" }, { module: "Discussion", menu: false, notice: "a.discuss:first" }, ], "Discuss": [ { module: "Discuss", menu: false }, { module: "Discuss", menu: false, notice: ".feeditem:first:visible" }, { module: "Discuss", menu:false, notice: "#newmsg" }, { module: "Discuss", menu:false, notice: "#feedupdates" }, ], "ChangePlan": [ { module: "ChangePlan", menu: false }, ],*/ }; function runHelp(module) { module = module || "Feed"; var notice = 1; if (typeof(helpModel[module]) == 'undefined') { notice = 0; return; } var noticef = function() { if (notice == 1) { setTimeout(noticef, 250); notice = 2; $(".takenotice,.takenotice2").removeClass("takenotice").removeClass("takenotice2").addClass("takenotice2"); } else if (notice == 2) { setTimeout(noticef, 250); notice = 1; $(".takenotice,.takenotice2").removeClass("takenotice").removeClass("takenotice2").addClass("takenotice"); } }; setTimeout(noticef, 650); var block = ''; $("body").append(block); var step = 0; var animating = false; function runStep(next) { $(".takenotice,.takenotice2").removeClass("takenotice").removeClass("takenotice2"); noMenuCloseTimer = helpModel[module][step].menu !== false; var f = function() { $("#helptxt").html(helpModel[module][step].txt || ''); if (helpModel[module][step].menu !== false) { showSubMenu($(helpModel[module][step].menu)); } if (typeof(helpModel[module][step].notice) != 'undefined') { if ($(helpModel[module][step].notice).length == 0) { if (next) { if (step == helpModel[module].length-1) { animating = false; return; } step = Math.min(step+1, helpModel[module].length-1); animating = false; return runStep(next); } else { step = Math.max(0, step-1); animating = false; return runStep(next); } } if (typeof(helpModel[module][step].blocked) == 'undefined') { unblockWindow(); } animating = true; $('html, body').stop().animate({ scrollTop: Math.max($($(helpModel[module][step].notice).get(0)).offset().top - 50, 0) }, 500, 'swing', function() { animating = false; if (typeof(helpModel[module][step].run) != 'undefined') { eval(helpModel[module][step].run); } if (typeof(helpModel[module][step].click) != 'undefined') { $(helpModel[module][step].notice).click(); } else if (next && typeof(helpModel[module][step].val) != 'undefined') { $(helpModel[module][step].notice).val(helpModel[module][step].val); if ($(helpModel[module][step].notice).prop('tagName').toLowerCase() == 'select') { $(helpModel[module][step].notice).triggerHandler('change'); } else { $(helpModel[module][step].notice).triggerHandler('keyup'); } } else if (! next && typeof(helpModel[module][step].prevval) != 'undefined') { $(helpModel[module][step].notice).val(helpModel[module][step].prevval); if ($(helpModel[module][step].notice).prop('tagName').toLowerCase() == 'select') { $(helpModel[module][step].notice).triggerHandler('change'); } else { $(helpModel[module][step].notice).triggerHandler('keyup'); } } else { $(helpModel[module][step].notice).addClass("takenotice"); if (typeof(helpModel[module][step].glow) != 'undefined') { $(helpModel[module][step].notice).addClass("glow"); } else if (typeof(helpModel[module][step].border) != 'undefined') { $(helpModel[module][step].notice).addClass("border"); } } if (typeof(helpModel[module][step].gonext) != 'undefined') { if (next) { $('html, body').stop().animate({ scrollTop: 0 }, 500, 'swing', function() {}); } } }); } }; if (g_mainWindow && g_mainWindow.windowName != helpModel[module][step].module) { animating = true; setWindow(helpModel[module][step].module, null, null, f); } else { f(); } return; } $("#nexthelp").click(function(e) { e.preventDefault(); if (animating) { return; } step = Math.min(step+1, helpModel[module].length-1); runStep(true); }); $("#prevhelp").click(function(e) { e.preventDefault(); if (animating) { return; } step = Math.max(0, step-1); runStep(); }); var rsz = function() { var h = Math.max(150, parseInt(window.innerHeight * 0.33)); $("#helpblock").css("top", (window.innerHeight - h) + 'px').css("height", h + "px"); $("#helptxt").css("height", (h - 70) + "px"); }; $(window).resize(rsz); $("#closehelp").click(function(e) { e.preventDefault(); noMenuCloseTimer = false; notice = 0; $(".takenotice,.takenotice2").removeClass("takenotice").removeClass("takenotice2"); $(window).off("resize", rsz); $("#helpcontainer").fadeOut('slow', function() { $("#helpcontainer").empty().remove(); }); }); rsz(); runStep(); }
Your Team:
\\ \ '; /*str += '
Friends:
\\