jQuery.noConflict();

//Control jQuery scope
(function($){

	/* Navigation */
	$(function(){
		$(".hover SPAN, .topics LI").each(function(i,e){
			$(e).hover(
				function(){$(this).addClass("over");},
				function(){$(this).removeClass("over");});
		});
	});

	/* Challenges */
	$(function(){
		
		$('DIV.challenge-panel.checkable').each(function(i,e){
			$challengePanel = $(this);
			$challengePanel.click(
				function(event){
					var $input = (this.nodeName == "INPUT" ? this : $("INPUT", this));
					if(event.target.nodeName != "INPUT" && event.target.nodeName != "LABEL"){
						if($input.attr("checked")) {
							$input.attr("checked",false)
						} else {
							$input.attr("checked",true)
						}
					}
					if($input.attr("checked")) {
						$(this).addClass("challenge-selected");
					} else {
						$(this).removeClass("challenge-selected");
					}
				
				});
				
			$("INPUT", this).each(function(i,e){
				if($(this).attr("checked")) {
					$challengePanel.addClass("challenge-selected");
				} else {
					$challengePanel.removeClass("challenge-selected");
				}
			})
		});

	});
	

	$(function(){
		var hero = new Hero({
				"hero-diary":"diary.swf"
				,"hero-twodays":"waterbottle.swf"
				,"hero-weekend":(Math.random() > 0.5 ? "football.swf" : "rugbyball.swf")
				,"hero-lower":"bottlecap.swf"
				,"hero-smaller":"wine3.swf"
				,"hero-food":"plate.swf"
				,"hero-water":"tap2.swf"
			});
	});
	
	$(function(){
		$("FORM.pick-challenge").validate();
		$("FORM.validate-me").validate();

		
	});

	
})(jQuery);

try {
 document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}