var unchanged=true;function openPopup(b,e,d,a){var c="width="+d+", height="+a+", scrollbars=no, menubar=no, location=no, resizable=no, top=0, left=0";window.open(b,e,c,true)}function close_window(){window.open("","_parent","");window.close()}function getSelectedOption(d){var a=document.getElementById(d).selectedIndex;var c=document.getElementById(d);if(c[0]!=null){var b=c[a].value}else{var b=0}return b}function changeHref(b,a){document.getElementById(b).href=a}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 sumPercentages(d,e){var f=0;inputs=$$(".percentage");if(inputs.length==0){return}for(i=0;i<inputs.length;i++){if(inputs[i].type=="text"&&inputs[i].id!="Total"){var c=inputs[i];if(c.value<10&&e){return 10}going=Math.floor(c.value*1/1);if(isNaN(going)){c.value=0}f=f+(c.value*1);c.value=Math.floor(c.value)}}if(e){return f}else{if(f!=100){unchanged=false}document.getElementById("Total").innerHTML=""+f+"%"}}function showdivs1(b){state=document.getElementById(b).style.display;document.getElementById("Baseball").style.display="none";document.getElementById("Football").style.display="none";document.getElementById("Basketball").style.display="none";document.getElementById("Soccer").style.display="none";document.getElementById("Hockey").style.display="none";document.getElementById("Baseballmore").style.display="block";document.getElementById("Footballmore").style.display="block";document.getElementById("Basketballmore").style.display="block";document.getElementById("Soccermore").style.display="block";document.getElementById("Hockeymore").style.display="block";document.getElementById("Baseballminus").style.display="none";document.getElementById("Footballminus").style.display="none";document.getElementById("Basketballminus").style.display="none";document.getElementById("Soccerminus").style.display="none";document.getElementById("Hockeyminus").style.display="none";if(state=="none"){document.getElementById(b+"minus").style.display="block";document.getElementById(b+"more").style.display="none";document.getElementById(b).style.display="block"}else{document.getElementById(b+"minus").style.display="none";document.getElementById(b+"more").style.display="block";document.getElementById(b).style.display="none"}}function hideTabsOnLoad(){Effect.BlindUp("Baseball",{duration:3});Effect.BlindUp("Basketball",{duration:3});Effect.BlindUp("Football",{duration:3});Effect.BlindUp("Hockey",{duration:3});Effect.BlindUp("Soccer",{duration:3});document.getElementById("Baseballmore").style.display="block";document.getElementById("Footballmore").style.display="block";document.getElementById("Basketballmore").style.display="block";document.getElementById("Soccermore").style.display="block";document.getElementById("Hockeymore").style.display="block";document.getElementById("Baseballminus").style.display="none";document.getElementById("Footballminus").style.display="none";document.getElementById("Basketballminus").style.display="none";document.getElementById("Soccerminus").style.display="none";document.getElementById("Hockeyminus").style.display="none"}function showAdvancedSearch(){if(document.getElementById("AdvancedSearch").style.display=="block"){document.getElementById("AdvancedSearch").style.display="none";document.getElementById("advancedSearchLink").innerHTML="Advanced Search";document.getElementById("city").disabled=true;document.getElementById("states").disabled=true}else{document.getElementById("AdvancedSearch").style.display="block";document.getElementById("advancedSearchLink").innerHTML="Hide Advanced Search";document.getElementById("city").disabled=false;document.getElementById("states").disabled=false}}function showAdvancedSearch2(){if(document.getElementById("AdvancedSearch").style.display=="block"){document.getElementById("AdvancedSearch").style.display="none";document.getElementById("advancedSearchLink").innerHTML="Search by location";document.getElementById("city").disabled=true;document.getElementById("states").disabled=true}else{document.getElementById("AdvancedSearch").style.display="block";document.getElementById("advancedSearchLink").innerHTML="Hide Search by location";document.getElementById("city").disabled=false;document.getElementById("states").disabled=false}}function showAdvancedSearch1(b){did="AdvancedSearch"+b;eid="advancedSearchLink"+b;city="city"+b;states="states"+b;if($(did).style.display=="block"){$(did).style.display="none";$(eid).innerHTML="Advanced Search";$(city).disabled=true;$(states).disabled=true}else{$(did).style.display="block";$(eid).innerHTML="Hide Advanced Search";$(city).disabled=false;$(states).disabled=false}}function showdivs(){$$("select").invoke("hide");document.getElementById("centerwindow").style.display="block";if(document.getElementById("grey2")){document.getElementById("grey2").style.display="block"}if(document.getElementById("grey")){document.getElementById("grey").style.display="block"}}function hidedivs(){$$("select").invoke("show");document.getElementById("centerwindow").style.display="none";if(document.getElementById("grey2")){document.getElementById("grey2").style.display="none"}if(document.getElementById("grey")){document.getElementById("grey").style.display="none"}}function trim(b){var a=b.replace(/^\s*|\s*$/g,"");return a}function toClipboard2(e){var f="Text to copy";netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");var d=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);if(!d){return false}d.data=f;var a=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);if(!a){return false}a.addDataFlavor("text/unicode");a.setTransferData("text/unicode",d,f.length*2);var c=Components.interfaces.nsIClipboard;var b=Components.classes["@mozilla.org/widget/clipboard;1"].getService(c);if(!b){return false}b.setData(a,null,c.kGlobalClipboard)}function confirmPercentages(a){sum=sumPercentages(a,true);if(sum!=100){if(sum==10){if(confirm("Please review your percentages; the percentage of each cause must be 10% as minimun. Or let us fix it for you by submitting the information as it is.")){unchanged=true;return true}}else{if(confirm("Please review your percentages, they need to add to 100%. Or let us fix it for you by submitting the information as it is.")){unchanged=true;return true}}}else{unchanged=true;return true}return false}function ienter(a){if(BrowserDetect.browser=="Explorer"||BrowserDetect.browser=="Safari"){if(window.event.keyCode==13){$(a).click()}}}function switchHide(a,c,g,b,k){try{var h=$(a);var d=$(g);if((h.style.display).toUpperCase()=="NONE"){d.innerHTML=k;h.style.display=c}else{d.innerHTML=b;h.style.display="none"}}catch(f){alert("Can't show/hide elements "+f)}}var MAX_DUMP_DEPTH=10;function dumpObj(g,c,a,h){if(h>MAX_DUMP_DEPTH){return a+c+": <Maximum Depth Reached>\n"}if(typeof g=="object"){var k=null;var b=a+c+"\n";a+="\t";for(var d in g){try{k=g[d]}catch(f){k="<Unable to Evaluate>"}if(typeof k=="object"){b+=dumpObj(k,d,a,h+1)}else{b+=a+d+": "+k+"\n"}}return b}else{return g}}function hide(a){try{$(a).style.display="none";a=null}catch(b){alert(b)}}function show(a){$(a).style.display="block"}function showHide(b){var a=$(b);if((a.style.display).toUpperCase()=="NONE"){a.style.display="block"}else{a.style.display="none"}}function confirmChallengeDonation(a){if(arguments.length==0){a=0}else{a=parseFloat(a)}if(($("amountodonate").value>=a)&&($("amountodonate").value>0)){return true}if(a!=0){alert("Amount must be at least "+a+". Please try again.")}else{alert("Amount must be higher than 0. Please try again.")}return false}function buildDate(){$("ChallengeDateLimit").value=$("ChallengeDate").value+"-"+$("ChallengeDate-mm").value+"-"+$("ChallengeDate-dd").value}function submitAjaxForm(c,a,b){new Ajax.Updater(c,a,{asynchronous:true,evalScripts:true,parameters:Form.serialize(b),requestHeaders:["X-Update","chadd"]})}function selectChallengeType(c,a,b){buildDate();if($("chTypeSelector").value!=""){submitAjaxForm(c,a,b)}else{alert("You must select a challenge type first!")}}function searchGroups(c,a,b){if($("gselector").value!=""){$("glist").innerHTML="";showdivs2();document.getElementById("centerwindow2").innerHTML="Searching";submitAjaxForm(c,a,b);return true}alert("You must select a group type first!");return false}empezar=false;capas=new Array("boxHome","boxMyMenu","boxCauses","boxGroupsFriends","boxChallenges");retardo=null;retardo2=null;ocultar=null;origHeight=0;itrInc=null;lastElement="";function muestra(a){xShow(a)}function oculta(a){xHide(a)}function muestra_coloca(a){if(empezar){for(i=0;i<capas.length;i++){if($(capas[i]).id!=a){xHide(capas[i]);$(anclas[i]).style.backgroundPosition="left"}else{$(anclas[i]).style.backgroundPosition="right"}}clearTimeout(retardo);clearTimeout(retardo2);xShow(a)}}function animateMenu(a,c){try{for(i=0;i<capas.length;i++){if($(capas[i]).id!=a){xHide(capas[i]);$(anclas[i]).style.backgroundPosition="left"}else{$(anclas[i]).style.backgroundPosition="right"}}elm=$(a);if(a!=lastElement){if(elm.style.height!=0){origHeight=parseInt(elm.style.height)}else{if(origHeight==0){origHeight=elm.offsetHeight}}lastElement=a}if(c==1){elm.style.visibility="hidden";i=1;mnuHeight=0;percent=i/100;itrInc=setInterval("incMenu()",1)}}catch(b){alert(b)}}function incMenu(){try{mnuHeight=parseInt(origHeight*percent);elm.style.height=mnuHeight+"px";elm.height=mnuHeight+"px";if(elm.style.visibility=="hidden"){elm.style.visibility="visible"}i=i+5;percent=i/100;if((parseInt(elm.style.height)>=origHeight)){clearInterval(itrInc);elm.height=mnuHeight}}catch(a){alert(a)}}function oculta_retarda(a){if(empezar){ocultar=a;clearTimeout(retardo2);retardo=setTimeout("oculta('"+ocultar+"')",100);retardo2=setTimeout("oculta_todo()",100)}}function muestra_retarda(a){if(empezar){clearTimeout(retardo);clearTimeout(retardo2)}if(a==$(capas[0]).id){$(anclas[0]).style.backgroundPosition="right"}if(a==$(capas[1]).id){$(anclas[1]).style.backgroundPosition="right"}if(a==$(capas[2]).id){$(anclas[2]).style.backgroundPosition="right"}if(a==$(capas[3]).id){$(anclas[3]).style.backgroundPosition="right"}}function oculta_todo(){clearInterval(itrInc);for(i=0;i<anclas.length;i++){$(anclas[i]).style.backgroundPosition="left"}}function showPropose(a){if(a==null){$("grey2").style.height=max(getPageHeight(),700)+"px";document.getElementById("grey2").style.display="block"}showAsDialog($("proposeChallenge"))}function showAsDialog(a,b){if(typeof isFacebookIframe!="undefined"){b=(typeof b!="undefined")?b:"";fbDlg=new FB.UI.FBMLPopupDialog(b,"");fbDlg.setContentWidth(a.getWidth());fbDlg.setContentHeight(a.getHeight());fbDlg.set_placement(FB.UI.PopupPlacement.center);if(tempY>10){Yposition=((tempY>200)?tempY-50:250)}else{Yposition=250}fbDlg.setTop(Yposition);fbDlg.show();fbDlg.setTop(Yposition);a.realParent=a.parentNode;fbDlg.srcObj=a;a.fbDlg=fbDlg;$("fb_dialog_content").innerHTML="";$("fb_dialog_content").appendChild(a);a.style.margin=a.style.left=a.style.top="0px";a.style.position="relative";a.style.display="block";fbDlg.oldClose=fbDlg.close;fbDlg.close=function(c){this.srcObj.style.display="none";this.srcObj.realParent.appendChild(this.srcObj);this.oldClose(c);this.close=this.oldClose;if((typeof $("grey2")!="undefined")){$("grey2").style.display="none"}}}else{a.style.display="block"}}function hidePropose(){if(typeof isFacebookIframe!="undefined"){$("proposeChallenge").fbDlg.close();return}if(document.getElementById("grey2")!=null){document.getElementById("grey2").style.display="none"}$("proposeChallenge").style.display="none";if($("featuredChVid")!=null){$("featuredChVid").style.display="block"}}function cleanPropose(){if($("proposeText").value=="Describe the challenge you want here..."){$("proposeText").value=""}}function validateChallengeProposal(){if($("proposeText").value=="Describe the challenge you want here..."){alert("Please write all the information required for the challenge proposal.");return false}return true}function showGroupRequest(){$("grey2").style.height=max(getPageHeight(),700)+"px";document.getElementById("grey2").style.display="block";$("groupRequest").style.display="block"}function hideGroupRequest(){document.getElementById("grey2").style.display="none";$("groupRequest").style.display="none";if($("featuredChVid")!=null){$("featuredChVid").style.display="block"}}function cleanGroupRequest(){if($("groupRequestText").value=="Please enter all the necessary information here."){$("groupRequestText").value=""}}function validateGroupRequest(){if($("groupRequestText").value=="Please enter all the necessary information here."){alert("Please write all the necessary information.");return false}if($("groupRequestText").value.length==0){alert("Please write all the necessary information.");return false}return true}var notblur=false;var secondbut=false;var firstbut=false;function dot(a){notblur=false;if((BrowserDetect.browser=="Explorer")&&(BrowserDetect.version>=7)){a.style.border="solid black 1px"}else{a.style.border="dotted black 1px"}}function undot(a){if(!notblur){a.style.border="dotted white 1px"}else{setTimeout("$('"+a.id+"').focus()",10);notblur=false}}function showAlert(a,c,b){if(typeof c=="undefined"){c="Notice"}if(typeof b=="undefined"){b=true}if(!b){$("closebtnalert").style.display="none"}$("loading2").style.display="block";$("inloading").innerHTML="<div style='margin-left: 10px; margin-right: 10px'>"+a+"</div>";$("modalBoxTitle").innerHTML=c;if((BrowserDetect.browser=="Explorer")&&$("causescombo")){if(BrowserDetect.version<7){$("causescombo").style.display="none"}}}function delayedHide2(b){try{popupTimeoutID=window.setTimeout("hideloading2();",b)}catch(a){alert("ERROR:"+a)}}function delayedHide3(b){try{popupTimeoutID=window.setTimeout("hideloading3(false);",b)}catch(a){alert("ERROR:"+a)}}sfHover=function(){var b=document.getElementsByTagName("input");for(var a=0;a<b.length;a++){if((b[a].type=="image")&&(b[a].noSFHover!="1")){b[a].onmouseover=function(){this.className+=" sfhover"};b[a].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"")}}}};function createAddHidden(a,c,b){inputfld=document.createElement("input");if(a.indexOf("[")>=0){inputfld.setAttribute("name",a)}else{inputfld.setAttribute("name","data[formlink]["+a+"]")}inputfld.setAttribute("value",c);inputfld.setAttribute("type","hidden");document.getElementById(b).appendChild(inputfld)}function dclickStopper(){return true}function checkMessage(a){if(a.value.length>1250){a.value=a.value.substr(0,1250)}}function check(c,b){var d=$(b);var a=$(c);if(trim(d.value)==""){a.checked=false}else{a.checked=true}}function checkAll(b){var a=$$("."+b);a.each(function(c){c.checked=true})}function uncheckAll(b){var a=$$("."+b);a.each(function(c){c.checked=false})}function fireEvent(b,c){if(document.createEventObject){var a=document.createEventObject();return b.fireEvent("on"+c,a)}else{var a=document.createEvent("HTMLEvents");a.initEvent(c,true,true);return !b.dispatchEvent(a)}}function max(d,c){if(d>c){return d}else{return c}}function getPageHeight(){if(window.innerHeight&&window.scrollMaxY){return window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){return document.body.scrollHeight}else{return document.body.offsetHeight}}}Function.prototype.defaults=function(){var b=this;var a=Array(b.length-arguments.length).concat(Array.prototype.slice.apply(arguments));return function(){return b.apply(b,Array.prototype.slice.apply(arguments).concat(a.slice(arguments.length,a.length)))}};
