window.onload = function()
{
	initSelect();
	initAutoBlankFields();
}

function initSelect()
{
	_initSelect('theme_list');
	_initSelect('public_list');
	_initSelect('date_list');
	_initSelect('sitemap');
	_initSelect('commune_select');
	_initSelect('commune_list');
	_initSelect('thematique_list');
}

function _initSelect(ids)
{
	var sel = document.getElementById(ids);
	if ( !sel )
		return ;
	sel.onchange = function() { redirectSelect(sel); }
}

function _initSelect(ids)
{
	var sel = document.getElementById(ids);
	if ( !sel )
		return ;
	sel.onchange = function() { redirectSelect(sel); }
}

function redirectSelect(sel)
{
	var opt= sel.options[sel.selectedIndex];
	document.location.href = opt.value;
}


function initAutoBlankFields()
{
	_initAutoBlankField('SearchText');
}

function _initAutoBlankField(idf)
{
	var f = document.getElementById(idf);
	if ( !f )
		return ;
	f.onfocus = function() { if ( f.value==f.defaultValue ) { f.value=''; } }
}
function popupcarte()
{
	newwp = window.open("/carte_interactive","popupcarte","width=810,height=610,scrollbars=no");
	setTimeout('newwp.focus();',250);
}

function carte_url(args)
{
	if (carte_array[args])
	{
		opener.document.location.href = carte_array[args];
		//window.close();
	}
	else
	{
		alert("Le lien correspondant à l'identifiant : '" + args + "' n'a pas été crée !");
	}
}
