/*
 * @package: jQuery TBA filtering functions
 * @version: 0.1
 * @author: Robin van Baalen / Stylr Web & Print / http://www.stylr.nl/
 * 
 * CHANGELOG:
 * 
 * 0.1		First release.
 * 
 */

// <![CDATA[
$(function(){
	
    	//*** AJAX setup
    	$.ajaxSetup({
    	    url: "/ajax/",
    	    success: function(){
    	    	$.uiMessage("Er is een fout opgetreden.",{image:false,css:{border:'2px red solid'}});
    	    }
    	});
    
	//*** Fix PNG transparency 
	$(document).pngFix();
	
	//*** Expand the footer 
	$("#expandFooter").show();
	$("#expandFooter").toggle(
		function(){
		    $("#bigFooter").slideDown(1000, function(){
			$.scrollTo({
			    top: 10000
			},
			{
			    axis: "y",
			    duration: 500
			});
			$("#expandFooter a").addClass("active");
		    });
		},
		function(){
		    $.scrollTo({
			top: 0, 
			left: 0
		    },
		    {
			axis: "y",
			duration: 500,
			onAfter: function() { 
				$("#bigFooter").slideUp(1000); 
				$("#expandFooter a").removeClass("active"); 
			}
		    });
		});

	//*** Help icons don't have a href if javascript is enabled.
	$("a.help").attr("href","#");
	//*** Enable tooltips on help icons
	$("img.help").tooltip({ 
	    position: "center right", 
	    offset: [-2, 10], 
	    effect: "fade", 
	    opacity: 0.9, 
	    tip: '.tooltip' 
	});
	
	//*** Make the table items draggable 
	$("#contentTable tbody tr td.first").draggable({
	    revert: false,
	    helper: 'clone'
	});
	
	
	//*** Bind an event to the "#empty" button of the dropbox.
//	$("#dropbox form").bind("submit", function(){
//	    $.debug("Submitted..");
//	    return false;
//	});
	$("#compare").bind("submit", function(){
	    $("#dropbox form").submit();
	});
	$("#empty").bind("click", function(){
	    removeRow("all");
	    $(".inputButtons").fadeOut("fast");
	    return false;
	});
	
	//*** Stripe the content table
	$("#contentTable tbody tr:odd").addClass("odd");
	
});
//]]>
