/* Original:http://jscript.brewskynet.com/friday  http://javascript.internet.com/calendars/find-friday-the-13th's!.html  */
/* Donnie Brewer - brewsky@cox.net brewsky@home.com  http://www.brewskynet.com/ http://www.brewskynet.com/guestbook/ */
/* DE http://javascript.internet.com/calendars/find-friday-the-13th's!.html */
var new_Date=new Date()
//var DOW=new_Date.getDay()+1
var DOM=new_Date.getDate()
//var Month=new_Date.getMonth()+1
var Year=new_Date.getFullYear()
var LongMonth = new Array("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre")
var LongDay = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi")
var setTimer = 5000;
var numFind = 0;
function find13th() {
	numFind = 0
	Start = document.getElementById('startyear').value
	End = document.getElementById('endyear').value
	var TooMuch = End-Start
	//alert(TooMuch)
	if (TooMuch > 99) {
		if (confirm("Caution, this may result in an extremely large result, and may take a long time to display those results."))
			writeDates()
		else 
			alert("Please make the years closer together..")
}
	else
		writeDates()}
function writeDates(){
	if (End < Start) //if end<start alert user, else
		alert("Sorry, the ending year must be greater than or equal to the beginning year..")
	else {	//allow dates and continue
		var BasicHTML = "<center><u>Résultats!!</u>"
		var ResultHTML = ""
		JSMonthSelect=document.getElementById('MonthSelect');
for (YearTest=Start;YearTest<=End;YearTest++) {
			if (JSMonthSelect.value==20) {
				for (MonthTest=0;MonthTest<=11;MonthTest++) {
					var TestDate = new Date(YearTest,MonthTest,13)
					if (TestDate.getDay()==5) {
						numFind++
						ResultHTML = ResultHTML+"<br>"+TestDate.getDate()+" "+LongMonth[MonthTest]+" "+YearTest
}}}
			else {
				var TestDate = new Date(YearTest,JSMonthSelect.value,13)
				if (TestDate.getDay()==5) {
					numFind++
					ResultHTML = ResultHTML+"<br>"+TestDate.getDate()+" "+LongMonth[JSMonthSelect.value]+" "+YearTest
}}}
		if (numFind == 0)
			numFind = "aucun"
		if (numFind == 1)
			var applyNoun = ""
		else
			var applyNoun = ""
		document.getElementById('InternalDiv').innerHTML = BasicHTML+"<br>Il y a "+applyNoun+numFind+" de trouver.<br>"+ResultHTML;	
}}
function clearResults() {
	var BasicHTML = "<center>Les résultats seront affichés ici!!</center>"
	document.getElementById('InternalDiv').innerHTML = BasicHTML;}