$(document).ready(function() {
  // do stuff when DOM is ready
	if($('body').attr('class') == 'tickets'){
		$('body.tickets ul#leftcol li:even, body.tickets ul#rightcol li:even ').addClass('highlight');
	}
	
	if($('body').attr('class') == 'winners'){	
		$('body.winners #winnersbox #winnerweeks a').click(function(){
			theclass = $(this).parent().attr('class');
			if(theclass != 'inact'){//eligible week to swtich to
				$('body.winners #winnersbox #winnerweeks li').removeClass('act');
				thenumber = $(this).attr('title');
				parsenumber = parseFloat(thenumber.substr(5));
				//alert(parsenumber);
				$(this).parent().addClass('act');
				$('#winnersbox > div.winners').css('display', 'none');
				$('#winnersbox .winners.' + parsenumber).css('display', 'block');
			}	
			return false;
		});
	}
	
	if($('body').attr('class') == 'enter'){	
		//ticket validation
		$('#entryright form ol li input').keyup(function(){
			if($(this).val() != ''){
				$(this).parent().addClass('required');
			}else if($(this).val() == '')
				$(this).parent().removeClass('required');
		})
	
		$("#entryright form").submit(function() {
			
	    });
		
		
		//autotab
			
		$('#ti11').autotab({ target: 'ti12', format: 'numeric' });
		$('#ti12').autotab({ target: 'ti13', format: 'numeric', previous: 'ti11' });
		$('#ti13').autotab({ target: 'ti21', format: 'numeric', previous: 'ti12' });
		
		$('#ti21').autotab({ target: 'ti22', format: 'numeric', previous: 'ti13' });
		$('#ti22').autotab({ target: 'ti23', format: 'numeric', previous: 'ti21' });
		$('#ti23').autotab({ target: 'ti31', format: 'numeric', previous: 'ti22' });
		
		$('#ti31').autotab({ target: 'ti32', format: 'numeric', previous: 'ti23' });
		$('#ti32').autotab({ target: 'ti33', format: 'numeric', previous: 'ti31' });
		$('#ti33').autotab({ target: 'ti41', format: 'numeric', previous: 'ti32' });
		
		$('#ti41').autotab({ target: 'ti42', format: 'numeric', previous: 'ti33' });
		$('#ti42').autotab({ target: 'ti43', format: 'numeric', previous: 'ti41' });
		$('#ti43').autotab({ target: 'ti51', format: 'numeric', previous: 'ti42' });
		
		$('#ti51').autotab({ target: 'ti52', format: 'numeric', previous: 'ti43' });
		$('#ti52').autotab({ target: 'ti53', format: 'numeric', previous: 'ti51' });
		$('#ti53').autotab({ format: 'numeric', previous: 'ti52' });	
	}		
});
