/// Copyright 2002 - 2010 (c) InfiniteSports LLC.  All rights reserved.
///
var g_enterZip = "Enter Zip";var g_errorNoName = "You must fill in a name.";var g_errorNoEmail = "You must specify an email address.";var g_errorNot13 = "You must be at least 13 years old to use this site.";var g_errorNoCity = "You must fill in the city.";var g_errorNoState = "You must fill in the state / province.";var g_errorNoGameDays = "You must check at least one day of the week.";var g_invalidPassword = "Email address doesn't look good.";

/// Copyright 2002 - 2010 (c) InfiniteSports LLC.  All rights reserved.
///
var fbPublishStreamPermission = "publish_stream";var fbEmailPermission = "email";var g_baseUri = document.getElementsByTagName("base")[0].href;var g_searchUri = g_baseUri + "search?q=";var g_preferencesUri = g_baseUri + "preferences";var g_newCrewUri = g_baseUri + "groups/new";var g_newGameUri = g_baseUri + "games/new";var g_searchUri = g_baseUri + "search?q=";var g_inboxUri = g_baseUri + "inbox";var Common = {};var Json = {};var registry = new BlockRegistry();var storeMenu = new Menu("universalNavStoreMenu");var pigeonFeedMenu = new Menu("universalNavPigeonFeedMenu");var signUpDialog = new SignUpDialog();var searchBox;var menuCache = [];var facebookConnect = new FacebookConnect();window.onload = function(){searchBox = new SearchBox("universalNavFindTextBox", Common.navigateSearch);searchBox.defaultText = g_enterZip;};String.prototype.trim = function(){return (this.replace(/^\s*|\s*$/g, ""));};function $(id){return window.document.getElementById(id);}/* Yahoo */if (typeof (YAHOO) != "undefined"){YAHOO.namespace("example.calendar");var g_calendars = YAHOO.example.calendar;}/* Common */Common.openYahooDialog = function(uri){Common.openWindow(uri, 880, 820);};Common.openGoogleDialog = function(uri){Common.openWindow(uri, 600, 450);};Common.openWindow = function(url, width, height){var left = parseInt((screen.width - width) / 2);var top = parseInt((screen.height - height) / 4);window.open(url, null, "top=" + top + ",left=" + left + ",width=" + width + ",height=" + height +",status=no,toolbar=no,menubar=no,location=no");};Common.keyPressDialogBox = function(e){if (!e)e = event;if (e.keyCode != 27)return;Common.hideDialogBox();};Common.cancelEvent = function(e){if (!e)e = window.event;e.cancelBubble = true;};Common.removeNode = function(o){o.parentNode.removeChild(o);};Common.updateBlocks = function(request){Common.updateBlockSet(Common.deserialize(request.responseText));};Common.updateBlockSet = function(blockSet){if (blockSet == null)return;for (var i = 0; i < blockSet.length; i++){var block = blockSet[i];var element = $(Common.isUndefined(block.contentId) ? block.id : block.contentId);if (element == null)continue;element.outerHTML = block.content;registry.add(block);}};Common.isUndefined = function(o){return (typeof (o) == "undefined");};Common.isUndefinedOrNull = function(o){return (typeof (o) == "undefined") || (o == null);};Common.deserialize = function(s){if (Common.isNullOrEmpty(s))return null;return eval("(" + s + ")");};Common.showElement = function(id){Common.hideShowElement(id, true);};Common.hideElement = function(id){Common.hideShowElement(id, false);};Common.hideShowElement = function(id, isVisible){$(id).style.display = isVisible ? "" : "none";};Common.showErrorElement = function(id, text){Common.showElement(id);Common.innerText(id, text);};Common.hideErrorElement = function(id){Common.hideElement(id);};Common.hideDialogBox = function(){var box = $("dialogBox");if (box)Common.removeNode(box);document.body.onkeypress = null;};Common.updateContentId = function(id, blockIds){$(Common.getContentId(blockIds)).id = id;};Common.getContentId = function(blockIds){for (var id in blockIds){if ($(blockIds[id]) != null)return blockIds[id];}alert("getContentId returned null");};Common.serializeDate = function(date){return (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear()};Common.isValidLocation = function(blockId){if (Common.isNullOrEmpty(Common.getVal("city"))){Common.showBlockError(g_errorNoCity, blockId);$("city").focus();return false;}if (Common.isNullOrEmpty(Common.getVal("state"))){Common.showBlockError(g_errorNoState, blockId);$("state").focus();return false;}return true;};Common.isValidName = function(id, blockId){if (Common.isNullOrEmpty(Common.getVal(id).trim())){Common.showBlockError(g_errorNoName, blockId);Common.focus(id);return false;}return true;};Common.getVal = function(o){if (typeof (o) == "string"){var obj = $(o);if (obj == null)alert(o);o = obj;}return o.value;};Common.getIntVal = function(id){return parseInt(Common.getVal(id));};Common.getBoolVal = function(id){return $(id).checked;};Common.getFloatVal = function(id){return parseFloat(Common.getVal(id));};Common.disableElement = function(id){$(id).disabled = true;};Common.enableElement = function(id){$(id).disabled = false;};Common.focus = function(id){var o = $(id);if (o)o.focus();};Common.isNullOrEmpty = function(s){return (s == null) || (s.length == 0);};Common.onLoad = function(fn){if (typeof (window.addEventListener) != "undefined"){window.addEventListener("load", fn, false);}else if (typeof (window.attachEvent) != "undefined"){window.attachEvent("onload", fn);}else {if (window.onload != null){var oldOnload = window.onload;window.onload = function(e){oldOnload(e);fn();};}else {window.onload = fn;}}};Common.onHashChange = function(fn){if (typeof (window.onhashchange) == "undefined"){window.setInterval(fn, 250);return;}if (typeof (window.addEventListener) != "undefined"){window.addEventListener("hashchange", fn, false);}else if (typeof (window.attachEvent) != "undefined"){window.setInterval(fn, 250);}else {if (window.onhashchange != null){var oldOnHashchange = window.onhashchange;window.onhashchange = function(e){oldOnHashchange(e);fn();};}else {window.onhashchange = fn;}}};Common.hideBlockError = function(id){Common.hideElement(id + "Error");};Common.showBlockError = function(v, id){id += "Error";if (typeof (v) == "object")Common.innerText(id, v.responseText);else Common.innerText(id, v);Common.showElement(id);};Common.showError = function(id, text){Common.showElement(id);Common.innerText(id, text);};Common.innerText = function(id, text){var o = $(id);if (o == null){alert(id);return;}if (Common.isIE())o.innerText = text;else o.textContent = text;};Common.isIE = function(){return navigator.userAgent.indexOf("MSIE") > -1;};Common.locationReload = function(){document.location.reload(true);};Common.navigateSearch = function(){var uri = g_searchUri + encodeURIComponent(searchBox.getText());var geocodeKey = searchBox.getValue();if (!Common.isNullOrEmpty(geocodeKey))uri += "&gk=" + encodeURIComponent(geocodeKey);Common.navigate(uri);};Common.navigateResponse = function(request){Common.navigate(request.responseText);};Common.navigate = function(href){document.location.href = href;};Common.navigateHash = function(hash){document.location.hash = Common.isUndefined(hash) ? "" : hash;};Common.navigateToDefault = function(refValue){if (Common.isNullOrEmpty(refValue))document.location.href = g_baseUri;else document.location.href = g_baseUri + "?ref=" + encodeURIComponent(refValue);};Common.navigateToPreferences = function(){document.location.href = g_preferencesUri;};Common.navigateToInbox = function(){document.location.href = g_inboxUri;};Common.htmlEncode = function(s){return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");};Common.alertResponse = function(request){alert(request.responseText);};/* Sign up dialog */function SignUpDialog(){var self = this;self.dialogHtml = null;self.locationBox = null;self.latitude = 0;self.longitude = 0;self.show = function(){if (self.dialogHtml == null)SecurityHandler.RenderSignUpBlock(self.onRenderSignUpDialogSuccess);else self.showDialog();};self.onRenderSignUpDialogSuccess = function(request){self.dialogHtml = request.responseText;self.showDialog();};self.showDialog = function(){if (navigator.geolocation)navigator.geolocation.getCurrentPosition(self.onGetCurrentPositionSuccess);var dialogBox = new DialogBox(self.dialogHtml);if ($("calleNeon") != null){dialogBox.onHide = function() { Common.showElement("calleNeon"); };Common.hideElement("calleNeon");}dialogBox.show(509, false);Common.focus("signUpEmail");self.locationBox = new SearchBox("signUpLocation");FB.XFBML.Host.parseDomTree();};self.onGetCurrentPositionSuccess = function(position){if (!Common.isUndefinedOrNull(position.coords)){self.latitude = position.coords.latitude;self.longitude = position.coords.longitude;}if (!Common.isUndefined(position.address)){var s = null;if (!Common.isNullOrEmpty(position.address.city)){s = position.address.city;if (!Common.isNullOrEmpty(position.address.region))s += ", " + position.address.region;}if (!Common.isNullOrEmpty(s)){self.locationBox.textBox.value = s;}}};self.register = function(){var self = this;var email = Common.getVal("signUpEmail").trim();var registrationConfirmAge;if (Common.isNullOrEmpty(email)){Common.showBlockError(g_errorNoEmail, "signUpBlock");$("signUpEmail").focus();return;}registrationConfirmAge = $("signUpMinimumAge");if (!registrationConfirmAge.checked){Common.showBlockError(g_errorNot13, "signUpBlock");registrationConfirmAge.focus();return;}SecurityHandler.Register(email,Common.getVal("signUpPassword"),self.locationBox.getText(),self.locationBox.getValue(),self.onRegistrationSuccess,self.onRegistrationError,"signUpBlock");};self.onRegistrationSuccess = function(request){Common.locationReload();};self.onRegistrationError = function(request, id){if (request.status == 402){Common.locationReload();return;}Common.showBlockError(request, id);};}/* Dialogs */function DialogBox(html){var self = this;self.html = html;self.onHide = null;self.show = function(width, isModal){var box = $("dialogBox");if (box)Common.removeNode(box);box = document.createElement("div");var boxStyle = box.style;document.body.appendChild(box);box.id = "dialogBox";boxStyle.width = width + "px";box.innerHTML = self.html;self.positionDialogBox(box);document.body.onkeypress = Common.keyPressDialogBox;if (isModal)document.body.onmousedown = null;else document.body.onmousedown = self.hide;box.onmousedown = Common.cancelEvent;};self.hide = function(){Common.hideDialogBox();if (self.onHide != null)self.onHide();};self.positionDialogBox = function(box){var boxStyle = box.style;boxStyle.left = ((document.body.clientWidth - box.offsetWidth) / 2) + "px";boxStyle.top = ((document.documentElement.clientHeight - box.offsetHeight) / 4) + document.documentElement.scrollTop + "px";};}/* Menu */function Menu(id){var self = this;self.id = id;self.show = function(){document.body.onmousedown = self.hide;$(self.id).onmousedown = Common.cancelEvent;Common.showElement(id);};self.hide = function(){document.body.onmousedown = null;Common.hideElement(id);};}/* BlockRegistry */function BlockRegistry(){var self = this;self.registry = {};self.add = function(block){var entry = {};for (var key in block){if ((key == "content") || (key == "contentId"))continue;entry[key] = block[key];}self.registry[entry.id] = entry;};self.serialize = function(){var entries = [];var i = 0;for (var entry in self.registry){entries[i++] = self.registry[entry];}return Json.stringify(entries);};}/* Search box */function SearchBox(textBoxId, onSelect){var self = this;self.defaultText = null;self.value = "";self.textBox = $(textBoxId);self.onSelect = onSelect;self.searchMenuTimeout = 0;self.searchMenu = new SearchMenu(self, textBoxId, onSelect);self.requestCount = 0;self.focus = function(){self.textBox.focus();};self.getText = function(){return self.textBox.value;};self.getValue = function(){return self.value;};self.onSearchBoxFocus = function(){if (self.defaultText == null)return;self.textBox.value = "";};self.onSearchBoxBlur = function(e){if (!Common.isNullOrEmpty(self.textBox.value.trim()))return;if (self.defaultText == null)return;self.textBox.value = self.defaultText;};self.navigate = function(){var text = self.getText();if (Common.isNullOrEmpty(text) || (text == self.defaultText)){self.textBox.focus();return;}if (self.onSelect)self.onSelect();};self.onSearchBoxKeyDown = function(e){window.clearTimeout(self.searchMenuTimeout);switch (e.keyCode){case 13:if (self.searchMenu.selectedIndex > -1){self.textBox.value = self.searchMenu.getSelectedText();self.value = self.searchMenu.getSelectedValue();}else {self.value = null;}if (self.onSelect)self.onSelect();self.searchMenu.hide();return false;case 40:self.searchMenu.selectDown();return true;case 38:self.searchMenu.selectUp();return true;case 27:case 9:self.searchMenu.hide();return true;}var text;text = self.textBox.value.trim();if ((text.length == 0) || ((text.length == 1) && (e.keyCode == 8))){self.searchMenu.hide();return true;}self.searchMenuTimeout = window.setTimeout(self.getSearchSuggestions, 400);return true;};self.getSearchSuggestions = function(){var searchKey = self.textBox.value.trim();if (searchKey.length == 0)return;var menuData = menuCache[searchKey.toUpperCase()];if (menuData == null){self.requestCount++;var searchContext = {};searchContext.searchKey = searchKey;searchContext.requestCount = self.requestCount;SearchHandler.GetSearchSuggestions(searchKey, self.onGetSearchSuggestions, null, searchContext);}else self.searchMenu.show(menuData);};self.onGetSearchSuggestions = function(request, searchContext){if (self.requestCount > searchContext.requestCount)return;var menuData = eval(request.responseText);if (menuData == null)return;menuCache[searchContext.searchKey.toUpperCase()] = menuData;self.searchMenu.show(menuData);};}/* Search menu */function SearchMenu(parentSearchBox, textBoxId, onSelect){var self = this;self.selectedIndex = -1;self.parentSearchBox = parentSearchBox;self.textBox = $(textBoxId);self.onSelect = onSelect;self.selectUp = function(){if (self.selectedIndex < 0)return;self.removeSelectedStyle(self.getSelectedLink());self.selectedIndex--;if (self.selectedIndex > -1)self.setSelectedStyle(self.getSelectedLink());};self.selectDown = function(){var links = self.getLinks();if (links.length == 0)return;if (self.selectedIndex >= links.length - 1)return;if (self.selectedIndex > -1)self.removeSelectedStyle(self.getSelectedLink());self.selectedIndex++;self.setSelectedStyle(self.getSelectedLink());};self.show = function(menuData){self.selectedIndex = -1;if (menuData.length == 0)return;var menu;menu = $("searchMenu");if (menu == null){menu = document.createElement("div");menu.id = "searchMenu";menu.className = "searchMenuClass";}self.textBox.parentNode.appendChild(menu);menu.onclick = self.clickMenuItem;menu.innerHTML = self.getMenuHtml(menuData);menu.onmousedown = Common.cancelEvent;menu.onmouseover = self.mouseOverMenuItem;document.body.onmousedown = self.hide;Common.showElement("searchMenu");};self.getMenuHtml = function(menuData){var html = "<ul>";for (var i = 0; i < menuData.length; i++){html += "<li><a href=\"javascript:void(0);\" _value=\"" +menuData[i].value + "\">" + menuData[i].key + "</a></li>";}html += "</ul>";return html;};self.hide = function(){self.selectedIndex = -1;var menu;menu = $("searchMenu");if (menu == null)return;Common.hideElement("searchMenu");document.body.onmousedown = null;};self.mouseOverMenuItem = function(e){if (!e)e = window.event;self.removeAllStyles();var o = e.srcElement || e.target;if (o.tagName != "A")return;self.setSelectedStyle(o);self.selectedIndex = self.getSelectedIndex(o);};self.getSelectedIndex = function(o){var i = 0;var li = o.parentNode;while (li.previousSibling){i++;li = li.previousSibling;}return i;};self.setSelectedStyle = function(o){o.style.color = "#fff";o.style.backgroundColor = "#212121";};self.removeSelectedStyle = function(o){o.style.color = "";o.style.backgroundColor = "";};self.removeAllStyles = function(){var links = self.getLinks();for (var i = 0; i < links.length; i++){self.removeSelectedStyle(links[i]);}};self.clickMenuItem = function(e){if (!e)e = window.event;var o = e.srcElement || e.target;if (o.tagName == "A"){self.textBox.value = o.innerText || o.textContent;self.parentSearchBox.value = self.getSelectedValue();}self.hide();if (self.onSelect)self.onSelect();};self.getLinks = function(){if (!$("searchMenu"))return [];return $("searchMenu").getElementsByTagName("A");};self.getSelectedLink = function(){if (self.selectedIndex < 0)return null;var links = self.getLinks();if (links.length == 0)return null;return links[self.selectedIndex];};self.getSelectedText = function(){var link = self.getSelectedLink();if (link == null)return null;return link.innerText || link.textContent;};self.getSelectedValue = function(){var link = self.getSelectedLink();if (link == null)return null;return link.getAttribute("_value");};self.getSelectedUri = function(){var link = self.getSelectedLink();if (link == null)return null;return link.href;};}/* Web services */if (!window.XMLHttpRequest){window.XMLHttpRequest = function(){var oR;var e;try{oR = new ActiveXObject("Msxml2.XMLHTTP.4.0");}catch (e){try{oR = new ActiveXObject("MSXML2.XMLHTTP");}catch (e){try{oR = new ActiveXObject("Microsoft.XMLHTTP");}catch (e){}}}return oR;}}function HttpRequest(){var self = this;self.send = send;self.response = response;function send(){var rgA = arguments;var body = "<is><c>" + Common.htmlEncode(rgA[0]) + "</c><m>" + Common.htmlEncode(rgA[1]) + "</m>";var i;if (rgA.length > 2){for (i = 2; i < rgA.length - 3; i++){if (rgA[i] == null)continue;if (typeof (rgA[i]) == "object"){if (rgA[i].length){for (var j = 0; j < rgA[i].length; j++)body += "<p" + (i - 2) + ">" + Common.htmlEncode(rgA[i][j]) + "</p" + (i - 2) + ">";}else {var dt = Date.parse(rgA[i]);body += "<p" + (i - 2) + ">" + Common.htmlEncode(dt) + "</p" + (i - 2) + ">";}}else {body += "<p" + (i - 2) + ">" + Common.htmlEncode(rgA[i]) + "</p" + (i - 2) + ">";}}}body += "</is>";var oR = new XMLHttpRequest();oR.open("POST", "webservice.ashx", 1);oR.onreadystatechange = self.response;self.response.oR = oR;self.response.fnS = rgA[rgA.length - 3];self.response.fnE = rgA[rgA.length - 2];self.response.oC = rgA[rgA.length - 1];oR.send(body);}function response(){var oR = response.oR;var oC = response.oC;if (oR.readyState != 4)return;if (oR.status == 200){if (response.fnS)response.fnS(oR, oC);}else {if (response.fnE)response.fnE(oR, oC);}}}/* HTMLElement */if (typeof (HTMLElement) != "undefined"){var g_emptyTags = {"IMG": true,"BR": true,"INPUT": true,"META": true,"LINK": true,"PARAM": true,"HR": true};HTMLElement.prototype.__defineGetter__("outerHTML", function(){var attrs = this.attributes;var s = "&lt;" + this.tagName;for (var i = 0; i < attrs.length; i++)s += " " + attrs[i].name + "=\"" + attrs[i].value + "\"";if (g_emptyTags[this.tagName])return s + "&gt;";return s + "&gt;" + this.innerHTML + "&lt;/" + this.tagName + "&gt;";});HTMLElement.prototype.__defineSetter__("outerHTML", function(html){var r = this.ownerDocument.createRange();r.setStartBefore(this);var df = r.createContextualFragment(html);this.parentNode.replaceChild(df, this);});}/* Json */Json.stringify = function(obj){var t = typeof (obj);if (t != "object" || obj === null){if (t == "string")obj = '"' + obj + '"';return String(obj);}else {var n, v, json = [], arr = (obj && obj.constructor == Array);for (n in obj){v = obj[n];t = typeof (v);if (t == "string")v = '"' + v + '"';else if (t == "object" && v !== null)v = Json.stringify(v);json.push((arr ? "" : '"' + n + '":') + String(v));}return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");}};Json.parse = function(s){if (s === "")s = '""';eval("var p=" + s + ";");return p;};/* QueryString */function QueryString(){var rg;var search;var o = {};search = document.location.search.substring(1, document.location.search.length);rg = search.split("&");for (var i = 0; i < rg.length; i++){var rg2 = rg[i].split("=");o[decodeURIComponent(rg2[0]).toLowerCase()] = decodeURIComponent(rg2[1]);}return o;}/* FacebookConnect */function FacebookConnect(){var self = this;self.shareBox = null;self.linkAccount = function(){PlayerHandler.FacebookLinkAccount($("useFacebookImage").checked,Common.updateBlocks,Common.showBlockError,"facebookPreferencesBlock");};self.logOn = function(){SecurityHandler.FacebookLogOn(self.onRenderPostLogOnBox, self.onLogOnError);};self.register = function(){SecurityHandler.FacebookLogOn(self.onRenderPostRegistrationBox, self.onRegisterError);};self.onRenderPostLogOnBox = function(request){Common.navigateToDefault();};self.onRenderPostRegistrationBox = function(request){Common.navigate(document.location.href +((document.location.href.indexOf("?") > -1) ? "&" : "?") +"ref=facebook");};self.onLogOnError = function(request){Common.showBlockError(request, "logOnBlock");};self.onRegisterError = function(request){Common.showBlockError(request, "signUpBlock");};self.showShareOnDialogForRegistration = function(){PlayerHandler.RenderShareOnFacebookBlockForRegistration(self.onShowShareOnDialogForRegistrationSuccess,self.onShowShareOnDialogForRegistrationError);};self.onShowShareOnDialogForRegistrationSuccess = function(request){var dialog = new DialogBox(request.responseText);dialog.show(400, true);self.shareBox = new ExpandableTextBox("shareOnFacebookTextBox");Common.focus("shareOnFacebookTextBox");};self.onShowShareOnDialogForRegistrationError = function(request){Common.showBlockError(request, "shareOnFacebookBlock");};self.publishRegistrationWithPermission = function(){FB.Facebook.apiClient.users_hasAppPermission(fbPublishStreamPermission,self.onPublishRegistrationWithPermission);};self.onPublishRegistrationWithPermission = function(hasAppPermission){if (hasAppPermission == 1)self.publishRegistration();else FB.Connect.showPermissionDialog(fbPublishStreamPermission, self.publishRegistration);};self.onShowPermissionDialog = function(permission){if (isNullOrEmpty(permission) || (permission.indexOf(fbPublishStreamPermission) == -1)){Common.hideDialogBox();return;}self.publishRegistration();};self.publishRegistration = function(){PlayerHandler.PublishRegistrationToStream(Common.getVal("shareOnFacebookTextBox"),self.onUpdateStatus,Common.showBlockError,"shareOnFacebookBlock");};self.onUpdateStatus = function(request){var dialog = new DialogBox(request.responseText);dialog.show(400, true);};}/* CommentBox */function CommentBox(commentBoxId, commentListId, teamId, gameId){var self = this;self.commentBox = $(commentBoxId);self.commentList = $(commentListId);self.teamId = teamId;self.gameId = gameId;self.messageBox = new ExpandableTextBox(commentBoxId);self.send = function(){var text = self.commentBox.value.trim();if (Common.isNullOrEmpty(text))return;TeamHandler.CreateComment(self.teamId, self.gameId, text, self.onSendSuccess, self.onSendError);};self.focus = function(){self.commentBox.focus();};self.onSendSuccess = function(request){Common.hideErrorElement("commentBoxError");self.commentBox.value = "";self.commentBox.style.height = "";self.focus();Common.updateBlocks(request);};self.onSendError = function(request){Common.showErrorElement("commentBoxError", request.responseText);};}function ExpandableTextBox(id){var self = this;self.extraHeight = 20;self.textBox = document.getElementById(id);self.minHeight = self.textBox.clientHeight;self.cloneBox = self.textBox.cloneNode(true);self.cloneBox.removeAttribute("id");self.cloneBox.removeAttribute("name");self.cloneBox.tabIndex = -1;var cloneBoxStyle = self.cloneBox.style;cloneBoxStyle.position = "absolute";cloneBoxStyle.left = "-9999px";cloneBoxStyle.top = "0px";self.textBox.parentNode.insertBefore(self.cloneBox, self.textBox);self.updateSize = function(){self.cloneBox.style.height = 0;self.cloneBox.value = self.textBox.value;self.cloneBox.scrollTop = 10000;var scrollTop = self.cloneBox.scrollTop;if (scrollTop > self.minHeight){self.textBox.style.height = (scrollTop + self.extraHeight) + "px";}else {var computedStyle;if (Common.isUndefined(self.textBox.currentStyle))computedStyle = window.getComputedStyle(self.textBox, "");else computedStyle = self.textBox.currentStyle;self.textBox.style.height = (self.minHeight - parseInt(computedStyle.paddingTop) - parseInt(computedStyle.paddingBottom)) + "px";}};self.textBox.onkeydown = self.updateSize;self.textBox.onkeyup = self.updateSize;self.textBox.onchange = self.updateSize;}

/// Copyright 2004 - 2010 (c) Tosh Meston. All rights reserved.
///
window.PlayerHandler = new PlayerHandler();function PlayerHandler(){this.PublishPlayerStatusToStream = function(p0, p1, p2, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "PublishPlayerStatusToStream", p0, p1, p2, fnS, fnE, oC); };this.UpdatePublishPlayerStatusPreferenceToNever = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "UpdatePublishPlayerStatusPreferenceToNever", fnS, fnE, oC); };this.RenderShareOnFacebookBlockForStatus = function(p0, p1, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "RenderShareOnFacebookBlockForStatus", p0, p1, fnS, fnE, oC); };this.UpdateFacebookPreferences = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "UpdateFacebookPreferences", p0, fnS, fnE, oC); };this.FacebookLinkAccount = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "FacebookLinkAccount", p0, fnS, fnE, oC); };this.PublishRegistrationToStream = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "PublishRegistrationToStream", p0, fnS, fnE, oC); };this.RenderShareOnFacebookBlockForRegistration = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "RenderShareOnFacebookBlockForRegistration", fnS, fnE, oC); };this.CreateComment = function(p0, p1, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "CreateComment", p0, p1, fnS, fnE, oC); };this.DeleteProfileImage = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "DeleteProfileImage", fnS, fnE, oC); };this.RenderProfileBlocks = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "RenderProfileBlocks", fnS, fnE, oC); };this.SaveProfile = function(p0, p1, p2, p3, p4, p5, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "SaveProfile", p0, p1, p2, p3, p4, p5, fnS, fnE, oC); };this.RenderFeedCommentBlock = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "RenderFeedCommentBlock", fnS, fnE, oC); };this.RenderUploadImageBlock = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "RenderUploadImageBlock", fnS, fnE, oC); };this.RenderEditProfileBlock = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "RenderEditProfileBlock", fnS, fnE, oC); };this.UpdateEmailPreferences = function(p0, p1, p2, p3, p4, p5, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "UpdateEmailPreferences", p0, p1, p2, p3, p4, p5, fnS, fnE, oC); };this.UpdateTimezoneOffset = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.PlayerHandler", "UpdateTimezoneOffset", p0, fnS, fnE, oC); };}window.SecurityHandler = new SecurityHandler();function SecurityHandler(){this.AcceptTerms = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.SecurityHandler", "AcceptTerms", fnS, fnE, oC); };this.FacebookLogOn = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.SecurityHandler", "FacebookLogOn", fnS, fnE, oC); };this.ChangePassword = function(p0, p1, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.SecurityHandler", "ChangePassword", p0, p1, fnS, fnE, oC); };this.LogOn = function(p0, p1, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.SecurityHandler", "LogOn", p0, p1, fnS, fnE, oC); };this.Register = function(p0, p1, p2, p3, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.SecurityHandler", "Register", p0, p1, p2, p3, fnS, fnE, oC); };this.RenderSignUpBlock = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.SecurityHandler", "RenderSignUpBlock", fnS, fnE, oC); };this.RemindPassword = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.SecurityHandler", "RemindPassword", p0, fnS, fnE, oC); };}window.TeamHandler = new TeamHandler();function TeamHandler(){this.UpdateFacebookEmail = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "UpdateFacebookEmail", fnS, fnE, oC); };this.JoinTeamAndRender = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "JoinTeamAndRender", p0, fnS, fnE, oC); };this.AcceptInvitation = function(fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "AcceptInvitation", fnS, fnE, oC); };this.InvitePlayers = function(p0, p1, p2, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "InvitePlayers", p0, p1, p2, fnS, fnE, oC); };this.RenderInviteBlock = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "RenderInviteBlock", p0, fnS, fnE, oC); };this.JoinTeam = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "JoinTeam", p0, fnS, fnE, oC); };this.LeaveTeam = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "LeaveTeam", p0, fnS, fnE, oC); };this.UpdateTeam = function(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "UpdateTeam", p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, fnS, fnE, oC); };this.CreateTeam = function(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "CreateTeam", p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, fnS, fnE, oC); };this.RenderCrewDetailsBlock = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "RenderCrewDetailsBlock", p0, fnS, fnE, oC); };this.RenderEditCrewDetailsBlock = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "RenderEditCrewDetailsBlock", p0, fnS, fnE, oC); };this.DeleteTeam = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "DeleteTeam", p0, fnS, fnE, oC); };this.DeleteTeamImage = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "DeleteTeamImage", p0, fnS, fnE, oC); };this.RenderCrewDetailBlocks = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "RenderCrewDetailBlocks", p0, fnS, fnE, oC); };this.RenderUploadImageBlock = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "RenderUploadImageBlock", p0, fnS, fnE, oC); };this.CreateComment = function(p0, p1, p2, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.TeamHandler", "CreateComment", p0, p1, p2, fnS, fnE, oC); };}window.SearchHandler = new SearchHandler();function SearchHandler(){this.GetSearchSuggestions = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.SearchHandler", "GetSearchSuggestions", p0, fnS, fnE, oC); };}window.GameHandler = new GameHandler();function GameHandler(){this.UpdateTeam = function(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.GameHandler", "UpdateTeam", p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, fnS, fnE, oC); };this.UpdatePlayerStatus = function(p0, p1, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.GameHandler", "UpdatePlayerStatus", p0, p1, fnS, fnE, oC); };this.CreateGame = function(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.GameHandler", "CreateGame", p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, fnS, fnE, oC); };this.CreateGameAndTeam = function(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.GameHandler", "CreateGameAndTeam", p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, fnS, fnE, oC); };this.CreateRecurringGameAndTeam = function(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.GameHandler", "CreateRecurringGameAndTeam", p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, fnS, fnE, oC); };this.CreateRecurringGame = function(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.GameHandler", "CreateRecurringGame", p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, fnS, fnE, oC); };this.RenderGameDetailsBlock = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.GameHandler", "RenderGameDetailsBlock", p0, fnS, fnE, oC); };this.RenderEditGameDetailsBlock = function(p0, p1, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.GameHandler", "RenderEditGameDetailsBlock", p0, p1, fnS, fnE, oC); };this.UpdateGame = function(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.GameHandler", "UpdateGame", p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, fnS, fnE, oC); };this.UpdateRecurringGame = function(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.GameHandler", "UpdateRecurringGame", p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, fnS, fnE, oC); };}window.MessagingHandler = new MessagingHandler();function MessagingHandler(){this.AddActivityComment = function(p0, p1, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.MessagingHandler", "AddActivityComment", p0, p1, fnS, fnE, oC); };this.AppendToThread = function(p0, p1, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.MessagingHandler", "AppendToThread", p0, p1, fnS, fnE, oC); };this.DeleteThread = function(p0, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.MessagingHandler", "DeleteThread", p0, fnS, fnE, oC); };this.SendMessageToTeam = function(p0, p1, p2, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.MessagingHandler", "SendMessageToTeam", p0, p1, p2, fnS, fnE, oC); };this.SendMessageToPlayer = function(p0, p1, p2, fnS, fnE, oC) { var o = new HttpRequest(); o.send("InfiniteSports.Calle.UI.MessagingHandler", "SendMessageToPlayer", p0, p1, p2, fnS, fnE, oC); };}

/// Copyright 2002 - 2010 (c) InfiniteSports LLC.  All rights reserved.
///
var page = new ViewPlayerPage();Common.onLoad(page.load);Common.onHashChange(page.hashChange);function ViewPlayerPage(){var self = this;self.locationBox = null;self.playerId = 0;self.blockIds = ["feedCommentBlock", "editProfileBlock", "uploadImageBlock"];self.currentHash = "";self.messageBox = null;self.load = function(){document.page = self;self.messageBox = new ExpandableTextBox("feedCommentTextBox");if (!Common.isNullOrEmpty(document.location.hash))self.hashChange();};self.hashChange = function(){if (self.currentHash == document.location.hash)return;switch (document.location.hash){case "#edit":self.renderEditProfile();break;case "#upload":self.renderUploadImage();break;default:self.renderProfile();break;}self.currentHash = document.location.hash;};self.postComment = function(){var text = Common.getVal("feedCommentTextBox").trim();if (Common.isNullOrEmpty(text)){Common.focus("feedCommentTextBox");return;}PlayerHandler.CreateComment(page.playerId, text, self.onPostCommentSuccess, self.onPostCommentError);};self.onPostCommentSuccess = function(request){Common.updateBlocks(request);};self.onPostCommentError = function(request){alert(Common.getContentId(self.blockIds));Common.showBlockError(request, Common.getContentId(self.blockIds));};self.renderBlocks = function(){PlayerHandler.RenderProfileBlocks(self.onDeleteProfileImageSuccess, Common.showBlockError);};self.deleteProfileImage = function(){PlayerHandler.DeleteProfileImage(self.onDeleteProfileImageSuccess, Common.showBlockError);};self.onDeleteProfileImageSuccess = function(request){Common.updateContentId("feedCommentBlock", self.blockIds);Common.updateBlocks(request);};self.renderUploadImage = function(){PlayerHandler.RenderUploadImageBlock(self.onRenderUploadImageBlockSuccess, Common.showBlockError);};self.onRenderUploadImageBlockSuccess = function(request){Common.updateContentId("uploadImageBlock", self.blockIds);Common.updateBlocks(request);};self.renderEditProfile = function(){PlayerHandler.RenderEditProfileBlock(self.onRenderEditProfileBlockSuccess, Common.showBlockError);};self.onRenderEditProfileBlockSuccess = function(request){Common.updateContentId("editProfileBlock", self.blockIds);Common.updateBlocks(request);self.locationBox = new SearchBox("profileLocation");};self.onClickUpload = function(){window.frames["uploadFrame"].document.getElementById("form1").submit();};self.saveProfile = function(){if (!Common.isValidName("profileName", "editProfileBlock"))return;PlayerHandler.SaveProfile(Common.getVal("profileName"),Common.getIntVal("profileAge"),Common.getIntVal("profileSex"),self.locationBox.getText(),self.locationBox.getValue(),Common.getVal("profileWebsite"),self.onSaveProfileSuccess,Common.showBlockError);};self.onSaveProfileSuccess = function(request){Common.updateContentId("feedCommentBlock", self.blockIds);Common.updateBlocks(request);};self.renderProfile = function(){PlayerHandler.RenderFeedCommentBlock(self.onRenderFeedCommentBlockSuccess, Common.showBlockError);};self.onRenderFeedCommentBlockSuccess = function(request){Common.updateContentId("feedCommentBlock", self.blockIds);Common.updateBlocks(request);};}

