
var sTitreDoc = 'Municipalité Régionale de Comté de Vaudreuil-Soulanges';
document.title = sTitreDoc;

// Source: http://lists.evolt.org/archive/Week-of-Mon-20000207/096093.html
// Ferme la fenêtre enfant lorsque nous focussons sur la fenêtre parent sinon la fenêtre reste ouverte
var popupWin = null;
function openWin(url,w,h){
 if (w == 0) {
	w = screen.width - 200;
 }
//alert(screen.width + ':' + w);
 var itop=Math.floor((screen.height-h)/2);
 var ileft=Math.floor((screen.width-w)/2);
 popupWin = window.open(url,"PopupHelp","width="+w+",height="+h+",top="+itop+",left="+ileft+",toolbar=0,resizable=1,menubar=1,scrollbars=1");
  window.name = 'opener';
 }
function scram() {
  if (popupWin != null && popupWin.open) popupWin.close();
 }
window.onfocus=scram;

function AfficherTitreMenu(iSection) {
	var sOut = '';

	switch (iSection)
	{
		case 101: sOut = 'Présentation de la MRC';break;
		case 102: sOut = 'Le territoire';break;
		case 103: sOut = 'Coordonnées';break;
		case 104: sOut = 'Cour municipale régionale';break;
		case 105: sOut = 'Service d\'évaluation foncière';break;
		case 106: sOut = 'Sécurité publique';break;
		case 107: sOut = 'Politique nationale sur la ruralité';break;
		case 108: sOut = 'Culture et patrimoine';break;
		case 109: sOut = 'Services divers';break;
		case 110: sOut = 'Gestion des matières résiduelles';break;
		case 111: sOut = 'Aménagement du territoire';break;
		case 112: sOut = 'Gestion des cours d\'eau';break;
		case 113: sOut = 'Actualités';break;
		case 114: sOut = 'Document promotionnel';break;
		case 115: sOut = 'Bulletin Le Régional';break;
		
		default: sOut = '';break;
	}
	return sOut;
}

function AfficherCopyright() {
	var sOut = '';

	sOut += '<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">';
	sOut += '<tr>';
	sOut += '<td align="right" class="txtCopyright">';
	sOut += '&copy; - ' + sTitreDoc;
	sOut += '</td>';
	sOut += '</tr>';
	sOut += '</table>';

	return sOut;
}

//
// POUR TOUS LES PAGES (niveau 1 et 2)
//
function MenuPiedDePage(iSection, sNiv,sClass) {
	var sOut = '';

	aryMenu = new Array();
	aryMenu[0] = new Array(2); 
	aryMenu[1] = new Array(2); 
	aryMenu[2] = new Array(2); 
	aryMenu[3] = new Array(2);
	aryMenu[4] = new Array(2); 
	aryMenu[5] = new Array(2); 
	aryMenu[6] = new Array(2); 
	aryMenu[7] = new Array(2); 
	aryMenu[8] = new Array(2); 
	aryMenu[9] = new Array(2); 
	aryMenu[10] = new Array(2); 
	aryMenu[11] = new Array(2); 
	
	iSection = 101;
	aryMenu[0][0]="Présentation de la MRC"; aryMenu[0][1]=iSection + "/" + iSection + "a.htm";
	iSection = 102;
	aryMenu[1][0]="Le territoire"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm";
	iSection = 103;
	aryMenu[2][0]="Coordonnées"; aryMenu[2][1]=iSection + "/" + iSection + "a.htm";
	iSection = 104;
	aryMenu[3][0]="Cour municipale régionale"; aryMenu[3][1]=iSection + "/" + iSection + "a.htm";
	iSection = 105;
	aryMenu[4][0]="Service d'évaluation foncière"; aryMenu[4][1]=iSection + "/" + iSection + "a.htm";
	iSection = 110;
	aryMenu[5][0]="Gestion des matières résiduelles"; aryMenu[5][1]=iSection + "/" + iSection + "a.htm";
	iSection = 111;
	aryMenu[6][0]="Aménagement du territoire"; aryMenu[6][1]=iSection + "/" + iSection + "a.htm";
	iSection = 112;
	aryMenu[7][0]="Gestion des cours d'eau"; aryMenu[7][1]=iSection + "/" + iSection + "a.htm";
	iSection = 106;
	aryMenu[8][0]="Sécurité publique"; aryMenu[8][1]=iSection + "/" + iSection + "a.htm";
	iSection = 107;
	aryMenu[9][0]="Politique nationale sur la ruralité"; aryMenu[9][1]=iSection + "/" + iSection + "a.htm";
	iSection = 108;
	aryMenu[10][0]="Culture et patrimoine"; aryMenu[10][1]=iSection + "/" + iSection + "a.htm";
	iSection = 109;
	aryMenu[11][0]="Services divers"; aryMenu[11][1]=iSection + "/" + iSection + "a.htm";
	var intTotElmMenu = aryMenu.length;

	var iNbrInteger = 0;
	sOut += '<div id="Footer">';
	sOut += '|&nbsp;&nbsp;&nbsp;';
	for (var i = 0; i < intTotElmMenu; i++) {
		i = parseInt(i);
		var sUrl = aryMenu[i][1];
		sOut += '<a href="' + sNiv + sUrl + '" class="' + sClass + '">' + aryMenu[i][0] + '</a>';
		// enlever le dernier élément
		if (i < intTotElmMenu-1) {
			sOut += '&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;';
		}
		if ((i == 4) || (i==8) || (i== 12)) {
			sOut += '<br>|&nbsp;&nbsp;&nbsp;'
		}
	}
	sOut += '&nbsp;&nbsp;&nbsp;|';
	sOut += '</div><br>';

	return sOut;
}

//
// Maximum dans un tableau 7 éléments
//
function ChoisirSection(iSection) {

	aryMenu = new Array();

	if (iSection  == 101) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
		aryMenu[2] = new Array(2); 
		aryMenu[3] = new Array(2);
		aryMenu[4] = new Array(2); 
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="Mot du préfet"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm";
		aryMenu[2][0]="Origine de la MRC"; aryMenu[2][1]=iSection + "/" + iSection + "b.htm";
		aryMenu[3][0]="Organigramme institutionnel"; aryMenu[3][1]=iSection + "/" + iSection + "c.htm";
		aryMenu[4][0]="Budget"; aryMenu[4][1]=iSection + "/" + iSection + "d.htm";
	} else if (iSection  == 102) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
		aryMenu[2] = new Array(2); 
		aryMenu[3] = new Array(2);
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="Localisation"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm"
		aryMenu[2][0]="Les municipalités"; aryMenu[2][1]=iSection + "/" + iSection + "b.htm"
		aryMenu[3][0]="Données démographiques"; aryMenu[3][1]=iSection + "/" + iSection + "c.htm"
	} else if (iSection  == 103) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="Coordonnées et localisation"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm"
	} else if (iSection  == 104) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
		aryMenu[2] = new Array(2);
		aryMenu[3] = new Array(2);
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="Mandat"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm"
		aryMenu[2][0]="Coordonnées et localisation"; aryMenu[2][1]=iSection + "/" + iSection + "b.htm"
		aryMenu[3][0]="Heures d'ouverture"; aryMenu[3][1]=iSection + "/" + iSection + "c.htm"
		
	} else if (iSection  == 105) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
		aryMenu[2] = new Array(2); 
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="Évaluateur municipal"; aryMenu[1][1]=iSection + "/" + iSection + "b.htm"
		aryMenu[2][0]="Demande de révision"; aryMenu[2][1]=iSection + "/" + iSection + "a.htm"
	} else if (iSection  == 106) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
		aryMenu[2] = new Array(2); 
		aryMenu[3] = new Array(2);
		aryMenu[4] = new Array(2); 
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="Sécurité Incendie"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm"
		aryMenu[2][0]="Sécurité civile"; aryMenu[2][1]=iSection + "/" + iSection + "b.htm"
		aryMenu[3][0]="Sécurité publique"; aryMenu[3][1]=iSection + "/" + iSection + "c.htm"
		aryMenu[4][0]="911"; aryMenu[4][1]=iSection + "/" + iSection + "d.htm"
	} else if (iSection  == 107) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
		aryMenu[2] = new Array(2); 
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="La politique nationale de la ruralité"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm"
		aryMenu[2][0]="Subvention du pacte rural"; aryMenu[2][1]=iSection + "/" + iSection + "b.htm"
	} else if (iSection  == 108) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
		aryMenu[2] = new Array(2); 
		aryMenu[3] = new Array(2); 
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="Politique culturelle"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm"
		aryMenu[2][0]="Programme de soutien ..."; aryMenu[2][1]=iSection + "/" + iSection + "b.htm"
		aryMenu[3][0]="Répertoire culturel"; aryMenu[3][1]=iSection + "/" + iSection + "c.htm"
	} else if (iSection  == 109) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
		aryMenu[2] = new Array(2); 
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="Vente pour non-paiement de taxe"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm"
		aryMenu[2][0]="Programme d'habitation"; aryMenu[2][1]=iSection + "/" + iSection + "b.htm"
	} else if (iSection  == 110) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
		aryMenu[2] = new Array(2);
		aryMenu[3] = new Array(2);
		aryMenu[4] = new Array(2);
		aryMenu[5] = new Array(2);
		aryMenu[6] = new Array(2);		
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="Collecte sélective"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm"
		aryMenu[2][0]="RDD"; aryMenu[2][1]=iSection + "/" + iSection + "b.htm"
		aryMenu[3][0]="Plan de gestion des matières... "; aryMenu[3][1]=iSection + "/" + iSection + "c.htm"
		aryMenu[4][0]="Collecte des déchets domestiques"; aryMenu[4][1]=iSection + "/" + iSection + "d.htm"
		aryMenu[5][0]="Collecte des feuilles d'automne"; aryMenu[5][1]=iSection + "/" + iSection + "e.htm"
		aryMenu[6][0]="Gestion des matières putrescibles"; aryMenu[6][1]=iSection + "/" + iSection + "f.htm"		
	} else if (iSection  == 111) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
		
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="Schéma d'aménagement"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm"
		
	} else if (iSection  == 112) {
		strTitreMenuNiv2 = AfficherTitreMenu(iSection);
		aryMenu[0] = new Array(2); 
		aryMenu[1] = new Array(2); 
	
		aryMenu[0][0]="<br>"; aryMenu[0][1]="";
		aryMenu[1][0]="Demande d'information"; aryMenu[1][1]=iSection + "/" + iSection + "a.htm"
	}
	
	return aryMenu;
}

//
// MENU À GAUCHE FRANCAIS
//
function AfficherMenuNivFR(iSection, iPage, sNiv, sClass, sClassSelected) {
	var sOut = '';
	var strClassMenu = '';
	var strTitreMenuNiv2 = '';

	aryMenu = ChoisirSection(iSection);

	var intTotElmMenu = aryMenu.length;
	for (var i = 1; i < intTotElmMenu; i++) {
		if (i <= 7) {
			if (i != iPage) {
				i = parseInt(i);
				if (aryMenu[i][1] != '#') {
					sUrl = aryMenu[i][1];
					sOut += '<img src="' + sNiv + 'images/niv2/pg_selected_trans.gif" width="34" height="9">';
					sOut += '<a href="' + sNiv + sUrl + '" class="' + sClass +  i + '">' + aryMenu[i][0] + '</a><br>';
				} else {
					var sUrl = aryMenu[i][1];
					sOut += '<img src="' + sNiv + 'images/niv2/pg_selected_trans.gif" width="34" height="9">';
					sOut += '<a href="' + sNiv + sUrl + '" class="' + sClass + i + '">' + aryMenu[i][0] + '</a><br>';
				}
			} else if (i == iPage) {
				strTitreMenuNiv2 = AfficherTitreMenu(iSection);
				document.title = strTitreMenuNiv2 + ' - ' + aryMenu[i][0] + ' - ' + sTitreDoc;
				sOut += '<span class="' + sClassSelected + i + '">';
				sOut += '<img src="' + sNiv + 'images/niv2/pg_selected.gif" width="34" height="9">';
				sOut += aryMenu[i][0] + '<br>';
				sOut += '</span>';
			}
		}
	}

	return sOut;
}

//	[FS]  - Fonction pour la recherche du répertoire culturel
//	Crée le 12 juillet 2005
function fRecherche(sSection) {
	var strMessage = '';
	if (sSection == 'domaine') {
		var intCategorie = document.forms[0].sel_categorie.value;
		var intListBoxIndex = document.forms[0].sel_categorie.options.selectedIndex;
		if (intListBoxIndex == 0) {
			strMessage = 'Vous devez sélectionner un catégorie!\n';
		}

		var intListBoxIndex = document.forms[0].sel_domain.options.selectedIndex;
		if ((intListBoxIndex == 0) && (intCategorie != 999)) {
			strMessage += 'Vous devez sélectionner un domaine!\n';
		}
	} else if (sSection == 'municipalite') {
		var intListBoxIndex = document.forms[0].sel_municipalite.options.selectedIndex;
		if (intListBoxIndex == 0) {
			strMessage = 'Vous devez sélectionner une municipalité!';
		}
	} else if (sSection == 'mots') {
		var strMots = Trim(document.forms[0].txt_mot.value);
		document.forms[0].txt_mot.value = strMots;
		if (strMots == '') {
			strMessage = 'Vous devez entré un mot clé!';
		}
	}
	if (strMessage != '') {
		alert(strMessage);
		var bolValidationOk = false;
	} else {
		fEnvoi('resultat.asp');
		var bolValidationOk = true;
	}
}

function fEnvoi(sMode){
	document.f.action=sMode; 
    document.f.submit(); 
}
