
// JavaScript Document
<!--
var bt_partipolitique_state='close';
var bt_electeur_state='close';
var bt_quisommesnous_state='close';

is = new BrowserCheck();

function tg(gc,st) {
	var gcx = document.getElementById(gc);

	if (st==3) {
		gcx.style.display="block";
		ef = new fx.Height(gcx, {duration: 400}); 
		ef.toggle();
	}

	//CODE POUR CACHER L'AUTRE MENU SI OUVERT
	if (gc=="ShowMe1")
	{
		
		MM_swapImage('partis','','/img/bt-parti-politiques-Close0'+ varLangue +'.gif',0);
		MM_swapImage('quisommesnous','','/img/bt-qui-sommes-nous-Close0'+ varLangue +'.gif',0);

		gcx = document.getElementById('ShowMe2');
		if (st==3) 
		{
			gcx.style.display="none";
			ef = new fx.Height(gcx, {duration: 400}); 
			ef.toggle();
		}
		gcx = document.getElementById('ShowMe3');
		if (st==3) 
		{
			gcx.style.display="none";
			ef = new fx.Height(gcx, {duration: 400}); 
			ef.toggle();
		}
	} 
	else
	
		if (gc=="ShowMe2")
		{
			
			MM_swapImage('electeur','','/img/bt-electeurs-Close0'+ varLangue +'.gif',0);
			MM_swapImage('quisommesnous','','/img/bt-qui-sommes-nous-Close0'+ varLangue +'.gif',0);
			gcx = document.getElementById('ShowMe1');
			if (st==3) 
			{
				gcx.style.display="none";
				ef = new fx.Height(gcx, {duration: 400}); 
				ef.toggle();
			}
			gcx = document.getElementById('ShowMe3');
			if (st==3) 
			{
				gcx.style.display="none";
				ef = new fx.Height(gcx, {duration: 400}); 
				ef.toggle();
			}
			
		}
		else
		
			if (gc=="ShowMe3")
			{
				
				MM_swapImage('electeur','','/img/bt-electeurs-Close0'+ varLangue +'.gif',0);
				MM_swapImage('partis','','/img/bt-parti-politiques-Close0'+ varLangue +'.gif',0);

				gcx = document.getElementById('ShowMe1');
				if (st==3) 
				{
					gcx.style.display="none";
					ef = new fx.Height(gcx, {duration: 400}); 
					ef.toggle();
				}
				gcx = document.getElementById('ShowMe2');
				if (st==3) 
				{
					gcx.style.display="none";
					ef = new fx.Height(gcx, {duration: 400}); 
					ef.toggle();
				}
		
				
			}
	
	
	/*if (gc=="ShowMe1"){
		if (bt_partipolitique_state=='open'){
			swapState('partis');
			
			gcx = document.getElementById('ShowMe2');
			if (st==3) {
				gcx.style.display="block";
				ef = new fx.Height(gcx, {duration: 400}); 
				ef.toggle();
			}
		}
	} else if (gc=="ShowMe2"){
		if (bt_electeur_state=='open'){
			swapState('electeur');
			
			gcx = document.getElementById('ShowMe1');
			if (st==3) {
				gcx.style.display="none";
				ef = new fx.Height(gcx, {duration: 400}); 
				ef.toggle();
			}
		}
	}*/
	//FIN CODE POUR CACHER L'AUTRE MENU SI OUVERT
	
}

function swapImage(IdTheImage){
	if (IdTheImage=='electeur'){
		if (bt_electeur_state=='close'){
			MM_swapImage('electeur','','/img/bt-electeurs-Close1'+ varLangue +'.gif',0);
		}else{
			MM_swapImage('electeur','','/img/bt-electeurs-Open1'+ varLangue +'.gif',0);
		}
	}else if (IdTheImage=='partis'){
		if (bt_partipolitique_state=='close'){
			MM_swapImage('partis','','/img/bt-parti-politiques-Close1'+ varLangue +'.gif',0);
		}else{
			MM_swapImage('partis','','/img/bt-parti-politiques-Open1'+ varLangue +'.gif',0);
		}
	}else if (IdTheImage=='quisommesnous'){
		if (bt_quisommesnous_state=='close'){
			MM_swapImage('quisommesnous','','/img/bt-qui-sommes-nous-Close1'+ varLangue +'.gif',0);
		}else{
			MM_swapImage('quisommesnous','','/img/bt-qui-sommes-nous-Open1'+ varLangue +'.gif',0);
		}
	}
}

function swapState(IdTheImage){
	if (IdTheImage=='partis'){
		if (bt_partipolitique_state=='close'){
			bt_partipolitique_state='open';
			bt_electeur_state='close';
			bt_quisommesnous_state='close';
		}else{
			bt_partipolitique_state='close';
		}
	}else if (IdTheImage=='electeur'){
		if (bt_electeur_state=='close'){
			bt_electeur_state='open';
			bt_partipolitique_state='close';
			bt_quisommesnous_state='close';
		}else{
			bt_electeur_state='close';
		}
	}else if (IdTheImage=='quisommesnous'){
		if (bt_quisommesnous_state=='close'){
			bt_quisommesnous_state='open';
			bt_partipolitique_state='close';
			bt_electeur_state='close';
		}else{
			bt_quisommesnous_state='close';
		}
	}
}

function MM_swapImgRestoreMenu() { //v3.0
	if (bt_partipolitique_state=='close'){
		MM_swapImage('partis','','/img/bt-parti-politiques-Close0'+ varLangue +'.gif',0);
	}else{
		MM_swapImage('partis','','/img/bt-parti-politiques-Open0'+ varLangue +'.gif',0);
	}
	if (bt_electeur_state=='close'){
		MM_swapImage('electeur','','/img/bt-electeurs-Close0'+ varLangue +'.gif',0);
	}else{
		MM_swapImage('electeur','','/img/bt-electeurs-Open0'+ varLangue +'.gif',0);
	}
	if (bt_quisommesnous_state=='close'){
		MM_swapImage('quisommesnous','','/img/bt-qui-sommes-nous-Close0'+ varLangue +'.gif',0);
	}else{
		MM_swapImage('quisommesnous','','/img/bt-qui-sommes-nous-Open0'+ varLangue +'.gif',0);
	}
}


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_jumpMenu(targ,selObj,restore){ //v3.0
	if(selObj.options[selObj.selectedIndex].value== "resultatsOfficiel.asp")
	{
		window.open("resultatsOfficiel.asp","resultats");
	}
	else
	{
  		eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	}
  if (restore) selObj.selectedIndex=0;
}

function popup(lien, w, h, scroll)
{
	if (window.focus)
	{
		//newwindow=window.open(lien, '', 'width='+w+', height='+h+', resizable=yes,scrollbars='+scroll+',menubar=no');
		newwindow=window.open(lien, '', 'width=800, height=600, resizable=yes,scrollbars='+scroll+',menubar=no');
		if (window.focus) 
		{
			newwindow.focus();
		}
		return false;
		//Utilisation :
		//<a href="popupex.html" onClick="return popup('popupex.html')">Link to popup</a>
	}
}

//Fermeture des popup

function fermerFenetre() 
{
window.open('','_parent','');
window.close();
}


			function textePlus(){
				document.getElementById("contenu").style.fontSize = "13pt";
				}
			function texteMoyen(){
				document.getElementById("contenu").style.fontSize = "11pt";
				}
			function texteMoins(){
				document.getElementById("contenu").style.fontSize = "9pt";
				}
				
function Imprimer() 
{ // 1.0 alpha -- Alain Duchesneau
	if (is.ns4 || (is.mac && is.ie)) {
		var newLocation = pageCourante + "?impression=oui";
		var newWin = window.open(newLocation,"impression","top=0,left=0,status=0,menubar=1")
		newWin.focus();
	} else {
		window.print();
	}
}

function BrowserCheck() {
	var b = navigator.appName;
	if (b=="Netscape") {
		this.b = "ns";
	} else if (b=="Microsoft Internet Explorer") {
		this.b = "ie"
	} else {
		this.b = b
	}
	this.version = navigator.appVersion;
	this.v = parseInt(this.version);
	this.ns = (this.b=="ns" && this.v>=4) ? true : false ;
	this.ns4 = (this.b=="ns" && this.v==4) ? true : false ;
	this.ns5 = (this.b=="ns" && this.v==5) ? true : false ;
	this.ie = (this.b=="ie" && this.v>=4) ? true : false ;
	this.ie4 = (this.version.indexOf('MSIE 4')>0) ? true : false ;
	this.ie5 = (this.version.indexOf('MSIE 5')>0) ? true : false ;
	this.ow4 = (this.version.indexOf('OmniWeb')>0) ? true : false ;
	this.mac = (this.version.indexOf('Macintosh')>0) ? true : false ;
//	this.min = (this.ns||this.ie)
}
// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  
  return cookieValue;
}
function validCookieSize()
{
  var cookieValue = "";
  var search = "Size" + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
	else
	{
		writeCookie('Size', 'medium', 48);
		}
  }
  
  return cookieValue;
}



// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire + "; path=/partielles/";
}

// fonction initialise

function init(menu)
{
	validCookieSize();
	switch(menu){
		case 1:
			showmenu(1); 
			SetTypo(readCookie('Size'));
			return false; 
		break;
		case 2:
			showmenu(2); 
			SetTypo(readCookie('Size'));
			return false; 
		break;
		case 3:
			showmenu(3); 
			SetTypo(readCookie('Size'));
			return false; 
		break;
		case 0:
			showmenu(0);
			SetTypo(readCookie('Size'));
			return false; 
		break;
		default:
			showmenu(0);
			SetTypo(readCookie('Size'));
			return false; 
		break;
		}
}

function DocNameExtract()
{
   wholeurl = window.location.href;
   x = wholeurl.length;
   while((wholeurl.substring(x,x-1)) != "."){ x--; } clipend = x;
   while((wholeurl.substring(x,x-1)) != "/"){ x--; } clipstart = x;
   return wholeurl.substring(clipend-1,clipstart);
}
function DocFileNameExtract()
{
   wholeurl = window.location.href;
   x = wholeurl.length;
   while((wholeurl.substring(x,x-1)) != "/"){ x--; } clipstart = x;
   return wholeurl.substring(wholeurl.length,clipstart);
}
function SetAccTypo(NewSize){
	if (NewSize=='small'){
		document.getElementById('colonnegauche').style.fontSize='0.8em';
		document.getElementById('colonnecentre').style.fontSize='0.8em';
		document.getElementById('colonnedroite').style.fontSize='0.8em';
		document.getElementById('infobasdepage').style.fontSize='0.8em';
	}
	if (NewSize=='medium'){
		document.getElementById('colonnegauche').style.fontSize='1em';
		document.getElementById('colonnecentre').style.fontSize='1em';
		document.getElementById('colonnedroite').style.fontSize='1em';
		document.getElementById('infobasdepage').style.fontSize='1em';
	}
	if (NewSize=='large'){
		document.getElementById('colonnegauche').style.fontSize='1.2em';
		document.getElementById('colonnecentre').style.fontSize='1.2em';
		document.getElementById('colonnedroite').style.fontSize='1.2em';
		document.getElementById('infobasdepage').style.fontSize='1.2em';
	}		
}
function SetTypo(NewSize){
	writeCookie('Size', NewSize, 48);
	tempVar = new String(DocFileNameExtract());
	if((tempVar.indexOf('index.asp')!=-1)||(tempVar=='')||(tempVar=='#'))
		{
			indice = 'colonnedroite';	
		}
	else
		{
			indice = 'colonnedroiteniv2';	
		}

	if (NewSize=='small'){
		document.getElementById('colonnegauche').style.fontSize='0.8em';
		document.getElementById(indice).style.fontSize='0.8em';
		document.getElementById('infobasdepage').style.fontSize='0.8em';
		document.getElementById('smalltypo').style.backgroundColor = '#7A7A7A';
		document.getElementById('smalltypo').style.color = '#ffffff';
		document.getElementById('mediumtypo').style.backgroundColor = '#ffffff';
		document.getElementById('mediumtypo').style.color = '#7A7A7A';
		document.getElementById('largetypo').style.backgroundColor = '#ffffff';
		document.getElementById('largetypo').style.color = '#7A7A7A';
	}
	if (NewSize=='medium'){
		document.getElementById('colonnegauche').style.fontSize='1em';
		document.getElementById(indice).style.fontSize='1em';
		document.getElementById('infobasdepage').style.fontSize='1em';
		document.getElementById('smalltypo').style.backgroundColor = '#ffffff';
		document.getElementById('smalltypo').style.color = '#7A7A7A';	
		document.getElementById('mediumtypo').style.backgroundColor = '#7A7A7A';
		document.getElementById('mediumtypo').style.color = '#ffffff';
		document.getElementById('largetypo').style.backgroundColor = '#ffffff';
		document.getElementById('largetypo').style.color = '#7A7A7A';		
	}
	if (NewSize=='large'){
		document.getElementById('colonnegauche').style.fontSize='1.2em';
		document.getElementById(indice).style.fontSize='1.2em';
		document.getElementById('infobasdepage').style.fontSize='1.2em';
		document.getElementById('smalltypo').style.backgroundColor = '#ffffff';
		document.getElementById('smalltypo').style.color = '#7A7A7A';	
		document.getElementById('mediumtypo').style.backgroundColor = '#ffffff';
		document.getElementById('mediumtypo').style.color = '#7A7A7A';
		document.getElementById('largetypo').style.backgroundColor = '#7A7A7A';
		document.getElementById('largetypo').style.color = '#ffffff';			
	}		
}

function isPostCode(entry){ // CANADIAN CODES ONLY
	entry=entry.replace(" ", "");
	strlen=entry.length; if(strlen!=6) {return false;}
	entry=entry.toUpperCase();    // in case of lowercase characters
	// Check for legal characters in string - note index starts at zero
	if('GHJK'.indexOf(entry.charAt(0))<0) {return false;}
	if('0123456789'.indexOf(entry.charAt(1))<0) {return false;}
	if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(entry.charAt(2))<0) {return false;}
	if('0123456789'.indexOf(entry.charAt(3))<0) {return false;}
	if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(entry.charAt(4))<0) {return false;}
	if('0123456789'.indexOf(entry.charAt(5))<0) {return false;}
	return true;
}

function IsNumeric(sText){
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
	  { 
	  Char = sText.charAt(i); 
	  if (ValidChars.indexOf(Char) == -1) 
		 {
		 IsNumber = false;
		 }
	  }
   return IsNumber;
}

function isPostCode(entry){ // CANADIAN CODES ONLY
	strlen=entry.length; if(strlen!=6) {return false;}
	entry=entry.toUpperCase();    // in case of lowercase characters
	// Check for legal characters in string - note index starts at zero
	if('GHJ'.indexOf(entry.charAt(0))<0) {return false;}
	if('0123456789'.indexOf(entry.charAt(1))<0) {return false;}
	if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(entry.charAt(2))<0) {return false;}
	if('0123456789'.indexOf(entry.charAt(3))<0) {return false;}
	if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(entry.charAt(4))<0) {return false;}
	if('0123456789'.indexOf(entry.charAt(5))<0) {return false;}
	return true;
}
//-->
