/*!
 * laval.page.js
 * 
 * Ville de Laval - Page.
 * Par Alexandre Levac
 */
function init_textfields() {
	/* Hide form labels but use label text in associated textboxes */
	$('#navbar-search input.text, #newsletter input.text').each(function(i) {
		var labelValue = $('label[for="' + $(this).attr('id') + '"]').hide().text();
		$(this)
			.val(labelValue)
			.focus(function() {
				if ($(this).val() == labelValue) {
					$(this).val("");
				}
			})
			.blur(function() {
				if (!$(this).val()) {
					$(this)
						.val(labelValue);			
				}
			});		
		switch($(this).attr("id")) {
			case "query":
				$(this).css("width", "148px")
				break;
			case "email":
				$(this).css("width", "244px")
				break;
		}
	});
}
function trackEvent(item, type, source) {
	$.post("tracker.php", { item: item, type: type, source: source } );
}
$(document).ready(function() {
	init_textfields();
});
