/* File: js/interface_home.js, Ratio: 32.9% */

$(document).ready(function(){$(".imageGallery ul li").hover(function(){$(this).addClass("hover");},function(){$(this).removeClass("hover");});$(".leagueNews ul li a").hover(function(){var image=$(this).parent().find("img.newsImage").attr("src");$(".highlightImage img.overlay").attr("src",image);});$("#results table tr").each(function(){var percentage=$(this).find("td:first").text();var width=203*percentage.replace("%","")/100;$(this).find("td:last").append("<div class=\"bar\"></div>");$(this).find(".bar").css("width",width);});$('.polls ul li a').click(function(){$('.tabCopy > div').slideUp().filter(this.hash).slideDown();$('.polls .tabs ul li').removeClass('active');$(this).parent().addClass('active');});$(".header .crest a").click();$("#castVote").click(function(){var leagueName=readCookie('CakeCookie[League][website]').toLowerCase();if(leagueName==='no_name'){league_url="/Home/doVote";}
else{league_url="/"+leagueName+"/Home/doVote";}
var total=document.formPoll.Answers.length;que=$("#question_id").attr("value");for(var i=0;i<total;i++){if(document.formPoll.Answers[i].checked===true){answer=document.formPoll.Answers[i].value;}}
$.ajax({url:league_url,data:"id="+answer+"&qid="+que,type:'get',beforeSend:function(){$('.polls ul li').filter(':first').hide();$('#vote').hide();$('#loading').show();},success:function(msg){$('#results').html(msg);$("#results table tr").each(function(){var percentage=$(this).find("td:first").text();var width=203*percentage.replace("%","")/100;$(this).find("td:last").append("<div class=\"bar\"></div>");$(this).find(".bar").css("width",width);});$('#loading').hide();$('.polls ul li a').filter(':last').click();},error:function(xhr,textStatus,thrownError){}});});});function getDivisions(ageGroupID){var leagueName=readCookie('CakeCookie[League][website]').toLowerCase();if(leagueName==='no_name'){league_url="/Home/getAgeGroupDivisions";}
else{league_url="/"+leagueName+"/Home/getAgeGroupDivisions";}
$('#leagueTableDivGroup').remove();$('.leagueTopThreeDivs').append("<img class=\"loading\" src=\"/img/loading.gif\" alt=\"loading\" />");$.ajax({url:league_url,data:"id="+ageGroupID,type:'POST',success:function(msg){$('.leagueTopThreeDivs img.loading').remove();$('.leagueTables .leagueTopThreeDivs').append("<select name='data[Divisions][divisions]' id='leagueTableDivGroup' >");$('#leagueTableDivGroup').append(msg);$("#leagueTableDivGroup").selectmenu({style:'dropdown',width:98,maxHeight:250});$('#leagueTableDivGroup').append('</select>');},error:function(xhr,textStatus,thrownError){}});}
function redirectToDivision(){var ageGroup=document.getElementById("leagueTableAgeGroup").value;var divID=document.getElementById("leagueTableDivGroup").value;var leagueName=readCookie('CakeCookie[League][website]').toLowerCase();if(leagueName==='no_name'){league_url="/Divisions/index?div="+divID+"&age="+ageGroup;}
else{league_url="/"+leagueName+"/Divisions/index?div="+divID+"&age="+ageGroup;}
var site=league_url;window.location=site;}
function getAjax(e){var leagueName=readCookie('CakeCookie[League][website]').toLowerCase();if(leagueName==='no_name'){league_url="/Home/fixture/";}
else{league_url="/"+leagueName+"/Home/fixture/";}
$('#divGroup').remove();$('#divCompetition').append("<img class=\"loading\" src=\"/img/loading.gif\" alt=\"loading\" />");$('#match_type').attr('value',e);$.ajax({url:league_url,data:"type="+e,type:'post',success:function(msg,status){$('#divCompetition img.loading').remove();if(e=="league")
{$('#divCompetition').append("<select name=\"data[LeagueFixture][selectDivision]\" id=\"divGroup\">");}else{$('#divCompetition').append("<select name=\"data[LeagueFixture][selectCompetition]\" id=\"divGroup\">");}
$('#divGroup').append(msg);$('#divGroup').append('</select>');$("#divGroup").selectmenu({style:'dropdown',width:160,maxHeight:250});}});}