function jours_mois(choix,idj,idm,ida)
{
	var bisexe = 0;var jour_tmp = parent.document.getElementById(''+idj+'').selectedIndex;if(parent.document.getElementById(''+ida+'').value == 2000 || parent.document.getElementById(''+ida+'').value == 2004 || parent.document.getElementById(''+ida+'').value == 2008 || parent.document.getElementById(''+ida+'').value == 20012 || parent.document.getElementById(''+ida+'').value == 20016 || parent.document.getElementById(''+ida+'').value == 20020 || parent.document.getElementById(''+ida+'').value == 20024 || parent.document.getElementById(''+ida+'').value == 20028 || parent.document.getElementById(''+ida+'').value == 2032){bisexe = 1;}else{bisexe = 0;}if(choix == 1 || choix == 3 || choix == 5 || choix == 7 || choix == 8 || choix == 10 || choix == 12){var nbjour = 31;}else if(choix == 2){if(bisexe == 0){var nbjour = 28;}else{var nbjour = 29;}}else if(choix == 4 || choix == 6 || choix == 9 || choix == 11){var nbjour = 30;}parent.document.getElementById(''+idj+'').options.length = 0;for(i=1;i<=nbjour;i++){if(i<10){k = '0'+i;}else{k = i;}var j = new Option(k,i,false,false);parent.document.getElementById(''+idj+'').options[i-1] = j;}if(jour_tmp >= nbjour){var jour_tmp = nbjour-1;}parent.document.getElementById(''+idj+'').selectedIndex = jour_tmp;parent.document.getElementById(''+idm+'').selectedIndex = choix-1;
}

function changePeriode(laction)
{
	var lurl	=	"";
	lurl	+=	"&mdebpro=" + parent.document.getElementById('mdebpro').value;
	lurl	+=	"&adebpro=" + parent.document.getElementById('adebpro').value;
	lurl	+=	"&mfinpro=" + parent.document.getElementById('mfinpro').value;
	lurl	+=	"&afinpro=" + parent.document.getElementById('afinpro').value;

	document.location	=	'./index.php?page=' + laction + lurl;
}

function delThis(page, type2, leType,leTxt,lid)
{
	if (confirm("Êtes-vous sûr de vouloir supprimer " + leTxt + " ?"))
	{
		document.location = './index.php?page=' + page + '&del' + type2 + '=1&action=Del' + leType + '&id=' + lid;
	}
}

function ShowPic(pic,w,h)
{
	if (w > screen.width)
	{
		var wid		=	screen.width-100;
		var	ratio	=	wid/w;
		self.open('showPic.php?pic='+pic+'&width='+wid+'&height='+(h*ratio)+'','zoom','width=' + wid + ',height=' + (h*ratio) + ',menubar=no,titlebar=no');
	}
	else if (h > screen.height)
	{
		var hei	=	screen.height-100;
		var	ratio	=	hei/h;
		self.open('showPic.php?pic='+pic+'&width='+(w*ratio)+'&height='+hei+'','zoom','width=' + (w*ratio) + ',height=' + hei + ',menubar=no,titlebar=no');
	}
	else
	{
		self.open('showPic.php?pic='+pic+'&width='+w+'&height='+h+'','zoom','width=' + w + ',height=' + h + ',menubar=no,titlebar=no');
	}
}

function CheckForm()
{
	var jdeb = 1*document.getElementById('jdeb').value;
	var mdeb = 1*document.getElementById('mdeb').value;
	var adeb = 1*document.getElementById('adeb').value;

	var jfin = 1*document.getElementById('jfin').value;
	var mfin = 1*document.getElementById('mfin').value;
	var afin = 1*document.getElementById('afin').value;

	if (jdeb < 10)
	{
		jdeb = "0" + jdeb;		
	}
	
	if (mdeb < 10)
	{
		mdeb = "0" + mdeb;		
	}

	if (jfin < 10)
	{
		jfin = "0" + jfin;		
	}
	
	if (mfin < 10)
	{
		mfin = "0" + mfin;		
	}	
	
	var deb = adeb+mdeb+jdeb;
	var fin = afin+mfin+jfin;
	

	if (fin < deb)
	{
		alert("Veuillez vérifier votre date de Fin de Séjour.");
	}
	else
	{
		document.form.submit();
	}

}