// SCRIPT PAR Mike Gleason Jr Couturier (mcouturier@bmgmultimedia.com)
// POUR BMG Multimedia
// http://www.bmgmultimedia.com/


// ----------------------
// À conserver intacte
// ----------------------
var liensSections = new Array();
var liensBasPage = new Array();
// FIN "À conserver intacte"


// ----------------------
// Menu PIV
// ----------------------
/* accueil      */ liensSections[liensSections.length] = ['index.htm', '11,1,50,14', true];
/* plan         */ liensSections[liensSections.length] = ['sections/plan/site/', '60,1,116,14', true];
/* nous joindre */ liensSections[liensSections.length] = ['sections/courrier/', '125,1,185,14', true];
/* portail      */ liensSections[liensSections.length] = ['http://www.gouv.qc.ca/', '195,1,261,14', false];
/* aide         */ liensSections[liensSections.length] = ['sections/aide/navigation/', '271,1,296,14', true];
/* recherche    */ liensSections[liensSections.length] = ['http://recherched.gouv.qc.ca/Internet/recherche.asp?Lang=fr&hx=100&lx=760&Fy=60&mx=0&mo=n&curl=txt|http://www.bape.gouv.qc.ca/sections/recherche/&Int=BAPE&rd=y', '306,1,353,14',false];
/* english      */ liensSections[liensSections.length] = ['sections/english/', '363,1,422,14', true];


// FIN "Menu PIV"

// ----------------------
// Pied de page
// ----------------------
/* declaration  */ liensBasPage[liensBasPage.length] = ['sections/declaration/citoyens/', 'Déclaration de services aux citoyens', true];
/* politique    */ liensBasPage[liensBasPage.length] = ['sections/politique/citoyens/', 'Politique de confidentialité', true];
/* propos       liensBasPage[liensBasPage.length] = ['sections/propos/site/', 'À propos de ce site', true]; */
// FIN "Pied de page"


// ----------------------
// Envoyer cette page
// ----------------------
var sujet = 'Un ami vous envoi une page';
// FIN "Envoyer cette page"



// ----------------------
// À conserver intacte
// ----------------------
function telechargerPDF(lePoids, leDocument){
  OpenNewWindow(cheminVersRacine + 'popups/telecharger/index.htm?document=' + leDocument + '&poids=' + lePoids, 'alerte', 350, 200, 0);
}

function ancienSite(adresse){
  OpenNewWindow(cheminVersRacine + 'popups/anciensite/index.htm?adresse=' + adresse, 'alerte', 350, 200, 0);
}

function ecrireMenuPIV(){
  // Utiliser cette ligne pour une bande avec les "image maps"
  // document.write('<img src="' + cheminVersRacine + 'images/bandeau/menu_piv.gif" width="557" height="43" border="0" usemap="#MenuGeneral">');

  // Utiliser ces lignes pour des rollovers
  document.write('<table width="557" border="0" cellspacing="0" cellpadding="0">');
     document.writeln('<tr>');
     
    document.writeln('  <td width="55" height="15"><a href="' + (liensSections[0][2] == true ? cheminVersRacine : '') + liensSections[0][0] + '"><img src="' + cheminVersRacine + 'images/piv_rollovers/bt_accueil.gif" alt="Accueil" name="btn_piv_accueil" width="55" height="15" border="0"></a></td>');
    document.writeln('  <td width="67" height="15"><a href="' + (liensSections[1][2] == true ? cheminVersRacine : '') + liensSections[1][0] + '"><img src="' + cheminVersRacine + 'images/piv_rollovers/bt_plan.gif" alt="Plan du site" name="btn_piv_plan" width="67" height="15" border="0"></a></td>');
     document.writeln('  <td width="72" height="15"><a href="' + (liensSections[2][2] == true ? cheminVersRacine : '') + liensSections[2][0] + '"><img src="' + cheminVersRacine + 'images/piv_rollovers/bt_joindre.gif" alt="Nous joindre" name="btn_piv_joindre" width="72" height="15" border="0"></a></td>');
     document.writeln('  <td width="83" height="15"><a href="' + (liensSections[3][2] == true ? cheminVersRacine : '') + liensSections[3][0] + '"><img src="' + cheminVersRacine + 'images/piv_rollovers/bt_portail.gif" alt="Portail Québec" name="btn_piv_portail" width="83" height="15" border="0"></a></td>');
     document.writeln('  <td width="36" height="15"><a href="' + (liensSections[4][2] == true ? cheminVersRacine : '') + liensSections[4][0] + '"><img src="' + cheminVersRacine + 'images/piv_rollovers/bt_aide.gif" alt="Aide" name="btn_piv_aide" width="36" height="15" border="0"></a></td>');
    document.writeln('  <td width="63" height="15"><a href="' + (liensSections[5][2] == true ? cheminVersRacine : '') + liensSections[5][0] + '"><img src="' + cheminVersRacine + 'images/piv_rollovers/bt_recherche.gif" alt="Recherche" name="btn_piv_recherche" width="63" height="15" border="0"></a></td>');
    document.writeln('  <td width="96" height="15" background="' + cheminVersRacine + 'images/piv_rollovers/bt_vide.gif"><img src="' + cheminVersRacine + 'images/piv_rollovers/bt_vide.gif" width="96" height="15"></td>');
     document.writeln('  <td width="85" height="15"><a href="' + (liensSections[6][2] == true ? cheminVersRacine : '') + liensSections[6][0] + '"><img src="' + cheminVersRacine + 'images/piv_rollovers/bt_english_section.gif" alt="English section" name="btn_piv_english_section" width="85" height="15" border="0"></a></td>');
     document.writeln('</tr>');
   document.write('</table>');
}


function getQueryVariable(variable){
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  }
  alert('Variable ' + variable + ' non trouvée');
}

function ajouterFavoris(){
  if(document.all && (navigator.platform.indexOf('Mac') == -1))
    window.external.AddFavorite(document.location.href, 'Bureau d\'audiences publiques sur l\'environnement');
  else
    alert('Fonction disponible uniquement sur Microsoft Internet Explorer (PC)')
};

function envoyerPage(){
  document.location.href = 'mailto:?subject=' + sujet + '&body=' + document.location.href;
}

function OpenNewWindow(winPath, winName, winWidth, winHeight, winScrollable){
  var winLeft = (screen.width - winWidth) / 2;
  var winTop = (screen.height - winHeight ) / 2;
  var theWindow = window.open(winPath, winName, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+winScrollable+',resizable=0,width='+winWidth+',height='+winHeight+',screenX='+winLeft+',screenY='+winTop+',left='+winLeft+',top='+winTop+'');
  theWindow.opener = self;
  theWindow.focus();
}

function CloseWindow(){
  if(window.opener && !window.opener.closed)
    window.opener.focus();
  window.close();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
// FIN "À conserver intacte"

