/* File: js/interface.js, Ratio: 35.4% */

function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');var i,c;for(i=0;i<ca.length;i++){c=ca[i];while(c.charAt(0)===' '){c=c.substring(1,c.length);}
if(c.indexOf(nameEQ)===0){return c.substring(nameEQ.length,c.length);}}
return null;}
function theRotator(){$('div#rotator ul li').css({opacity:0.0,'display':'none'});$('div#rotator ul li:first').css({opacity:1.0,'display':'block'});setInterval(rotate,6000);}
function rotate(){var current=($('div#rotator ul li.show')?$('div#rotator ul li.show'):$('div#rotator ul li:first'));var next=((current.next().length)?((current.next().hasClass('show'))?$('div#rotator ul li:first'):current.next()):$('div#rotator ul li:first'));next.css({opacity:0.0,'display':'none'}).addClass('show').animate({opacity:1.0,'display':'block'},1000);current.animate({opacity:0.0,'display':'none'},1000).removeClass('show');}
function doRotateInit(){setInterval(doRotate,6000);}
function doRotate(){var current=($('#headlineSlides li.show')?$('#headlineSlides li.show'):$('#headlineSlides li:first'));var next=((current.next().length)?((current.next().hasClass('show'))?$('#headlineSlides li:first'):current.next()):$('#headlineSlides li:first'));next.addClass('show');current.removeClass('show');$('#headlinesDiv').html(next.html());$('#headlinesReveal').animate({left:'945'},5000);$('#headlinesReveal').animate({left:'167'},20);}
$(document).ready(function(){if(jQuery.browser.msie){if(parseInt(jQuery.browser.version)<8)
{var zIndexNumber=1000;$('.adminBar').css('z-index',zIndexNumber);zIndexNumber-=10;$('.adminBar').children().each(function(){$(this).css('z-index',zIndexNumber)
zIndexNumber-=10;});var zIndexNumber=1000;$('td.moreInfo').each(function(){$(this).children().each(function(){$(this).css('z-index',zIndexNumber);zIndexNumber-=10;});});}};if(jQuery().innerfade)
{$("#rotator ul").innerfade({speed:1000,timeout:6000,type:'sequence',containerheight:'95px'});}
$(".print a").bind("click",function(){window.print();});if(jQuery().datepicker){if($("#date"))
{$("#date").datepicker({dateFormat:'dd-mm-yy'});}
$("input#datePicker").datepicker({dateFormat:'dd-mm-yy'});$("input.datePicker").datepicker({dateFormat:'dd-mm-yy'});}
if(jQuery().fancybox){$(".gallery a.lightbox").fancybox({'zoomSpeedIn':300,'zoomSpeedOut':300,'overlayShow':false,'opacity':true,'centerOnScroll':false,'hideOnOverlayClick':true});$("a.lightbox").fancybox({'transitionIn':'fade','transitionOut':'fade','overlayShow':true,'opacity':true,'centerOnScroll':false,'hideOnOverlayClick':true,'titlePosition':'inside','showCloseButton':true,'showNavArrows':true,'enableEscapeButton':true});}
$('#headlineSlides').css('display','none');doRotateInit();var $target,targetOffset;$('a[href*=#]').click(function(){if(location.pathname.replace(/^\//,'')===this.pathname.replace(/^\//,'')&&location.hostname===this.hostname){$target=$(this.hash);$target=$target.length&&$target||$('[name='+this.hash.slice(1)+']');if($target.length){targetOffset=$target.offset().top;$('html,body').animate({scrollTop:targetOffset},1000);return false;}}});var teams=$(".teamScoresTable tr th").length;var totalWidth=teams*119;$(".teamScoresTable").css({'width':totalWidth,'margin-left':0,'position':'relative'});$(".resultsGrid li.first a").click(function(){$(".teamScoresTable").animate({marginLeft:0},500);});$(".resultsGrid li.prev a").click(function(){var currentPosition=$(".teamScoresTable").css("margin-left");var newPosition=parseFloat(currentPosition.replace("px",""))+119;if(newPosition<1){$(".teamScoresTable").animate({marginLeft:newPosition},500);}});$(".resultsGrid li.next a").click(function(){var currentPosition=$(".teamScoresTable").css("margin-left");var newPosition=currentPosition.replace("px","")-119;if(currentPosition.replace("px","")*-1<totalWidth-595){$(".teamScoresTable").animate({marginLeft:newPosition},500);}});$(".resultsGrid li.last a").click(function(){$(".teamScoresTable").animate({marginLeft:parseInt(totalWidth-595,10)*-1},500);});var table=$("table#leagueFixturesTable");$("ul.tableScroll li.first").attr("title","Scroll to the left");$("ul.tableScroll li.first a").click(function(){table.animate({marginLeft:0},500);});$("ul.tableScroll li.last").attr("title","Scroll to the right");$("ul.tableScroll li.last a").click(function(){table.animate({marginLeft:-320},500);});if(jQuery().tablesorter)
{$("#playerStats table").tablesorter({sortList:[[0,0],[2,1]]});}
if(jQuery().selectmenu){$("#roundGroup").selectmenu({style:'dropdown',width:160,maxHeight:250});$("#leagueTableAgeGroup").selectmenu({style:'dropdown',width:175,maxHeight:250,menuWidth:225});$("#leagueTableDivGroup").selectmenu({style:'dropdown',width:98,maxHeight:250,menuWidth:225});$("#ageGroup").selectmenu({style:'dropdown',width:120,maxHeight:250});$("#compGroup").selectmenu({style:'dropdown',width:80,maxHeight:250});$("#divGroup").selectmenu({style:'dropdown',width:160,maxHeight:250,menuWidth:225});$("#divisionGroup").selectmenu({style:'dropdown',width:250,maxHeight:250});$(".archiveSelect").selectmenu({style:'dropdown',width:155,maxHeight:250});$("#gallery").selectmenu({style:'dropdown',width:250,maxHeight:250});$("#seasonDropdown").selectmenu({style:'dropdown',maxHeight:250,width:120});$("#chooseDivision").selectmenu({style:'dropdown',width:250,maxHeight:250});$("#changeDivisionOptions").selectmenu({style:'dropdown',width:250,maxHeight:250});$("#selectDivisions").selectmenu({style:'dropdown',width:250,maxHeight:250});$("#team").selectmenu({style:'dropdown',width:250,maxHeight:250});$("#teamFixtureAgeGroup").selectmenu({style:'dropdown',width:100,maxHeight:250});$("#teamFixtureDivisions").selectmenu({style:'dropdown',width:230,maxHeight:250});$("#teamFixturesTeams").selectmenu({style:'dropdown',width:160,maxHeight:250});$("#fixgen_hh").selectmenu({style:'dropdown',width:50,maxHeight:150});$("#fixgen_mm").selectmenu({style:'dropdown',width:50,maxHeight:150});$("#fixture_status").selectmenu({style:'dropdown',width:150,maxHeight:150});$("#venue").selectmenu({style:'dropdown',width:168,maxHeight:150});$("#gender").selectmenu({style:'dropdown',width:100,maxHeight:150});$("#weekday").selectmenu({style:'dropdown',width:153,maxHeight:150});$("#slot_type").selectmenu({style:'dropdown',width:153,maxHeight:150});}
var sky="<iframe src ='/ads\/skyscrapergeneral.html\' width='100%' scrolling='no' frameborder='0'><p>Ads could not be loaded</p></iframe>";$(".grid_2.skyscraper").html(sky);var mpu="<iframe src ='/ads\/mpugeneral.html' width='100%' scrolling='no' frameborder='0'><p>Ads could not be loaded</p></iframe>";$(".grid_4.adspace").html(mpu);var banner="<iframe src ='/ads\/bannerads.html' width='100%' scrolling='no' frameborder='0'><p>Ads could not be loaded</p></iframe>";$(".bannerAd").html(banner);var leaderboard="<iframe src ='/ads\/leaderboard.html' width='100%' scrolling='no' frameborder='0'><p>Ads could not be loaded</p></iframe>";$(".leaderboard").html(leaderboard);});Cufon.replace('#sidebar h2',{fontFamily:'Capture it'});Cufon.replace('#contentArea h1',{fontFamily:'Capture it'});Cufon.replace('.contentBlock_broad h3',{fontFamily:'Capture it'});Cufon.replace('.contentBlock_short h3',{fontFamily:'Capture it'});Cufon.replace('.newsArchive h4',{fontFamily:'Capture it'});Cufon.replace('.historyItems h4',{fontFamily:'Capture it'});Cufon.replace('.noticeBoard h4',{fontFamily:'Capture it'});Cufon.replace('.header h1',{fontFamily:'Capture it'});Cufon.replace('.header h2',{fontFamily:'Capture it'});Cufon.replace('.divisionTitle h2',{fontFamily:'Capture it'});Cufon.replace('.divisionTitle .divisionTitleSponsor',{fontFamily:'Capture it'});Cufon.replace('.divisionTitle .divisionTitleSponsor a',{fontFamily:'Capture it'});var leagueName=readCookie('CakeCookie[League][website]').toLowerCase();$(document).ready(function(){$('#fbShareBtn').bind('click',function(){var shareContent=$.trim($('.'+$(this).attr('rel')).text());var curLink=location.href;if(leagueName==="no_name"){var url="/facebook/post";}
else{var url="/"+leagueName+"/facebook/post";}
postData={'curLink':curLink,'shareContent':shareContent};if($.trim(shareContent)=="")
{return false;}
$.ajax({type:"POST",url:url,data:postData,dataType:"json",cache:false,success:function(response){if(response.success){$.jGrowl("Published to your wall.");}
else
{$.jGrowl("There was some error publishing this to your wall. Please try again.");}},error:function(XMLHttpRequest,textStatus,errorThrown){$.jGrowl("There was some error publishing this to your wall. Please try again.");}});});});