function routeMenu(){
	var ruta = window.location.pathname.split(".")[0];
	$("ul#menu li").removeClass("active");
	switch(ruta){
		case "/":
			$("li#home").addClass("active");
			break;
		case "/program":
			$("li#program").addClass("active");
			break;
		case "/committees":
			$("li#committees").addClass("active");
			break;
		case "/invitedspeakers":
			$("li#invitedspeakers").addClass("active");
			break;
		case "/registration":
			$("li#registration").addClass("active");
			break;
		case "/participants":
			$("li#participants").addClass("active");
			break;
		case "/practicalinfo":
			$("li#practicalinfo").addClass("active");
			break;
		default:
	}
}
$(document).ready(function(){
	routeMenu();
	var margin = $(".container").css("margin-left");
	//$("#menu").css("margin-left",margin);

	$('#contactform').submit(function(event){
        var fail=false;
		$("#statusmsg").hide();
		event.preventDefault();
		if($('#g-recaptcha-response').val() == ""){
            	$("div.g-recaptcha").tooltip({
				"title":'Marque "No soy un robot"',
				"pacement":"right",
				"trigger":"manual"
			});
			$("div.g-recaptcha").tooltip("show");
			fail=true;
        }
        if(!fail){
            var post = $.post('contact', $(this).serialize());
            post.done(function(data){
                data = $.parseJSON(data);
                if(data.success){
                    showmsg(data.message,true);
                }
                else{
                    showmsg(data.message,false);

                }
                console.log(data)

            });
            post.fail(function(error){
                console.log(error)
            });
        }
	});



});
