$(document).ready(function(){ //requires jQuery
	Toyota.Contest = (function(){ //Contest singleton	
				
				return {
					init:function(){
						$('#rules_btn').click(function(){
							Toyota.CommonTools.winOpen($(this).attr('href'), 800, 500, 0, 1);
							return false; 
						});
						
						//bind the tooltip to the #continue_btn
						$('button#continue_btn').tooltip({
							showURL: false
						});
						
						//on each refresh make the checkbox unchecked
						$('#read_rule_option').attr('checked',false);
						
						$('#read_rule_option').click(function(){
							$('button#continue_btn').toggleClass('inactive');							
							if($(this).attr('checked') == true){
								$.tooltip.blocked = true;								   					
							}else{
								$.tooltip.blocked = false;
							}							
   						});
                        
						//disable the continue button if the checkbox has not been checked
						$('button#continue_btn').click(function(){
							if($('#read_rule_option').attr('checked') == false){
								return false;
							}
						});
						
					}
				};	
			})();
	
	Toyota.Contest.init();		
	
});


