$(document).ready(function() {
	$('.active .bracket-left .zoom').imgPreview({
		containerID: 'imgPreviewWithStyles',
		imgCSS: {
			// Limit preview size:
			height: 200
		},
		// When container is shown:
		onShow: function(link){
			// Animate link:
			$(link).stop().animate({opacity:0.4});
			// Reset image:
			$('img', this).stop().css({opacity:0});
		},
		// When image has loaded:
		onLoad: function(){
			// Animate image
			$(this).animate({opacity:1}, 300);
		},
		// When container hides: 
		onHide: function(link){
			// Animate link:
			$(link).stop().animate({opacity:1});
		}
	});
});


$(document).ready(function() {
	$('.active .bracket-right .zoom').imgPreview({
		containerID: 'imgPreviewWithStyles2',
		imgCSS: {
			// Limit preview size:
			height: 200
		},
		// When container is shown:
		onShow: function(link){
			// Animate link:
			$(link).stop().animate({opacity:0.4});
			// Reset image:
			$('img', this).stop().css({opacity:0});
		},
		// When image has loaded:
		onLoad: function(){
			// Animate image
			$(this).animate({opacity:1}, 300);
		},
		// When container hides: 
		onHide: function(link){
			// Animate link:
			$(link).stop().animate({opacity:1});
		}
	});
});


$(function () {
	$('#madness a.zoom').click(function(e) {
		e.preventDefault();
		//do other stuff when a click happens
	});
});

$(function () {
	var Toggled=false;
		  $(document).ready(function() {
			  $('#details').click(function(){
				if(Toggled==false){$('#details').html('Show details &#187;'); Toggled=true; $.cookie("details", null);}
				else{$('#details').html('Hide details &#171;');Toggled=false; $.cookie("details", "hide");}
				$("#copy").slideToggle(200);
				return false;
			  });
		  }); 	
});

$(function () {
				
			$('.on .open').live("click", function vote() {
												  
				shoe_id_raw = $(this).attr("href");
				pair_id_raw = $(this).closest("div").attr("id");
				shoe_id_jpg = shoe_id_raw.substring(19);
				pair_id = pair_id_raw.substring(4);
				shoe_id = shoe_id_jpg.split(".",1);
				
				$(this).closest("div").find('a').removeClass('open');
				$(this).find('img').replaceWith('<img src="/maven-madness/200y/' + shoe_id + '.jpg" />');
				
					$.ajax({
					url: '/maven-madness/js/vote.php',
					type: 'POST',
					data: 'shoe_id=' + shoe_id + '&pair_id=' + pair_id,
					success: function(result) {

						pageTracker._trackPageview('/madness-vote.html');
						pageTracker._trackEvent('Madness', 'Add vote', shoe_id, pair_id);
					
						}
				  });
				
				return false;
				
		});
						
});
$(function () {
				
			$('#remove').live("click", function vote() {
					
					week = 5;
							
					$.ajax({
					url: '/maven-madness/js/remove.php',
					type: 'POST',
					data: 'remove=' + week,
					success: function(result) {

						top.location = 'http://www.inhershoesradio.com/madness';
					
						}
				  });
				
				return false;
				
		});
						
});
