<!--
// INDEX DES CHAMPS
//"Nom Agence;Agence;Samedi matin;GAB;Western Union;Adresse 1;Adresse 2;Cpost;Ville;Tel;Fax",
var NOM_AGENCE 	 = 0 ;
var ADRESSE 	 = 1 ;
var VILLE 	 = 2 ;
var CODE_POST	 = 3 ;
var TEL		 = 4 ;
var FAX 	 = 5 ;

tabIndex = new Array();
DATA_AGENCES = new Array();
DATA_AGENCES = AGENCES_BPLG ;
function affiche_resultat(deb){
	
	var nbAff = 3 ;
	var hostlien = document.location.host.toString().toLowerCase() ;
	var loc = 'http://' + document.location.host + '/fr/aboutus/' ;
	var nbPage = Math.ceil(tabIndex.length / nbAff) ;
	var Page = (deb / nbAff) + 1 ;
	var libS = (tabIndex.length > 1) ? 's' : '' ;
	var libsearch = tabIndex.length+' agence' + libS + '<br/>BNP Paribas Lease Group';
	
	var ifBTDI = false ;
	
	//document.formulaire.up.focus(); // haut de page -   parent.fpg.up.focus(); 	
	
	var out = '' ;
	out += '<html><head>'
	out += ' <title>BPLG : Nos agences</title>'
	out += '<link href="css.css" rel="stylesheet" type="text/css">';
	out += '</head><body>';
		
	if (tabIndex.length == 0){	
		out += '<BR>Aucune agence ne correspond à vos critères.<BR><a class="textecoloroutil" href="javascript:parent.window.All_Agences();">Toutes les agences de la ville</A><br>';
	} else {
		out += "<SPAN class=\"txtNormal\" >"+ libsearch + "</SPAN><BR><BR>" ; 	
	}
	//out += ((nbPage > 1) ? '     page ' + Page + '/' + nbPage + '' : '') + '<BR>';			

	// PARTIE PAGINATION
	if(nbPage > 1){
		// PARTIE PAGINATION
		out += '<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class=\"txtPetit\"><tr><td width="20">';	
		out += (Page > 1) ? '<a href="javascript:parent.window.affiche_resultat('+ (deb - nbAff) +')" onMouseOver="window.status=\'\';return(true);"><img src="'+ loc +'/images/bt_precedent.gif" alt="Pr&eacute;c&eacute;dent" width="16" height="9" border="0" /></a>' : '&nbsp;' ;
		out += '</td><td valign="top"  align="center">&nbsp;';
		//out += (nbPage > 1) ? 'page ' + Page + '/' + nbPage : '&nbsp;' ;
		out += '</td><td width="20" align="right">';
		out += (Page < nbPage) ? '<a href="javascript:parent.window.affiche_resultat('+ (deb+nbAff) +')" onMouseOver="window.status=\'\';return(true);" ><img src="'+ loc +'/images/bt_suivant.gif" alt="Suivant" width="16" height="9" border="0" /></a>' : '&nbsp;' ;
		out += '</td></tr></table>';
	}


	for (var i = deb ; i < (deb + nbAff) ; i++){
		
		if ( i < tabIndex.length ){
			/* debut boucle */
			
			var data = DATA_AGENCES[tabIndex[i]].split(";") ;
			
			if( data[NOM_AGENCE].trim().indexOf("*") != -1 && !ifBTDI)ifBTDI = true ; // Test si AGENCE BTDI
		 	out += "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"txtNormal\">\n";
		        out += "<tr>\n";
		        out += "<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
			out += "<tr>\n";
			out += "<td class=\"txtNormal\"><nobr><strong>"+data[NOM_AGENCE].trim()+"</strong>&nbsp;&nbsp;</nobr></td>\n";
		        out += "<td width=\"100%\" background=\""+loc+"/images/fond_nom_agence.gif\"></td>\n";
			out += "</tr></table></td></tr><tr>\n";
			out += "<td>"+data[ADRESSE].trim()+"</td>\n";
			out += "</tr><tr>\n";
		        out += "<td>"+data[CODE_POST].trim()+" "+data[VILLE].trim()+"</td>\n";
			out += "</tr><tr>\n";
			out += "<td height=\"10\"></td>\n";
			out += "</tr><tr>\n";
			out += "<td>Tél. : "+data[TEL].trim()+"</td>\n";
			out += "</tr><tr>\n";
			out += "<td>Fax : "+data[FAX].trim()+"</td>\n";
			out += "</tr><tr><td>&nbsp;</td></tr></table>";		        		        
			
			/* fin boucle */
			
		}
	}

	if(ifBTDI){
		out += "<span class=\"txtNormal\">* BTIC : Agence spécialisée dans la bureautique, la téléphonie et la distribution informatique.</span><br/><br/>" ;
	}
	// PARTIE PAGINATION
	if(nbPage > 1){
		// PARTIE PAGINATION
		out += '<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class=\"txtPetit\"><tr><td width="20">';	
		out += (Page > 1) ? '<a href="javascript:parent.window.affiche_resultat('+ (deb - nbAff) +')" onMouseOver="window.status=\'\';return(true);"><img src="'+ loc +'images/bt_precedent.gif" alt="Pr&eacute;c&eacute;dent" width="16" height="9" border="0" /></a>' : '&nbsp;' ;
		out += '</td><td valign="top"  align="center">';
		out += (nbPage > 1) ? 'page ' + Page + '/' + nbPage : '&nbsp;' ;
		out += '</td><td width="20" align="right">';
		out += (Page < nbPage) ? '<a href="javascript:parent.window.affiche_resultat('+ (deb+nbAff) +')" onMouseOver="window.status=\'\';return(true);" ><img src="'+ loc +'images/bt_suivant.gif" alt="Suivant" width="16" height="9" border="0" /></a>' : '&nbsp;' ;
		out += '</td></tr></table>';
	}


	// PARTIE IFRAME DISCLAMER
	out += '</body></html>';	

	return out ;	
}


var rVille = "" ;
var agence_ville = false ;
var btdi = false ;
var theMask ;

function recherche_agences(theForm){
		
	// Données du formulaire de recherche
	theMask = theForm ;
	rVille = theForm.rVille.value ; //theForm.ville.options[rVilleInd].value ;
	
	resultats.document.close();
	var out = '' ;
	var nbResultat = 0 ;		
	tabIndex = new Array();
	rVille = rVille.trim().toUpperCase() ;
	
	for (var i = 0 ; i < DATA_AGENCES.length - 1; i++){			
		var data = DATA_AGENCES[i].split(";") ;
		var found = false ;
		
		if ( data[NOM_AGENCE].toUpperCase().indexOf(rVille) != -1 || agence_ville ){
			if(!btdi ||  btdi && (data[NOM_AGENCE].indexOf("BTDI") != -1) ) found = true ;
		}
		
		if (found){
			tabIndex[nbResultat] = i ;
			nbResultat++ ;
		}
	}
	//alert(nbResultat);
	out = affiche_resultat(0);

	
	resultats.document.write(out);

	return false ;
}

function mapSelect(ville){
	
	
	for ( var i = 1 ; i < document.formulaire.ville.length ; i++){
		if ( document.formulaire.ville.options[i].value.indexOf(ville.toUpperCase()) != -1){
		document.formulaire.ville.options[i].selected = true ;
		break;
		}
	}
	
	
	btdi = false ;
	if(ville == "BTDI"){
		btdi = true ;
		document.formulaire.rVille.value = "" ;
	}	
	else
	document.formulaire.rVille.value = ville ;
	recherche_agences(document.formulaire);
}

function All_Agences() {
	var theMask = document.formulaire ;
	theMask.agence_ville.checked = true ; // boolean
	theMask.btdi.checked = true ; // boolean
	recherche_agences(theMask);	
}

// trim 
String.prototype.trim = function(){ 
    return this.replace(/(^\s*)|(\s*$)/g, ""); 
}
/*
String.prototype.trim2 = function(){ 
    if( this.search(/[-]/) != -1)return this.replace(/[-]/g, "-&nbsp;"); 
    return this.replace(/[" "]/g, "&nbsp;"); 
}
*/


function imprimAgence(){
	window.resultats.focus();
if (window.print)window.print();
else alert("Pour imprimer avec votre navigateur, \ncliquer sur le menu Fichier / Imprimer.");
}
function GetParameter(Nom){
var param= unescape(document.location.search.substring(1));
if (!param.length) return('');
var P = param.split("&");
var PName= new Array();
var PValue= new Array();
for(i=0;i<P.length;i++){
PName[i]=P[i].substring(0,P[i].indexOf("="));
PValue[i]=P[i].substring(P[i].indexOf("=")+1);
}
var resultat=false;
for(i=0;i<PName.length;i++){
	if(PName[i].toLowerCase()==Nom.toLowerCase())return (unescape(PValue[i]));                   
	}
return('');
}
function InitSearch(theForm) {
	
if (DATA_AGENCES.length > 0)
{
	var indList = 1 ;
	//theForm.ville.options[1] = new Option("Agences BTDI", "BTDI");
	for (var i = 0 ; i < DATA_AGENCES.length-1 ; i++){
		var data = DATA_AGENCES[i].split(";") ;
		//if ( data[NOM_AGENCE].indexOf("BTDI") == -1 ){
		//if ( theForm.ville.options[indList-1].value.indexOf(data[NOM_AGENCE]) != -1 ){		
		theForm.ville.options[indList] = new Option(data[NOM_AGENCE], data[NOM_AGENCE]);
		indList++;
		//}
		
	}
}
	
	
var Iville = GetParameter('Ville') ;
theForm.rVille.value = Iville ;
var found = false ;
if (Iville.length)mapSelect(Iville);

}
//-->