﻿if (navigator.cookieEnabled == false) { window.location.href = "error-3"; } String.prototype.count = function (s1) { return (this.length - this.replace(new RegExp(s1, "g"), "").length) / s1.length; }; function PushAnalyticsEvent(lbl) { _gaq.push(["_trackEvent", "Clicks", "Click", lbl]); } function ValidateRank(txt, num) { var val = $get(txt).value; var result = ""; for (i = 1; i <= num; i++) { if (val.indexOf(i.toString()) == -1) { result += i + ", "; } if (val.count(i.toString()) > 1) { jQuery.facebox("You ranked #" + i.toString() + " more than once."); return false; } } if (result != "") { jQuery.facebox("You're missing the ranks for #" + result.substr(0, result.length - 2)); return false; } PushAnalyticsEvent("Rank Button"); return true; } function LoadHelp() { PushAnalyticsEvent("How Does This Work"); PageMethods.GetHowDoesThisWorkContent(OnComplete); } function OnComplete(result) { jQuery.facebox(result); } function HideHelp() { PushAnalyticsEvent("Hide Help"); PageMethods.HideHelp(OnHideHelpComplete); } function OnHideHelpComplete(result) { $get("ctl00_MainContent_HelpDiv").style.display = "none"; $get("ctl00_MainContent_ShowHelpSpan").style.display = ""; } function ShowHelp() { PushAnalyticsEvent("Show Help"); PageMethods.ShowHelp(OnShowHelpComplete); } function OnShowHelpComplete(result) { $get("ctl00_MainContent_HelpDiv").style.display = ""; $get("ctl00_MainContent_ShowHelpSpan").style.display = "none"; } function Subscribe() { var SubscribeTxt = $get("ctl00_MainContent_SubscribeTxt"); if (SubscribeTxt.value != "" && SubscribeTxt.value != "Enter Email Address") { PageMethods.Subscribe(SubscribeTxt.value, OnSubscribeComplete); } } function OnSubscribeComplete(result) { if (result == "ALREADY") { jQuery.facebox("You are already subscribed to receive daily emails of photos."); } else { if (result == "INVALID") { jQuery.facebox("Invalid email address."); } else { if (result == "FAIL") { jQuery.facebox("There was a problem subscribing you to receive daily emails of photos."); } else { jQuery.facebox("You have successfully subscribed to receive daily emails of photos."); $get("SubscribeDiv").style.display = "none"; } } } } function HideShowNumbers() { if ($get("imgdivwrapper").children.length > 2) { for (var i = $get("imgdivwrapper").children.length - 1; i >= 2; i--) { $get("imgdivwrapper").removeChild($get("imgdivwrapper").children[i]); } } else { var locations = $get("ctl00_MainContent_LocationsHidden").value.split(","); for (var j = 0; j < locations.length - 1; j++) { var x = locations[j].split(":")[0]; var y = locations[j].split(":")[1]; var dv = document.createElement("div"); dv.innerHTML = "<div class='locationnum' style='left:" + x + "px; top:" + y + "px'>" + (j + 1) + "</div>"; $get("imgdivwrapper").appendChild(dv); } } } function ShowCommentPopup() { $get("ctl00_MainContent_CommentPopup_ctl00_CommentTxt").value = ""; $get("ctl00_MainContent_CommentPopup_ctl00_CommentTxt").style.height = ""; $find("CommentBehavior1").show(); } function VoteUp(img, id) { img.setAttribute("onclick", "return false"); $get(img.id.replace("Up", "Down")).setAttribute("onclick", "return false"); PageMethods.CommentVote(id, true, OnVoteUpComplete); } function VoteDown(img, id) { img.setAttribute("onclick", "return false"); $get(img.id.replace("Down", "Up")).setAttribute("onclick", "return false"); PageMethods.CommentVote(id, false, OnVoteDownComplete); } function OnVoteUpComplete(result) { $get("VoteUp" + result).innerHTML = $get("VoteUp" + result).innerHTML * 1 + 1; } function OnVoteDownComplete(result) { $get("VoteDown" + result).innerHTML = $get("VoteUp" + result).innerHTML * 1 + 1; } function pageLoad() { $("#ctl00_MainContent_CommentPopup_ctl00_CommentTxt").elastic(); }
