
function createRequestObject(){var requestObject;var browser=navigator.appName;if(browser=="Microsoft Internet Explorer"){requestObject=new ActiveXObject("Microsoft.XMLHTTP");}else{requestObject=new XMLHttpRequest();}
return requestObject;}
var http=createRequestObject();function smartCancel(){if((document.referrer!="")&&(window.location.search=="")){var referrer=document.referrer;if(referrer.indexOf("login")!=-1){document.getElementById("form").action="/";}else{document.getElementById("form").action=referrer;}
document.getElementById("form").submit();return false;}
return true;}
function alerts_selectElevated(obj){if(obj.checked){obj.checked=confirm("Are you sure you want Elevated alerts?  These are the least exciting games.");}}
function contact_submit(){var form=document.form;if(trim(form.contactName.value)==""){alert("Please enter your name.");}else if(trim(form.contactEmail.value)==""){alert("Please enter your email address, so we can contact you.");}else if(!isValidEmail(form.contactEmail.value)){alert("Your email address doesn't look right.  Are you sure you entered it correctly?");}else if(trim(form.body.value)==""){alert("Huh?  If you want to tell us something, you have to actually type a message, genius.");}else if(form.body.value.length>5000){alert("Woah, woah, woah.  Not looking for your life story here.  Please shorten your message.");}else{return true;}
return false;}
function grid_timeSelect(){document.getElementById("timeSelect").action="/tv/"+(parseInt(document.getElementById("gridDay").value)+parseInt(document.getElementById("gridTime").value));document.getElementById("timeSelect").submit();}
function tags_tagSelect(){var selects=document.getElementsByTagName("select");var tagsURL="";for(var i=0;i<selects.length;i++){if(selects[i].options[selects[i].selectedIndex].value!=""){tagsURL+="/"+selects[i].options[selects[i].selectedIndex].value;}}
document.getElementById("tagSelections").action="/tv/labels"+tagsURL;document.getElementById("tagSelections").submit();}
function tags_removeTag(id){document.getElementById(id).options[0].text="Removing...";document.getElementById(id).selectedIndex=0;tags_tagSelect();}
function home_togglePostalCodeCountry(){if(document.getElementById("liveInText").alt.indexOf("U.S.")==-1){document.getElementById("postalCode").style.backgroundImage="url('/images/flag-ca.gif?20091119211140')";document.getElementById("enterToStart").alt="Enter your CPC to start:";document.getElementById("enterToStart").src="/images/enter-your-cpc-to-start.gif?20091119211140";document.getElementById("liveInText").alt="Live in The U.S.?";document.getElementById("liveInText").src="/images/live-in-the-us.gif?20091119211140";document.getElementById("liveInFlag").src="/images/flag-us.gif?20091119211140";}else{document.getElementById("postalCode").style.backgroundImage="url('/images/flag-us.gif?20091119211140')";document.getElementById("enterToStart").alt="Enter your ZIP Code to start:";document.getElementById("enterToStart").src="/images/enter-your-zip-code-to-start.gif?20091119211140";document.getElementById("liveInText").alt="Live in Canada?";document.getElementById("liveInText").src="/images/live-in-canada.gif?20091119211140";document.getElementById("liveInFlag").src="/images/flag-ca.gif?20091119211140";}
document.getElementById("postalCode").value="";}
function headerSearch_onfocus(){if(document.getElementById("headerSearch").value==document.getElementById("headerSearch").defaultValue){document.getElementById("headerSearch").value="";document.getElementById("headerSearch").style.color='#000000';}}
function headerSearch_onblur(){if(document.getElementById("headerSearch").value==""){document.getElementById("headerSearch").value=document.getElementById("headerSearch").defaultValue;document.getElementById("headerSearch").style.color='#999999';}}
function headerSearch_onclick(){if(document.getElementById("headerSearch").value==document.getElementById("headerSearch").defaultValue){document.getElementById("headerSearch").value="";}}
function mylinks_show(){document.getElementById("my-links").style.display='block';document.getElementById("my-page").className="strong my-page on";}
function mylinks_hide(){document.getElementById("my-links").style.display='none';document.getElementById("my-page").className="strong my-page";}
function register_validate(){var nickname=trim(document.getElementById("nickname").value);var email=trim(document.getElementById("email").value);var password=trim(document.getElementById("password").value);var passwordConfirm=trim(document.getElementById("passwordConfirm").value);var captcha=trim(document.getElementById("captcha").value);var ageCheck=document.getElementById("ageCheck").checked;if(nickname.length<4){alert("Please choose a nickname that is at between four and fiteen characters long.");}else if(!nickname.match("^[0-9a-zA-Z]{4,15}$")){alert("Please use just letters and numbers in your nickname.");}else if(nickname.match("^[0-9]{4,15}$")){alert("Please include at least one letter in your nickname.");}else if(!isValidEmail(email)){alert("Please enter a valid email address.");}else if(password.length<4){alert("Please choose a password that is at least four characters long.");}else if(password!=passwordConfirm){alert("The passwords you entered didn't match--try entering them again.");}else if(captcha==""){alert("Please enter the characters you see in the image.");}else if(!ageCheck){alert("You must be 14 years old or older to register with this site.");}else{return true;}
return false;}
function viewVideos_filter(){document.getElementById("form").submit();}
function changePassword_submit(){var form=document.form;if(trim(form.oldPassword.value)==""){alert("Please enter your current password.")}else if(trim(form.newPassword.value).length<4){alert("Please enter a new password that is at least 4 characters long.")}else if(trim(form.newPassword.value)==""){alert("Please enter what you want your new password to be.")}else if(trim(form.newPasswordConfirm.value)==""){alert("Please enter what you want your new password to be...twice.")}else if(trim(form.newPassword.value)!=trim(form.newPasswordConfirm.value)){alert("Please make sure the passwords you enter match.")}else{return true;}
return false;}
function changeEmail_submit(){var newEmail=trim(document.getElementById("newEmail").value);var newEmailConfirm=trim(document.getElementById("newEmailConfirm").value);if((newEmail=="")||(newEmailConfirm=="")){alert("Please enter what you want your new email to be...twice.")}else if(newEmail!=newEmailConfirm){alert("Please make sure the emails you have entered match.")}else if(!isValidEmail(newEmail)){alert("The email you entered doesn't look like a valid email.  Are you sure you entered it correctly?");}else{return true;}
return false;}
function forgotPassword_validate(){var email=trim(document.getElementById("email").value);if(!isValidEmail(email)){alert("Please enter a valid email address.");}else{return true;}
return false;}
function post_defaultMessage_onFocus(text){if(text.value==text.defaultValue){text.value="";}}
function post_defaultMessage_onBlur(text){if(text.value==""){text.value=text.defaultValue;}}
function selectStations_selectAll_toggle(obj){var shouldSelectAll=obj.checked;var checkboxes=document.getElementsByTagName("input");for(var i=0;i<checkboxes.length;i++){if(checkboxes[i].id.indexOf("station_")!=-1){checkboxes[i].checked=shouldSelectAll;}}
document.getElementById("selectAll").innerHTML=!shouldSelectAll?"Select All":"Unselect All";}
function usershout_submit(){if((trim(document.getElementById("body").value)=="")||(document.getElementById("body").value==document.getElementById("body").defaultValue)){alert("You tried to shout at this user, but you didn't write anything.  Give it another try.");return false;}}
function viewTeam_inviteBandwagon_request(teamID){var fromAddress=document.getElementById("fromAddress").value;var toAddresses=document.getElementById("toAddresses").value.split(",");var message=document.getElementById("message").value;for(var i=0;i<toAddresses.length;i++){if((trim(toAddresses[i])!="")&&!isValidEmail(toAddresses[i])){alert("The email address '"+toAddresses[i]+"' doesn't look quite right--please check it.");return;}}
if(!isValidEmail(fromAddress)){alert("Your from email address doesn't look quite right--please check it.");}else if(trim(document.getElementById("toAddresses").value)==""){alert("We can't send invites if you don't enter their addresses.");}else{document.getElementById('inviteBandwagon_status').innerHTML="Sending...";http.open('get','/index.jsp?.state=async/invite-bandwagon&teamID='+teamID+'&fromAddress='+fromAddress+'&toAddresses='+toAddresses+'&message='+message);http.onreadystatechange=viewTeam_inviteBandwagon_response;http.send(null);}}
function viewTeam_inviteBandwagon_response(){if(http.readyState==4){document.getElementById("inviteBandwagon_status").innerHTML="Message sent!";document.getElementById("toAddresses").value="";document.getElementById("message").value="";}}
function select_quickjump(obj){if(obj&&(obj.value!="")){location.href=obj.value;}}
function async_response(){if(http.readyState==4){var data=http.responseText.split('|');var textColor;for(var i=0;i<data.length-1;i=i+2){var fields=document.getElementsByName(data[i]);for(var j=0;j<fields.length;j++){if((fields[j].innerHTML!=null)&&(trim(fields[j].innerHTML)!="")&&(trim(fields[j].innerHTML)!=null)&&(trim(fields[j].innerHTML)!=data[i+1])){textColor=getColor(fields[j]);if((textColor!='#ffffff')&&(textColor!='rgb(255, 255, 255)')){fields[j].shouldHighlight=true;fields[j].style.backgroundColor="rgb(255, 255,0)";}else{fields[j].shouldHighlight=false;}
window.setTimeout(function(obj,val){return function(){obj.style.fontWeight="bolder";obj.innerHTML=val;if(!obj.shouldHighlight){window.setTimeout(function(obj){return function(){obj.style.fontWeight="lighter";obj.style.backgroundColor="";}}(obj),2000);}else{obj.hexColor=0;obj.interval=window.setInterval(function(obj){return function(){var hexColor=Math.min(obj.hexColor+29,255);obj.style.backgroundColor="rgb(255, 255, "+hexColor+")";obj.hexColor=hexColor;if(hexColor==255){clearInterval(obj.interval);obj.style.fontWeight="lighter";obj.style.backgroundColor="";}}}(obj),250);}}}(fields[j],data[i+1]),1000);}}}
return data;}}
function asyncGame(gameIDs,isCompact,team1,team2){var url="/index.jsp?.state=async/game";if(isCompact){url+="&compact=";}
for(var i=0;i<gameIDs.length;i++){url+="&gameID="+gameIDs[i];}
url+="&cacheKiller="+new Date().getTime();http.open('get',url);if(team1&&team2){http.onreadystatechange=(function(){var t1=team1;var t2=team2;return function(){async_responseUpdateTitle(t1,t2);}})();}else{http.onreadystatechange=async_response;}
http.send(null);}
function async_responseUpdateTitle(team1,team2){var data=async_response();if(data!=null){document.title=team1+" "+data[1]+" "+team2+" "+data[3]+", "+data[5];}}
function asyncVoteGame(gameID,source){var url="/index.jsp?.state=async/vote-game&gameID="+gameID+"&source="+source;url+="&cacheKiller="+new Date().getTime();http.open('get',url);http.onreadystatechange=async_response;http.send(null);return false;}
function asyncPrediction(gameID,teamID){var url="/index.jsp?.state=async/prediction&gameID="+gameID+"&teamID="+teamID+"&cacheKiller="+new Date().getTime();http.open('get',url);http.onreadystatechange=async_response;http.send(null);var checkmarks=document.getElementsByName("prediction"+gameID);for(var i=0;i<checkmarks.length;i++){if(checkmarks.item(i).id=="prediction"+gameID+teamID){checkmarks.item(i).src="/images/accept-on.png?20091119211140";}else{checkmarks.item(i).src="/images/accept-off.png?20091119211140";}}
var imgWYG=document.getElementById("prediction"+gameID+"wyg");if(imgWYG){imgWYG.style.display="none";}}
function getColor(obj){var objColor;if(window.getComputedStyle){objColor=window.getComputedStyle(obj,null).color;}else if(obj.currentStyle){objColor=obj.currentStyle.color;}
return objColor;}
function selectInputContents(obj){obj.focus();obj.select();}
function trim(str){return str.replace(/^\s*|\s*$/g,"");}
function multiPart_submit(clickedButton){document.form.action+='&'+clickedButton.name+'='+clickedButton.value;}
function isValidEmail(email){var pattern=/^^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$$/;return pattern.test(trim(email));}
function faq_highlight(){try{var location=new String(document.location);if(location.indexOf("#")!=-1){var questionID=location.substring(location.indexOf("#")+1);if(document.getElementById(questionID)){document.getElementById(questionID).style.backgroundColor="#ffff00";}}}catch(exception){}}