$(document).ready(function() {
//$('div.craftMadnessLogo').pngFix( );
	//$('.quadrantPanel').each(function () {
	//	var seasonIdentifier = $(this).attr("ID");
	//	seasonIdentifier = seasonIdentifier.replace('Panel','');
	//	$(this).find("li").each(function () { 
	//		if (this.id) {
	//			this.id = seasonIdentifier + this.id;
	//		}
	//	}); 
	//});
	
	/*$('#resultsUpdate').toggle(function () {
		$('#panelsContainer').slideUp(500);
		$('#resultsPanel').slideDown(500);
	}, function () {
		$('#panelsContainer').slideDown(500);
		$('#resultsPanel').slideUp(500);			
	});*/
	$('#finalRoundBox1').qtip( {
			content:  { url: '/crafts/craftMadness_display.aspx?id=337'}, position: { adjust: { x:11, y:-243}}, style: { width: 300, padding: 5, border: { width: 7, radius: 5, color: '#3b9ad0' }, tip: 'leftMiddle', name: 'light'}
	});
	$('#finalRoundBox2').qtip( {
			content:  { url: '/crafts/craftMadness_display.aspx?id=291'}, position: { adjust: { x:-512, y:-243}}, style: { width: 300, padding: 5, border: { width: 7, radius: 5, color: '#3b9ad0' }, tip: 'rightMiddle', name: 'light'}
	});
	
	$(".quadrantPanel li.finalRound").click(function() { //On click...
		var thumbClick = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
		thirdRoundThumbClick = thumbClick.replace('rd4.jpg','rd5.jpg');
		//Set a background image(thumbOver) on the <div> tag 
		var clickedThumb = $(this).attr("ID");
			var winningThumb = "#finalRoundBox3";
			$(winningThumb).find("span").css('opacity', '1.00');
			$(winningThumb).find("div.craftThumb").css({'background' : 'url(' + thirdRoundThumbClick + ') no-repeat center bottom'});
			//Fade the image to 0
			$(winningThumb).find("span").stop().fadeTo('normal', 0 , function() {
				$(this).find("img").attr("src",thirdRoundThumbClick).addClass('activated');
			});
			
			if (clickedThumb == "finalRoundBox1") {
				var classClear = "#finalRoundBox2";
				$(classClear).find("img").removeClass('selected','');
			}
			else if (clickedThumb == "finalRoundBox2") {
				var classClear = "#finalRoundBox1";
				$(classClear).find("img").removeClass('selected');
			}
		$(this).find("img").addClass("selected");
		swappChoice($(this).find("img").attr("src"));
	});
	
	$(".quadrantPanel li.finalRound").hover(function() { //On hover...
		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
		//Set a background image(thumbOver) on the <div> tag 
		$(this).find("div.craftThumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		//Fade the image to 0 
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).hide() //Hide the image after fade
		});		
	} , function() { //on hover out...
		//Fade the image to 1 
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});
	

});
