/* http://www.valleymorningstar.com/common/tools/load.php?js=common_sitelife,common_sitelife-registration */
function submitRequest(){pullCounts(articleid)}function pullCounts(A){var B=new ArticleKey(A);var C=new RequestBatch();C.AddToRequest(B);C.BeginRequest(serverUrl,renderArticle)}function renderArticle(B){if(B.Responses.length==0){var C=document.getElementById("articleCommentCount"+articleid);var E=document.getElementById("articleRecommendCount"+articleid);C.style.visibility="hidden";E.style.visibility="hidden";C.innerHTML=0;E.innerHTML=0}else{var D=B.Responses[0].Article;var C=document.getElementById("articleCommentCount"+D.ArticleKey.Key);var E=document.getElementById("articleRecommendCount"+D.ArticleKey.Key);C.innerHTML=D.Comments.NumberOfComments;E.innerHTML=D.Recommendations.NumberOfRecommendations;var F=D.Recommendations.CurrentUserHasRecommended;if(F=="True"){var A=document.getElementById("recommendlink"+D.ArticleKey.Key);A.innerHTML="Recommended"}C.style.visibility="visible";E.style.visibility="visible"}}function recommendReview(A){var D=new RequestBatch();var C=new ArticleKey(A);var B=new RecommendAction(C);D.AddToRequest(B);D.BeginRequest(serverUrl,recommendationComplete)}function recommendationComplete(A){if(A.Responses.length>0){submitRequest()}else{updateArticle()}}function updateArticle(){var E=new ArticleKey(articleid);var C=document.location.href;var D=new Section(sectionTitle);var A=new Array();var F=new RequestBatch();var B=new UpdateArticleAction(E,C,pageTitle,D);F.AddToRequest(B);F.BeginRequest(serverUrl,articleUpdated)}function articleUpdated(A){if(A.Messages[0].Message=="ok"){submitRequest()}}function recommendReviewAbox(A){var D=new RequestBatch();var C=new ArticleKey(A);var B=new RecommendAction(C);D.AddToRequest(B);D.BeginRequest(serverUrl,recommendationCompleteAbox)}function recommendationCompleteAbox(A){SubmitListRequest()}function recommendReviewList(A){var D=new RequestBatch();var C=new ArticleKey(A);var B=new RecommendAction(C);D.AddToRequest(B);D.BeginRequest(serverUrl,recommendationCompleteList)}function recommendationCompleteList(A){getRecentActivity()}function getRecentActivity(){var H=new Array(new Section("All"));var C=new Array(new Category("All"));var G=new Array(new UserTier("All"));var D=new Activity("Commented");var B=2;var A=5;if(cacheMostCommentedRecommended){renderRecentContent(cacheMostCommentedRecommended.ResponseBatch,5)}else{var F=new RequestBatch();var E=new DiscoverArticlesAction(H,C,G,D,B,A);F.AddToRequest(E);F.BeginRequest(serverUrl,renderRecentContent,5)}}function renderRecentContent(C,B){if(C.Responses.length>=1){var F=C.Responses[0].DiscoverArticlesAction;if(!B){B=F.DiscoveredArticles.length}else{if(B>F.DiscoveredArticles.length){B=F.DiscoveredArticles.length}}var E=document.getElementById("mostcommented_list");if(E){var A="
";for(var D=0;D";E.innerHTML=A}}}function getArticleLink(D){var B=D.PageUrl.split("#");var A=B[0]+"#slComments";var C="- "+unescape(D.PageTitle)+"
";C+=" | ";if(D.Recommendations.CurrentUserHasRecommended=="True"){C+="Recommended"+D.Recommendations.NumberOfRecommendations+""}else{C+="Recommend "+D.Recommendations.NumberOfRecommendations+""}C+=" \n";return C}function getMostCommentedArticle(){var H=new Array(new Section("All"));var C=new Array(new Category("All"));var G=new Array(new UserTier("All"));var D=new Activity("Commented");var B=2;var A=5;var F=new RequestBatch();var E=new DiscoverArticlesAction(H,C,G,D,B,A);F.AddToRequest(E);F.BeginRequest(serverUrl,renderMostCommentedArticle)}function renderMostCommentedArticle(B){if(B.Responses.length==1){var E=B.Responses[0].DiscoverArticlesAction;var D=document.getElementById("mostcommented_list_article");if(D){var A="";for(var C=0;C"+A+"
"}}}function getArticleLinkArticle(B){var A=""+unescape(B.PageTitle)+"";A+="\n";return A}function getMostRecommendedArticle(){var H=new Array(new Section("All"));var C=new Array(new Category("All"));var G=new Array(new UserTier("All"));var D=new Activity("Recommended");var B=2;var A=5;var F=new RequestBatch();var E=new DiscoverArticlesAction(H,C,G,D,B,A);F.AddToRequest(E);F.BeginRequest(serverUrl,renderMostRecommendedArticle)}function renderMostRecommendedArticle(B){if(B.Responses.length==1){var E=B.Responses[0].DiscoverArticlesAction;var D=document.getElementById("mostrecommended_list_article");if(D){var A="";for(var C=0;C"+A+""}}}var aboxMostCommented=new Array();var aboxMostRecommended=new Array();function getMostCommentedRecommendedArticleList(C){var J=new Array(new Section("All"));var F=new Array(new Category("All"));var G=new Array(new UserTier("All"));var E=new Activity("Commented");var A=new Activity("Recommended");var I=2;if(!C){C=5}if(cacheMostCommentedRecommended){renderMostCommentedArticle(cacheMostCommentedRecommended.ResponseBatch,C)}else{var H=new RequestBatch();var B=new DiscoverArticlesAction(J,F,G,E,I,C);var D=new DiscoverArticlesAction(J,F,G,A,I,C);H.AddToRequest(B);H.AddToRequest(D);H.BeginRequest(serverUrl,renderMostCommentedArticle)}}function getMostCommentedRecommendedArticleList2(C){var J=new Array(new Section("All"));var F=new Array(new Category("All"));var G=new Array(new UserTier("All"));var E=new Activity("Commented");var A=new Activity("Recommended");var I=2;if(!C){C=3}var H=new RequestBatch();var B=new DiscoverArticlesAction(J,F,G,E,I,C);var D=new DiscoverArticlesAction(J,F,G,A,I,C);H.AddToRequest(B);H.AddToRequest(D);H.BeginRequest(serverUrl,renderMostCommentedArticle)}function renderMostCommentedArticle(D,B){if(D.Responses.length>=1){var G=D.Responses[0].DiscoverArticlesAction;if(!B){B=5}if(B>G.DiscoveredArticles.length){B=G.DiscoveredArticles.length}if(aboxMostCommented.length>=1){for(var E=0;E"+A+""}}}else{var F=document.getElementById("mostcommented_list_article");if(F){var A="";for(var E=0;E"+A+""}}}if(D.Responses.length>=2){var G=D.Responses[1].DiscoverArticlesAction;if(!B){B=5}if(B>G.DiscoveredArticles.length){B=G.DiscoveredArticles.length}if(aboxMostRecommended.length>=1){for(var E=0;E"+A+""}}}else{var F=document.getElementById("mostrecommended_list_article");if(F){var A="";for(var E=0;E"+A+""}}}}function pluckProcessResponseBatch(H,G,I,M){var J=0;if(H.Responses.length>M.length){J=M.length}else{J=H.Responses.length}for(var F=0;F";if(typeof (L)=="string"){var A=document.getElementById(L);if(A){A.innerHTML=E}}else{for(var C=0;C=1){var H=D.Responses[0].DiscoverArticlesAction;if(!B){B=5}var G;if(B>H.DiscoveredArticles.length){G=H.DiscoveredArticles.length}else{G=B}if(aboxMostCommented.length>=1){for(var E=0;E"+A+""}}}else{var F=document.getElementById("mostcommented_list_article");if(F){var A="";for(var E=0;E"+A+""}}}if(D.Responses.length>=2){var H=D.Responses[1].DiscoverArticlesAction;if(!B){B=5}if(B>H.DiscoveredArticles.length){G=H.DiscoveredArticles.length}else{G=B}if(aboxMostRecommended.length>=1){for(var E=0;E"+A+""}}}else{var F=document.getElementById("mostrecommended_list_article");if(F){var A="";for(var E=0;E"+A+""}}}}function isLoggedIn(){var A=document.cookie.split(";");var B="";for(i=0;iLogin | Register";if(A){var F=A.contentWindow.document.getElementById("SiteLife_Login");if(F){F.innerHTML=D}}var B=document.getElementById("messagesiframe");if(B){var F=B.contentWindow.document.getElementById("Messages_NewMessageHead");if(F){F.innerHTML=D}}var E=document.getElementById("personaprofileiframe");if(E){var C=E.contentWindow.document.getElementById("ProfileEdit_SectionDescription_Link");C.style.display="none"}}function LoginPage(){var B=window.document.domain;var A="http://www."+B+"/sections/share/users/login";window.location.href=A}function RegPage(){var B=window.document.domain;var A="http://www."+B+"/sections/share/users/registration";window.location.href=A}function changePluckLoginLinks(){if(!isLoggedIn()){var A="javascript:parent.LoginPage()";var F="javascript:parent.RegPage()";var G=document.getElementById("commentsiframe");var E='You must be logged in to contribute. Login | Register";if(G){var L=G.contentWindow.document.getElementById("SiteLife_Login");if(L){L.innerHTML=E}}var D=document.getElementById("messagesiframe");if(D){var L=D.contentWindow.document.getElementById("Messages_NewMessageHead");if(L){L.innerHTML=E}}var J=document.getElementById("personaprofileiframe");if(J){var C=J.contentWindow.document.getElementById("ProfileEdit_SectionDescription_Link");C.style.display="none"}var K=document.getElementById("CreateDiscussion1");var I=document.getElementById("CreateDiscussion2");var B=document.getElementById("A1");var H=document.getElementById("ForumDiscussionAddPost");if(K){K.href=A}if(I){I.href=A}if(B){B.href=F;reg_att=B.attributes;for(i=0;i=0){userkey=A[x];uuId=userkey.substring(2,userkey.length);break}}}if(uuId!=""){var B=new UserKey(uuId);var D=new RequestBatch();D.AddToRequest(B);D.BeginRequest(serverUrl,renderUserData)}}function getUserInfo(A){if(A!=""&&A!="anonymous"){var B=new UserKey(A);var C=new RequestBatch();C.AddToRequest(B);C.BeginRequest(serverUrl,renderUserData)}}function renderUserData(H){if(H.Responses.length!=0){var F=H.Responses[0].User;if(F.UserKey.Key!="anonymous"){var P=document.getElementById("status_links");var G=document.getElementById("user_messages");var L=document.getElementById("status_avatar");var C=document.getElementById("StatusBoxAvatar");var E=document.getElementById("BillboardAvatarTabImg");var D=document.getElementById("you_image");var O=document.getElementById("status_box_logged_in");var M=document.getElementById("status_box_logged_out");var A=document.getElementById("SitelifeJoin");var B=document.getElementById("SitelifeLogin");var J=document.getElementById("BillboardButtons");if(document.getElementById("StatusBoxHelp")){var N=document.getElementById("StatusBoxHelp");N.style.display="none"}M.style.display="none";O.style.display="block";if(A){A.style.display="none"}if(B){B.style.display="none"}if(J){J.style.display="none"}var I="Welcome, "+F.DisplayName+"
";I+="My Profile | Logout
";var K=F.NumberOfMessages+" messages";P.innerHTML=I;G.innerHTML=K;C.innerHTML="
";E.innerHTML="
";if(document.getElementById("AvatarTabImg")){}}}}var aboxArticles=new Array();function SubmitListRequest(){var B=new RequestBatch();for(var A=0;ARecommended"}A.style.visibility="visible";I.style.visibility="visible"}}for(var C=0;CRecommended"}D.style.visibility="visible";F.style.visibility="visible"}}}function popUp(URL){day=new Date();id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=300,left = 390,top = 312');")}function billboardNav(A){var B=document.getElementById(A);location.href=B.value}function getCookieUUID(){var A=document.cookie.split(";");var E="";var C="";var B="";var D="";for(i=0;i0)||!showRecommendedOnly){if((H.Comments[F].Author.IsBlocked=="False"&&H.Comments[F].AbuseReportCount<4)||(H.Comments[F].Author.IsBlocked=="True"&&H.Comments[F].Author.UserKey.Key==A)){J+=getCommentHtml(H.Comments[F])}}}J+="";K.innerHTML=J}}function getCommentHtml(B){var A="";A+='";return A}function getMostRecentPhotos(C){if(!C){C=5}var A=document.getElementById("recent_list_photos");if(cacheMostRecentPhotos){var B='';B+='
';B+=createPhotoHtml(cacheMostRecentPhotos.ResponseBatch,C);B+="
";A.innerHTML=B}}function createPhotoHtml(C,D){discoveredContent=C.Responses[0].DiscoverContentAction.DiscoveredContent;if(D>discoveredContent.length){D=discoveredContent.length}var B="";for(var A=0;A';B+='';B+=' | ';B+='';B+='";B+='"}else{D++}}return B}function getBillboardLinks(){var I=document.getElementById("photo1link");var F=document.getElementById("photo2link");var E=document.getElementById("photo3link");var K=document.getElementById("photo1img");var D=document.getElementById("photo2img");var B=document.getElementById("photo3img");if(cacheMostRecentPhotos){discoveredContent=cacheMostRecentPhotos.ResponseBatch.Responses[0].DiscoverContentAction.DiscoveredContent;var Q=0;for(var G=0;G=1){var F=document.getElementById("photo1link");var D=document.getElementById("photo2link");var C=document.getElementById("photo3link");var H=document.getElementById("photo1img");var B=document.getElementById("photo2img");var A=document.getElementById("photo3img");var I=G.Responses[0].DiscoverContentAction.DiscoveredContent;var J=0;for(var E=0;E';A+=createPhotoHtml(cacheMostRecommendedPhotos.ResponseBatch,C);A+="";B.innerHTML=A}}var defaultEmptyOK=false;var whitespace=" \t\n\r";var alreadySubmitted=false;var EMAIL="email";var EMAIL_MSG="Please enter a valid email address.";var USER_NAME="userName";var USER_NAME_MSG="Please enter a username that is at least 6 characters long\nand contains only letters and numbers.";var PASSWORD="password";var PASSWORD_MSG="Please enter a password that is at least 6 characters long\ncontaining only letters and numbers.";var PASSWORD2="password2";var PASSWORD2_MSG="Your password entries must match, please re-enter.";var GENDER="gender";var GENDER_MSG="Please select your gender.";var BIRTHYEAR="birthYear";var BIRTHYEAR_MSG="Please enter a valid year of birth. You must be at least 13 years of age to register.";var TERMS="submit";var TERMS_MSG="You must agree to the user agreement terms to register.";errorMsgArr=new Array();errorMsgArr[EMAIL]=EMAIL_MSG;errorMsgArr[USER_NAME]=USER_NAME_MSG;errorMsgArr[PASSWORD]=PASSWORD_MSG;errorMsgArr[PASSWORD2]=PASSWORD2_MSG;errorMsgArr[GENDER]=GENDER_MSG;errorMsgArr[BIRTHYEAR]=BIRTHYEAR_MSG;errorMsgArr[TERMS]=TERMS_MSG;function trim(A){while(A.substring(0,1)==" "){A=A.substring(1,A.length)}while(A.substring(A.length-1,A.length)==" "){A=A.substring(0,A.length-1)}return A}function isWhitespace(B){var A;if(isEmpty(B)){return true}for(A=0;A(D-13)){return false}return true}function validateRadioButton(A){index=-1;for(i=0;i-1)}function getRadioValue(A){index=-1;for(i=0;i-1)}function getSelectedValue(A){index=-1;for(i=0;i |