
function basculerCalendrier(id)
{
	var temp=document.getElementById('div_noscript_'+id).style.display;
	document.getElementById('div_noscript_'+id).style.display=document.getElementById('div_script_'+id).style.display;
	document.getElementById('div_script_'+id).style.display=temp;
}

function OuvrirCalendrier(id,masque)
{
	if(id=='reservation_fin' && document.getElementById('reservation_debut').value!='' && document.getElementById('reservation_fin').value=='')
	{
		var expression=/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/(19[7-9][0-9]|20[0-9]{2})$/;
		if(expression.test(document.getElementById('reservation_debut').value))
		{
			expression.exec(document.getElementById('reservation_debut').value);
			return OuvrirPopup('/public/calendrier.html?id='+id+'&masque='+masque+'&defaut='+(Date.UTC(RegExp.$3,RegExp.$2-1,parseInt(RegExp.$1)+7)),true,'Calendrier','toolbar=0,location=0,personnalbar=0,status=0,menubar=0,scrollbars=0,resizable=1,height=250,width=300,left='+(screen.width/2-150)+',top='+(screen.height/2-125)+',channelmode=0,directories=0');
		}
	}
	return OuvrirPopup('/public/calendrier.html?id='+id+'&masque='+masque,true,'Calendrier','toolbar=0,location=0,personnalbar=0,status=0,menubar=0,scrollbars=0,resizable=1,height=250,width=300,left='+(screen.width/2-150)+',top='+(screen.height/2-125)+',channelmode=0,directories=0');
}

function CreerCalendrier(id,masque,value)
{
	document.getElementById('div_noscript_'+id).style.display='none';
	document.write('<span id="div_script_'+id+'">');
	document.write('<a href="#" onclick="if(!OuvrirCalendrier(\''+id+'\','+masque+')) basculerCalendrier(\''+id+'\'); return false;"><img src="/public/image/boutons/calendrier_affichage.png" style="vertical-align:middle; border-style:none;" alt="Afficher le calendrier" title="Afficher le calendrier" /></a> &nbsp;&nbsp;&nbsp;');
	document.write('<a href="#" onclick="document.getElementById(\''+id+'\').value=\'\'; return false;"><img src="/public/image/boutons/calendrier_effacer.png" style="vertical-align:middle; border-style:none;" alt="Effacer la date" title="Effacer la date" /></a> &nbsp;&nbsp;&nbsp;');
	document.write('<input type="text" name="'+id+'" id="'+id+'" value="'+value+'" onclick="if(!OuvrirCalendrier(\''+id+'\','+masque+')) basculerCalendrier(\''+id+'\');" readonly="readonly" style="cursor:pointer;" />');
	document.write('</span>');
}

