vanilla.namespace('joblib.offre');

joblib.offre.home =
{
    init : function(properties, callback)
    {
	$("#view-candidat-quicksearch form").submit
	(
	    function()
	    {
		var secteur	= $(this).find("div.field.secteur select").val();
		var poste	= $(this).find("div.field.poste select").val();
		var departement	= $(this).find("div.field.departement select").val();

		var hash = "#";
		if ( secteur )
		{
		    hash += "/secteur:" + secteur;
		}

		if ( poste )
		{
		    hash += "/poste:" + poste;
		}

		if ( departement )
		{
		    hash += "/localisation:d" + departement;
		}

		window.location.href = callback.literal.replace("__PARAMETERS__", "") + hash;
	    }
	);
    }
}

