// JavaScript Document
function fBouttonMoinsMois() {	
	if(document.frmCalendrier.tbMoisSel.selectedIndex == 0) {
		document.frmCalendrier.tbMoisSel.options[11].selected = true
		document.frmCalendrier.tbAnneeSel.options[document.frmCalendrier.tbAnneeSel.selectedIndex-1].selected = true
	} else {
		document.frmCalendrier.tbMoisSel.options[document.frmCalendrier.tbMoisSel.selectedIndex-1].selected = true
	}
	frmCalendrier.submit();		
}
	
function fBouttonPlusMois() {
	if(document.frmCalendrier.tbMoisSel.selectedIndex == 11) {
		document.frmCalendrier.tbMoisSel.options[0].selected = true
		document.frmCalendrier.tbAnneeSel.options[document.frmCalendrier.tbAnneeSel.selectedIndex+1].selected = true
	} else {
		document.frmCalendrier.tbMoisSel.options[document.frmCalendrier.tbMoisSel.selectedIndex+1].selected = true
	}
	frmCalendrier.submit();
}
	
function fBouttonMoinsAnnee() {
	document.frmCalendrier.tbAnneeSel.options[document.frmCalendrier.tbAnneeSel.selectedIndex-1].selected = true
	frmCalendrier.submit();
}
	
function fBouttonPlusAnnee() {
	document.frmCalendrier.tbAnneeSel.options[document.frmCalendrier.tbAnneeSel.selectedIndex+1].selected = true
	frmCalendrier.submit();
}

//jour.php

function afficherAjouter(idHeure, idClient, annee, mois, jour) {
	ajouter.style.display = "inline";
	ajouter.style.position = "absolute";
	ajouter.style.top = parseInt((screen.height / 2) - 150);
	ajouter.style.left = parseInt((screen.width / 2) - 166);
	document.getElementById("A_Heure").value = idHeure;
	document.getElementById("A_Client").value = idClient;
	document.getElementById("A_Annee").value = annee;
	document.getElementById("A_Mois").value = mois;
	document.getElementById("A_Jour").value = jour;
	document.getElementById("A_AffHeure").innerText = idHeure;
	disableLinks();
}
	
function cacherAjouter() {
	ajouter.style.display = "none";
	retour.style.display = "inline";
	document.getElementById("txtAjouter").innerText = "";
	enableLinks();
}
	
function afficherModifier(idHeure, idClient, annee, mois, jour, evtId, evenement) {
	modifier.style.display = "inline";
	modifier.style.position = "absolute";
	modifier.style.top = parseInt((screen.height / 2) - 150);
	modifier.style.left = parseInt((screen.width / 2) - 166);
	document.getElementById("M_Heure").value = idHeure;
	document.getElementById("M_Client").value = idClient;
	document.getElementById("M_Annee").value = annee;
	document.getElementById("M_Mois").value = mois;
	document.getElementById("M_Jour").value = jour;
	document.getElementById("M_EvtId").value = evtId;
	document.getElementById("M_AffHeure").innerText = idHeure;
	document.getElementById("txtModifier").innerText = evenement;
	disableLinks();
}
	
function cacherModifier() {
	modifier.style.display = "none";
	retour.style.display = "inline";
	enableLinks();
}
	
function afficherSupprimer(idHeure, idClient, annee, mois, jour, evtId, evenement) {
	supprimer.style.display = "inline";
	supprimer.style.position = "absolute";
	supprimer.style.top = parseInt((screen.height / 2) - 150);
	supprimer.style.left = parseInt((screen.width / 2) - 166);
	document.getElementById("S_Heure").value = idHeure;
	document.getElementById("S_Client").value = idClient;
	document.getElementById("S_Annee").value = annee;
	document.getElementById("S_Mois").value = mois;
	document.getElementById("S_Jour").value = jour;
	document.getElementById("S_EvtId").value = evtId;
	document.getElementById("S_AffHeure").innerText = idHeure;
	document.getElementById("txtSupprimer").innerText = evenement;
	disableLinks();
}

function cacherSupprimer() {
	supprimer.style.display = "none";
	retour.style.display = "inline";
	enableLinks();
}
	
function changeColor(idHeure) {
	for(var i = 0; i < 16; i++) {
		if(parseInt(i+7) == parseInt(idHeure))
			document.tr[i].style.backgroundColor = "#faebd7";
	}
}

function changeColorBack() {
	for(var i = 7; i <= 22; i++) {
		if(i%2 == 1)
			document.tr[i-7].style.backgroundColor = "#c0c0c0";
		else
			document.tr[i-7].style.backgroundColor = "#FFFFFF";
	}
}
	
function disableLinks() {
	for(var i = 0; i < 16; i++) {
		document.on[i].style.display = "none";
		document.off[i].style.display = "inline";
	}
}
	
function enableLinks() {
	for(var i = 0; i < 16; i++) {
		document.on[i].style.display = "inline";
		document.off[i].style.display = "none";
	}
}

function redirectJour(jour) {
	document.location = "jour.php?jj="+jour;
}

function getScreenWidth() {
	var width = screen.width;
	return width;
}

function getScreenHeight() {
	var height = screen.height;
	return width;
}

//calendrier.php div flottante