/* Document ready? */
$(document).ready(function() {

	/* Add fancybox to all paragraphs with the 'zoom' class */
	$("p.zoom a").fancybox({
		'hideOnContentClick': true,
	});
		
	/* Zebra all tables with the 'thetable' class */
	$(".thetable tr:even").addClass("alt");

	$(".thetable tr").mouseover(function(){
		$(this).addClass("over");
	});
	
	$(".thetable tr").mouseout(function(){
		$(this).removeClass("over");
	});

	/* Media plugin */
	$("a.media").media();
		
	$(".next").corner("round tr br");
	$(".prev").corner("round tl bl");
	$(".sold").corner("round");
		
	$("input:text:first").focus();
	
	$('.markitup').markItUp(markitupHTML);
	
	$('.multi').MultiFile({ 
   		accept: 'gif,jpg,png,bmp,swf' 
  	});

	$('.editequipmentdescription').editable('pages/updateequipment.php?part=description', { 
		indicator 	: '<img src="img/indicator.gif">',
		type      	: 'markitup',
		width     	: 480,
		height    	: 200,
		onblur    	: 'ignore',
		submit    	: 'Update',
		cancel    	: 'Do not update',
		markitup  	: markitupHTML
	});
	$('.editequipmenttitle').editable('pages/updateequipment.php?part=title', { 
		indicator 	: '<img src="img/indicator.gif">',
		type      	: 'textarea',
		width     	: 480,
		height    	: 200,
		onblur    	: 'ignore',
		submit    	: 'Update',
		cancel    	: 'Do not update'
	});
	
	$('.deleteequipment').click(function(){
		var id = $(this).prev().text();
		$.ajax({
			type: "POST",
			url: "pages/deleteequipment.php",
			data: "id="+id,
			success: function(html){
			    $("."+id).replaceWith(html);
			  }
		});
	});
	
	$('.ajax').ajaxForm({ 
	        target: '#notice', 
	});
	
}); 
