function searchForSchool(){getSchoolList($("#schoolSearchBox").val())}function initSearchByState(){$("#m_CurrentState").toggle(),$("#lnkStateSearch").toggle(),getSchoolsByState()}function getSchoolsByState(){$("#searchResults").html("<div class='new_loader_reskin'></div>"),state=$("#m_CurrentState").val(),ajaxUrl="/School/StateSearch",ajaxData={state:state},$.ajax({type:"POST",async:!0,cache:!1,dataType:"html",url:ajaxUrl,data:ajaxData,beforeSend:function(){},error:function(n,t,i){alert("There was a problem getting the data. ("+i+")"),$("#searchResults").html("")},complete:function(){},success:function(n){$("#searchResults").html(n)}})}function getSchoolList(n){$("#searchResults").html("<div class='new_loader_reskin'></div>"),state=null,ajaxUrl="/School/Search",ajaxData={searchString:n,state:state},$.ajax({type:"POST",async:!0,cache:!1,dataType:"html",url:ajaxUrl,data:ajaxData,beforeSend:function(){},error:function(){},complete:function(){},success:function(n){$("#searchResults").html(n)}})}function changeActiveAllTeamCountText(n){n?($("#activeTeamTextId").text("All Teams"),$(".showAllTeams span").text("Show Active")):($("#activeTeamTextId").text("Active Teams"),$(".showAllTeams span").text("Show All"))}function teamSearch(n){var t="/Teams";ajaxData={isAllTeam:n,isRedirect:"true"},$.ajax({type:"POST",async:!0,cache:!1,dataType:"html",url:t,data:ajaxData,error:function(){$("#TeamListPartial").html("")},success:function(t){$("#TeamListPartial").empty(),$("#TeamListPartial").html(t);var r=0;$("table").each(function(){var n=$(this).attr("id");r+=$("#"+n+" tr").length}),changeActiveAllTeamCountText(n),$("#activeTeamTextId").append($("<span class='proxima_nova_600_20px'> ("+r+") </span>"))}})}function FormatModal(){var n=$("#genericModal");n.find(".modal-header").html($("#OpponentHeader")),n.find(".modal-footer").html($("#OpponentFooter")),n.find(".modal-body").html($("#OpponentContent")),n.modal({backdrop:"static",keyboard:!1}),n.show(),$(".modal-backdrop").show(),$("#OpponentCloseButton").click(function(){Close(n)})}function Close(n){n.hide(),$(".modal-backdrop").hide()}$(function(){$("#schoolSearchBox").on("keyup",function(n){n.keyCode==13&&$("#btnSearch").click()});$("#homeSearchForm").on("submit",function(){if($("#searchString").val()===""||$("#searchString").val()===undefined)return $("#schoolName").text("Please enter a School name"),$(".errorSignUp").css("display","block"),!1;$(".errorSignUp").css("display","none")});$("#m_CurrentState").on("change",function(){getSchoolsByState()});$("#searchString").trigger("focus").trigger("select")});$(document).on("click",".otherOpponent",function(){$("#otherOpponentId").css("display","block"),$("#seeless_otherOpponentId").css("display","block"),$("#seeothers").css("display","none")});$(document).on("click",".seeless_otherOpponent",function(){$("#otherOpponentId").css("display","none"),$("#seeless_otherOpponentId").css("display","none"),$("#seeothers").css("display","block")});$("a[class=showAllTeams]").on("click",function(){var n=$(this).data("value");teamSearch(n),n=!n,$("a[name=status]").data("value",n)});$("a[class=showAllEvents]").on("click",function(){var n=cookieHelper();n.create("lastView","month",999),n.create("lastCalDate",new Date),window.location="/School/Calendar/"+$(this).data("index")});$("#seemore").on("click",function(){var n=cookieHelper();n.create("lastView","month",999),n.create("lastCalDate",new Date),window.location="/School/Calendar/"+$(this).data("index")});$(document).on("click",".gameRow",function(){$(this).data("istournament")=="True"?location="/Teams/Tournament/"+$(this).data("tournamentid")+"/"+$("#entityId").val():$(this).data("isgame")=="True"&&(location="/Teams/Game/"+$(this).data("gameid")+"/"+$("#entityId").val()+"/"+$(this).data("uniqueteamid")+"/"+$("#currentschoolyearid").val())});(function(n){function o(t,r,u,f){var o={data:f||(r?r.data:{}),_wrap:r?r._wrap:null,tmpl:null,parent:r||null,nodes:[],calls:nt,nest:tt,wrap:it,html:d,update:rt};return t&&n.extend(o,t,{nodes:[],parent:r}),u&&(o.tmpl=u,o._ctnt=o._ctnt||o.tmpl(n,o),o.key=++e,(c.length?s:i)[e]=o),o}function f(t,i,r){var e,o=r?n.map(r,function(n){return typeof n=="string"?t.key?n.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+u+'="'+t.key+'" $2'):n:f(n,t,n._ctnt)}):t;return i?o:(o=o.join(""),o.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(t,i,r,u){e=n(r).get(),y(e),i&&(e=a(i).concat(e)),u&&(e=e.concat(a(u)))}),e?e:a(o))}function a(t){var i=document.createElement("div");return i.innerHTML=t,n.makeArray(i.childNodes)}function w(t){return new Function("jQuery","$item","var $=jQuery,call,_=[],$data=$item.data;with($data){_.push('"+n.trim(t).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(t,i,r,u,f,e,o){var h=n.tmpl.tag[r],c,s,a;if(!h)throw"Template command not found: "+r;return c=h._default||[],e&&!/\w$/.test(f)&&(f+=e,e=""),f?(f=l(f),o=o?","+l(o)+")":e?")":"",s=e?f.indexOf(".")>-1?f+e:"("+f+").call($item"+o:f,a=e?s:"(typeof("+f+")==='function'?("+f+").call($item):("+f+"))"):a=s=c.$1||"null",u=l(u),"');"+h[i?"close":"open"].split("$notnull_1").join(f?"typeof("+f+")!=='undefined' && ("+f+")!=null":"true").split("$1a").join(a).split("$1").join(s).split("$2").join(u?u.replace(/\s*([^\(]+)\s*(\((.*?)\))?/g,function(n,t,i,r){return r=r?","+r+")":i?")":"",r?"("+t+").call($item"+r:n}):c.$2||"")+"_.push('"})+"');}return _;")}function p(t,i){t._wrap=f(t,!0,n.isArray(i)?i:[b.test(i)?i:n(i).html()]).join("")}function l(n){return n?n.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function g(n){var t=document.createElement("div");return t.appendChild(n.cloneNode(!0)),t.innerHTML}function y(t){function p(t){function p(n){n=n+a,f=v[n]=v[n]||o(f,i[f.parent.key+a]||f.parent,null,!0)}var y,h=t,c,f,l;if(l=t.getAttribute(u)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(y=h.getAttribute(u)));y!==l&&(h=h.parentNode?h.nodeType===11?0:h.getAttribute(u)||0:0,(f=i[l])||(f=s[l],f=o(f,i[h]||s[h],null,!0),f.key=++e,i[e]=f),r&&p(l)),t.removeAttribute(u)}else r&&(f=n.data(t,"tmplItem"))&&(p(f.key),i[f.key]=f,h=n.data(t.parentNode,"tmplItem"),h=h?h.key:0);if(f){for(c=f;c&&c.key!=h;)c.nodes.push(t),c=c.parent;delete f._ctnt,delete f._wrap,n.data(t,"tmplItem",f)}}for(var a="_"+r,c,l,v={},h,f=0,y=t.length;f<y;f++)if((c=t[f]).nodeType===1){for(l=c.getElementsByTagName("*"),h=l.length-1;h>=0;h--)p(l[h]);p(c)}}function nt(n,t,i,r){if(!n)return c.pop();c.push({_:n,tmpl:t,item:this,data:i,options:r})}function tt(t,i,r){return n.tmpl(n.template(t),i,r,this)}function it(t,i){var r=t.options||{};return r.wrapped=i,n.tmpl(n.template(t.tmpl),t.data,r,t.item)}function d(t,i){var r=this._wrap;return n.map(n(n.isArray(r)?r.join(""):r).filter(t||"*"),function(n){return i?n.innerText||n.textContent:n.outerHTML||g(n)})}function rt(){var t=this.nodes;n.tmpl(null,null,null,this).insertBefore(t[0]),n(t).remove()}var k=n.fn.domManip,u="_tmplitem",b=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,i={},s={},h,v={key:0,data:{}},e=0,r=0,c=[];n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,u){n.fn[t]=function(f){var e=[],s=n(f),c,o,a,v,l=this.length===1&&this[0].parentNode;if(h=i||{},l&&l.nodeType===11&&l.childNodes.length===1&&s.length===1)s[u](this[0]),e=this;else{for(o=0,a=s.length;o<a;o++)r=o,c=(o>0?this.clone(!0):this).get(),n.fn[u].apply(n(s[o]),c),e=e.concat(c);r=0,e=this.pushStack(e,t,s.selector)}return v=h,h=null,n.tmpl.complete(v),e}}),n.fn.extend({tmpl:function(t,i,r){return n.tmpl(this[0],t,i,r)},tmplItem:function(){return n.tmplItem(this[0])},template:function(t){return n.template(t,this[0])},domManip:function(t,u,f){if(t[0]&&t[0].nodeType){for(var o=n.makeArray(arguments),s=t.length,c=0,l;c<s&&!(l=n.data(t[c++],"tmplItem")););s>1&&(o[0]=[n.makeArray(t)]),l&&r&&(o[2]=function(t){n.tmpl.afterManip(this,t,f)}),k.apply(this,o)}else k.apply(this,arguments);return r=0,h||n.tmpl.complete(i),this}}),n.extend({tmpl:function(t,r,u,e){var h,c=!e;if(c)e=v,t=n.template[t]||n.template(null,t),s={};else if(!t)return t=e.tmpl,i[e.key]=e,e.nodes=[],e.wrapped&&p(e,e.wrapped),n(f(e,null,e.tmpl(n,e)));return t?(typeof r=="function"&&(r=r.call(e||{})),u&&u.wrapped&&p(u,u.wrapped),h=n.isArray(r)?n.map(r,function(n){return n?o(u,e,t,n):null}):[o(u,e,t,r)],c?n(f(e,null,h)):h):[]},tmplItem:function(t){var i;for(t instanceof n&&(t=t[0]);t&&t.nodeType===1&&!(i=n.data(t,"tmplItem"))&&(t=t.parentNode););return i||v},template:function(t,i){return i?(typeof i=="string"?i=w(i):i instanceof n&&(i=i[0]||{}),i.nodeType&&(i=n.data(i,"tmpl")||n.data(i,"tmpl",w(i.innerHTML))),typeof t=="string"?n.template[t]=i:i):t?typeof t!="string"?n.template(null,t):n.template[t]||n.template(null,b.test(t)?t:n(t)):null},encode:function(n){return(""+n).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}}),n.extend(n.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){_=_.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(_,$1,$2);_=[];",close:"call=$item.calls();_=call._.concat($item.wrap(call,_));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){_.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){_.push($.encode($1a));}"},"!":{open:""}},complete:function(){i={}},afterManip:function(t,i,u){var f=i.nodeType===11?n.makeArray(i.childNodes):i.nodeType===1?[i]:[];u.call(t,i),y(f),r++}})})(jQuery)