function changeCity() {
	window.location.replace("/city/city?id=" + $('#city_selector').val());
}

function changeCategory() {
	window.location.replace($("#category_selector").val());
}

function toggleMenu() {
	$('#menu_categories').toggle();
	return false;
}

String.prototype.contains = function(it) { return this.indexOf(it) != -1; };

$(document).ready( function() {
	$("#city_selector").selectbox();
	$("#category_selector").selectbox();
});


function submitSplashScreen() {
	var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
    var emailaddressVal = $("#email-newsletter").val();
    if(emailaddressVal == '' || !emailReg.test(emailaddressVal) || emailaddressVal == "martin@adresse.fr") {
		
		$("#email-newsletter").focus();
		return false;
    }
	return true;
}

function closeHeaderMessages() {
	$(".header_messages").slideUp();
}

function toggleCities() {
	$("#cities").slideToggle();
}
