function createNamespace(D){var C=D.split(".");var A=window;for(var B=0;B<C.length;B++){if(typeof A[C[B]]=="undefined"){A[C[B]]=new Object()}A=A[C[B]]}return A}createNamespace("limeade.services");limeade.services.sendRequest=function(B,H,K,D,E,J){var G=limeade.services.createXMLHTTPObject();if(!G){return}var A=(D)?"POST":"GET";var I=(E)?E:true;var C=new Date();var F=(B.indexOf("?")==-1)?"?nocache=":"&nocache=";G.open(A,B+F+C.getTime(),I);G.setRequestHeader("User-Agent","XMLHTTP/1.0");if(D){G.setRequestHeader("Content-type","application/x-www-form-urlencoded")}G.onreadystatechange=function(){if(G.readyState!=4){return}if(G.responseText.indexOf('div id="loginbox1" align="center"')!=-1&&G.responseText.indexOf('<div id="ctl00_bcr_Login1___Login1"')!=-1){limeade.browserdetect.SessionTimedOut();return}if(G.status!=200&&G.status!=304&&G.status!=0){limeade.browserdetect.ConnectionFailed(G.status);return}else{limeade.browserdetect.HideErrorBar();K(G,H)}};if(G.readyState==4){return}G.send(D)};limeade.services.XMLHttpFactories=[function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];limeade.services.createXMLHTTPObject=function(){var A=null;for(var B=0;B<limeade.services.XMLHttpFactories.length;B++){try{A=limeade.services.XMLHttpFactories[B]()}catch(C){continue}break}return A};limeade.services.reloadPage=function(){window.location=window.location};limeade.services.trim=function(A){return A.replace(/^\s+|\s+$/g,"")};limeade.services.trimNonBreakSpaces=function(A){return A.replace("&nbsp;","")};limeade.services.containsDOM=function(A,C){var B=false;do{if((B=A==C)){break}C=C.parentNode}while(C!=null);return B};limeade.services.checkMouseLeave=function(B,A){if(B.contains&&A.toElement){return !B.contains(A.toElement)}else{if(A.relatedTarget){return !limeade.services.containsDOM(B,A.relatedTarget)}}};limeade.services.createXMLHttpRequest=function(){if(window.ActiveXObject){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}else{if(window.XMLHttpRequest){xmlHttp=new XMLHttpRequest()}}};limeade.services.preloadImages=function(){var A=new Array();for(i=0;i<limeade.services.preloadImages.length;i++){A[i]=new Image();A[i].src=limeade.services.preloadImages.arguments[i]}};limeade.services.getBody=function(D,C,B,E){var A=D.indexOf(C);var F=D.lastIndexOf(B);return D.slice(A+E,F)};limeade.services.hideElement=function(A){if(A!=null){A.style.visibility="hidden";A.style.display="none"}};limeade.services.showElement=function(A){if(A!=null){A.style.visibility="visible";A.style.display=""}};limeade.services.findPos=function(A){var B=curtop=0;if(A.offsetParent){B=A.offsetLeft;curtop=A.offsetTop;while(A=A.offsetParent){B+=A.offsetLeft;curtop+=A.offsetTop}}return[B,curtop]};limeade.services.findPosX=function(B){var A=limeade.services.findPos(B);return A[0]};limeade.services.findPosY=function(B){var A=limeade.services.findPos(B);return A[1]};limeade.services.findPosition=function(E,D){var M=E.offsetHeight;var K=limeade.services.findPos(E);var L=K[0];var B=K[1];L=L-20;var C=460;if(parseInt(navigator.appVersion)>3){if(navigator.appName=="Netscape"){C=window.innerHeight}if(navigator.appName.indexOf("Microsoft")!=-1){if(document.documentElement.clientHeight){C=document.documentElement.clientHeight}else{C=document.body.offsetHeight}}}var I,H;if(self.pageYOffset){H=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){H=document.documentElement.scrollTop}else{if(document.body){H=document.body.scrollTop}}}var G=H;var A=H+C;var J=B-(D/2);var F=B+(D/2);if(G>J){J=G+5}else{if(F>A){J=B-D-M}}return[L,J]};limeade.services.getQueryVariable=function(A){var C=window.location.search.substring(1);var D=C.split("&");for(var B=0;B<D.length;B++){var E=D[B].split("=");if(E[0]==A){return E[1]}}return null};limeade.services.getElementByClassTitle=function(F,D,A,G){if(D==null){D=document}if(A==null){A="*"}var C=D.getElementsByTagName(A);var B=C.length;var E=new RegExp("(^|\\s)"+F+"(\\s|$)");for(i=0;i<B;i++){if(E.test(C[i].className)&&(C[i].title==G)){return C[i]}}return null};limeade.services.nullFunction=function(B,A){};limeade.services.getElementsByClassName=function(D,E){var G=new Array();var F=D.getElementsByTagName("*");for(var C=0;C<F.length;C++){if(F[C].className.indexOf(" ")>=0){var B=F[C].className.split(" ");for(var A=0;A<B.length;A++){if(B[A]==E){G.push(F[C])}}}else{if(F[C].className==E){G.push(F[C])}}}return G};limeade.services.ValidateNumber=function(A){if(A==""){return -1}else{if(isNaN(A)){return 2}else{if(A.indexOf(".")>-1){if(limeade.services.trim(A.substring(A.indexOf("."),A.length-1)).length==0){return 3}else{return 5}}else{if(parseInt(A)>=0){return 1}else{return 4}}}}};limeade.services.DecrementASPControlId=function(G,D){var F=G.length;var B=D.indexOf(G+"_ctl");if(B==-1){return D}var A=D.substring(B+F+4,B+F+6);var C=parseInt(A,10);C=C-1;var E="";if(C<=9){E="0"}C=C+"";E=E+C;D=D.replace(G+"_ctl"+A,G+"_ctl"+E);return D};createNamespace("limeade.calendar");limeade.calendar.monthLabels=new Array("January","February","March","April","May","June","July","August","September","October","November","December");limeade.calendar.CalDayLabels=new Array("S","M","T","W","T","F","S");limeade.calendar.setFieldValueDisplay=function(A,B){if(B.getUTCDate()<10){document.getElementById(A).value=limeade.calendar.monthLabels[B.getUTCMonth()]+" 0"+B.getDate()+", "+B.getUTCFullYear()}else{document.getElementById(A).value=limeade.calendar.monthLabels[B.getUTCMonth()]+" "+B.getDate()+", "+B.getUTCFullYear()}};limeade.calendar.SetDate=function(D,B,A){limeade.calendar.setFieldValueDisplay(D,B);var C=$find(A);if(C!=null){C.set_selectedDate(B)}};limeade.calendar.ShowNextWeek=function(C,E,F,G,D){Year=parseInt(document.getElementById(E).value);Month=parseInt(document.getElementById(F).value);Day=parseInt(document.getElementById(G).value);if(C==true){Day=Day+7}else{Day=Day-7}var A=new Date(Year,Month,Day);var H=new Date(Year,Month,Day+6);document.getElementById(E).value=A.getFullYear();document.getElementById(F).value=A.getMonth();document.getElementById(G).value=A.getDate();var B=limeade.calendar.monthLabels[A.getMonth()]+" "+A.getDate()+" to "+monthLabels[H.getMonth()]+" "+H.getDate();document.getElementById(D).innerHTML=B;return false};createNamespace("limeade.controls");limeade.controls.ChangeMyPlanTab=function(A){if(A>0&&A<=2){var B=$find("ctl00_ctl00_bcr_TabContainerMyPlan");A-=1;if(B!=null){B.set_activeTab(B.get_tabs()[A])}}return false};limeade.controls.ChangeMyResultsTab=function(A){if(A>0&&A<=7){var B=$find("ctl00_ctl00_bcr_LifeAreasTabContainer");A-=1;if(B!=null){B.set_activeTab(B.get_tabs()[A])}}return false};limeade.controls.OnChange=function(E){var A=document.getElementById(E.id+"_TB");var C=document.getElementById(E.id+"_LB");var B=C.selectedIndex;if(B!=-1){var D=C.options[B].value;if(D.indexOf("add new units")!=-1){A.value="";A.focus()}}return true};limeade.controls.SaveButtonReset=function(A){if(A!=null&&A.value!="Save"){A.style.backgroundColor="";A.style.color="";A.value="Save"}};limeade.controls.AdjustDailyViewDown=function(A){var B=document.getElementById(A.id.replace(/DailyViewDown/,"NumericDaily"));var C=document.getElementById(A.id.replace(/DailyViewDown/,"SaveTrackingDataButton"));limeade.controls.AdjustDailyView(B,-1,C)};limeade.controls.AdjustDailyViewUp=function(A){var B=document.getElementById(A.id.replace(/DailyViewUp/,"NumericDaily"));var C=document.getElementById(A.id.replace(/DailyViewUp/,"SaveTrackingDataButton"));limeade.controls.AdjustDailyView(B,1,C)};limeade.controls.AdjustDailyView=function(B,C,A){if(B!=null){var D=0;if(B.value!=""){D=(parseFloat(B.value)+C)}if(D>=0){B.value=D}limeade.controls.SaveButtonReset(A)}};limeade.controls.NumericDailyChanged=function(A){var B=document.getElementById(A.id.replace(/NumericDaily/,"SaveTrackingDataButton"));limeade.controls.SaveButtonReset(B)};createNamespace("limeade.browserdetect");limeade.browserdetect.displayBrowserWarning=function(A){limeade.browserdetect.IE6=((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1))?true:false;limeade.browserdetect.IE7=((document.all)&&(navigator.appVersion.indexOf("MSIE 7.")!=-1))?true:false;limeade.browserdetect.IE8=((document.all)&&(navigator.appVersion.indexOf("MSIE 8.")!=-1))?true:false;limeade.browserdetect.FF3=((navigator.userAgent.indexOf("Firefox/3")!=-1))?true:false;limeade.browserdetect.FF2=((navigator.userAgent.indexOf("Firefox/2")!=-1))?true:false;limeade.browserdetect.FF1=((navigator.userAgent.indexOf("Firefox/1")!=-1))?true:false;if(!limeade.browserdetect.IE6&&!limeade.browserdetect.IE7&&!limeade.browserdetect.IE8&&!limeade.browserdetect.FF1&&!limeade.browserdetect.FF2&&!limeade.browserdetect.FF3){var B=document.getElementById(A);B.style.display="block";B.style.visibility="visible"}};limeade.browserdetect.ConnectionFailed=function(A){var B=document.getElementById("IncompatibleBrwsrLbl");if(B!=null){switch(A){case 408:B.innerHTML="Your connection has timed out. Please ensure you're connected to the internet and try again.";break;default:B.innerHTML="Unable to connect to the internet right now. Please ensure you're connected to the internet and try again.";break}limeade.services.showElement(B);B.style.display="block"}};limeade.browserdetect.SessionTimedOut=function(){var A=document.getElementById("IncompatibleBrwsrLbl");if(A!=null){A.innerHTML='You are not signed in! <a href="/login.aspx"  style="color:Black;">Click here</a> to sign in again.';limeade.services.showElement(A);A.style.display="block"}};limeade.browserdetect.HideErrorBar=function(){if(document.getElementById("IncompatibleBrwsrLbl")!=null){if(document.getElementById("IncompatibleBrwsrLbl").innerHTML.indexOf("For optimal user experience")==-1){limeade.services.hideElement(document.getElementById("IncompatibleBrwsrLbl"))}}};createNamespace("limeade.incentives");limeade.incentives.showIncentivePts=function(){limeade.services.showElement(document.getElementById("WellPoints"))};limeade.incentives.updatepoints=function(){limeade.services.sendRequest("/Incentives/ManageIncentives.aspx?op=calculate",null,limeade.services.nullFunction,null)};createNamespace("limeade.web.ui.grid");limeade.web.ui.grid.HighlightRow=function(A){A.className="hightlighrow MyPlanGoal"};limeade.web.ui.grid.DeHighlightRow=function(A){A.className="normalrow MyPlanGoal"};createNamespace("limeade.web.ui.messages");limeade.web.ui.messages.DismissMsg=function(B,C){limeade.services.hideElement(C);var A="/User/DismissMessage.aspx?msg="+B;limeade.services.sendRequest(A,null,limeade.services.nullFunction)};createNamespace("limeade.popups");limeade.popups.popupDelay=400;limeade.popups.closePopupDelay=500;limeade.popups.closeGoalTimer;limeade.popups.showAddToPlanButton="true";limeade.popups.currentlocation="";limeade.popups.showGoalTimer;limeade.popups.mode="edit";limeade.popups.HandleResourcePageChange=function(B,C){var D=C[2];var A=B.responseText;A=A.replace("ShowNextResource(","ShowNextResource("+C[0]+","+C[1]+",");D.html(A)};limeade.popups.HidePopup=function(){if($(".popupMenu")){$(".popupMenu").hide()}limeade.services.hideElement(document.getElementById("viewyourplan"))};limeade.popups.HideGoal=function(){clearTimeout(limeade.popups.showGoalTimer);clearTimeout(limeade.popups.closeGoalTimer);limeade.popups.HidePopup()};limeade.popups.HideGoalWithDelay=function(A){if(A.tagName!="INPUT"){limeade.popups.HidePopupWithDelay()}};limeade.popups.HidePopupWithDelay=function(){clearTimeout(limeade.popups.showGoalTimer);clearTimeout(limeade.popups.closeGoalTimer);limeade.popups.closeGoalTimer=setTimeout("limeade.popups.HidePopup();",limeade.popups.closePopupDelay)};function HideResource(){limeade.popups.HideGoal()}limeade.popups.ShowGoalDelay=function(F,D,B,G,E,A){window.planbtn=A;if(!window.planbtn){limeade.popups.showAddToPlanButton="true"}else{limeade.popups.showAddToPlanButton=window.planbtn}if(F.id!="PopupGoal"){var C=new Date();if(!F.id){F.id="tempId"+C.getTime()}F.onmouseout=function(){limeade.popups.HidePopupWithDelay()};clearTimeout(limeade.popups.showGoalTimer);clearTimeout(limeade.popups.closeGoalTimer);limeade.popups.showGoalTimer=setTimeout('limeade.popups.ShowGoalWithID("'+F.id+'",'+D+",'"+escape(B)+"','"+G+"','"+E+"')",limeade.popups.popupDelay)}else{clearTimeout(limeade.popups.closeGoalTimer)}};limeade.popups.ShowGoal=function(F,C,B,G,E){if(F.id!="PopupGoal"){clearTimeout(limeade.popups.closeGoalTimer);var D=new Date();var A="/MyResults/AjaxGoal.aspx?g="+encodeURIComponent(C)+"&p="+encodeURIComponent(G)+"&e="+encodeURIComponent(E)+"&target="+encodeURIComponent(F.id)+"&addplanbtn="+encodeURIComponent(limeade.popups.showAddToPlanButton)+"&loc="+encodeURIComponent(limeade.popups.currentlocation)+"&nocache="+D.getTime();limeade.services.sendRequest(A,new Array(F),limeade.popups.HandleGoalStateChange);return true}};limeade.popups.ShowGoalWithID=function(D,B,A,E,C){D=document.getElementById(D);limeade.popups.ShowGoal(D,B,A,E,C)};limeade.popups.ShowTargetDelay=function(F,C,A,G,E,D){if(D=="true"){limeade.popups.mode="create"}else{limeade.popups.mode="edit"}if(F.id!="PopupGoal"){var B=new Date();if(!F.id){F.id="tempId"+B.getTime()}F.onmouseout=function(){limeade.popups.HidePopupWithDelay()};clearTimeout(limeade.popups.showGoalTimer);clearTimeout(limeade.popups.closeGoalTimer);limeade.popups.showGoalTimer=setTimeout('limeade.popups.ShowTargetWithID("'+F.id+'",'+C+",'"+escape(A)+"','"+G+"','"+E+"')",limeade.popups.popupDelay)}else{clearTimeout(limeade.popups.closeGoalTimer)}};limeade.popups.ShowTarget=function(F,C,B,G,E){if(F.id!="PopupGoal"){clearTimeout(limeade.popups.closeGoalTimer);var D=new Date();var A="/MyPlan/AjaxTarget.aspx?g="+encodeURIComponent(C)+"&p="+encodeURIComponent(G)+"&e="+encodeURIComponent(E)+"&target="+encodeURIComponent(F.id)+"&mode="+encodeURIComponent(limeade.popups.mode)+"&loc="+encodeURIComponent(limeade.popups.currentlocation)+"&nocache="+D.getTime();limeade.services.sendRequest(A,new Array(F),limeade.popups.HandleGoalStateChange);return true}};limeade.popups.ShowTargetWithID=function(D,B,A,E,C){D=document.getElementById(D);limeade.popups.ShowTarget(D,B,A,E,C)};function ShowPopupDelay(C,A){var B=new Date();if(!C.id){C.id="tempId"+B.getTime()}if(C.id!="PopupGoal"){C.onmouseout=function(){limeade.popups.HidePopupWithDelay()};clearTimeout(limeade.popups.showGoalTimer);clearTimeout(limeade.popups.closeGoalTimer);ShowPopupWithID(C.id,A)}else{clearTimeout(limeade.popups.closeGoalTimer)}}function ShowPopupWithID(B,A){B=document.getElementById(B);ShowPopup(B,A)}function ShowPopup(B,A){if(B.id!="PopupGoal"){clearTimeout(limeade.popups.closeGoalTimer);limeade.services.sendRequest(A,new Array(B),limeade.popups.HandleGoalStateChange);return true}}function ShowHealthRiskCriteria(A,C){var B="/myresults/ajaxhealthriskcriteria.aspx?r="+encodeURIComponent(C);ShowPopupDelay(A,B)}function ShowResourceDelay(G,F,E,D,B,A){clearTimeout(limeade.popups.showGoalTimer);clearTimeout(limeade.popups.closeGoalTimer);if(E.className&&E.className=="PopupLink"){var C=new Date();if(!E.id){E.id="resLink"+C.getTime()}if(E.tagName=="A"){E.onmouseout=function(){limeade.popups.HidePopupWithDelay()}}E.onclick=function(){ShowResource(G,F,E,D,B,A)};limeade.popups.showGoalTimer=setTimeout('ShowResourceWithID("'+G+'",'+F+",'"+E.id+"','"+escape(D)+"',"+B+",'"+A+"')",limeade.popups.popupDelay)}}function ShowResourceWithID(F,E,D,C,B,A){D=document.getElementById(D);ShowResource(F,E,D,C,B,A)}function ShowResource(H,G,F,E,C,B){if($(F).attr("class")!="popupMenu"){var D=$(F).parents(".popupMenu:first");if(D.is(":visible")){ShowNextResource(H,G,E,C,B,D)}else{var A="/MyResults/AjaxResource.aspx?r="+encodeURIComponent(E)+"&p="+encodeURIComponent(H)+"&e="+encodeURIComponent(G)+"&save="+encodeURIComponent(C)+"&status="+encodeURIComponent(B);limeade.services.sendRequest(A,new Array(F),limeade.popups.HandleGoalStateChange)}}return true}function ShowNextResource(F,E,D,C,A){var B=$(".popupMenu").is(":visible");return ShowNextResource(F,E,D,C,A,B)}function ShowNextResource(G,F,E,D,B,C){var A="/MyResults/AjaxResource.aspx?r="+encodeURIComponent(E)+"&save="+encodeURIComponent(D)+"&status="+encodeURIComponent(B);if(typeof G!="undefined"){A+="&p="+encodeURIComponent(G)}if(typeof F!="undefined"){A+="&e="+encodeURIComponent(F)}limeade.services.sendRequest(A,new Array(G,F,C),limeade.popups.HandleResourcePageChange);return true}function AssociateGoalWithDimension(C,I,F,D,B){var A=document.getElementById("lstBxRelatedDimensions");var J=A.selectedIndex;if(J!=-1){limeade.services.showElement(document.getElementById("spinningassociate"));document.getElementById("associategoaltodim").disabled="true";var G=A.options[J].text;var E=A.options[J].value;var H="/MyPlan/UpdateGoalResource.aspx?g="+encodeURIComponent(C)+"&d="+encodeURIComponent(G)+"&r="+encodeURIComponent(E);limeade.services.sendRequest(H,new Array(F,D,I,C,B),HandleAssociateResourcesStateChange)}}function AddGoalToPlan(B){limeade.services.showElement(document.getElementById("spinning"));limeade.services.hideElement(document.getElementById("viewyourplan"));var A="/MyResults/AjaxAddGoalToPlan.aspx?g="+encodeURIComponent(B);limeade.services.sendRequest(A,null,HandleAddToPlanStateChange)}function HandleAddToPlanStateChange(A){limeade.services.hideElement(document.getElementById("spinning"));limeade.services.showElement(document.getElementById("viewyourplan"));document.getElementById("viewyourplan").style.display="inline";document.getElementById("addgoaltoplan").disabled="true";document.getElementById("addgoaltoplan").value=A.responseText}function HandleAssociateResourcesStateChange(C,A){var B=document.getElementById("associategoaltodim");if(C.responseText.indexOf("Success")!=-1){B.value="Updating resource...";var D=document.getElementById(A[2]);limeade.popups.ShowGoal(D,A[3],A[4],A[0],A[1])}else{B.disabled=false}limeade.services.hideElement(document.getElementById("spinningassociate"))}limeade.popups.DisplayPopup=function(G,B){var F=document.getElementById("PopupGoal");F.innerHTML=B;var A=document.createElement("DIV");A.innerHTML=B;document.getElementsByTagName("BODY")[0].appendChild(A);var E=A.offsetHeight;document.getElementsByTagName("BODY")[0].removeChild(A);var D=limeade.services.findPosition(G,E);var C,H;C=D[0]+G.scrollWidth;H=D[1];F.style.position="absolute";F.style.left=C+"px";F.style.top=H+"px";F.style.display="inline";limeade.services.showElement(F);F.onmouseover=G.onmouseover;if(navigator.userAgent.indexOf("Firefox")!=-1){F.onmouseout=function(I){if(limeade.services.checkMouseLeave(this,I)){limeade.popups.HideGoalWithDelay(this)}}}else{F.onmouseout=function(){if(limeade.services.checkMouseLeave(this,event)){limeade.popups.HideGoalWithDelay(this)}}}};limeade.popups.HandleGoalStateChange=function(B,A){limeade.popups.DisplayPopup(A[0],B.responseText)};createNamespace("limeade.answers");limeade.answers.xmlHttp;limeade.answers.myid=0;limeade.answers.ajaxlocked=false;limeade.answers.starImages=new Array("/User/images/0star.gif","/User/images/1star.gif","/User/images/2star.gif","/User/images/3star.gif","/User/images/4star.gif","/User/images/5star.gif");limeade.answers.nullStarMessage="/User/images/0.gif";limeade.answers.starMap=new Array("0,0,0,0","7,0,23,20","24,0,41,20","42,0,59,20","60,0,77,20","78,0,95,20");limeade.answers.starMessages=new Array("images/0.gif","images/1.gif","images/2.gif","images/3.gif","images/4.gif","images/5.gif","images/saved.gif");limeade.answers.savedRatings=new Array();limeade.answers.changedRatings=new Array();limeade.answers.starTwinkler=new Array();limeade.answers.msgTwinkler=new Array();limeade.answers.isRatingsBarChanged=false;limeade.answers.delayTime=5;limeade.services.preloadImages(limeade.answers.starImages);limeade.services.preloadImages(limeade.answers.starMessages);limeade.answers.SaveRatingAjax=function(D,C,B){rating=B;var A="AjaxAnswer.aspx?id="+encodeURIComponent(D)+"&Rating="+encodeURIComponent(B);limeade.answers.myid=D;limeade.answers.isRatingsBarChanged=true;limeade.answers.ajaxlocked=true;limeade.services.sendRequest(A,null,limeade.answers.HandleStateChange,null)};limeade.answers.HandleStateChange=function(A){limeade.answers.SwapStarMsg(limeade.answers.myid,rating);limeade.answers.ShowAnswerState(limeade.answers.myid);limeade.answers.HandleContinueButtonVisibility();limeade.answers.ajaxlocked=false};limeade.answers.SwapStars=function(B,A){document.images["stars."+B].style.cursor="hand";if(A==undefined){if(limeade.answers.changedRatings[B]==1){document.images["stars."+B].src=limeade.answers.starImages[limeade.answers.savedRatings[B]]}else{document.images["stars."+B].src=limeade.answers.starImages[0]}}else{document.images["stars."+B].src=limeade.answers.starImages[A]}};limeade.answers.SwapStarMsg=function(B,A){if(A==undefined){if(limeade.answers.changedRatings[B]==1){document.images["messages."+B].src=limeade.answers.starMessages[limeade.answers.savedRatings[B]]}else{document.images["messages."+B].src=limeade.answers.nullStarMessage}}else{document.images["messages."+B].src=limeade.answers.starMessages[A]}};limeade.answers.ShowAnswerState=function(A){document.images["answer."+A].src=limeade.answers.starMessages[6]};limeade.answers.SaveStarsAjax=function(B,A){if(limeade.answers.ajaxlocked==true){return}if((A==1)||(A==2)||(A==3)||(A==4)||(A==5)){limeade.answers.savedRatings[B]=A;limeade.answers.changedRatings[B]=1;limeade.answers.SaveRatingAjax(B,"onetofive",A)}else{alert("Answer Value out of the bound, Values can only be 1/2/3/4/5. Current answer value: "+A)}};limeade.answers.HandleContinueButtonVisibility=function(){var A=0;var H=0;var G=document.getElementById("ctl00_bcr_GridView1");var E=getElementsByClass("FivePtDiv",G,"div");for(var C=0;C<E.length;C++){if(E[C].style.visibility=="visible"){A++}}for(var F in limeade.answers.savedRatings){if((parseInt(F,10)!=0)&&(!isNaN(F))){H++}}var D;var B;if(document.getElementById){D=document.getElementById("ctl00_bcr_Continue1");B=document.getElementById("ctl00_bcr_Continue2")}else{if(document.all){D=document.all.ctl00_bcr_Continue1;B=document.all.ctl00_bcr_Continue2}}if(A==H){if(D!=undefined){D.disabled=false}if(B!=undefined){B.disabled=false}setVisibility("ctl00_bcr_Continue1",1);setVisibility("ctl00_bcr_Continue2",1)}else{if(D!=undefined){D.disabled=true}if(B!=undefined){B.disabled=true}setVisibility("ctl00_bcr_Continue1",0);setVisibility("ctl00_bcr_Continue2",0)}};limeade.answers.StarMouseOver=function(B,A){if(limeade.answers.starTwinkler[B]!=0){window.clearTimeout(limeade.answers.starTwinkler[B]);limeade.answers.starTwinkler[B]=0}if(limeade.answers.msgTwinkler[B]!=0){window.clearTimeout(limeade.answers.msgTwinkler[B]);limeade.answers.msgTwinkler[B]=0}limeade.answers.SwapStars(B,A);limeade.answers.SwapStarMsg(B,A)};limeade.answers.StarMouseOut=function(A){limeade.answers.starTwinkler[A]=window.setTimeout("limeade.answers.SwapStars('"+A+"')",limeade.answers.delayTime);limeade.answers.msgTwinkler[A]=window.setTimeout("limeade.answers.SwapStarMsg('"+A+"')",limeade.answers.delayTime)};limeade.answers.DisplayStarsAjax=function(D,C){var A="stars."+D;limeade.answers.starTwinkler[D]=0;limeade.answers.msgTwinkler[D]=0;document.write("<map name='starmap"+D+"'>");var B=0;for(B=1;B<6;B++){document.write("<area shape=rect coords='"+limeade.answers.starMap[B]+"' onMouseOver=\"limeade.answers.StarMouseOver('"+D+"',"+B+');" onMouseOut="limeade.answers.StarMouseOut(\''+D+"');\" onClick=\"limeade.answers.SaveStarsAjax('"+D+"',"+B+');" >')}document.write("</map>");document.write("<img vspace=2 title = '' src='"+limeade.answers.starImages[C]+"'");document.write(" border=0 usemap='#starmap"+D);document.write("' id='"+A+"'>")};limeade.answers.DisplayMsgAjax=function(A,D,G,F,E,C,B,I){var H="messages."+A;if(D==undefined){document.write("<img align='center' vspace=2 src='"+limeade.answers.nullStarMessage+"'")}else{document.write("<img vspace=2 src='"+limeade.answers.starMessages[D]+"'")}document.write("' id='"+H+"'>")};limeade.answers.DisplayAnswerStateAjax=function(C,A){var B="answer."+C;if((A==undefined)||(A==0)){document.write("<img align='center' vspace=2 src='images/question.gif'")}else{document.write("<img vspace=2 src='"+limeade.answers.starMessages[A]+"'")}document.write("' id='"+B+"'>")};function getElementsByAttribute(H,I,J,D){var E=(I=="*"&&document.all)?document.all:H.getElementsByTagName(I);var C=new Array();var G=(typeof D!="undefined")?new RegExp("(^|\\s)"+D+"(\\s|$)"):null;var A;var F;for(var B=0;B<E.length;B++){A=E[B];F=A.getAttribute(J);if(typeof F=="string"&&F.length>0){if(typeof D=="undefined"||(G&&G.test(F))){C.push(A)}}}return C}function getElementsByClass(G,E,A){var D=new Array();if(E==null){E=document}if(A==null){A="*"}var C=E.getElementsByTagName(A);var B=C.length;var F=new RegExp("(^|\\s)"+G+"(\\s|$)");for(i=0,j=0;i<B;i++){if(F.test(C[i].className)){D[j]=C[i];j++}}return D}function setVisibility(A,C){if(document.getElementById){var B=document.getElementById(A)}else{if(document.all){x=document.all[A]}}}xMousePos=0;yMousePos=0;xMousePosMax=0;yMousePosMax=0;xMouseLast=0;yMouseLast=0;function getScrollingPosition(){var A=[0,0];if(typeof window.pageYOffset!="undefined"){A=[0,0]}else{if(typeof document.documentElement.scrollTop!="undefined"&&document.documentElement.scrollTop>0){A=[document.documentElement.scrollLeft,document.documentElement.scrollTop]}else{if(typeof document.body.scrollTop!="undefined"){A=[document.body.scrollLeft,document.body.scrollTop]}}}return A}function mouseMove(B){B=B||window.event;var A=mouseCoords(B)}function mouseCoords(A){xMouseLast=xMousePos;yMouseLast=yMousePos;if(A.pageX||A.pageY){xMousePos=A.pageX;yMousePos=A.pageY;xMousePosMax=window.innerWidth+window.pageXOffset;yMousePosMax=window.innerHeight+window.pageYOffset;return{x:A.pageX,y:A.pageY}}if(document.body){xMousePos=A.clientX+document.body.scrollLeft-document.body.clientLeft;yMousePos=A.clientY+document.body.scrollTop-document.body.clientTop;xMousePosMax=document.body.clientWidth+document.body.scrollLeft;yMousePosMax=document.body.clientHeight+document.body.scrollTop;return{x:A.clientX+document.body.scrollLeft-document.body.clientLeft,y:A.clientY+document.body.scrollTop-document.body.clientTop}}}function at_display(A){win=window.open();for(var B in A){win.document.write(B+" = "+A[B]+"<br>")}}function at_show_aux(A,F){var D=document.getElementById(A);var E=document.getElementById(F);var C=(E.at_position=="y")?D.offsetHeight+0:0;var B=(E.at_position=="x")?D.offsetWidth+2:0;for(;D;D=D.offsetParent){if(D.className!="CommonTitleBar"){C+=D.offsetTop;B+=D.offsetLeft}}B-=141;E.style.position="absolute";E.style.top=C+"px";E.style.left=B+"px";limeade.services.showElement(E)}function at_show(){p=document.getElementById(this["at_parent"]);c=document.getElementById(this["at_child"]);at_show_aux(p.id,c.id);clearTimeout(c.at_timeout)}function at_hide(){c=document.getElementById(this["at_child"]);c.at_timeout=setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'",333)}function at_click(){p=document.getElementById(this["at_parent"]);c=document.getElementById(this["at_child"]);if(c.style.visibility!="visible"){at_show_aux(p.id,c.id)}else{c.style.visibility="hidden"}return false}function at_attach(C,E,B,A,D){p=document.getElementById(C);c=document.getElementById(E);p.at_parent=p.id;c.at_parent=p.id;p.at_child=c.id;c.at_child=c.id;p.at_position=A;c.at_position=A;c.style.position="absolute";c.style.visibility="hidden";if(D!=undefined){p.style.cursor=D}switch(B){case"click":p.onclick=at_click;p.onmouseout=at_hide;c.onmouseover=at_show;c.onmouseout=at_hide;break;case"hover":p.onmouseover=at_show;p.onmouseout=at_hide;c.onmouseover=at_show;c.onmouseout=at_hide;break}}createNamespace("limeade.graphs");limeade.graphs.DataReceived=function(B,A){document.getElementById(A[0]).innerHTML=limeade.services.getBody(B.responseText,"<!--StartGraphDisplay-->","<!--EndGraphDisplay-->",25)};limeade.graphs.ShowHealthRisk=function(A){document.getElementById("HealthRiskDimensionGraph").innerHTML=A.responseText};createNamespace("limeade.goals");limeade.goals.HideCreateGoal=function(){e1=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_PanelAddANewGoal");if(e1!=null){limeade.services.hideElement(e1);e1.style.height="0px"}e2=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_CreateNewGoalUpdatePanel");if(e2!=null){limeade.services.hideElement(e2);e2.style.height="0px"}var B=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_PanelCreateGoal");if(B!=null){limeade.services.hideElement(B);e2.style.height="0px"}var A=document.getElementById("CustomGoalDiv");if(A!=null){A.style.height="0px";limeade.services.hideElement(A)}document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalRelatedGoalRow").value="";document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalRelatedGoalId").value=""};limeade.goals.ShowCreateGoal=function(){var B=document.getElementById("CustomGoalDiv");if(B!=null){B.style.height="0px";limeade.services.hideElement(B)}var G=document.getElementById("CreateGoalDiv");if(G!=null){G.style.height="auto";limeade.services.showElement(G);G.style.display="inline"}var D=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_PanelCreateGoal");limeade.services.hideElement(D);var F=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_CreateNewGoalUpdatePanel");if(F!=null){F.style.height="auto";limeade.services.showElement(D);F.style.display="block"}var E=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_PanelAddANewGoal");if(E!=null){F.style.height="auto";limeade.services.showElement(E);E.style.display="inline"}var A=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_Top20Goals");if(A!=null){}limeade.services.showElement(document.getElementById("CreateGoalClose"));document.getElementById("CreateGoalClose").style.display="inline";limeade.services.hideElement(document.getElementById("CustomGoalClose"));var C=$find("ctl00_ctl00_bcr_TabContainerMyPlan");C.set_activeTab(C.get_tabs()[0])};limeade.goals.ShowCustomGoal=function(){var A=document.getElementById("CreateGoalDiv");if(A!=null){A.style.height="0px";limeade.services.hideElement(A)}A=document.getElementById("CustomGoalDiv");if(A!=null){A.style.height="auto";limeade.services.showElement(A);A.style.display="inline"}A=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_PanelCreateGoal");if(A!=null){A.style.height="auto";limeade.services.showElement(A);A.style.display="inline"}limeade.services.hideElement(document.getElementById("CreateGoalClose"));limeade.services.showElement(document.getElementById("CustomGoalClose"));document.getElementById("CustomGoalClose").style.display="inline"};limeade.goals.SetRelatedGoalId=function(B){var A=document.getElementById(B.id.replace(/RGCCreateGoal/,"GoalIdHidden")).value;document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalRelatedGoalId").value=A;document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalRelatedGoalRow").value=B.id.replace(/RGCCreateGoal/,"pnlGoalRow")};limeade.goals.SetImageRelatedGoalId=function(B){var A=document.getElementById(B.id.replace(/RGImageCreateGoal/,"GoalIdHidden")).value;document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalRelatedGoalId").value=A;document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalRelatedGoalRow").value=B.id.replace(/RGImageCreateGoal/,"pnlGoalRow")};limeade.goals.DisableImproveThisAndSpin=function(A){A.disabled=true;A.value="Adding goal..."};limeade.goals.ImproveGoalThroughRecommendation=function(A,B){limeade.services.sendRequest("/MyPlan/ManageGoals.aspx?&op=improve&dim="+encodeURIComponent(B),new Array(A),limeade.goals.DimensionImproved)};limeade.goals.DimensionImproved=function(C,B){var D=document.getElementById(B[0].id.replace("btnImproveThis","divImproveThis"));if(D){limeade.services.showElement(D)}var A=limeade.services.getBody(C.responseText,"<!--StartLoginBoxDisplay-->","<!--EndLoginBoxDisplay-->",27);if(A=="1"){B[0].value="Added Goal to Plan"}else{if(A=="0"){B[0].value="Goal already in Plan"}}};limeade.goals.InitSelection=function(A,D,B){var C=document.getElementById(A);B="false";if(B=="true"){document.getElementById("Goaltracker_Numeric").style.backgroundColor="#D6D6D6";document.getElementById("Goaltracker_weekly").style.backgroundColor="#D6D6D6";document.getElementById("Goaltracker_Journal").style.backgroundColor="#D6D6D6";document.getElementById("Goaltracker_FivePoint").style.backgroundColor="#D6D6D6";document.getElementById("Goaltracker_FivePointSmileys").style.backgroundColor="#D6D6D6";document.getElementById("Goaltracker_BinaryTracker").style.backgroundColor="#D6D6D6";C.style.backgroundColor="#CEFF9C";document.getElementById(D).value=C.id}else{limeade.goals.ActivateSelection(C,D,B)}};limeade.goals.ActivateSelection=function(C,D,A){A="false";if(A=="false"){document.getElementById("Goaltracker_Numeric").style.backgroundColor="transparent";document.getElementById("Goaltracker_weekly").style.backgroundColor="transparent";document.getElementById("Goaltracker_Journal").style.backgroundColor="transparent";document.getElementById("Goaltracker_FivePoint").style.backgroundColor="transparent";document.getElementById("Goaltracker_FivePointSmileys").style.backgroundColor="transparent";document.getElementById("Goaltracker_BinaryTracker").style.backgroundColor="transparent";C.style.backgroundColor="#CEFF9C";document.getElementById(D).value=C.id;var B=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblPromptFirst");var E=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblPromptLast");document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_txtUnits_TB").value="";limeade.goals.SetStandardTrackerUnits();switch(C.id){case"Goaltracker_Numeric":B.innerHTML="How many";E.innerHTML="today?";break;case"Goaltracker_weekly":B.innerHTML="How many";E.innerHTML="this week?";break;case"Goaltracker_FivePointSmileys":case"Goaltracker_FivePoint":B.innerHTML="Rating for";E.innerHTML="today?";break;case"Goaltracker_Journal":B.innerHTML="How is your";E.innerHTML="?";break;case"Goaltracker_BinaryTracker":B.innerHTML="Did you";E.innerHTML="today?";limeade.goals.SetBinaryTrackerUnits();break}}};limeade.goals.SetStandardTrackerUnits=function(){var A=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_txtUnits_LB");A.options.length=0;limeade.goals.AddItem("cigarettes","cigarettes",A);limeade.goals.AddItem("drinks","drinks",A);limeade.goals.AddItem("hours","hours",A);limeade.goals.AddItem("minutes","minutes",A);limeade.goals.AddItem("miles","miles",A);limeade.goals.AddItem("add new units...","add new units...",A)};limeade.goals.SetBinaryTrackerUnits=function(){var A=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_txtUnits_LB");A.options.length=0;limeade.goals.AddItem("exercise","exercise",A);limeade.goals.AddItem("run","run",A);limeade.goals.AddItem("bike","bike",A);limeade.goals.AddItem("smoke","smoke",A);limeade.goals.AddItem("drink","drink",A);limeade.goals.AddItem("walk","walk",A);limeade.goals.AddItem("add new activity...","add new activity...",A)};limeade.goals.AddItem=function(C,A,D){var B=document.createElement("option");D.options.add(B);B.text=C;B.value=A};limeade.goals.HighlightSelection=function(B,C,A,D){A="false";if(A=="false"){if(document.getElementById(C).value==null||document.getElementById(C).value==""){document.getElementById(C).value="Goaltracker_Numeric"}if(document.getElementById(C).value!=B.id){if(D==true){B.style.backgroundColor="#CEFF9C";B.style.cursor="hand"}else{B.style.backgroundColor="transparent"}}else{B.style.cursor="default"}}return true};limeade.goals.ReloadAfterGoalAdded=function(A){window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?status=added&goalname="+escape(A)};limeade.goals.SetToCenter=function(E,B,D){var F=document.getElementById(E);var H=document.getElementById(B);var C=getScrollingPosition();if(D=="true"){H.style.display="inline";H.style.position="absolute";H.style.left=limeade.services.findPosX(F)+(F.offsetWidth/2)+"px";H.style.top=limeade.services.findPosY(F)-(F.offsetHeight*1.5)-(H.offsetHeight/2)+"px"}else{var G=F.parentNode;var A=0;while(G.parentNode){if(G.style.display.toLowerCase()=="inline"){break}else{if(G.style.position=="absolute"){break}}G=G.parentNode}H.style.display="inline";H.style.position="absolute";H.style.left=limeade.services.findPosX(F)-limeade.services.findPosX(G)+(F.offsetWidth/2)+"px";H.style.top=limeade.services.findPosY(F)-limeade.services.findPosY(G)-(F.offsetHeight*1.5)-(H.offsetHeight/2)+"px"}};createNamespace("limeade.myplan");limeade.myplan.postbackChecker="";limeade.myplan.AddStandardGoal=function(A){var I=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_Top20Goals");var D=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalKeywords").value;var H=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalRelatedGoalId");var G=I.options[I.selectedIndex].value;var C=I.options[I.selectedIndex].innerHTML;var B=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_RFVGoalName");if(G==0){B.style.display="inline"}else{var F=limeade.myplan.replacementID();I.remove(I.selectedIndex);limeade.myplan.AddNewGoal(G,C,B,F)}var E="?op=add&goaltype=standard&g="+encodeURIComponent(G)+"&caldate="+limeade.myplan.trackerDate().format("MM/dd/yyyy");limeade.services.sendRequest("/MyPlan/ManageGoals.aspx"+E,new Array(F),limeade.myplan.GoalAdded,null)};limeade.myplan.AddCustomGoal=function(A){var N=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_txtBoxCreateGoalName");var B=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_RFVCustomGoalName");var C=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_RFVGoalUnits");var D=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCustomError");var O=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalTracker");var M=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalIcon");var H=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalKeywords");var F=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalResource");var L=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalRelatedGoalId");var E="Type the name of your new Goal here.";var K="NumericTrackingDailyView";var J=limeade.myplan.replacementID();var P=true;var G=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_txtUnits_TB");if(N.value==E||limeade.services.trim(N.value)==""){B.style.display="inline";D.innerHTML="You must enter a goal name.";P=false}else{B.style.display="none"}if(limeade.services.trim(G.value)==""){C.style.display="inline";P=false}else{C.style.display="none"}if(P){switch(O.value){case"Goaltracker_Numeric":K="NumericTrackingDailyView";break;case"Goaltracker_weekly":K="NumericTrackingWeeklyView";break;case"Goaltracker_Journal":K="Microjournal";break;case"Goaltracker_FivePoint":K="FivePointScale";break;case"Goaltracker_FivePointSmileys":K="FivePointScaleSmileys";break;case"Goaltracker_BinaryTracker":K="BinaryTracker";break}if(document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalRelatedGoalRow").value!=""){var Q=document.getElementById(document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_lblCreateGoalRelatedGoalRow").value);if(Q){limeade.services.hideElement(Q)}}var I="?op=add&goaltype=custom&gname="+encodeURIComponent(N.value)+"&units="+encodeURIComponent(G.value)+"&tool="+encodeURIComponent(K)+"&kw="+encodeURIComponent(H.value)+"&res="+encodeURIComponent(F.value)+"&icon="+encodeURIComponent(M.value)+"&caldate="+encodeURIComponent(limeade.myplan.trackerDate().format("MM/dd/yyyy"));if(L.value!="0"&&L.value!=""){I=I+"&relatedid="+L.value}if(limeade.myplan.AddNewGoal(L.value,N.value,B,J)){N.value="";G.value="";limeade.myplan.WatermarkBlur(N,E);limeade.goals.ActivateSelection(document.getElementById("Goaltracker_Numeric"),O.id,"");limeade.services.sendRequest("/MyPlan/ManageGoals.aspx"+I,new Array(J),limeade.myplan.GoalAdded,null)}else{D.innerHTML=" Goal already exists.";B.style.display="inline"}}};limeade.myplan.AddNewGoal=function(J,F,D,C){if(!limeade.myplan.GoalExists(F)){D.style.display="none";var E=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_GridView1").getElementsByTagName("tbody")[0];var G=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabPanelTrackProgress_BulkEditGridView1").getElementsByTagName("tbody")[0];var M=document.getElementById("Grid1GoalRow").cloneNode(true);var H=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_GoalCountHidden");var A=new Date();M.id="MyPlan_"+J;limeade.myplan.renameElementsInGoalRow(M,C);var K=limeade.services.getElementsByClassName(M,"SubHeaderColor");K[0].innerHTML=F;if(H.value==0){if(E.hasChildNodes()){E.removeChild(E.firstChild)}if(G.hasChildNodes()){G.removeChild(G.firstChild)}}E.appendChild(M);limeade.goals.HideCreateGoal();var L=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_goalstatus");var I=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_lblGoalModifiedStatus");var B=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_status");I.innerHTML='Added the goal "'+F+'" to your plan.&nbsp;Would you like to <a href="#" onclick="javascript:limeade.controls.ChangeMyPlanTab(2); return false;" >track your progress</a>?';if(B){limeade.services.hideElement(B)}limeade.services.showElement(L);H.value=Number(H.value)+1;return true}else{return false}};limeade.myplan.ShowOrHideOverThreeGoals=function(){var B=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_GoalCountHidden");var A=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_status");if(A){if(B.value>3){limeade.services.showElement(A)}}};limeade.myplan.GoalAdded=function(A,F){var R=limeade.services.getBody(A.responseText,"<!--StartGoalIdDisplay-->","<!--EndGoalIdDisplay-->",25);var D=limeade.services.getBody(A.responseText,"<!--StartResourceDisplay-->","<!--EndResourceDisplay-->",27);var Y=limeade.services.getBody(A.responseText,"<!--StartIconDisplay-->","<!--EndIconDisplay-->",23);var e=limeade.services.getBody(A.responseText,"<!--StartNameDisplay-->","<!--EndNameDisplay-->",23);var H=limeade.services.getBody(A.responseText,"<!--StartUseCountDisplay-->","<!--EndUseCountDisplay-->",27);var B=limeade.services.getBody(A.responseText,"<!--StartForumUrlDisplay-->","<!--EndForumUrlDisplay-->",27);var K=limeade.services.getBody(A.responseText,"<!--StartChallengeGoalDisplay-->","<!--EndChallengeGoalDisplay-->",32);var M=limeade.services.getBody(A.responseText,"<!--StartEditableTargetDisplay-->","<!--EndEditableTargetDisplay-->",33);var X=limeade.services.getBody(A.responseText,"<!--StartEditTargetPromptDisplay-->","<!--EndEditTargetPromptDisplay-->",35);var d=limeade.services.getBody(A.responseText,"<!--StartTitleDisplay-->","<!--EndTitleDisplay-->",24);var T=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"GoalTitle");var Z=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"ViewForumButton");var N=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"myGoalsChallenge");var a=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"lblChallengeSeparator");var S=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"GoalResources");var G=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"resPanel");var P=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"pnlResource");var C=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"lblUseCount");var V=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"GoalForum");var J=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_EmployerID");var Q=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_ProviderID");document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"GoalIdHidden").value=R;document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"GoalNameHidden").value=e;if(N!=null&&a!=null){if(K=="1"){limeade.services.showElement(N);N.href="/Challenges/CreateChallenge.aspx?g="+encodeURIComponent(R);limeade.services.showElement(a)}}if(Z!=null){Z.src="/Images/"+Y}if(V!=null){V.href=B}if(S!=null){S.onclick=function(){limeade.popups.ShowGoal(this,R,e,Q.value,J.value,"false");return false};S.onmouseover=function(){limeade.popups.ShowGoalDelay(this,R,e,Q.value,J.value,"false");return false}}if(C!=null){C.innerHTML=H}if(G!=null){if(D!=null&&limeade.services.trim(D)!=""){G.innerHTML=D;limeade.services.showElement(P)}}var E=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabPanelTrackProgress_BulkEditGridView1").getElementsByTagName("tbody")[0];var I=document.createElement("TR");I.className="normalrow TrackProgressGoal";I.onmouseover=function(){limeade.web.ui.grid.HighlightRow(this);this.className="hightlighrow TrackProgressGoal";return false};I.onmouseout=function(){limeade.web.ui.grid.DeHighlightRow(this);this.className="normalrow TrackProgressGoal";return false};I.id="TrackProgress_"+R;var U=document.createElement("TD");U.style.border="lightgrey 1px solid";U.style.verticalAlign="top";U.style.width="100%";U.innerHTML=limeade.services.getBody(A.responseText,"<!--StartTrackingDisplay-->","<!--EndTrackingDisplay-->",27);I.appendChild(U);limeade.myplan.renameElementsInGoalRow(I,F[0]);limeade.myplan.WireUpControls(I);if(E.rows[0].innerHTML.indexOf("To automatically Create Your Plan based on your Well-Being Assessment Results, click")!=-1){E.rows[0].style.display="none"}E.appendChild(I);var O="ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"EditTargetPrefix";var b=document.getElementById(O);O="ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"EditTargetLink2";var W=document.getElementById(O);O="ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_"+F[0]+"EditTargetSuffix2";var L=document.getElementById(O);if(M=="1"){limeade.services.showElement(b);W.onclick=function(){limeade.popups.ShowTarget(this,R,e,Q.value,J.value,"false");return false};W.onmouseover=function(){limeade.popups.ShowTargetDelay(this,R,e,Q.value,J.value,"false");return false};limeade.services.showElement(W);limeade.services.showElement(L);T.innerHTML=d}};limeade.myplan.SetTargetClick=function(B,E){var D=document.getElementById("goalname").innerHTML;var F=document.getElementById("ismorebetter");var H=F.options[F.selectedIndex].value;F=document.getElementById("frequency");var G=F.options[F.selectedIndex].value;var A=document.getElementById("goaltarget").value;document.getElementById("settarget").disabled=true;document.getElementById("saving").style.visibility="visible";document.getElementById("saving").style.display="inline";var C="/MyPlan/ManageGoals.aspx?op=settarget&g="+E+"&mb="+H+"&freq="+G+"&target="+A;limeade.services.sendRequest(C,new Array(B,E,D),limeade.myplan.SetTargetCallback)};String.prototype.endsWith=function(A){return(this.match(A+"$")==A)};limeade.myplan.SetTargetCallback=function(J,I){limeade.popups.HidePopup();var K=limeade.services.getBody(J.responseText,"<!--StartTitleDisplay-->","<!--EndTitleDisplay-->",24);K=K.trim();var H=limeade.services.getBody(J.responseText,"<!--StartAmountUnitsDisplay-->","<!--EndAmountUnitsDisplay-->",30);H=H.trim();var L=limeade.myplan.GetGoalTitleElementByNameUnits(I[2],H);if(L){L.innerHTML=K}var D=limeade.services.getBody(J.responseText,"<!--StartEditTargetPromptDisplay-->","<!--EndEditTargetPromptDisplay-->",35);var F=null;var E=I[0].indexOf("EditTargetLink2");if(E==-1){E=I[0].indexOf("SetTargetLink");if(E!=-1){var G=document.getElementById(I[0]);var B=I[0].replace(/SetTargetLink/,"EditTargetPrompt");$("#"+I[0]).before('<span id="'+B+'"></span>');F=document.getElementById(B);G.innerHTML="edit";$("#"+I[0]).after(")");var A=I[0].replace(/SetTargetLink/,"EditTargetLink");G.id=A}else{F=document.getElementById(I[0].replace(/EditTargetLink/,"EditTargetPrompt"))}}else{var C=$("#TrackProgress_"+I[1]).find("span[id*='EditTargetPrompt']");if(C){F=C[0]}}if(F){F.innerHTML=D}if(K.endsWith(" this week")){K=K.substr(0,K.length-10)}$(".WeeklyActivityItem a[id*="+I[1]+"]").text(K)};limeade.myplan.WatermarkFocus=function(A,B){if(A.value==B){A.value="";A.className=""}};limeade.myplan.WatermarkBlur=function(A,B){if(A.value==""){A.value=B;A.className="watermarked"}};limeade.myplan.GoalChange=function(C){var A=C.selectedIndex;var B=C.options[A].value;if(B==-2){limeade.goals.ShowCustomGoal()}else{document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_RFVGoalName").style.display="none"}};limeade.myplan.customNameChanged=function(){document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_CreateNewGoal_RFVCustomGoalName").style.display="none"};limeade.myplan.replacementID=function(){var C=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_AddCountHidden");var B=Number(C.value)+2;if(B<10){B="0"+B}C.value=Number(C.value)+1;var A="GridView1_ctl"+B+"_";return A};limeade.myplan.renameElementsInGoalRow=function(D,A){var C=D.getElementsByTagName("*");for(var B=0;B<C.length;B++){if(C[B].id){C[B].id=C[B].id.replace(/GridView1_ctl\d*_/gi,A)}if(C[B].name){C[B].name=C[B].name.replace(/GridView1_ctl\d*_/gi,A)}}};limeade.myplan.GoalExists=function(A){var C=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_GridView1");var D=limeade.services.getElementsByClassName(C,"SubHeaderColor");for(var B=0;B<D.length;B++){if(D[B].innerHTML==A){return true}}return false};limeade.myplan.GetGoalTitleElementByNameUnits=function(B,A){if(B.toLowerCase().indexOf(A.toLowerCase())!=-10){A="times"}var D=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_GridView1");var F=limeade.services.getElementsByClassName(D,"SubHeaderColor");for(var C=0;C<F.length;C++){var E=F[C].innerHTML.indexOf(B);if(E!=-1){if(A!=""){if(F[C].innerHTML.indexOf(A)!=-1){return F[C]}}else{return F[C]}}}return null};limeade.myplan.ActiveTabChanged=function(A,B){limeade.popups.HideGoal();limeade.myplan.ManageTabViews(A.get_activeTabIndex())};limeade.myplan.ManageTabViews=function(E){var B=document.getElementById("divMyGoals");var F=document.getElementById("divCalendar");var D=document.getElementById("divDoneTrackingMyGoals");var C=document.getElementById("divDoneTrackProgress");var A=document.getElementById("MyPlanIntroduction");if(E==1){limeade.services.showElement(F);limeade.services.showElement(C);limeade.services.hideElement(B);limeade.services.hideElement(D);A.appendChild(F)}else{limeade.services.hideElement(F);limeade.services.showElement(B);limeade.services.showElement(D);limeade.services.hideElement(C);A.appendChild(B)}};limeade.myplan.resetgoals=function(A,B){if(A!=null){limeade.myplan.DisplayControlValues(A);if(B!=null){limeade.myplan.DisplayControlValues(B)}}};limeade.myplan.DisplayControlValues=function(D){var E="";var C=D.getElementsByTagName("*");for(var B=0;B<C.length;B++){if(C[B].id){if((C[B].id.indexOf("FivePointScaleHowAreYou_Rating1Saved")!=-1)||(C[B].id.indexOf("FivePointScaleSmileysView1_Rating1Saved")!=-1)){var A=C[B].id.substring(0,C[B].id.length-6);limeade.myplan.SetSmileyById(A,0)}if(C[B].id.indexOf("FivePointScale_Star_")!=-1){document.getElementById(C[B].id.replace(/FivePointScale.*/,"FivePointScale_A")).title="0";limeade.myplan.ratingMouseOut(C[B])}if(C[B].id.indexOf("CompletedGoalLink")!=-1){C[B].href="#"}if(C[B].id.indexOf("TrackingTool1_BinaryTracker1_ImgYesNo")!=-1){document.getElementById(C[B].id.replace(/ImgYesNo/,"yesNoToggle")).value="-1";limeade.myplan.DeHighLightBinaryTracker(C[B])}if(C[B].id.indexOf("TrackingTool1_MessageText")!=-1){C[B].value="";limeade.myplan.WatermarkBlur(C[B],"Type your journal entry here.")}if(C[B].id.indexOf("WeeklyViewDateRange")!=-1){limeade.myplan.resetNumericWeekly(C[B],limeade.myplan.trackerDate())}if(C[B].id.indexOf("SaveTrackingDataButton")!=-1){limeade.controls.SaveButtonReset(C[B])}if(C[B].id.indexOf("NumericDaily")!=-1){C[B].value="0"}}}};limeade.myplan.WireUpControls=function(D){var C="";var B=null;if(!D){B=document.getElementsByTagName("*")}else{B=D.getElementsByTagName("*")}for(var A=0;A<B.length;A++){if(B[A].id){if(B[A].id.indexOf("FivePointScale_Star_")!=-1){B[A].onclick=function(){limeade.myplan.SaveStars(this);return false};B[A].onmouseover=function(){limeade.myplan.ratingMouseOver(this);return false};B[A].onmouseout=function(){limeade.myplan.ratingMouseOut(this);return false};B[A].title=B[A].id.charAt(B[A].id.length-1)}if(B[A].id.indexOf("FivePointScaleHowAreYou_Rating")!=-1){B[A].onclick=limeade.myplan.SaveHowAreYouSmileys}if(B[A].id.indexOf("MessageText")!=-1){B[A].style.width="185px";B[A].style.height="45px"}}}};limeade.myplan.resetNumericWeekly=function(H,C){if(H!=null){if(H.firstChild!=null){if(C!=null){var A=new Date();var D=-6;A=new Date(C.getFullYear(),C.getMonth(),C.getDate()-0+D);H.firstChild.data=limeade.calendar.monthLabels[A.getMonth()]+" "+A.getUTCDate()+" to "+limeade.calendar.monthLabels[C.getMonth()]+" "+C.getUTCDate();var G=document.getElementById(H.id.replace("WeeklyViewDateRange","WeekStartYear"));var B=document.getElementById(H.id.replace("WeeklyViewDateRange","WeekStartMonth"));var E=document.getElementById(H.id.replace("WeeklyViewDateRange","WeekStartDay"));if(G!=null){G.value=A.getFullYear()}if(B!=null){B.value=A.getMonth()}if(E!=null){E.value=A.getUTCDate()}for(var I=1;I<=7;I++){var F=document.getElementById(H.id.replace("WeeklyViewDateRange","Weekday"+I));if(F!=null){F.value=""}}limeade.myplan.setWeekDayLetters(A,H.id.replace("WeeklyViewDateRange",""))}}}};limeade.myplan.numericWeeklyChanged=function(A){var B=document.getElementById(A.id.replace(/TrackingTool1_.*/,"TrackingTool1_SaveTrackingDataButton"));limeade.controls.SaveButtonReset(B)};limeade.myplan.AcceptGoalClick=function(E,D){var B;var A=document.getElementById(E.id.replace(D,"RelatedGoalsHidden")).value;if(A!="True"){B=document.getElementById(E.id.replace(D,"GoalNameHidden")).value}else{var G=document.getElementById(E.id.replace(/AcceptTop3GoalLink/,"relatedNames")).value;var C=G.split("|");var F=parseInt(document.getElementById(E.id.replace(/AcceptTop3GoalLink/,"relatedindx")).value);B=C[F]}limeade.services.sendRequest("/MyPlan/ManageGoals.aspx?op=goalexists&gname="+encodeURIComponent(B),new Array(E,D,B),limeade.myplan.AcceptGoalCallback)};limeade.myplan.AcceptGoalCallback=function(B,D){var Z;var T;var R=limeade.services.getBody(B.responseText,"<!--StartLoginBoxDisplay-->","<!--EndLoginBoxDisplay-->",27);if(R=="1"){alert('"'+D[2]+'" - Goal is already accepted on your plan.');return}var V=D[0];var G=D[1];var L=document.getElementById(V.id.replace(G,"RelatedGoalsHidden")).value;var C=document.getElementById(V.id.replace(G,"AcceptGoalPanel"));var Q=document.getElementById(V.id.replace(G,"GoalAcceptedPanel"));var a=document.getElementById(V.id.replace(G,"GoalIdHidden")).value;var Y=document.getElementById(V.id.replace(G,"pnlGoalRow"));if(L=="True"){var I=document.getElementById(V.id.replace(/AcceptTop3GoalLink/,"relatedNames")).value;var S=I.split("|");var W=parseInt(document.getElementById(V.id.replace(/AcceptTop3GoalLink/,"relatedindx")).value);Z=S[W];var F=document.getElementById(V.id.replace(/AcceptTop3GoalLink/,"relatedTitles")).value;var J=F.split("|");T=J[W]}else{Z=document.getElementById(V.id.replace(G,"GoalNameHidden")).value}var E=document.getElementById(V.id.replace(/TabMyGoals_.*/,"TabMyGoals_status"));var O=document.getElementById(V.id.replace(/TabMyGoals_.*/,"TabMyGoals_goalstatus"));var X=document.getElementById(V.id.replace(/TabMyGoals_.*/,"TabMyGoals_lblGoalModifiedStatus"));var N=$find("ctl00_ctl00_bcr_TabContainerMyPlan");if(L!="True"){limeade.services.hideElement(C);limeade.services.showElement(Q)}X.innerHTML='Accepted the goal "'+Z+'". &nbsp;Would you like to <a href="#" onclick="javascript:limeade.controls.ChangeMyPlanTab(2); return false;" >track your progress</a>?';if(E){limeade.services.hideElement(E)}limeade.services.showElement(O);if(L=="True"){var A=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_GridView1").getElementsByTagName("tbody")[0];var M=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabPanelTrackProgress_BulkEditGridView1").getElementsByTagName("tbody")[0];var H=document.getElementById("Grid1GoalRow").cloneNode(true);var U=new Date();var P=limeade.myplan.replacementID();H.id="MyPlan_"+a;limeade.myplan.renameElementsInGoalRow(H,P);var K=limeade.services.getElementsByClassName(H,"SubHeaderColor");K[0].innerHTML=T;A.insertBefore(H,Y.parentNode.parentNode);A.removeChild(Y.parentNode.parentNode);limeade.services.sendRequest("/MyPlan/ManageGoals.aspx?g="+encodeURIComponent(a)+"&op=accept&gname="+encodeURIComponent(Z),new Array(P),limeade.myplan.GoalAdded)}else{limeade.services.sendRequest("/MyPlan/ManageGoals.aspx?g="+encodeURIComponent(a)+"&op=accept&gname="+encodeURIComponent(Z),null,limeade.services.nullFunction)}};limeade.myplan.AccomplishChallengeGoal=function(B,D,A){var C="Congratulations! Click 'OK' to accomplish the challenge and see your challenge record.";if(confirm(C)){limeade.services.sendRequest("/MyPlan/ManageGoals.aspx?g="+encodeURIComponent(B)+"&cid="+encodeURIComponent(A)+"&op="+encodeURIComponent(D),null,limeade.services.nullFunction);return true}else{return false}};limeade.myplan.DeleteGoalClick=function(Q,C,E,B){var O=document.getElementById(Q.id.replace(E,"IsChallengeHidden")).value;var T=document.getElementById(Q.id.replace(E,"GoalIdHidden")).value;var S=document.getElementById(Q.id.replace(E,"GoalNameHidden")).value;var G=document.getElementById(Q.id.replace(E,"GoalVisibility")).value;var D=document.getElementById(Q.id.replace(/TabMyGoals_.*/,"TabMyGoals_status"));var J=document.getElementById(Q.id.replace(/TabMyGoals_.*/,"TabMyGoals_goalstatus"));var R=document.getElementById(Q.id.replace(/TabMyGoals_.*/,"TabMyGoals_lblGoalModifiedStatus"));var F;var K;var H="delete";if(C=="0"){if(G=="1"){if(O=="True"){F="Are you sure you want to stop tracking this Challenge Goal?"}else{F="Are you sure you want to stop tracking this goal?"}}K='The goal "'+S+'" has been removed from your plan.';H="delete"}else{if(G=="1"){if(O=="True"){F="Congratulations! Do you want to stop tracking this Challenge Goal?"}else{F="Congratulations! Do you want to stop tracking this goal?"}}K='Congratulations! You accomplished the goal "'+S+'".';H="accomplish"}var P=true;if(G=="1"){P=confirm(F)}if(P){var L=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabMyGoals_GridView1").getElementsByTagName("tbody")[0];var N=document.getElementById(Q.id.replace(E,"pnlGoalRow"));L.removeChild(N.parentNode.parentNode);var M=document.getElementById("TrackProgress_"+T);if(M){var I=document.getElementById("ctl00_ctl00_bcr_TabContainerMyPlan_TabPanelTrackProgress_BulkEditGridView1").getElementsByTagName("tbody")[0];I.removeChild(M)}if(D){limeade.services.hideElement(D)}limeade.services.showElement(J);var A=document.getElementById(Q.id.replace(/TabMyGoals_.*/,"TabMyGoals_GoalCountHidden"));A.value-=1;if(A.value==0){K='You have no goals. To Create Your Plan based on your Well-Being Assessment Results, click <a href="/MyPlan/index.aspx?mode=createplan">here</a>.';limeade.services.hideElement(document.getElementById(Q.id.replace(/TabMyGoals_.*/,"TabMyGoals_closeBtn")))}R.innerHTML=K;limeade.services.sendRequest("/MyPlan/ManageGoals.aspx?g="+encodeURIComponent(T)+"&cid="+encodeURIComponent(B)+"&op="+encodeURIComponent(H),null,limeade.services.nullFunction)}return false};limeade.myplan.TurnOnBinaryTracker=function(E){E.src="/myplan/images/BinaryTrackerCheckMarked.gif";var C=document.getElementById(E.id.replace(/ImgYesNo/,"BinarySaved"));var B=document.getElementById(E.id.replace(/ImgYesNo/,"BinarySavedNo"));var A=document.getElementById(E.id.replace(/ImgYesNo/,"yesNoToggle"));A.value="1";C.style.color="";B.style.color="lightgrey";var D=document.getElementById(E.id.replace(/BinaryTracker1_ImgYesNo.*/,"TrackingGoalId"));limeade.tracking.SaveTrackingData("1",limeade.myplan.trackerDate().format("MM/dd/yyyy"),D.value,E);return false};limeade.myplan.TurnOnYesLink=function(E){var C=document.getElementById(E.id.replace(/BinarySaved/,"ImgYesNo"));var B=document.getElementById(E.id.replace(/BinarySaved/,"BinarySavedNo"));var A=document.getElementById(E.id.replace(/BinarySaved/,"yesNoToggle"));C.src="/myplan/images/BinaryTrackerCheckMarked.gif";A.value="1";E.style.color="";B.style.color="lightgrey";var D=document.getElementById(E.id.replace(/BinaryTracker1_BinarySaved.*/,"TrackingGoalId"));limeade.tracking.SaveTrackingData("1",limeade.myplan.trackerDate().format("MM/dd/yyyy"),D.value,E);return false};limeade.myplan.TurnOnNoLink=function(E){var C=document.getElementById(E.id.replace(/BinarySavedNo/,"ImgYesNo"));var B=document.getElementById(E.id.replace(/BinarySavedNo/,"BinarySaved"));var A=document.getElementById(E.id.replace(/BinarySavedNo/,"yesNoToggle"));C.src="/myplan/images/BinaryTrackerUnCheckMarked.gif";A.value="0";B.style.color="lightgrey";E.style.color="";var D=document.getElementById(E.id.replace(/BinaryTracker1_BinarySavedNo.*/,"TrackingGoalId"));limeade.tracking.SaveTrackingData("0",limeade.myplan.trackerDate().format("MM/dd/yyyy"),D.value,E);return false};limeade.myplan.HighLightBinaryTracker=function(C){C.src="/myplan/images/BinaryTrackerCheckMarked.gif";var B=document.getElementById(C.id.replace(/ImgYesNo/,"BinarySaved"));var A=document.getElementById(C.id.replace(/ImgYesNo/,"BinarySavedNo"));B.style.color="";A.style.color="lightgrey";return false};limeade.myplan.DeHighLightBinaryTracker=function(D){var A=document.getElementById(D.id.replace(/ImgYesNo/,"yesNoToggle"));var C=document.getElementById(D.id.replace(/ImgYesNo/,"BinarySaved"));var B=document.getElementById(D.id.replace(/ImgYesNo/,"BinarySavedNo"));if(A.value!="1"){D.src="/myplan/images/BinaryTrackerUnCheckMarked.gif";C.style.color="lightgrey";if(A.value=="0"){B.style.color=""}}return false};limeade.myplan.HighLightYesLink=function(C){var B=document.getElementById(C.id.replace(/BinarySaved/,"ImgYesNo"));var A=document.getElementById(C.id.replace(/BinarySaved/,"BinarySavedNo"));B.src="/myplan/images/BinaryTrackerCheckMarked.gif";C.style.color="";A.style.color="lightgrey"};limeade.myplan.HighLightNoLink=function(C){var A=document.getElementById(C.id.replace(/BinarySavedNo/,"ImgYesNo"));var B=document.getElementById(C.id.replace(/BinarySavedNo/,"BinarySaved"));A.src="/myplan/images/BinaryTrackerUnCheckMarked.gif";C.style.color="";B.style.color="lightgrey"};limeade.myplan.DeHighLightYesLink=function(C){var A=document.getElementById(C.id.replace(/BinarySaved/,"yesNoToggle"));var B=document.getElementById(C.id.replace(/BinarySaved/,"BinarySavedNo"));if(A.value!="1"){C.style.color="lightgrey";document.getElementById(C.id.replace(/BinarySaved/,"ImgYesNo")).src="/myplan/images/BinaryTrackerUnCheckMarked.gif";if(A.value=="0"){B.style.color=""}}};limeade.myplan.DeHighLightNoLink=function(D){var B=document.getElementById(D.id.replace(/BinarySavedNo/,"ImgYesNo"));var A=document.getElementById(D.id.replace(/BinarySavedNo/,"yesNoToggle"));var C=document.getElementById(D.id.replace(/BinarySavedNo/,"BinarySaved"));if(A.value=="1"){B.src="/myplan/images/BinaryTrackerCheckMarked.gif";C.style.color=""}if(A.value!="0"){D.style.color="lightgrey"}};limeade.myplan.setWeekDayLetters=function(A,C){var D=new Date();for(var E=0;E<=6;E++){D=new Date(A.getFullYear(),A.getMonth(),A.getDate()-0+E);var B=document.getElementById(C+"dayltr"+(E+1));if(B!=null){if(B.firstChild!=null){B.firstChild.data=limeade.calendar.CalDayLabels[D.getDay()]}}}};limeade.myplan.PopupClicked=function(A,B){while(A.parentNode){if(A.id.indexOf(B)!=-1||A.id.indexOf("GoalResources")!=-1||A.id.indexOf("timeStampButton")!=-1){return true}A=A.parentNode}return false};limeade.myplan.SaveStars=function(A){var C=document.getElementById(A.id.replace(/FivePointScale.*/,"TrackingGoalId"));var B=document.getElementById(A.id.replace(/FivePointScale.*/,"FivePointScale_A"));var D=parseFloat(A.id.charAt(A.id.length-1));B.title=D;limeade.tracking.SaveTrackingData(D,limeade.myplan.trackerDate().format("MM/dd/yyyy"),C.value,A);return false};limeade.myplan.ratingMouseOver=function(D){var B=parseFloat(D.id.charAt(D.id.length-1));for(var C=1;C<=5;C++){var A=document.getElementById(D.id.substring(0,D.id.length-1)+C);if(C<=B){A.className="ratingItem Filled"}else{A.className="ratingItem Empty"}}};limeade.myplan.ratingMouseOut=function(D){var E=document.getElementById(D.id.replace(/FivePointScale.*/,"FivePointScale_A"));var B=parseFloat(E.title);for(var C=1;C<=5;C++){var A=document.getElementById(D.id.substring(0,D.id.length-1)+C);if(C<=B){A.className="ratingItem Filled"}else{A.className="ratingItem Empty"}}};limeade.myplan.SaveSmileys=function(B){var A=document.getElementById(B.id.replace(/FivePointScaleSmileysView1_Rating.*/,"TrackingGoalId"));var C=parseFloat(B.id.charAt(B.id.length-1));limeade.tracking.SaveTrackingData(C,limeade.myplan.trackerDate().format("MM/dd/yyyy"),A.value,B);limeade.myplan.SetSmileys(B);return false};limeade.myplan.trackerDate=function(){var A=new Date(document.getElementById("ctl00_ctl00_bcr_txtMyPlanCalendar").value);return A};limeade.myplan.SaveHowAreYouSmileys=function(){var A=parseFloat(this.id.charAt(this.id.length-1));limeade.tracking.SaveTrackingData(A,limeade.myplan.trackerDate().format("MM/dd/yyyy"),null,this,true);limeade.myplan.SetSmileys(this);return false};limeade.myplan.SetSmileys=function(B){var A=B.id.substring(0,B.id.length-1);limeade.myplan.SetSmileyById(A,B.id.charAt(B.id.length-1))};limeade.myplan.SetSmileyById=function(B,A){var D=B+A;for(i=1;i<=5;i++){var C=document.getElementById(B+i);if(C.id!=D){C.src=C.src.replace(/smileyroll/,"smiley");this.onmouseout="this.src = '"+C.src+"'"}else{C.onmouseout=null}}};limeade.myplan.SaveButtonClicked=function(A){var C=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"TrackingGoalId"));var G=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"TrackingToolHidden"));var E=true;var D="";switch(G.value){case"Microjournal":case"MicroJournal":D=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"MessageText")).value;if(D=="Type your journal entry here."){D=""}break;case"NumericTrackingDailyView":D=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"NumericDaily")).value;var F=limeade.services.ValidateNumber(D);if(F!=1&&F!=5){var B=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"numericErrorText"));switch(F){case -1:B.innerHTML=" Value required.";break;case 2:B.innerHTML=" Valid number required.";break;case 3:B.innerHTML=" Invalid decimal number.";break;case 4:B.innerHTML=" Value less than zero.";break}limeade.services.showElement(document.getElementById(A.id.replace(/SaveTrackingDataButton/,"RFVNumericError")));E=false}D=Math.round(D);break;case"NumericTrackingWeeklyView":var N=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"WeeklyView1_Weekday1")).value;var M=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"WeeklyView1_Weekday2")).value;var L=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"WeeklyView1_Weekday3")).value;var K=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"WeeklyView1_Weekday4")).value;var J=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"WeeklyView1_Weekday5")).value;var I=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"WeeklyView1_Weekday6")).value;var H=document.getElementById(A.id.replace(/SaveTrackingDataButton/,"WeeklyView1_Weekday7")).value;D=N+","+M+","+L+","+K+","+J+","+I+","+H;break}if(E){A.style.color="white";A.style.backgroundColor="black";A.value="Saved!";limeade.services.hideElement(document.getElementById(A.id.replace(/SaveTrackingDataButton/,"RFVNumericWarning")));limeade.services.hideElement(document.getElementById(A.id.replace(/SaveTrackingDataButton/,"RFVNumericError")));limeade.tracking.SaveTrackingData(D,limeade.myplan.trackerDate().format("MM/dd/yyyy"),C.value,A)}return false};limeade.myplan.NumberHasFocus=function(A){limeade.services.hideElement(document.getElementById(A.id.replace(/NumericDaily/,"RFVNumericWarning")))};limeade.myplan.NumberLostFocus=function(B){var D=limeade.services.ValidateNumber(B.value);var C=document.getElementById(B.id.replace(/NumericDaily/,"RFVNumericWarning"));if(D==5){B.value=Math.round(B.value);var A=document.getElementById(B.id.replace(/NumericDaily/,"numericWarningText"));A.innerHTML=" Decimal number rounded.";limeade.services.showElement(C)}else{limeade.services.hideElement(C);limeade.services.hideElement(document.getElementById(B.id.replace(/NumericDaily/,"RFVNumericError")))}};limeade.myplan.IsNewTrackingData=function(B){if(B.value=="NewData"){initPopUp();var A=new Date();showPopWin("NewTrackingData.aspx?nocache="+A.getTime(),427,390,limeade.services.reloadPage)}};limeade.myplan.SetIncrementalDate=function(F,A){var E=document.getElementById(F);var C=false;if(E!=null){var D=new Date(E.value);var B=new Date();D.setDate(D.getDate()+A);if(D<=B){limeade.calendar.SetDate(F,D,"myPlanCal");C=true}}return C};limeade.myplan.checkNewActivity=function(D){var C=document.getElementById(D.id.replace(/chkNewActivity.*/i,"TrackingTool1_TrackingGoalId")).value;var B=document.getElementById(D.id.replace(/chkNewActivity.*/i,"HistoricDataGraphID_HistoricDataUpdatePanel"));var A=document.getElementById("newActivityDiv");B.innerHTML=A.innerHTML;limeade.services.sendRequest("/Sync/HealthVaultSync.aspx?synchactdata=true",new Array(C,B),limeade.myplan.UpdateChart)};limeade.myplan.UpdateChart=function(F,C){var D=C[1];var B=document.getElementById(D.id.replace(/HistoricDataGraphID_HistoricDataUpdatePanel/,"GraphMonth"));var A="/Chart/HistoricChartGenerate.aspx";var E="goalId="+C[0];if(B!=null){E+="&months="+B.value}else{E+="&months=1"}A+="?"+E;limeade.services.sendRequest(A,new Array(D),limeade.tracking.ReloadGraph,null)};createNamespace("limeade.tracking");limeade.tracking.ReloadGraph=function(B,A){A[0].innerHTML=limeade.services.getBody(B.responseText,"<!--StartChartDisplay-->","<!--EndChartDisplay-->",25)};limeade.tracking.DataSaved=function(F,C){limeade.incentives.updatepoints();var B="/Chart/HistoricChartGenerate.aspx";var E="";var D=null;var A=null;if(C[2]==true){D=document.getElementById(C[0].id.replace(/FivePointScaleHowAreYou_Rating.*/,"HDGHowAreYou_HistoricDataUpdatePanel"));A=document.getElementById(C[0].id.replace(/FivePointScaleHowAreYou_Rating.*/,"HDGHowAreYou_GraphMonth"));E="howAreYou=true"}else{E="goalId="+C[1];D=document.getElementById(C[0].id.replace(/TrackingTool1_.*/,"HistoricDataGraphID_HistoricDataUpdatePanel"));A=document.getElementById(C[0].id.replace(/TrackingTool1_.*/,"GraphMonth"))}if(D){if(A!=null){E+="&months="+A.value}B+="?"+E;limeade.services.sendRequest(B,new Array(D),limeade.tracking.ReloadGraph,null)}};limeade.tracking.UpdateChartFromLink=function(F){var C=F.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;var B="/Chart/HistoricChartGenerate.aspx";var E="months="+F.innerHTML;var A=null;if(C.id.indexOf("HDGHowAreYou")==-1){var D=document.getElementById(C.id.replace(/HistoricDataGraphID_.*/,"TrackingTool1_TrackingGoalId"));E+="&goalid="+D.value;A=document.getElementById(C.id.replace(/HistoricDataGraphID_.*/,"GraphMonth"))}else{E+="&howAreYou=true";A=document.getElementById(C.id.replace(/HistoricDataUpdatePanel.*/,"GraphMonth"))}A.value=encodeURIComponent(F.innerHTML);B+="?"+E;limeade.services.sendRequest(B,new Array(C),limeade.tracking.ReloadGraph,null);return false};limeade.tracking.SaveTrackingData=function(D,B,G,C,H){var A="/MyPlan/SaveTrackingData.aspx";var I="toolVal="+encodeURIComponent(D);I+="&goalId="+encodeURIComponent(G);I+="&trackedDate="+encodeURIComponent(B);if(H){I+="&how="+encodeURIComponent(H)}A+="?"+I;var F=document.getElementById(C.id.replace(/TrackingTool1_.*/,"AcceptGoalPanel").replace(/TabPanelTrackProgress_BulkEditGridView1/,"TabMyGoals_GridView1"));var E=document.getElementById(C.id.replace(/TrackingTool1_.*/,"GoalAcceptedPanel").replace(/TabPanelTrackProgress_BulkEditGridView1/,"TabMyGoals_GridView1"));limeade.services.hideElement(F);limeade.services.showElement(E);limeade.services.sendRequest(A,new Array(C,G,H),limeade.tracking.DataSaved,null)};var dateFormat=function(){var A=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,B=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,D=/[^-+\dA-Z]/g,C=function(F,E){F=String(F);E=E||2;while(F.length<E){F="0"+F}return F};return function(J,V,R){var G=dateFormat;if(arguments.length==1&&(typeof J=="string"||J instanceof String)&&!/\d/.test(J)){V=J;J=undefined}J=J?new Date(J):new Date();if(isNaN(J)){throw new SyntaxError("invalid date")}V=String(G.masks[V]||V||G.masks["default"]);if(V.slice(0,4)=="UTC:"){V=V.slice(4);R=true}var T=R?"getUTC":"get",O=J[T+"Date"](),E=J[T+"Day"](),K=J[T+"Month"](),Q=J[T+"FullYear"](),S=J[T+"Hours"](),N=J[T+"Minutes"](),U=J[T+"Seconds"](),P=J[T+"Milliseconds"](),F=R?0:J.getTimezoneOffset(),I={d:O,dd:C(O),ddd:G.i18n.dayNames[E],dddd:G.i18n.dayNames[E+7],m:K+1,mm:C(K+1),mmm:G.i18n.monthNames[K],mmmm:G.i18n.monthNames[K+12],yy:String(Q).slice(2),yyyy:Q,h:S%12||12,hh:C(S%12||12),H:S,HH:C(S),M:N,MM:C(N),s:U,ss:C(U),l:C(P,3),L:C(P>99?Math.round(P/10):P),t:S<12?"a":"p",tt:S<12?"am":"pm",T:S<12?"A":"P",TT:S<12?"AM":"PM",Z:R?"UTC":(String(J).match(B)||[""]).pop().replace(D,""),o:(F>0?"-":"+")+C(Math.floor(Math.abs(F)/60)*100+Math.abs(F)%60,4),S:["th","st","nd","rd"][O%10>3?0:(O%100-O%10!=10)*O%10]};return V.replace(A,function(H){return H in I?I[H]:H.slice(1,H.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(A,B){return dateFormat(this,A,B)};var limchallenges=createNamespace("limeade.challenges");var limcreatechallenge=createNamespace("limeade.challenges.createchallenge");limchallenges.toggleUnitsValidator=function(){var B=document.getElementById("ctl00_bcr_rbNumber");if(B!=null){var A=document.getElementById("ctl00_bcr_RFVUnits");if(B.checked){ValidatorEnable(A,true)}else{ValidatorEnable(A,false)}}};limchallenges.clientValidate=function(C){var B;if(C.id.indexOf("txtNewParticipant")!=-1){B=C.id.replace(/bp___v___ctl00_ctl00_bcr_txtNewParticipant/gi,"")}else{if(C.id.indexOf("ctl00_bcr_txtLimeadeChallenger")!=-1){B=C.id.replace(/ctl00_bcr_txtLimeadeChallenger/gi,"")}}C.value=limeade.services.trim(C.value);if(C.value!=""){limeade.services.hideElement(document.getElementById("NotEnoughUsers"));var A="/Challenges/ValidateUserNameOrEmail.aspx?user="+encodeURIComponent(C.value);try{limeade.services.sendRequest(A,new Array(B),limchallenges.userNameEmailValidated,null,false)}catch(D){return;3}}else{limeade.services.hideElement(document.getElementById("UserNotFound"+B))}};limchallenges.userNameEmailValidated=function(A,C){if(A.responseText.length!=0){var B=limeade.services.getBody(A.responseText,"<!--StartDisplay-->","<!--EndDisplay-->",19);var D=document.getElementById("UserNotFound"+C[0]);if(B.indexOf("True")!=-1){limeade.services.hideElement(D)}else{if(D!=null){limeade.services.showElement(D);D.style.height=""}}}};limchallenges.validateUnits=function(){var A=document.getElementById("challTrackingTypeRow");var D=document.getElementById("ctl00_bcr_rbWeight");if(D&&D.checked){return true}if(A.style.visibility=="visible"){var C=document.getElementById("ctl00_bcr_rbNumber");var E=document.getElementById("ctl00_bcr_rbYesNo");var B;if(C&&C.checked){B=document.getElementById("ctl00_bcr_cmbUnits_TB")}else{if(E&&E.checked){B=document.getElementById("ctl00_bcr_cmbYesNo_TB")}}if(limeade.services.trim(B.value)==""){document.getElementById("ctl00_bcr_RFVChallengeUnits").style.display="inline";window.scrollTo(0,240);return false}else{document.getElementById("ctl00_bcr_RFVChallengeUnits").style.display="none"}}return true};limchallenges.validateAllUsernames=function(){var G=document.getElementById("ctl00_bcr_NotifyPanel");var A=document.getElementById("inviteesDiv");var C=true;if(A!=null&&A.style.visibility=="hidden"){C=true}else{if(G!=null){var D=limeade.services.getElementsByClassName(G,"invitee");var E=0;for(var B=0;B<D.length;B++){D[B].value=limeade.services.trim(D[B].value);if(D[B].value!=""){limchallenges.clientValidate(D[B]);var F=document.getElementById("UserNotFound"+D[B].id.replace(/ctl00_bcr_txtLimeadeChallenger/gi,""));if(F.style.visibility=="visible"){C=C&&false}else{C&&true}E+=1}}if(E==0){limeade.services.showElement(document.getElementById("NotEnoughUsers"));C=false}}}return C};limchallenges.ValidateOneTimeDesc=function(B,A){var C=limeade.services.trim(limeade.services.trimNonBreakSpaces(document.getElementById("ctl00_bcr_OneTimeHTMLDescription_ctl02_ctl00").contentWindow.document.body.innerHTML));if(C!=null&&C!=""&&C!="<br>"){A.IsValid=true}else{A.IsValid=false}};limchallenges.endDateValidate=function(C,B){var D=new Date(B.Value);var A=new Date();if(D<A){B.IsValid=false}else{B.IsValid=true}};limcreatechallenge.initializePage=function(){var A=document.getElementById("UserNotFoundA");limeade.services.hideElement(A)};limcreatechallenge.CreatePreviewChallenge=function(o,D){Page_ClientValidate();var S=limchallenges.validateAllUsernames();var f=limchallenges.validateUnits();Page_IsValid=Page_IsValid&&S&&f;if(Page_IsValid){document.getElementById("btnCreateChallenge").disabled=true;limeade.services.hideElement(document.getElementById("lnkPreviewChallenge"));var B=document.getElementById("statusText");if(D=="preview"){B.innerHTML="Previewing Challenge..."}else{if(D=="create"){B.innerHTML="Creating Challenge..."}}document.getElementById("loading").style.visibility="visible";document.getElementById("loading").style.display="inline";var E;var J=document.getElementById("ctl00_bcr_hiddenGoalId").value;if(J&&J!="-1"){E=document.getElementById("ctl00_bcr_lblExistingChallengeName").firstChild.data}else{E=document.getElementById("ctl00_bcr_txtWhatIsChallenge").value}var C=limeade.services.trim(document.getElementById("ctl00_bcr_hiddenChallengeType").value);var d=document.getElementById("ctl00_bcr_txtChallengeEndDate").value;var v=document.getElementById("ctl00_bcr_txtPersonalMessage").value;var n=0;var q="";var AD="";var A=0;var m;var V="";var W="";var w=1;var Z="";var O=1;var e="";var AF="";var h="";var H=document.getElementById("ctl00_bcr_rbTargetMinimum");var Q=document.getElementById("ctl00_bcr_rbTargetHighest");var AA=document.getElementById("ctl00_bcr_rbTargetLowest");var AB=document.getElementById("ctl00_bcr_rbWeight");var l=document.getElementById("ctl00_bcr_rbOneTimeEvent");var y=document.getElementById("ctl00_bcr_rbNumber");var u=document.getElementById("ctl00_bcr_cmbUnits_TB");var M=document.getElementById("ctl00_bcr_cmbYesNo_TB");var F=document.getElementById("ctl00_bcr_txtLeastNumber");var AE=document.getElementById("ctl00_bcr_txtLeastDays");var G=document.getElementById("ctl00_bcr_rbYesNo");var g=document.getElementById("ctl00_bcr_cmbWeightUnits");var t=document.getElementById("ctl00_bcr_cmbWeightChange");if(AB&&AB.checked){n=4}else{if(H&&H.checked){n=4}else{if(Q&&Q.checked){n=0}else{if(AA&&AA.checked){n=1}else{if(l&&l.checked){n=5;q=4;e=document.getElementById("ctl00_bcr_OneTimeHTMLDescription_ctl02_ctl00").contentWindow.document.body.innerHTML;AF=document.getElementById("ctl00_bcr_OneTimeLocation").value;h=document.getElementById("ctl00_bcr_OneTimeWebLink").value}}}}}if(n!=5){if(AB&&AB.checked){q=2;AD=g.value;if(t){A=t.value}}else{if(y&&y.checked){q=0;AD=u.value;if(H&&H.checked){A=F.value}}else{if(G&&G.checked){q=3;AD=M.value;if(H&&H.checked){A=AE.value}}}}}var a=null;if(C.toLowerCase()=="employer"){a=document.getElementById("ctl00_bcr_chkOpenEmployerChallenge");if(a&&!a.checked){O=0}}else{a=document.getElementById("ctl00_bcr_chkOpenPersonalChallenge");if(a&&!a.checked){O=0}}var k=document.getElementById("ctl00_bcr_rbAwardIncentives");var X=document.getElementById("ctl00_bcr_rbAwardSomethingElse");var s=document.getElementById("ctl00_bcr_txtIncentivePts");var N=document.getElementById("ctl00_bcr_txtReward");var b="";var P=document.getElementById("inviteeList");var r=document.getElementById("promoteToMe");var R=document.getElementById("promoteToAll");if(C.toLowerCase()=="employer"){if(k&&k.checked){m=0;V=s.value}else{if(X&&X.checked){m=1;W=N.value}}limeade.services.hideElement(document.getElementById("promoteAllPersonal"));limeade.services.showElement(document.getElementById("promoteAllCompany"))}else{V=0;m=1;W=N.value;limeade.services.hideElement(r);limeade.services.showElement(R);limeade.services.hideElement(document.getElementById("promoteAllCompany"));limeade.services.showElement(document.getElementById("promoteAllPersonal"))}var L=document.getElementById("ctl00_bcr_rbInvitation");var T=document.getElementById("ctl00_bcr_rbAllUsers");if(L&&L.checked){w=1}else{if(T&&T.checked){w=2}}if(C.toLowerCase()!="employer"){w=0}if(w==2||w==0){var K=document.getElementById("ctl00_bcr_NotifyPanel");if(K!=null){P.innerHTML="";var z=limeade.services.getElementsByClassName(K,"invitee");for(var AC=0;AC<z.length;AC++){z[AC].value=limeade.services.trim(z[AC].value);if(z[AC].value!=""){Z+=z[AC].value+",";var Y=document.createElement("li");Y.className="LinkColor";var U=document.createElement("span");U.style.color="#000";U.innerHTML=z[AC].value;Y.appendChild(U);P.insertBefore(Y,P.firstChild)}}if(Z.length>0){Z=Z.substring(0,Z.length-1)}limeade.services.showElement(R);limeade.services.hideElement(r)}}else{if(C.toLowerCase()=="employer"){Z=document.getElementById("ctl00_bcr_txtLimeadeChallengerA").value}else{Z=document.getElementById("ctl00_bcr_hiddenCurrentUsername").value}document.getElementById("confirmYourEmail").innerHTML=Z;limeade.services.showElement(r);limeade.services.hideElement(R)}var I="/challenges/ajaxchallenges.aspx?";I+="act="+encodeURIComponent(D);I+="&end="+encodeURIComponent(d);I+="&track="+encodeURIComponent(q);I+="&target="+encodeURIComponent(A);I+="&strategy="+encodeURIComponent(n);I+="&name="+encodeURIComponent(E);I+="&units="+encodeURIComponent(AD);I+="&rewardtype="+encodeURIComponent(m);I+="&rewarddesc="+encodeURIComponent(W);I+="&points="+encodeURIComponent(V);I+="&open="+encodeURIComponent(O);I+="&promo="+encodeURIComponent(w);I+="&msg="+encodeURIComponent(v);I+="&invitees="+encodeURIComponent(Z);I+="&about="+encodeURIComponent(e);I+="&location="+encodeURIComponent(AF);I+="&url="+encodeURIComponent(h);I+="&employer="+(C.toLowerCase()=="employer"?"true":"false");limeade.services.sendRequest(I,new Array(E,d,O,D,q),limcreatechallenge.challengeCreated)}};limcreatechallenge.challengeCreated=function(G,I){if(G.responseText.length!=0){if(I[3]=="create"){limeade.incentives.updatepoints();var J=G.responseText.replace("success!","");var E=window.location.toString();E=E.replace(/info\/.*/gi,"info");E=E.replace(/com\/.*/gi,"com");E=E.replace(/localhost\/.*/gi,"localhost");var C=document.getElementById("lnkViewChallengeStatus");C.href="/Challenges/"+J+"/default.aspx";document.getElementById("challengeName").innerHTML=I[0];document.getElementById("challengeEndDate").innerHTML=I[1];if(I[4]==4){document.getElementById("challengeVerb").innerHTML="happening on"}var F=document.getElementById("ctl00_bcr_pnlPublicChallengeCreated");if(I[2]==1){limeade.services.showElement(F);var D=document.getElementById("lnkPublicChallengeLink");D.innerHTML=E+"/Challenges/"+J+"/default.aspx";D.href=E+"/Challenges/"+J+"/default.aspx"}else{limeade.services.hideElement(F)}var K=document.getElementById("ctl00_bcr_pnlChallengeExists");var H=document.getElementById("pnlChallengeDetails");var A=document.getElementById("pnlChallengeCreated");limeade.services.hideElement(K);limeade.services.hideElement(H);limeade.services.showElement(A);window.scrollTo(0,210)}else{if(I[3]=="preview"){initPopUp();var B=new Date();showPopWin("/user/emailpreview.aspx?f=EmailGoalChallengePreview.html&t=Challenge Email Preview&nocache="+B.getTime(),567,522,limeade.services.reloadPage);document.getElementById("btnCreateChallenge").disabled=false;limeade.services.showElement(document.getElementById("lnkPreviewChallenge"));limeade.services.hideElement(document.getElementById("loading"))}}}};limcreatechallenge.calendarClicked=function(){var E=$find("challEndDate");if(E!=null){var C=document.getElementById("dayNumber");if(C!=null){var B=new Date();var A=1000*60*60*24;var D=Math.ceil((E.get_selectedDate().getTime()-B.getTime())/(A));C.innerHTML=D}}};limcreatechallenge.ChallengeTypeChanged=function(D){var B=document.getElementById("minTracking");var O=document.getElementById("highestTracking");var I=document.getElementById("lowestTracking");var A=document.getElementById("challTrackingTypeRow");var M=document.getElementById("challengeTrackingDiv");var L=document.getElementById("lblTrackingNumberText");var P=document.getElementById("lblTrackingDaysText");var F=document.getElementById("txtLeastNumberDiv");var V=document.getElementById("txtLeastDaysDiv");var E=document.getElementById("ctl00_bcr_cmbUnits_TB");var W=document.getElementById("ctl00_bcr_cmbYesNo_TB");var Y=document.getElementById("ctl00_bcr_cmbYesNo");var R=document.getElementById("OneTimeEventDetails");var X=document.getElementById("WeightLossChallengeDetails");var S=document.getElementById("ctl00_bcr_divDatePrefix");var a=document.getElementById("standardexamples");var N=document.getElementById("onetimeexamples");var C=document.getElementById("ctl00_bcr_RFVLeastNumber");var Q=document.getElementById("ctl00_bcr_RegExpLeastNumber");var U=document.getElementById("ctl00_bcr_RFVLeastDays");var J=document.getElementById("ctl00_bcr_RegExpLeastDays");var K=document.getElementById("ctl00_bcr_RFVDescription");var H=document.getElementById("ctl00_bcr_rbNumber");var T=document.getElementById("ctl00_bcr_rbYesNo");if(C!=null){ValidatorEnable(C,false)}if(U!=null){ValidatorEnable(U,false)}if(Q!=null){ValidatorEnable(Q,false)}if(J!=null){ValidatorEnable(J,false)}if(K!=null){ValidatorEnable(K,false)}var Z=document.getElementById("ctl00_bcr_cmbUnits_LBC");var G=document.getElementById("ctl00_bcr_cmbYesNo_LBC");if(Z!=null){Z.style.left="";Z.style.top=""}if(G!=null){G.style.left="";G.style.top=""}if(S!=null){S.innerHTML="from today through"}switch(D){case"minimum":limeade.services.showElement(B);limeade.services.showElement(A);limeade.services.hideElement(O);limeade.services.hideElement(I);B.appendChild(A);A.style.height="208px";limeade.services.hideElement(R);limeade.services.hideElement(X);if(Y){Y.parentNode.style.paddingLeft="0px"}limeade.services.showElement(F);limeade.services.showElement(V);if(H&&H.checked){C.enabled=true;Q.enabled=true}if(T&&T.checked){U.enabled=true;J.enabled=true}limcreatechallenge.highestTrackerUnits();break;case"weight":limeade.services.hideElement(A);limeade.services.hideElement(I);limeade.services.hideElement(R);limeade.services.showElement(X);if(Y){Y.parentNode.style.paddingLeft="0px"}limeade.services.hideElement(F);limeade.services.hideElement(V);E.value="pounds";limcreatechallenge.nonHighestTrackerUnits();break;case"lowest":limeade.services.hideElement(B);limeade.services.showElement(A);limeade.services.showElement(I);limeade.services.hideElement(O);I.appendChild(A);A.style.height="155px";O.innerHTML=B.innerHTML;limeade.services.hideElement(R);limeade.services.hideElement(X);if(Y){Y.parentNode.style.paddingLeft="0px"}limeade.services.hideElement(F);limeade.services.hideElement(V);limcreatechallenge.nonHighestTrackerUnits();break;case"highest":limeade.services.hideElement(B);limeade.services.showElement(O);limeade.services.hideElement(I);limeade.services.showElement(A);O.appendChild(A);A.style.height="155px";limeade.services.hideElement(R);limeade.services.hideElement(X);if(Y){Y.parentNode.style.paddingLeft="0px"}limeade.services.hideElement(F);limeade.services.hideElement(V);limcreatechallenge.highestTrackerUnits();break;case"onetime":limeade.services.hideElement(B);limeade.services.hideElement(O);limeade.services.hideElement(I);limeade.services.hideElement(A);limeade.services.showElement(R);limeade.services.hideElement(X);limeade.services.hideElement(A);if(K!=null){K.enabled=true}if(S!=null){S.innerHTML="from today through"}break}};limcreatechallenge.highestTrackerUnits=function(){var A=document.getElementById("ctl00_bcr_cmbUnits_LB");A.options.length=0;limeade.goals.AddItem("hours","hours",A);limeade.goals.AddItem("minutes","minutes",A);limeade.goals.AddItem("miles","miles",A);limeade.goals.AddItem("add new units...","add new units...",A);var B=document.getElementById("ctl00_bcr_cmbYesNo_LB");B.options.length=0;limeade.goals.AddItem("exercise","exercise",B);limeade.goals.AddItem("run","run",B);limeade.goals.AddItem("bike","bike",B);limeade.goals.AddItem("walk","walk",B);limeade.goals.AddItem("add new activity...","add new activity...",B)};limcreatechallenge.nonHighestTrackerUnits=function(){var A=document.getElementById("ctl00_bcr_cmbUnits_LB");A.options.length=0;limeade.goals.AddItem("calories","calories",A);limeade.goals.AddItem("cigarettes","cigarettes",A);limeade.goals.AddItem("drinks","drinks",A);limeade.goals.AddItem("hours","hours",A);limeade.goals.AddItem("minutes","minutes",A);limeade.goals.AddItem("miles","miles",A);limeade.goals.AddItem("add new units...","add new units...",A);var B=document.getElementById("ctl00_bcr_cmbYesNo_LB");B.options.length=0;limeade.goals.AddItem("exercise","exercise",B);limeade.goals.AddItem("run","run",B);limeade.goals.AddItem("bike","bike",B);limeade.goals.AddItem("smoke","smoke",B);limeade.goals.AddItem("drink","drink",B);limeade.goals.AddItem("walk","walk",B);limeade.goals.AddItem("add new activity...","add new activity...",B)};limcreatechallenge.challengePromotionChanged=function(H,E){var D=document.getElementById("divPromoInvite");var G=document.getElementById("divPromoAll");var C=document.getElementById("lnkAddMorePeople");var B=document.getElementById("inviteesDiv");var A=document.getElementById("yourEmailAddress");var F=document.getElementById("sendersEmailAddress");switch(H){case"all":if(E=="employer"){limeade.services.hideElement(D);limeade.services.showElement(G)}else{if(E=="personal"){limeade.services.showElement(C);limeade.services.showElement(B);D.innerText="Send the invitation to:";limeade.services.showElement(D)}}limeade.services.showElement(F);limeade.services.hideElement(A);break;case"invite":if(E=="employer"){limeade.services.hideElement(G);limeade.services.showElement(D);limeade.services.showElement(A)}else{if(E=="personal"){limeade.services.hideElement(C);limeade.services.hideElement(D);limeade.services.hideElement(B);limeade.services.hideElement(document.getElementById("NotEnoughUsers"));limeade.services.hideElement(A)}}limeade.services.hideElement(F);break}};limcreatechallenge.enableRewardValidator=function(C){var B=document.getElementById("ctl00_bcr_RFVIncentReward");var A=document.getElementById("ctl00_bcr_RFVIncentSomeElse");switch(C){case"incentiveReward":if(B!=null){B.enabled=true}if(A!=null){ValidatorEnable(A,false)}break;case"somethingReward":if(A!=null){A.enabled=true}if(B!=null){ValidatorEnable(B,false)}break}};limcreatechallenge.setUpSampleChallenge=function(R,Y,e,U,E,A,P,K,C){var G=document.getElementById("ctl00_bcr_RFVLeastNumber");var Z=document.getElementById("ctl00_bcr_RegExpLeastNumber");var f=document.getElementById("ctl00_bcr_RFVLeastDays");var S=document.getElementById("ctl00_bcr_RegExpLeastDays");var M=document.getElementById("ctl00_bcr_txtWhatIsChallenge");var X=document.getElementById("ctl00_bcr_rbTargetMinimum");var W=document.getElementById("ctl00_bcr_rbTargetHighest");var a=document.getElementById("ctl00_bcr_rbTargetLowest");var V=document.getElementById("ctl00_bcr_rbOneTimeEvent");var F=document.getElementById("ctl00_bcr_rbWeight");var O=document.getElementById("ctl00_bcr_rbNumber");var d=document.getElementById("ctl00_bcr_rbYesNo");var J=document.getElementById("ctl00_bcr_txtLeastNumber");var k=document.getElementById("ctl00_bcr_txtLeastDays");var D=document.getElementById("ctl00_bcr_cmbUnits_TB");var I=document.getElementById("ctl00_bcr_cmbYesNo_TB");var B=document.getElementById("ctl00_bcr_rbAwardIncentives");var Q=document.getElementById("ctl00_bcr_txtIncentivePts");var T=document.getElementById("ctl00_bcr_rbAwardSomethingElse");var N=document.getElementById("ctl00_bcr_txtReward");var L=document.getElementById("ctl00_bcr_rbInvitation");var h=document.getElementById("ctl00_bcr_rbAllUsers");if(B!=null){B.checked=false}if(T!=null){T.checked=false}if(Q!=null){Q.value=""}if(a!=null){a.checked=false}if(F!=null){F.checked=false}if(V!=null){V.checked=false}if(X!=null){X.checked=false}if(W!=null){W.checked=false}O.checked=false;d.checked=false;N.value="";if(J!=null){J.value=""}if(k!=null){k.value=""}D.value="";I.value="";M.value=R;switch(Y){case"min":X.checked=true;limcreatechallenge.ChallengeTypeChanged("minimum");break;case"highest":W.checked=true;limcreatechallenge.ChallengeTypeChanged("highest");break;case"lowest":a.checked=true;limcreatechallenge.ChallengeTypeChanged("lowest");break;case"weight":F.checked=true;limcreatechallenge.ChallengeTypeChanged("weight");break;case"onetime":V.checked=true;limcreatechallenge.ChallengeTypeChanged("onetime");break}switch(U){case"number":O.checked=true;if(J!=null){J.value=E}D.value=e;limcreatechallenge.trackerChanged("number");limchallenges.validateUnits();break;case"binary":d.checked=true;if(k!=null){k.value=E}I.value=e;limcreatechallenge.trackerChanged("binary");limchallenges.validateUnits();break;case"uselastnumber":D.value="";if(G!=null){ValidatorEnable(G,false)}if(f!=null){ValidatorEnable(f,false)}if(Z!=null){ValidatorEnable(Z,false)}if(S!=null){ValidatorEnable(S,false)}var b;if(C=="personal"){b="5"}else{if(C=="company"){b="0"}}var H=document.getElementById("ctl00_bcr_cmbWeightChange");for(var g=0;g<H.length;g++){if(H[g].value==b){H[g].selected=true}}break}switch(A){case"points":B.checked=true;Q.value=P;limcreatechallenge.enableRewardValidator("incentiveReward");break;case"customreward":if(T!=null){T.checked=true}N.value=P;limcreatechallenge.enableRewardValidator("somethingReward");break;default:}};limcreatechallenge.trackerRadioBtn=function(B){var A=document.getElementById(B);if(A!=null){A.checked=true}};limcreatechallenge.trackerChanged=function(F){var I=document.getElementById("ctl00_bcr_RFVLeastNumber");var D=document.getElementById("ctl00_bcr_RegExpLeastNumber");var E=document.getElementById("ctl00_bcr_RFVLeastDays");var C=document.getElementById("ctl00_bcr_RegExpLeastDays");var G=document.getElementById("ctl00_bcr_txtLeastNumber");var H=document.getElementById("ctl00_bcr_txtLeastDays");var A=document.getElementById("ctl00_bcr_cmbUnits_TB");var B=document.getElementById("ctl00_bcr_cmbYesNo_TB");var J=document.getElementById("ctl00_bcr_rbTargetMinimum");if(I!=null){ValidatorEnable(I,false)}if(E!=null){ValidatorEnable(E,false)}if(D!=null){ValidatorEnable(D,false)}if(C!=null){ValidatorEnable(C,false)}switch(F){case"number":if(J.checked){if(I!=null){I.enabled=true}if(D!=null){D.enabled=true}}else{ValidatorEnable(I,false);ValidatorEnable(D,false)}if(E!=null){ValidatorEnable(E,false);ValidatorEnable(C,false)}if(G!=null){G.readOnly=false}if(A!=null){A.readOnly=false}if(H!=null){H.readOnly=true}if(B!=null){B.readOnly=true}break;case"binary":if(J.checked){if(E!=null){E.enabled=true}if(C!=null){C.enabled=true}}else{ValidatorEnable(E,false);ValidatorEnable(C,false)}if(I!=null){ValidatorEnable(I,false);ValidatorEnable(D,false)}if(G!=null){G.readOnly=true}if(A!=null){A.readOnly=true}if(H!=null){H.readOnly=false}if(B!=null){B.readOnly=false}break}};limeade.myplan.usernameIndex=1;limcreatechallenge.addMorePeople=function(){var E=document.getElementById("ctl00_bcr_NotifyPanel");if(E!=null){var B=document.createElement("DIV");B.setAttribute("id","User"+limeade.myplan.usernameIndex);var I=document.createElement("DIV");I.style.paddingLeft="18px";I.style.width="100%";I.style.clear="both";var H=document.createElement("SPAN");H.setAttribute("id","UserNotFound"+limeade.myplan.usernameIndex);H.style.paddingLeft="2px";H.style.fontWeight="normal";H.style.fontSize="8pt";H.style.visibility="hidden";H.style.display="none";H.style.color="black";var C=document.createElement("img");C.setAttribute("src","/images/icon-error.gif");C.setAttribute("align","absBottom");H.appendChild(C);H.innerHTML+="Sign in name or email not found.";I.appendChild(H);var A=document.createElement("DIV");A.style.styleFloat="left";A.style.cssFloat="left";var J=document.createElement("img");J.style.borderWidth="0px";J.setAttribute("src","/Images/icon-user.gif");A.appendChild(J);A.innerHTML+="&nbsp;";var F=document.createElement("DIV");F.style.styleFloat="left";var G=document.createElement("INPUT");G.className="invitee";G.setAttribute("id","ctl00_bcr_txtLimeadeChallenger"+limeade.myplan.usernameIndex);G.setAttribute("onblur","limchallenges.clientValidate(this);");G.style.fontWeight="bold";G.style.width="325px";G.style.height="15px";var D=document.createElement("a");D.setAttribute("href","#");D.setAttribute("onclick","limchallenges.removeUserBox(this); return false;");D.innerHTML="x";D.title="remove user";D.style.textDecoration="none";D.setAttribute("id","closeUser"+limeade.myplan.usernameIndex);F.appendChild(G);F.innerHTML+="&nbsp;";F.appendChild(D);F.innerHTML+="<br />";B.appendChild(I);B.appendChild(A);B.appendChild(F);E.appendChild(B);limeade.myplan.usernameIndex+=1}};limchallenges.removeUserBox=function(A){var B=document.getElementById(A.id.replace(/closeUser/gi,"User"));var C=document.getElementById("ctl00_bcr_NotifyPanel");if(C!=null&&B!=null){C.removeChild(B)}};var limhome=createNamespace("limeade.home");limhome.showAddContentPanel=function(){$(this).hide("slow")};