vanilla.namespace("archimede.track");

archimede.track = 
{
    init : function()
    {
	/*
	   Tracking des recherches 
	*/

	$("div.rechercheContainer div.resultat")
	.bind	    
	(
	    "reload", 
	     function(e, a, form)
	     {
		if ( window['pageTracker'] )
		{
		    var category = $("div#view-navigation li.selected").text();

		    $(form.criteres).each
		    (
			function()
			{
			    var action  = this.name;
			    var label   = this.getSelectionLabels().join(',');

			    if ( label )
			    {
				pageTracker._trackEvent(category, action, label); 
			    }
			}
		    );
		}
	     }
	);
    }
};

$(document).ready
(
    function()
    {
	archimede.track.init();
    }
);

