








     
		
		
     

     
		
		
     

     
		
		
     

     
		
		
     

     
		
		
     

     
		
		
     

     
		
		
     


// JavaScript Document
//SuckerTree Horizontal Menu (Sept 14th, 06)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

var menuids=["nav"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_horizontal(){
for (var i=0; i<menuids.length; i++){
var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul");
for (var t=0; t<ultags.length; t++){
if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
//	ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px"; //dynamically position first level submenus to be height of main menu item
//ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon";
}
else{ //else if this is a sub level menu (ul)
var niveauMenu = ultags[t].className;
var positionAUtiliser = 0;
// We gotta check not only the previous ul, but the previous UL that's a level under it;
for (var z=t-1; z >= 0; z--)
{
if (ultags[z].className < niveauMenu)
{
positionAUtiliser = z;
break;
}
}
ultags[t].style.left=ultags[positionAUtiliser].getElementsByTagName("a")[0].offsetWidth+"px"; //position menu to the right of menu item that activated it
// Pas besoin changer la classe pour les flèches pour là...
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon";
}
ultags[t].parentNode.onmouseover=function(){
this.getElementsByTagName("ul")[0].style.visibility="visible";
}
	
ultags[t].parentNode.onmouseout=function(){
this.getElementsByTagName("ul")[0].style.visibility="hidden";
}
	
}
}
}



function PopulerJours(mois, jour, annee)
{
var vieuxJourSelectionne = jour.selectedIndex;

nbOptions = jour.length;
for (i=0; i < nbOptions; i++)
jour[0] = null;

var nbJours = 0;

switch (mois)
{
case '01' :
nbJours = 31;
break; 
case '02' :
if ((annee % 4) == 0)
if (((annee % 100) == 0) && ((annee % 400) == 0))
nbJours = 29;
else 
if ((annee % 100) == 0)
nbJours = 28;
else
nbJours = 29;
else
nbJours = 28;
break; 
case '03' :
nbJours = 31;
break; 
case '04' :
nbJours = 30;
break; 
case '05' :
nbJours = 31;
break; 
case '06' :
nbJours = 30;
break; 
case '07' :
nbJours = 31;
break; 
case '08' :
nbJours = 31;
break; 
case '09' :
nbJours = 30;
break; 
case '10' :
nbJours = 31;
break; 
case '11' :
nbJours = 30;
break; 
case '12' :
nbJours = 31;
break; 
default : 
nbJours = 31;
break;
}

var i = 1;
while (i <= nbJours)
{
if (i < 10)
nouvelleOption = new Option('0' + i, '0' + i);
else
nouvelleOption = new Option(i, i);

jour.options[(i - 1)] = nouvelleOption;
i++;
}

if (vieuxJourSelectionne >= jour.length)
jour[(jour.length - 1)].selected = true;
else 
jour[vieuxJourSelectionne].selected = true;
champsDateHidden = document.getElementById(jour.name.replace('jourDate', 'date'));
champsDateMois = document.getElementById(jour.name.replace('jourDate', 'moisDate'));
champsDateAnnee = document.getElementById(jour.name.replace('jourDate', 'anneeDate'));
champsDateHidden.value =champsDateAnnee[champsDateAnnee.selectedIndex].value + "-" + champsDateMois[champsDateMois.selectedIndex].value + "-" + jour[jour.selectedIndex].value;
}


function InitialisationFormulaire(p_formulaire)
{
formulaireAUtiliser = eval(p_formulaire);
// On vérifie si on doit enlever les classes erreurs qu'il y a eu...
for(var h=0; h < formulaireAUtiliser.elements.length; h++)
{
if(formulaireAUtiliser.elements[h].className.indexOf("erreur") != -1)
{
var classe = formulaireAUtiliser.elements[h].className;
var classeAvantErreur = classe.substring(7);
formulaireAUtiliser.elements[h].className = classeAvantErreur;
}
}
}
function ViderArray(arrayAVider)
{
nbOptions = arrayAVider.length;
for (i=0; i < nbOptions; i++)
arrayAVider[0] = null;
}

//Prototype pour fonction indexOf
if (!Array.prototype.indexOf) {
	Array.prototype.indexOf = function(val, fromIndex) {
if (typeof(fromIndex) != 'number') fromIndex = 0;
for (var index = fromIndex,len = this.length; index < len; index++)
if (this[index] == val) return index;
return -1;
	}
}


function ValiderChampsObligatoires(p_formulaire,p_listeChamps)
{
ViderArray(tableauErreurObligatoire);
ViderArray(tableauErreurOptionnel);
texteErreur = "";

for (i = 0; i < p_listeChamps.length; i++)
{
if (p_listeChamps[i].obligatoire)
{
switch (p_listeChamps[i].typeDeChamp)
{
case 'texte' : 
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.trim();
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length == 0)
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
} 
break;
case 'texteAutre' : 
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.trim();
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length == 0)
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
} 
break;
case 'memo' : 
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.trim();
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length == 0)
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
} 
break;
case 'select' : 
selectionneQuelqueChose = -1;
for (indexDropListe = 0; indexDropListe < eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length; indexDropListe++)
{
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexDropListe + '].selected') == true)
{
selectionneQuelqueChose = indexDropListe;
break;
} 
} 
if(selectionneQuelqueChose < 0)
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
}
else if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + selectionneQuelqueChose + '].value.length') == 0)
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
}
break;
case 'radio' : 
if (typeof(eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length) == 'undefined')
{
if (!eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).checked)
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
}
}
else
{
cocheQuelqueChose = false;
for (indexRadio = 0; indexRadio < eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length; indexRadio++)
{
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexRadio + '].checked') == true)
{
cocheQuelqueChose = true;
break;
}
}
if(!cocheQuelqueChose)
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
}
}
break;
case 'checkbox' : 
if (typeof(eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length) == 'undefined')
{
if (!eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).checked)
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
}
}
else
{
cocheQuelqueChose = false;
for (indexCheckbox = 0; indexCheckbox < eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length; indexCheckbox++)
{
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexCheckbox + ']').checked)
{
cocheQuelqueChose = true;
break;
}
}
if(!cocheQuelqueChose)
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
}
}
break;
case 'consoleWord' : 
tempMCEControl = tinyMCE.getInstanceById(p_listeChamps[i].nomDuChamp);
if ((tempMCEControl) && (tempMCEControl.getBody().innerHTML == ''))
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
} 
break;
case 'fichier' : 
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length == 0)
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
}
break;
case 'image' : 
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length == 0)
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
}
break;
case 'div' : 
if (eval(p_listeChamps[i].nomDuChamp).innerHTML == '')
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
}
break;
case 'date' : 
dropListeJour = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('date', 'jourDate'));
dropListeMois = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('date', 'moisDate'));
dropListeAnnee = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('date', 'anneeDate'));
if ((dropListeJour.selectedIndex < 0) || (dropListeJour[dropListeJour.selectedIndex].value == '') || (dropListeMois.selectedIndex < 0) || (dropListeMois[dropListeMois.selectedIndex].value == '') || (dropListeAnnee.selectedIndex < 0) || (dropListeAnnee[dropListeAnnee.selectedIndex].value == ''))
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
}
break;
case 'googleMaps' : 
if ((eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('map', 'latitude')).value == 0) || (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('map', 'longitude')).value == 0))
{
tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
} 
break;
default : 
break;
}
}
}
}

function AfficherErreur(p_formulaire, p_tableauErreurObligatoire, p_tableauErreurOptionnel, p_langue)
{
var objEstEnvoye = eval(p_formulaire + '.estEnvoye')
var texteErreur = "";
var champsFocus = "";
var lblAUtiliser = "";

// Création des messages d'erreur et affichage
if(p_tableauErreurObligatoire.length > 0)
if (p_langue.indexOf('ang') == -1)
texteErreur = "Les champs suivants sont obligatoires :\n\n";
else
texteErreur = "The following fields are required:\n\n";

if(p_tableauErreurObligatoire.length != 0)
{
for(var k=0; k < p_tableauErreurObligatoire.length; k++)
{
lblAUtiliser = document.getElementById('lbl_' + p_tableauErreurObligatoire[k].nomDuChamp).innerHTML;
// Validation pour tous les types de champs
switch (p_tableauErreurObligatoire[k].typeDeChamp)
{
case 'radio' : 
if(lblAUtiliser.indexOf(" :") == -1){
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length) + "\n";
}else{
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
}
position = 0;
while (typeof(eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp + '[' + position + ']')) != 'undefined')
{
obj = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp + '[' + position + ']');
var classe = obj.className; 
obj.className = "erreur " + classe;
position += 1;
}
break;
case 'checkbox' : 
if(lblAUtiliser.indexOf(" :") == -1){
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length) + "\n";
}else{
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
}
position = 0;
while (typeof(eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp + '[' + position + ']')) != 'undefined')
{
obj = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp + '[' + position + ']');
var classe = obj.className; 
obj.className = "erreur " + classe;
position += 1;
}
break;
case 'image' : 
if(lblAUtiliser.indexOf(" :") == -1){
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length) + "\n";
}else{
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
}
break;
case 'fichier' : 
if(lblAUtiliser.indexOf(" :") == -1){
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length) + "\n";
}else{
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
}
break;
case 'consoleWord' : 
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
tempMCEControl = tinyMCE.getInstanceById(p_tableauErreurObligatoire[k].nomDuChamp);
if (tempMCEControl)
{
if(champsFocus == "")
champsFocus = tempMCEControl.contentWindow;
obj = tempMCEControl.getBody();
var classe = obj.className; 
if(obj.className.indexOf("erreur") == -1) 
obj.className = "erreur " + classe;
}
break;
case 'date' : 
if(champsFocus == "")
champsFocus = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp.replace('date', 'jourDate'));
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
obj = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp.replace('date', 'jourDate'));
var classe = obj.className;
if(obj.className.indexOf("erreur") == -1)
obj.className = "erreur " + classe;
obj = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp.replace('date', 'moisDate'));
var classe = obj.className;
if(obj.className.indexOf("erreur") == -1)
obj.className = "erreur " + classe;
obj = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp.replace('date', 'anneeDate'));
var classe = obj.className;
if(obj.className.indexOf("erreur") == -1)
obj.className = "erreur " + classe;
break;
case 'googleMaps' : 
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
break;
default : 
if(champsFocus == "")
champsFocus = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp);
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
obj = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp);
var classe = obj.className;
if(obj.className.indexOf("erreur") == -1)
obj.className = "erreur " + classe;
break;
}
}
}

if(p_tableauErreurOptionnel.length > 0)
if (p_langue.indexOf('ang') == -1)
texteErreur += "\nLe(s) champ(s) suivant(s) comporte(nt) des erreurs :\n\n";
else
texteErreur += "\nThe following field(s) contain invalid data:\n\n";

for(var m=0; m < p_tableauErreurOptionnel.length; m++)
{
var sectionGauche = p_tableauErreurOptionnel[m].substring(0,p_tableauErreurOptionnel[m].indexOf(' :\n'));
//Validation pour les champs qui sont pas des champs autres...
if(sectionGauche.indexOf('Autre') == -1)
{
if(champsFocus == "")
{
champsFocus = eval(p_formulaire + '.' + sectionGauche);
}
lblAUtiliser = document.getElementById('lbl_' + sectionGauche).innerHTML;
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2);
}
//Validation pour les champs autres, car ils n'ont pas de label
else
{
lblAUtiliser = document.getElementById('lbl_' + sectionGauche.substring(0, sectionGauche.length - 5)).innerHTML;
texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2);
if(champsFocus == "")
champsFocus = eval(p_formulaire + '.' + sectionGauche); 
}
texteErreur +=p_tableauErreurOptionnel[m].substring(p_tableauErreurOptionnel[m].indexOf(':'),p_tableauErreurOptionnel[m].length) + "\n\n";
obj = eval(p_formulaire + '.' + sectionGauche);
var Classe = obj.className; 
if(obj.className.indexOf("erreur") == -1)
obj.className = "erreur " + Classe;

}
if(texteErreur != "")
{
alert(texteErreur);
if(champsFocus != "")
{
if (typeof(champsFocus[0]) == 'undefined')
champsFocus.focus();
else 
champsFocus[0].focus();
}
return true;
}

objEstEnvoye.value = 1;
return false;
}

function AfficherFormulaire(p_formulaire,p_listeChamps) 
{
eval(p_formulaire + '.estEnvoye').value = 0;
for (var i = 0; i < p_listeChamps.length; i++)
{
// On set les labels obligatoires...
lblAUtiliser = document.getElementById('lbl_' + p_listeChamps[i].nomDuChamp);
if ((lblAUtiliser) && (p_listeChamps[i].obligatoire))
{
lblAUtiliser.className = lblAUtiliser.className + ' obl';
}
// On set les valeurs par défaut...
switch (p_listeChamps[i].typeDeChamp)
{
case 'hidden' : 
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = p_listeChamps[i].valeurParDefaut;
break;
case 'texte' : 
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = p_listeChamps[i].valeurParDefaut;
break;
case 'radio' : 
if (typeof(eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length) == 'undefined')
{
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value == p_listeChamps[i].valeurParDefaut)
{
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).checked = true;
}
}
else
{
for (indexRadio = 0; indexRadio < eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length; indexRadio++)
{
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexRadio + ']').value == p_listeChamps[i].valeurParDefaut)
{
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexRadio + ']').checked = true;
}
}
}
break;
case 'checkbox' : 
if (typeof(eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length) == 'undefined')
{
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value == p_listeChamps[i].valeurParDefaut)
{
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).checked = true;
}
}
else
{
for (indexCheckbox = 0; indexCheckbox < eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length; indexCheckbox++)
{
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexCheckbox + ']').value == p_listeChamps[i].valeurParDefaut)
{
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexCheckbox + ']').checked = true;
}
}
}
break;
case 'select' : 
for (indexSelect = 0; indexSelect < eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length; indexSelect++)
{
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexSelect + ']').value == p_listeChamps[i].valeurParDefaut)
{
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexSelect + ']').selected = true;
}
}
break;
case 'memo' : 
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = p_listeChamps[i].valeurParDefaut;
break;
case 'consoleWord' : 
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = p_listeChamps[i].valeurParDefaut;
break;
case 'fichier' : 
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = p_listeChamps[i].valeurParDefaut;
layerDuMessage = document.getElementById(p_listeChamps[i].nomDuChamp + 'Message');
layerDuMessage.innerHTML = '';
break;
case 'image' : 
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = p_listeChamps[i].valeurParDefaut;
if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length > 0)
{
layerDuMessage = document.getElementById(p_listeChamps[i].nomDuChamp + 'Message');
layerDuMessage.innerHTML = '';
eval('document[\'' + p_listeChamps[i].nomDuChamp + 'Preview\']').src = adresseSiteInternet + 'FichiersUpload/' + dossierFichiers + '/' + p_listeChamps[i].valeurParDefaut;
}
else
{
layerDuMessage = document.getElementById(p_listeChamps[i].nomDuChamp + 'Message');
layerDuMessage.innerHTML = '';
eval('document[\'' + p_listeChamps[i].nomDuChamp + 'Preview\']').src = adresseSiteInternet + 'Images/Formulaires/transparent.gif';
}
break;
case 'div' : 
layerDuDiv = document.getElementById(listeChamps[i].nomDuChamp);
layerDuDiv.innerHTML = p_listeChamps[i].valeurParDefaut;
break;
case 'date' : 
dropListeJour = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('date', 'jourDate'));
dropListeMois = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('date', 'moisDate'));
dropListeAnnee = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('date', 'anneeDate'));
tempValeurDate = p_listeChamps[i].valeurParDefaut;
valeurAnnee = tempValeurDate.substring(0, tempValeurDate.indexOf('-'));
tempValeurDate = tempValeurDate.substring(tempValeurDate.indexOf('-')+1, tempValeurDate.length);
valeurMois = tempValeurDate.substring(0, tempValeurDate.indexOf('-'));
tempValeurDate = tempValeurDate.substring(tempValeurDate.indexOf('-')+1, tempValeurDate.length);
valeurJour = tempValeurDate.substring(0, tempValeurDate.length);
for (indexSelectJour = 0; indexSelectJour < dropListeJour.length; indexSelectJour++)
{
if (dropListeJour[indexSelectJour].value == valeurJour)
{
dropListeJour[indexSelectJour].selected = true;
}
}
for (indexSelectMois = 0; indexSelectMois < dropListeMois.length; indexSelectMois++)
{
if (dropListeMois[indexSelectMois].value == valeurMois)
{
dropListeMois[indexSelectMois].selected = true;
}
}
for (indexSelectAnnee = 0; indexSelectAnnee < dropListeAnnee.length; indexSelectAnnee++)
{
if (dropListeAnnee[indexSelectAnnee].value == valeurAnnee)
{
dropListeAnnee[indexSelectAnnee].selected = true;
}
}
break;
case 'googleMaps' : 
tableauLatLong = p_listeChamps[i].valeurParDefaut.split(',')
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('map', 'latitude')).value = tableauLatLong[0];
eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('map', 'longitude')).value = tableauLatLong[1];
if ((eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('map', 'latitude')).value != 0) || (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('map', 'longitude')).value != 0))
{
if (GBrowserIsCompatible()) 
{
var latlng = new GLatLng(eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('map', 'latitude')).value, eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp.replace('map', 'longitude')).value);
marker = createMarker(latlng);
mapGoogleMaps.addOverlay(marker);
mapGoogleMaps.setCenter(latlng, 5);
ChangerLatLong(marker);
}
} 
break;
default : 
break;
}
}
// On affiche le formulaire vu qu'il est caché...
eval(p_formulaire).style.visibility = 'visible'; 
eval(p_formulaire).style.display= 'block';
}

function structureChamps(p_typeDeChamp, p_nomDuChamp, p_valeurParDefaut, p_obligatoire) 
{
this.typeDeChamp = p_typeDeChamp;
this.nomDuChamp = p_nomDuChamp;
this.valeurParDefaut = p_valeurParDefaut;
this.obligatoire = p_obligatoire;
}

//Valider Code Postal
function ValiderCodePostal(valeur,pays,langue)
{
 if(valeur != ""){
if(pays == "Canada"){
valeur = valeur.replace(' ','');
valeur = valeur.replace('-','');
valeur = valeur.toUpperCase();
var oRegExp = /^[^DFIOQUWZ0-9][0-9][^DFIOQU0-9][0-9][^DFIOQU0-9][0-9]$/;
if (!oRegExp.test(valeur)){
if(langue == '_ang'){
return "You must enter a valid postal code (X9X 9X9)";
}else{
return "Veuillez entrer un code postal valide (X9X 9X9)";
}
}else if(pays == "United States"){
if(langue == '_ang'){
var msgErreur = "You must enter a valid zip code (99999)";
	}else{
var msgErreur = "Veuillez entrer un code postal valide (99999)";
	}
zipcode = valeur.replace(' ','');
if (!(zipcode.length == 5 || zipcode.length == 9 || zipcode.length == 10)) return msgErreur;
if ((zipcode.length == 5 || zipcode.length == 9) && isNaN(zipcode)) return msgErreur;
if (zipcode.length == 10 && zipcode.search && zipcode.search(/^\d{5}-\d{4}$/) == -1) return msgErreur;
}
}
 } 
 return true;
}

 
function DatePickerCallBack(p_dateASelectionner, p_champsDate)
{
var nomChampsDate = p_champsDate.id;
dropListeJour = document.getElementById(nomChampsDate.replace('date', 'jourDate'));
dropListeMois = document.getElementById(nomChampsDate.replace('date', 'moisDate'));
dropListeAnnee = document.getElementById(nomChampsDate.replace('date', 'anneeDate'));
tempValeurDate = p_dateASelectionner;
valeurAnnee = tempValeurDate.substring(0, tempValeurDate.indexOf('-'));
tempValeurDate = tempValeurDate.substring(tempValeurDate.indexOf('-')+1, tempValeurDate.length);
valeurMois = tempValeurDate.substring(0, tempValeurDate.indexOf('-'));
tempValeurDate = tempValeurDate.substring(tempValeurDate.indexOf('-')+1, tempValeurDate.length);
valeurJour = tempValeurDate.substring(0, tempValeurDate.length);
for (indexSelectJour = 0; indexSelectJour < dropListeJour.length; indexSelectJour++)
{
if (dropListeJour[indexSelectJour].value == valeurJour)
{
dropListeJour[indexSelectJour].selected = true;
break;
}
}
for (indexSelectMois = 0; indexSelectMois < dropListeMois.length; indexSelectMois++)
{
if (dropListeMois[indexSelectMois].value == valeurMois)
{
dropListeMois[indexSelectMois].selected = true;
break;
}
}
for (indexSelectAnnee = 0; indexSelectAnnee < dropListeAnnee.length; indexSelectAnnee++)
{
if (dropListeAnnee[indexSelectAnnee].value == valeurAnnee)
{
dropListeAnnee[indexSelectAnnee].selected = true;
break;
}
}
PopulerJours(dropListeMois[dropListeMois.selectedIndex].value, dropListeJour, dropListeAnnee[dropListeAnnee.selectedIndex].value);
}

	

String.prototype.trim = function() {
temp = escape(this);
while ((temp.indexOf('%BB') > -1) || (temp.indexOf('%AB') > -1) || (temp.indexOf('%u2018') > -1) || (temp.indexOf('%u2019') > -1))
{ 
temp = temp.replace(/%BB/, "'");
temp = temp.replace(/%AB/, "'");
temp = temp.replace(/%u2018/, "'");
temp = temp.replace(/%u2019/, "'");
}
temp = unescape(temp); 
return temp.replace(/^\s*/,"").replace(/\s*$/,"").replace("’","'").replace("–","-");
}

function OuvrirFenetre(page, largeur, hauteur, scrollBars)
{
if (typeof(scrollBars) == 'undefined')
scrollBars = true;
if (scrollBars)
WindowFenetre = open(page, 'WindowFenetre', 'resizable=no,scrollbars=yes,status=yes,menubar=no,' + StringGrandeur(largeur,hauteur));
else
WindowFenetre = open(page, 'WindowFenetre', 'resizable=no,scrollbars=no,status=yes,menubar=no,' + StringGrandeur(largeur,hauteur));
WindowFenetre.focus();
}

function StringGrandeur (width, height)
{
var string = 'width=' + width + ',height=' + height + ',left=' + ((screen.width - width) / 2) + ',top=' + ((screen.height - height) / 2) + ',screenX=' + ((screen.width - width) / 2) + ',screenY=' + ((screen.height - height) / 2);
return string;
}

function ValiderCourriel(valeur, langue)
{
var stringErreur = '';
var nAccepte = 'abcdefghijklmnopqrstuvwxyz0123456789-_.@';
var nChar;
valeur = valeur.toLowerCase();
valeur = valeur.trim();
var indexOfArobas= valeur.indexOf('@');
var indexOf2Arobas= valeur.lastIndexOf('@');
var lastIndexOfPoint= valeur.lastIndexOf('.');
var indexOf2Point= valeur.indexOf('..');
var valeurLength= valeur.length;
var indexOfEspace= valeur.indexOf(' ');

if (indexOfEspace!= -1)
if (langue == '_ang')
stringErreur = 'Your e-mail must not contain any spaces.';
else
stringErreur = 'Votre courriel doit pas contenir d\'espace.';
if (indexOfArobas< 0)
if (langue == '_ang')
stringErreur = 'Your e-mail must contain an @ character.';
else
stringErreur = 'Votre courriel doit contenir un arobas (@).';
if (indexOfArobas== 0)
if (langue == '_ang')
stringErreur = 'Your e-mail must have at least one character in front of the @ character.';
else
stringErreur = 'Votre courriel doit avoir un minimum d\'un caractère avant l\'arobas (@).';
if (lastIndexOfPoint< (indexOfArobas + 1))
if (langue == '_ang')
stringErreur = 'Your e-mail must contain at least one dot (.) after the @ character.';
else
stringErreur = 'Votre courriel doit contenir au moins un point (.) après l\'arobas (@).';
if (lastIndexOfPoint== valeurLength-1)
if (langue == '_ang')
stringErreur = 'Your e-mail must not end with a dot (.).';
else
stringErreur = 'Votre courriel ne peut se terminer par un point (.).';
if (indexOf2Arobas!= indexOfArobas)
if (langue == '_ang')
stringErreur = 'Your e-mail must only have one @ character.';
else
stringErreur = 'Votre courriel doit contenir seulement un arobas (@).';
if (indexOf2Point!= -1)
if (langue == '_ang')
stringErreur = 'Your e-mail cannot have two dots (..) in a row.';
else
stringErreur = 'Votre courriel ne peut pas contenir 2 points de suite (..).';
if (stringErreur == '')
{
for (var i=0; i<valeur.length; i++)
{
nChar = '' + valeur.substring(i, i+1).toLowerCase();
if (nAccepte.indexOf(nChar) == -1){
if (langue == '_ang')
stringErreur = 'Your e-mail contains the (' + valeur.substring(i, i+1) + ') which is not a valid character for an e-mail.';
else
stringErreur = 'Votre courriel contient le caractère (' + valeur.substring(i, i+1) + ') qui n\'est pas un caractère valide dans un courriel.';
i = valeur.length;
}
}
}
if (stringErreur == '')
return true;
else
{
if (langue == '_ang')
return (stringErreur + '\nHere is an example of a valid e-mail: name@domain.com');
else
return (stringErreur + '\nVoici l\'exemple d\'un courriel valide : nom@domaine.com');
}
}

function CompterCar(obj,nbCharMax,langue){
var nb = $(obj).val().trim().length;
if (nb > nbCharMax)
{
$(obj).val($(obj).val().trim().substring(0,nbCharMax));
nb = nbCharMax;
if (langue == "_ang")
alert("Your message has exceeded the maximum length for sending a page and has been automatically truncated to "+nbCharMax+" characters.");
else
alert("Votre message dépasse le nombre de caractères permis et a été réduit à "+nbCharMax+" caractères."); 
}
$(obj).next("div").text(nb + ' / ' + nbCharMax + ' caractères maximum');
}

function Antispam(tableau1, tableau2, subject){
var courriel = ""; 
var texte= "";
for (i=0;i<tableau1.length;i++)
courriel+=String.fromCharCode(tableau1[i])
if (typeof(tableau2) != 'undefined'){
if (tableau2.length > 0){
for (i=0;i<tableau2.length;i++)
texte+=String.fromCharCode(tableau2[i])
}
else
texte = courriel;
}
else
texte = courriel;
if ((typeof(tableau2) == 'undefined') || (typeof(subject) == 'undefined'))
subject = "";

tableauTexte = texte.split("@");
if (tableauTexte.length == 2){
texte = tableauTexte[0] + '<span style="display:none;">REMOVE-THIS-FOR-SPAM</span>&#64;' + tableauTexte[1];
}
document.write('<a href="mailto:a" onclick="this.href = AntiSpamClic(Array(' + tableau1 + '),\'' + subject + '\');">' + texte + '</a>');
 }

function AntiSpamClic(tableau1, subject){ 
var courriel = ""; 
for (i=0;i<tableau1.length;i++)
courriel+=String.fromCharCode(tableau1[i]);
if (subject.length > 0)
courriel+= '?subject=' + subject;
else if (courriel.indexOf('?subject=') == -1 )
courriel+= '?subject=' + 'Demande via ' + window.location.hostname;
return 'mai' + 'lto:' + courriel; 
 }



jQuery(function($){var userAgent=navigator.userAgent.toLowerCase();var browserVersion=(userAgent.match(/.+(?:rv|webkit|khtml|opera|msie)[\/: ]([\d.]+)/)||[0,'0'])[1];var isIE6=(/msie/.test(userAgent)&&!/opera/.test(userAgent)&&parseInt(browserVersion)<7&&(!window.XMLHttpRequest||typeof(XMLHttpRequest)==='function'));var body=$('body');var currentSettings;var callingSettings;var shouldResize=false;var gallery={};var fixFF=false;var contentElt;var contentEltLast;var modal={started:false,ready:false,dataReady:false,anim:false,animContent:false,loadingShown:false,transition:false,resizing:false,closing:false,error:false,blocker:null,blockerVars:null,full:null,bg:null,loading:null,tmp:null,content:null,wrapper:null,contentWrapper:null,scripts:new Array(),scriptsShown:new Array()};var resized={width:false,height:false,windowResizing:false};var initSettingsSize={width:null,height:null,windowResizing:true};var windowResizeTimeout;$.fn.nyroModal=function(settings){if(!this)return false;return this.each(function(){var me=$(this);if(this.nodeName.toLowerCase()=='form'){me.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){if(e.isDefaultPrevented())return false;if(me.data('nyroModalprocessing'))return true;if(this.enctype=='multipart/form-data'){processModal($.extend(settings,{from:this}));return true}e.preventDefault();processModal($.extend(settings,{from:this}));return false})}else{me.unbind('click.nyroModal').bind('click.nyroModal',function(e){if(e.isDefaultPrevented())return false;e.preventDefault();processModal($.extend(settings,{from:this}));return false})}})};$.fn.nyroModalManual=function(settings){if(!this.length)processModal(settings);return this.each(function(){processModal($.extend(settings,{from:this}))})};$.nyroModalManual=function(settings){processModal(settings)};$.nyroModalSettings=function(settings,deep1,deep2){setCurrentSettings(settings,deep1,deep2);if(!deep1&&modal.started){if(modal.bg&&settings.bgColor)currentSettings.updateBgColor(modal,currentSettings,function(){});if(modal.contentWrapper&&settings.title)setTitle();if(!modal.error&&(settings.windowResizing||(!modal.resizing&&(('width'in settings&&settings.width==currentSettings.width)||('height'in settings&&settings.height==currentSettings.height))))){modal.resizing=true;if(modal.contentWrapper)calculateSize(true);if(modal.contentWrapper&&modal.contentWrapper.is(':visible')&&!modal.animContent){if(fixFF)modal.content.css({position:''});currentSettings.resize(modal,currentSettings,function(){currentSettings.windowResizing=false;modal.resizing=false;if(fixFF)modal.content.css({position:'fixed'});if($.isFunction(currentSettings.endResize))currentSettings.endResize(modal,currentSettings)})}}}};$.nyroModalRemove=function(){removeModal()};$.nyroModalNext=function(){var link=getGalleryLink(1);if(link)return link.nyroModalManual(getCurrentSettingsNew());return false};$.nyroModalPrev=function(){var link=getGalleryLink(-1);if(link)return link.nyroModalManual(getCurrentSettingsNew());return false};$.fn.nyroModal.settings={debug:false,blocker:false,windowResize:true,modal:false,type:'',forceType:null,from:'',hash:'',processHandler:null,selIndicator:'nyroModalSel',formIndicator:'nyroModal',content:null,bgColor:'#000000',ajax:{},swf:{wmode:'transparent'},width:null,height:null,minWidth:400,minHeight:300,resizable:true,autoSizable:true,padding:25,regexImg:'[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$',addImageDivTitle:false,defaultImgAlt:'Image',setWidthImgTitle:true,ltr:true,gallery:null,galleryLinks:'<a href="#" class="nyroModalPrev">Prev</a><a href="#"class="nyroModalNext">Next</a>',galleryCounts:galleryCounts,galleryLoop:false,zIndexStart:100,cssOpt:{bg:{position:'absolute',overflow:'hidden',top:0,left:0,height:'100%',width:'100%'},wrapper:{position:'absolute',top:'50%',left:'50%'},wrapper2:{},content:{},loading:{position:'absolute',top:'50%',left:'50%',marginTop:'-50px',marginLeft:'-50px'}},wrap:{div:'<div class="wrapper"></div>',ajax:'<div class="wrapper"></div>',form:'<div class="wrapper"></div>',formData:'<div class="wrapper"></div>',image:'<div class="wrapperImg"></div>',swf:'<div class="wrapperSwf"></div>',iframe:'<div class="wrapperIframe"></div>',iframeForm:'<div class="wrapperIframe"></div>',manual:'<div class="wrapper"></div>'},closeButton:'<a href="#" class="nyroModalClose" id="closeBut" title="close">Close</a>',title:null,titleFromIframe:true,openSelector:'.nyroModal',closeSelector:'.nyroModalClose',contentLoading:'<a href="#" class="nyroModalClose">Cancel</a>',errorClass:'error',contentError:'The requested content cannot be loaded.<br />Please try again later.<br /><a href="#" class="nyroModalClose">Close</a>',handleError:null,showBackground:showBackground,hideBackground:hideBackground,endFillContent:null,showContent:showContent,endShowContent:null,beforeHideContent:null,hideContent:hideContent,showTransition:showTransition,hideTransition:hideTransition,showLoading:showLoading,hideLoading:hideLoading,resize:resize,endResize:null,updateBgColor:updateBgColor,endRemove:null};function processModal(settings){if(modal.loadingShown||modal.transition||modal.anim)return;debug('processModal');modal.started=true;callingSettings=$.extend(true,settings);setDefaultCurrentSettings(settings);if(!modal.full)modal.blockerVars=modal.blocker=null;modal.error=false;modal.closing=false;modal.dataReady=false;modal.scripts=new Array();modal.scriptsShown=new Array();currentSettings.type=fileType();if(currentSettings.forceType){if(!currentSettings.content)currentSettings.from=true;currentSettings.type=currentSettings.forceType;currentSettings.forceType=null}if($.isFunction(currentSettings.processHandler))currentSettings.processHandler(currentSettings);var from=currentSettings.from;var url=currentSettings.url;initSettingsSize.width=currentSettings.width;initSettingsSize.height=currentSettings.height;if(currentSettings.type=='swf'){setCurrentSettings({overflow:'visible'},'cssOpt','content');currentSettings.content='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+currentSettings.width+'" height="'+currentSettings.height+'"><param name="movie" value="'+url+'"></param>';var tmp='';$.each(currentSettings.swf,function(name,val){currentSettings.content+='<param name="'+name+'" value="'+val+'"></param>';tmp+=' '+name+'="'+val+'"'});currentSettings.content+='<embed src="'+url+'" type="application/x-shockwave-flash" width="'+currentSettings.width+'" height="'+currentSettings.height+'"'+tmp+'></embed></object>'}if(from){var jFrom=$(from).blur();if(currentSettings.type=='form'){var data=$(from).serializeArray();data.push({name:currentSettings.formIndicator,value:1});if(currentSettings.selector)data.push({name:currentSettings.selIndicator,value:currentSettings.selector.substring(1)});showModal();$.ajax($.extend({},currentSettings.ajax,{url:url,data:data,type:jFrom.attr('method')?jFrom.attr('method'):'get',success:ajaxLoaded,error:loadingError}));debug('Form Ajax Load: '+jFrom.attr('action'))}else if(currentSettings.type=='formData'){initModal();jFrom.attr('target','nyroModalIframe');jFrom.attr('action',url);jFrom.prepend('<input type="hidden" name="'+currentSettings.formIndicator+'" value="1" />');if(currentSettings.selector)jFrom.prepend('<input type="hidden" name="'+currentSettings.selIndicator+'" value="'+currentSettings.selector.substring(1)+'" />');modal.tmp.html('<iframe frameborder="0" hspace="0" name="nyroModalIframe" src="javascript:\'\';"></iframe>');$('iframe',modal.tmp).css({width:currentSettings.width,height:currentSettings.height}).error(loadingError).load(formDataLoaded);debug('Form Data Load: '+jFrom.attr('action'));showModal();showContentOrLoading()}else if(currentSettings.type=='image'){debug('Image Load: '+url);var title=jFrom.attr('title')||currentSettings.defaultImgAlt;initModal();modal.tmp.html('<img id="nyroModalImg" />').find('img').attr('alt',title);modal.tmp.css({lineHeight:0});$('img',modal.tmp).error(loadingError).load(function(){debug('Image Loaded: '+this.src);$(this).unbind('load');var w=modal.tmp.width();var h=modal.tmp.height();modal.tmp.css({lineHeight:''});resized.width=w;resized.height=h;setCurrentSettings({width:w,height:h,imgWidth:w,imgHeight:h});initSettingsSize.width=w;initSettingsSize.height=h;setCurrentSettings({overflow:'visible'},'cssOpt','content');modal.dataReady=true;if(modal.loadingShown||modal.transition)showContentOrLoading()}).attr('src',url);showModal()}else if(currentSettings.type=='iframeForm'){initModal();modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Form Load: '+url);$('iframe',modal.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);modal.dataReady=true;showModal()}else if(currentSettings.type=='iframe'){initModal();modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Load: '+url);$('iframe',modal.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);modal.dataReady=true;showModal()}else if(currentSettings.type){debug('Content: '+currentSettings.type);initModal();modal.tmp.html(currentSettings.content);var w=modal.tmp.width();var h=modal.tmp.height();var div=$(currentSettings.type);if(div.length){setCurrentSettings({type:'div'});w=div.width();h=div.height();if(contentElt)contentEltLast=contentElt;contentElt=div;modal.tmp.append(div.contents())}initSettingsSize.width=w;initSettingsSize.height=h;setCurrentSettings({width:w,height:h});if(modal.tmp.html())modal.dataReady=true;else loadingError();if(!modal.ready)showModal();else endHideContent()}else{debug('Ajax Load: '+url);setCurrentSettings({type:'ajax'});var data=currentSettings.ajax.data||{};if(currentSettings.selector){if(typeof data=="string"){data+='&'+currentSettings.selIndicator+'='+currentSettings.selector.substring(1)}else{data[currentSettings.selIndicator]=currentSettings.selector.substring(1)}}showModal();$.ajax($.extend(true,currentSettings.ajax,{url:url,success:ajaxLoaded,error:loadingError,data:data}))}}else if(currentSettings.content){debug('Content: '+currentSettings.type);setCurrentSettings({type:'manual'});initModal();modal.tmp.html($('<div/>').html(currentSettings.content).contents());if(modal.tmp.html())modal.dataReady=true;else loadingError();showModal()}else{}}function setDefaultCurrentSettings(settings){debug('setDefaultCurrentSettings');currentSettings=$.extend(true,{},$.fn.nyroModal.settings,settings);setMargin()}function setCurrentSettings(settings,deep1,deep2){if(modal.started){if(deep1&&deep2){$.extend(true,currentSettings[deep1][deep2],settings)}else if(deep1){$.extend(true,currentSettings[deep1],settings)}else{if(modal.animContent){if('width'in settings){if(!modal.resizing){settings.setWidth=settings.width;shouldResize=true}delete settings['width']}if('height'in settings){if(!modal.resizing){settings.setHeight=settings.height;shouldResize=true}delete settings['height']}}$.extend(true,currentSettings,settings)}}else{if(deep1&&deep2){$.extend(true,$.fn.nyroModal.settings[deep1][deep2],settings)}else if(deep1){$.extend(true,$.fn.nyroModal.settings[deep1],settings)}else{$.extend(true,$.fn.nyroModal.settings,settings)}}}function setMarginScroll(){if(isIE6&&!modal.blocker){if(document.documentElement){currentSettings.marginScrollLeft=document.documentElement.scrollLeft;currentSettings.marginScrollTop=document.documentElement.scrollTop}else{currentSettings.marginScrollLeft=document.body.scrollLeft;currentSettings.marginScrollTop=document.body.scrollTop}}else{currentSettings.marginScrollLeft=0;currentSettings.marginScrollTop=0}}function setMargin(){setMarginScroll();currentSettings.marginLeft=-(currentSettings.width+currentSettings.borderW)/2;currentSettings.marginTop=-(currentSettings.height+currentSettings.borderH)/2;if(!modal.blocker){currentSettings.marginLeft+=currentSettings.marginScrollLeft;currentSettings.marginTop+=currentSettings.marginScrollTop}}function setMarginLoading(){setMarginScroll();var outer=getOuter(modal.loading);currentSettings.marginTopLoading=-(modal.loading.height()+outer.h.border+outer.h.padding)/2;currentSettings.marginLeftLoading=-(modal.loading.width()+outer.w.border+outer.w.padding)/2;if(!modal.blocker){currentSettings.marginLeftLoading+=currentSettings.marginScrollLeft;currentSettings.marginTopLoading+=currentSettings.marginScrollTop}}function setTitle(){var title=$('h1#nyroModalTitle',modal.contentWrapper);if(title.length)title.text(currentSettings.title);else modal.contentWrapper.prepend('<h1 id="nyroModalTitle">'+currentSettings.title+'</h1>')}function initModal(){debug('initModal');if(!modal.full){if(currentSettings.debug)setCurrentSettings({color:'white'},'cssOpt','bg');var full={zIndex:currentSettings.zIndexStart,position:'fixed',top:0,left:0,width:'100%',height:'100%'};var contain=body;var iframeHideIE='';if(currentSettings.blocker){modal.blocker=contain=$(currentSettings.blocker);var pos=modal.blocker.offset();var w=modal.blocker.outerWidth();var h=modal.blocker.outerHeight();if(isIE6){setCurrentSettings({height:'100%',width:'100%',top:0,left:0},'cssOpt','bg')}modal.blockerVars={top:pos.top,left:pos.left,width:w,height:h};var plusTop=(/msie/.test(userAgent)?0:getCurCSS(body.get(0),'borderTopWidth'));var plusLeft=(/msie/.test(userAgent)?0:getCurCSS(body.get(0),'borderLeftWidth'));full={position:'absolute',top:pos.top+plusTop,left:pos.left+plusLeft,width:w,height:h}}else if(isIE6){body.css({marginLeft:0,marginRight:0});var w=body.width();var h=$(window).height()+'px';if($(window).height()>=body.outerHeight()){h=body.outerHeight()+'px'}else w+=20;w+='px';body.css({width:w,height:h,position:'static',overflow:'hidden'});$('html').css({overflow:'hidden'});setCurrentSettings({cssOpt:{bg:{position:'absolute',zIndex:currentSettings.zIndexStart+1,height:'110%',width:'110%',top:currentSettings.marginScrollTop+'px',left:currentSettings.marginScrollLeft+'px'},wrapper:{zIndex:currentSettings.zIndexStart+2},loading:{zIndex:currentSettings.zIndexStart+3}}});iframeHideIE=$('<iframe id="nyroModalIframeHideIe" src="javascript:\'\';"></iframe>').css($.extend({},currentSettings.cssOpt.bg,{opacity:0,zIndex:50,border:'none'}))}contain.append($('<div id="nyroModalFull"><div id="nyroModalBg"></div><div id="nyroModalWrapper"><div id="nyroModalContent"></div></div><div id="nyrModalTmp"></div><div id="nyroModalLoading"></div></div>').hide());modal.full=$('#nyroModalFull').css(full).show();modal.bg=$('#nyroModalBg').css($.extend({backgroundColor:currentSettings.bgColor},currentSettings.cssOpt.bg)).before(iframeHideIE);modal.bg.bind('click.nyroModal',clickBg);modal.loading=$('#nyroModalLoading').css(currentSettings.cssOpt.loading).hide();modal.contentWrapper=$('#nyroModalWrapper').css(currentSettings.cssOpt.wrapper).hide();modal.content=$('#nyroModalContent');modal.tmp=$('#nyrModalTmp').hide();if($.isFunction($.fn.mousewheel)){modal.content.mousewheel(function(e,d){var elt=modal.content.get(0);if((d>0&&elt.scrollTop==0)||(d<0&&elt.scrollHeight-elt.scrollTop==elt.clientHeight)){e.preventDefault();e.stopPropagation()}})}$(document).bind('keydown.nyroModal',keyHandler);modal.content.css({width:'auto',height:'auto'});modal.contentWrapper.css({width:'auto',height:'auto'});if(!currentSettings.blocker&&currentSettings.windowResize){$(window).bind('resize.nyroModal',function(){window.clearTimeout(windowResizeTimeout);windowResizeTimeout=window.setTimeout(windowResizeHandler,200)})}}}function windowResizeHandler(){$.nyroModalSettings(initSettingsSize)}function showModal(){debug('showModal');if(!modal.ready){initModal();modal.anim=true;currentSettings.showBackground(modal,currentSettings,endBackground)}else{modal.anim=true;modal.transition=true;currentSettings.showTransition(modal,currentSettings,function(){endHideContent();modal.anim=false;showContentOrLoading()})}}function clickBg(e){if(!currentSettings.modal)removeModal()}function keyHandler(e){if(e.keyCode==27){if(!currentSettings.modal)removeModal()}else if(currentSettings.gallery&&modal.ready&&modal.dataReady&&!modal.anim&&!modal.transition){if(e.keyCode==39||e.keyCode==40){e.preventDefault();$.nyroModalNext();return false}else if(e.keyCode==37||e.keyCode==38){e.preventDefault();$.nyroModalPrev();return false}}}function fileType(){var from=currentSettings.from;var url;if(from&&from.nodeName){var jFrom=$(from);url=jFrom.attr(from.nodeName.toLowerCase()=='form'?'action':'href');if(!url)url=location.href.substring(window.location.host.length+7);currentSettings.url=url;if(jFrom.attr('rev')=='modal')currentSettings.modal=true;currentSettings.title=jFrom.attr('title');if(from&&from.rel&&from.rel.toLowerCase()!='nofollow'){var indexSpace=from.rel.indexOf(' ');currentSettings.gallery=indexSpace>0?from.rel.substr(0,indexSpace):from.rel}var imgType=imageType(url,from);if(imgType)return imgType;if(isSwf(url))return'swf';var iframe=false;if(from.target&&from.target.toLowerCase()=='_blank'||(from.hostname&&from.hostname.replace(/:\d*$/,'')!=window.location.hostname.replace(/:\d*$/,''))){iframe=true}if(from.nodeName.toLowerCase()=='form'){if(iframe)return'iframeForm';setCurrentSettings(extractUrlSel(url));if(jFrom.attr('enctype')=='multipart/form-data')return'formData';return'form'}if(iframe)return'iframe'}else{url=currentSettings.url;if(!currentSettings.content)currentSettings.from=true;if(!url)return null;if(isSwf(url))return'swf';var reg1=new RegExp("^http://|https://","g");if(url.match(reg1))return'iframe'}var imgType=imageType(url,from);if(imgType)return imgType;var tmp=extractUrlSel(url);setCurrentSettings(tmp);if(!tmp.url)return tmp.selector}function imageType(url,from){var image=new RegExp(currentSettings.regexImg,'i');if(image.test(url)){return'image'}}function isSwf(url){var swf=new RegExp('[^\.]\.(swf)\s*$','i');return swf.test(url)}function extractUrlSel(url){var ret={url:null,selector:null};if(url){var hash=getHash(url);var hashLoc=getHash(window.location.href);var curLoc=window.location.href.substring(0,window.location.href.length-hashLoc.length);var req=url.substring(0,url.length-hash.length);if(req==curLoc||req==$('base').attr('href')){ret.selector=hash}else{ret.url=req;ret.selector=hash}}return ret}function loadingError(){debug('loadingError');modal.error=true;if(!modal.ready)return;if($.isFunction(currentSettings.handleError))currentSettings.handleError(modal,currentSettings);modal.loading.addClass(currentSettings.errorClass).html(currentSettings.contentError);$(currentSettings.closeSelector,modal.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();modal.loading.css({marginTop:currentSettings.marginTopLoading+'px',marginLeft:currentSettings.marginLeftLoading+'px'})}function fillContent(){debug('fillContent');if(!modal.tmp.html())return;modal.content.html(modal.tmp.contents());modal.tmp.empty();wrapContent();if(currentSettings.type=='iframeForm'){$(currentSettings.from).attr('target','nyroModalIframe').data('nyroModalprocessing',1).submit().attr('target','_blank').removeData('nyroModalprocessing')}if(!currentSettings.modal)modal.wrapper.prepend(currentSettings.closeButton);if($.isFunction(currentSettings.endFillContent))currentSettings.endFillContent(modal,currentSettings);modal.content.append(modal.scripts);$(currentSettings.closeSelector,modal.contentWrapper).unbind('click.nyroModal').bind('click.nyroModal',removeModal);$(currentSettings.openSelector,modal.contentWrapper).nyroModal(getCurrentSettingsNew())}function getCurrentSettingsNew(){return callingSettings;var currentSettingsNew=$.extend(true,{},currentSettings);if(resized.width)currentSettingsNew.width=null;else currentSettingsNew.width=initSettingsSize.width;if(resized.height)currentSettingsNew.height=null;else currentSettingsNew.height=initSettingsSize.height;currentSettingsNew.cssOpt.content.overflow='auto';return currentSettingsNew}function wrapContent(){debug('wrapContent');var wrap=$(currentSettings.wrap[currentSettings.type]);modal.content.append(wrap.children().remove());modal.contentWrapper.wrapInner(wrap);if(currentSettings.gallery){modal.content.append(currentSettings.galleryLinks);gallery.links=$('[rel="'+currentSettings.gallery+'"], [rel^="'+currentSettings.gallery+' "]');gallery.index=gallery.links.index(currentSettings.from);if(currentSettings.galleryCounts&&$.isFunction(currentSettings.galleryCounts))currentSettings.galleryCounts(gallery.index+1,gallery.links.length,modal,currentSettings);var currentSettingsNew=getCurrentSettingsNew();var linkPrev=getGalleryLink(-1);if(linkPrev){var prev=$('.nyroModalPrev',modal.contentWrapper).attr('href',linkPrev.attr('href')).click(function(e){e.preventDefault();$.nyroModalPrev();return false});if(isIE6&&currentSettings.type=='swf'){prev.before($('<iframe id="nyroModalIframeHideIeGalleryPrev" src="javascript:\'\';"></iframe>').css({position:prev.css('position'),top:prev.css('top'),left:prev.css('left'),width:prev.width(),height:prev.height(),opacity:0,border:'none'}))}}else{$('.nyroModalPrev',modal.contentWrapper).remove()}var linkNext=getGalleryLink(1);if(linkNext){var next=$('.nyroModalNext',modal.contentWrapper).attr('href',linkNext.attr('href')).click(function(e){e.preventDefault();$.nyroModalNext();return false});if(isIE6&&currentSettings.type=='swf'){next.before($('<iframe id="nyroModalIframeHideIeGalleryNext" src="javascript:\'\';"></iframe>').css($.extend({},{position:next.css('position'),top:next.css('top'),left:next.css('left'),width:next.width(),height:next.height(),opacity:0,border:'none'})))}}else{$('.nyroModalNext',modal.contentWrapper).remove()}}calculateSize()}function getGalleryLink(dir){if(currentSettings.gallery){if(!currentSettings.ltr)dir*=-1;var index=gallery.index+dir;if(index>=0&&index<gallery.links.length)return gallery.links.eq(index);else if(currentSettings.galleryLoop){if(index<0)return gallery.links.eq(gallery.links.length-1);else return gallery.links.eq(0)}}return false}function calculateSize(resizing){debug('calculateSize');modal.wrapper=modal.contentWrapper.children('div:first');resized.width=false;resized.height=false;if(false&&!currentSettings.windowResizing){initSettingsSize.width=currentSettings.width;initSettingsSize.height=currentSettings.height}if(currentSettings.autoSizable&&(!currentSettings.width||!currentSettings.height)){modal.contentWrapper.css({opacity:0,width:'auto',height:'auto'}).show();var tmp={width:'auto',height:'auto'};if(currentSettings.width){tmp.width=currentSettings.width}else if(currentSettings.type=='iframe'){tmp.width=currentSettings.minWidth}if(currentSettings.height){tmp.height=currentSettings.height}else if(currentSettings.type=='iframe'){tmp.height=currentSettings.minHeight}modal.content.css(tmp);if(!currentSettings.width){currentSettings.width=modal.content.outerWidth(true);resized.width=true}if(!currentSettings.height){currentSettings.height=modal.content.outerHeight(true);resized.height=true}modal.contentWrapper.css({opacity:1});if(!resizing)modal.contentWrapper.hide()}if(currentSettings.type!='image'&&currentSettings.type!='swf'){currentSettings.width=Math.max(currentSettings.width,currentSettings.minWidth);currentSettings.height=Math.max(currentSettings.height,currentSettings.minHeight)}var outerWrapper=getOuter(modal.contentWrapper);var outerWrapper2=getOuter(modal.wrapper);var outerContent=getOuter(modal.content);var tmp={content:{width:currentSettings.width,height:currentSettings.height},wrapper2:{width:currentSettings.width+outerContent.w.total,height:currentSettings.height+outerContent.h.total},wrapper:{width:currentSettings.width+outerContent.w.total+outerWrapper2.w.total,height:currentSettings.height+outerContent.h.total+outerWrapper2.h.total}};if(currentSettings.resizable){var maxHeight=modal.blockerVars?modal.blockerVars.height:$(window).height()-outerWrapper.h.border-(tmp.wrapper.height-currentSettings.height);var maxWidth=modal.blockerVars?modal.blockerVars.width:$(window).width()-outerWrapper.w.border-(tmp.wrapper.width-currentSettings.width);maxHeight-=currentSettings.padding*2;maxWidth-=currentSettings.padding*2;if(tmp.content.height>maxHeight||tmp.content.width>maxWidth){if(currentSettings.type=='image'||currentSettings.type=='swf'){var useW=currentSettings.imgWidth?currentSettings.imgWidth:currentSettings.width;var useH=currentSettings.imgHeight?currentSettings.imgHeight:currentSettings.height;var diffW=tmp.content.width-useW;var diffH=tmp.content.height-useH;if(diffH<0)diffH=0;if(diffW<0)diffW=0;var calcH=maxHeight-diffH;var calcW=maxWidth-diffW;var ratio=Math.min(calcH/useH,calcW/useW);calcW=Math.floor(useW*ratio);calcH=Math.floor(useH*ratio);tmp.content.height=calcH+diffH;tmp.content.width=calcW+diffW}else{tmp.content.height=Math.min(tmp.content.height,maxHeight);tmp.content.width=Math.min(tmp.content.width,maxWidth)}tmp.wrapper2={width:tmp.content.width+outerContent.w.total,height:tmp.content.height+outerContent.h.total};tmp.wrapper={width:tmp.content.width+outerContent.w.total+outerWrapper2.w.total,height:tmp.content.height+outerContent.h.total+outerWrapper2.h.total}}}if(currentSettings.type=='swf'){$('object, embed',modal.content).attr('width',tmp.content.width).attr('height',tmp.content.height)}else if(currentSettings.type=='image'){$('img',modal.content).css({width:tmp.content.width,height:tmp.content.height})}modal.content.css($.extend({},tmp.content,currentSettings.cssOpt.content));modal.wrapper.css($.extend({},tmp.wrapper2,currentSettings.cssOpt.wrapper2));if(!resizing)modal.contentWrapper.css($.extend({},tmp.wrapper,currentSettings.cssOpt.wrapper));if(currentSettings.type=='image'&&currentSettings.addImageDivTitle){$('img',modal.content).removeAttr('alt');var divTitle=$('div',modal.content);if(currentSettings.title!=currentSettings.defaultImgAlt&&currentSettings.title){if(divTitle.length==0){divTitle=$('<div>'+currentSettings.title+'</div>');modal.content.append(divTitle)}if(currentSettings.setWidthImgTitle){var outerDivTitle=getOuter(divTitle);divTitle.css({width:(tmp.content.width+outerContent.w.padding-outerDivTitle.w.total)+'px'})}}else if(divTitle.length=0){divTitle.remove()}}if(currentSettings.title)setTitle();tmp.wrapper.borderW=outerWrapper.w.border;tmp.wrapper.borderH=outerWrapper.h.border;setCurrentSettings(tmp.wrapper);setMargin()}function removeModal(e){debug('removeModal');if(e)e.preventDefault();if(modal.full&&modal.ready){$(document).unbind('keydown.nyroModal');if(!currentSettings.blocker)$(window).unbind('resize.nyroModal');modal.ready=false;modal.anim=true;modal.closing=true;if(modal.loadingShown||modal.transition){currentSettings.hideLoading(modal,currentSettings,function(){modal.loading.hide();modal.loadingShown=false;modal.transition=false;currentSettings.hideBackground(modal,currentSettings,endRemove)})}else{if(fixFF)modal.content.css({position:''});modal.wrapper.css({overflow:'hidden'});modal.content.css({overflow:'hidden'});$('iframe',modal.content).hide();if($.isFunction(currentSettings.beforeHideContent)){currentSettings.beforeHideContent(modal,currentSettings,function(){currentSettings.hideContent(modal,currentSettings,function(){endHideContent();currentSettings.hideBackground(modal,currentSettings,endRemove)})})}else{currentSettings.hideContent(modal,currentSettings,function(){endHideContent();currentSettings.hideBackground(modal,currentSettings,endRemove)})}}}if(e)return false}function showContentOrLoading(){debug('showContentOrLoading');if(modal.ready&&!modal.anim){if(modal.dataReady){if(modal.tmp.html()){modal.anim=true;if(modal.transition){fillContent();modal.animContent=true;currentSettings.hideTransition(modal,currentSettings,function(){modal.loading.hide();modal.transition=false;modal.loadingShown=false;endShowContent()})}else{currentSettings.hideLoading(modal,currentSettings,function(){modal.loading.hide();modal.loadingShown=false;fillContent();setMarginLoading();setMargin();modal.animContent=true;currentSettings.showContent(modal,currentSettings,endShowContent)})}}}else if(!modal.loadingShown&&!modal.transition){modal.anim=true;modal.loadingShown=true;if(modal.error)loadingError();else modal.loading.html(currentSettings.contentLoading);$(currentSettings.closeSelector,modal.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();currentSettings.showLoading(modal,currentSettings,function(){modal.anim=false;showContentOrLoading()})}}}function ajaxLoaded(data){debug('AjaxLoaded: '+this.url);if(currentSettings.selector){var tmp={};var i=0;data=data.replace(/\r\n/gi,'nyroModalLN').replace(/<script(.|\s)*?\/script>/gi,function(x){tmp[i]=x;return'<pre style="display: none" class=nyroModalScript rel="'+(i++)+'"></pre>'});data=$('<div>'+data+'</div>').find(currentSettings.selector).html().replace(/<pre style="display: none;?" class="?nyroModalScript"? rel="(.?)"><\/pre>/gi,function(x,y,z){return tmp[y]}).replace(/nyroModalLN/gi,"\r\n")}modal.tmp.html(filterScripts(data));if(modal.tmp.html()){modal.dataReady=true;showContentOrLoading()}else loadingError()}function formDataLoaded(){debug('formDataLoaded');var jFrom=$(currentSettings.from);jFrom.attr('action',jFrom.attr('action')+currentSettings.selector);jFrom.attr('target','');$('input[name='+currentSettings.formIndicator+']',currentSettings.from).remove();var iframe=modal.tmp.children('iframe');var iframeContent=iframe.unbind('load').contents().find(currentSettings.selector||'body').not('script[src]');iframe.attr('src','about:blank');modal.tmp.html(iframeContent.html());if(modal.tmp.html()){modal.dataReady=true;showContentOrLoading()}else loadingError()}function iframeLoaded(){if((window.location.hostname&&currentSettings.url.indexOf(window.location.hostname)>-1)||currentSettings.url.indexOf('http://')){var iframe=$('iframe',modal.full).contents();var tmp={};if(currentSettings.titleFromIframe){tmp.title=iframe.find('title').text();if(!tmp.title){try{tmp.title=iframe.find('title').html()}catch(err){}}}var body=iframe.find('body');if(!currentSettings.height&&body.height())tmp.height=body.height();if(!currentSettings.width&&body.width())tmp.width=body.width();$.extend(initSettingsSize,tmp);$.nyroModalSettings(tmp)}}function galleryCounts(nb,total,elts,settings){if(total>1)settings.title+=(settings.title?' - ':'')+nb+'/'+total}function endHideContent(){debug('endHideContent');modal.anim=false;if(contentEltLast){contentEltLast.append(modal.content.contents());contentEltLast=null}else if(contentElt){contentElt.append(modal.content.contents());contentElt=null}modal.content.empty();gallery={};modal.contentWrapper.hide().children().remove().empty().attr('style','').hide();if(modal.closing||modal.transition)modal.contentWrapper.hide();modal.contentWrapper.css(currentSettings.cssOpt.wrapper).append(modal.content);showContentOrLoading()}function endRemove(){debug('endRemove');$(document).unbind('keydown',keyHandler);modal.anim=false;modal.full.remove();modal.full=null;if(isIE6){body.css({height:'',width:'',position:'',overflow:'',marginLeft:'',marginRight:''});$('html').css({overflow:''})}if($.isFunction(currentSettings.endRemove))currentSettings.endRemove(modal,currentSettings)}function endBackground(){debug('endBackground');modal.ready=true;modal.anim=false;showContentOrLoading()}function endShowContent(){debug('endShowContent');modal.anim=false;modal.animContent=false;modal.contentWrapper.css({opacity:''});fixFF=/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)&&parseFloat(browserVersion)<1.9&&currentSettings.type!='image';if(fixFF)modal.content.css({position:'fixed'});modal.content.append(modal.scriptsShown);if(currentSettings.type=='iframe')modal.content.find('iframe').attr('src',currentSettings.url);if($.isFunction(currentSettings.endShowContent))currentSettings.endShowContent(modal,currentSettings);if(shouldResize){shouldResize=false;$.nyroModalSettings({width:currentSettings.setWidth,height:currentSettings.setHeight});delete currentSettings['setWidth'];delete currentSettings['setHeight']}if(resized.width)setCurrentSettings({width:null});if(resized.height)setCurrentSettings({height:null})}function getHash(url){if(typeof url=='string'){var hashPos=url.indexOf('#');if(hashPos>-1)return url.substring(hashPos)}return''}function filterScripts(data){if(typeof data=='string')data=data.replace(/<\/?(html|head|body)([^>]*)>/gi,'');var tmp=new Array();$.each($.clean({0:data},this.ownerDocument),function(){if($.nodeName(this,"script")){if(!this.src||$(this).attr('rel')=='forceLoad'){if($(this).attr('rev')=='shown')modal.scriptsShown.push(this);else modal.scripts.push(this)}}else tmp.push(this)});return tmp}function getOuter(elm){elm=elm.get(0);var ret={h:{margin:getCurCSS(elm,'marginTop')+getCurCSS(elm,'marginBottom'),border:getCurCSS(elm,'borderTopWidth')+getCurCSS(elm,'borderBottomWidth'),padding:getCurCSS(elm,'paddingTop')+getCurCSS(elm,'paddingBottom')},w:{margin:getCurCSS(elm,'marginLeft')+getCurCSS(elm,'marginRight'),border:getCurCSS(elm,'borderLeftWidth')+getCurCSS(elm,'borderRightWidth'),padding:getCurCSS(elm,'paddingLeft')+getCurCSS(elm,'paddingRight')}};ret.h.outer=ret.h.margin+ret.h.border;ret.w.outer=ret.w.margin+ret.w.border;ret.h.inner=ret.h.padding+ret.h.border;ret.w.inner=ret.w.padding+ret.w.border;ret.h.total=ret.h.outer+ret.h.padding;ret.w.total=ret.w.outer+ret.w.padding;return ret}function getCurCSS(elm,name){var ret=parseInt($.curCSS(elm,name,true));if(isNaN(ret))ret=0;return ret}function debug(msg){if($.fn.nyroModal.settings.debug||currentSettings&&currentSettings.debug)nyroModalDebug(msg,modal,currentSettings||{})}function showBackground(elts,settings,callback){elts.bg.css({opacity:0}).fadeTo(500,0.75,callback)}function hideBackground(elts,settings,callback){elts.bg.fadeOut(300,callback)}function showLoading(elts,settings,callback){elts.loading.css({marginTop:settings.marginTopLoading+'px',marginLeft:settings.marginLeftLoading+'px',opacity:0}).show().animate({opacity:1},{complete:callback,duration:400})}function hideLoading(elts,settings,callback){callback()}function showContent(elts,settings,callback){elts.loading.css({marginTop:settings.marginTopLoading+'px',marginLeft:settings.marginLeftLoading+'px'}).show().animate({width:settings.width+'px',height:settings.height+'px',marginTop:settings.marginTop+'px',marginLeft:settings.marginLeft+'px'},{duration:350,complete:function(){elts.contentWrapper.css({width:settings.width+'px',height:settings.height+'px',marginTop:settings.marginTop+'px',marginLeft:settings.marginLeft+'px'}).show();elts.loading.fadeOut(200,callback)}})}function hideContent(elts,settings,callback){elts.contentWrapper.animate({height:'50px',width:'50px',marginTop:(-(25+settings.borderH)/2+settings.marginScrollTop)+'px',marginLeft:(-(25+settings.borderW)/2+settings.marginScrollLeft)+'px'},{duration:350,complete:function(){elts.contentWrapper.hide();callback()}})}function showTransition(elts,settings,callback){elts.loading.css({marginTop:elts.contentWrapper.css('marginTop'),marginLeft:elts.contentWrapper.css('marginLeft'),height:elts.contentWrapper.css('height'),width:elts.contentWrapper.css('width'),opacity:0}).show().fadeTo(400,1,function(){elts.contentWrapper.hide();callback()})}function hideTransition(elts,settings,callback){elts.contentWrapper.hide().css({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px',opacity:1});elts.loading.animate({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px'},{complete:function(){elts.contentWrapper.show();elts.loading.fadeOut(400,function(){elts.loading.hide();callback()})},duration:350})}function resize(elts,settings,callback){elts.contentWrapper.animate({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px'},{complete:callback,duration:400})}function updateBgColor(elts,settings,callback){if(!$.fx.step.backgroundColor){elts.bg.css({backgroundColor:settings.bgColor});callback()}else elts.bg.animate({backgroundColor:settings.bgColor},{complete:callback,duration:400})}$($.fn.nyroModal.settings.openSelector).nyroModal()});var tmpDebug='';function nyroModalDebug(msg,elts,settings){if(elts.full&&elts.bg){elts.bg.prepend(msg+'<br />'+tmpDebug);tmpDebug=''}else tmpDebug+=msg+'<br />'}


(function($) {

$.fn.innerfade = function(options) {
return this.each(function() {
$.innerfade(this, options);
});
};

$.innerfade = function(container, options) {
var settings = {
'animationtype':'fade',
'speed':'normal',
'type':'sequence',
'timeout':2000,
'containerheight':'auto',
'runningclass':'innerfade',
'children':null
};
if (options)
$.extend(settings, options);
if (settings.children === null)
var elements = $(container).children();
else
var elements = $(container).children(settings.children);
if (elements.length > 1) {
$(container).css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass);
for (var i = 0; i < elements.length; i++) {
$(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute').hide();
};
if (settings.type == "sequence") {
setTimeout(function() {
$.innerfade.next(elements, settings, 1, 0);
}, settings.timeout);
$(elements[0]).show();
} else if (settings.type == "random") {
var last = Math.floor ( Math.random () * ( elements.length ) );
setTimeout(function() {
do { 
current = Math.floor ( Math.random ( ) * ( elements.length ) );
} while (last == current );
$.innerfade.next(elements, settings, current, last);
}, settings.timeout);
$(elements[last]).show();
} else if ( settings.type == 'random_start' ) {
settings.type = 'sequence';
var current = Math.floor ( Math.random () * ( elements.length ) );
setTimeout(function(){
$.innerfade.next(elements, settings, (current + 1) %elements.length, current);
}, settings.timeout);
$(elements[current]).show();
}	else {
alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
}
}
};

$.innerfade.next = function(elements, settings, current, last) {
if (settings.animationtype == 'slide') {
$(elements[last]).slideUp(settings.speed);
$(elements[current]).slideDown(settings.speed);
} else if (settings.animationtype == 'fade') {
$(elements[last]).fadeOut(settings.speed);
$(elements[current]).fadeIn(settings.speed, function() {
removeFilter($(this)[0]);
});
} else
alert('Innerfade-animationtype must either be \'slide\' or \'fade\'');
if (settings.type == "sequence") {
if ((current + 1) < elements.length) {
current = current + 1;
last = current - 1;
} else {
current = 0;
last = elements.length - 1;
}
} else if (settings.type == "random") {
last = current;
while (current == last)
current = Math.floor(Math.random() * elements.length);
} else
alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
setTimeout((function() {
$.innerfade.next(elements, settings, current, last);
}), settings.timeout);
};

})(jQuery);

// **** remove Opacity-Filter in ie ****
function removeFilter(element) {
	if(element.style.removeAttribute){
element.style.removeAttribute('filter');
	}
}
$(document).ready(function(){

$.nyroModalSettings({
processHandler: function(settings) {
var scaleRatio = 1;
var from = settings.from;
$.nyroModalSettings({
width: (650),
height: (510),
url: from.href 
});
}
});

if($('body').find('#contenuInterieur').length > 0) {
var hauteurMinimum = $(window).height()-154;
var hauteurContenu = $('#contenuInterieur').height()+154;
if (hauteurMinimum > hauteurContenu){
$('div#blocBasDePage').addClass("blocBasDePageAbsolute");
}
}


var monHeight="0px";
if ($('body').find('#boiteFlashAccueil').length > 0) {
monHeight="357px";
} else {
monHeight="250px";
}

if($('.boiteFlash div').length > 1)
{
$('.boiteFlash').innerfade({
speed: 1000,
timeout: 4000,
type: 'sequence',
containerheight: monHeight
});
}
	if (document.getElementById("imprimanteTexte")){
buildsubmenus_horizontal();
$("#envoyerAmiTexte").click( function(e) {
var url = 'http://www.apbb.qc.ca/fr/demandeDEnvoyerAUnAmi.cfm?pageReferer='+ window.location;
e.preventDefault();
$.nyroModalManual({
url: url
});
return false;
});
$("#imprimanteTexte").click( function() {
if (window.print) window.print();
else alert('Votre navigateur ne suporte pas le format pour impression.');
return false;
});	
	};
});TP = new Array();
TPA = new Array();

TPA[0]="Algeria";
TPA[1]="Allemagne";
TP[0]="1|Baden-Württemberg";
TP[1]="1|Bayern";
TP[2]="1|Berlin";
TP[3]="1|Brandenburg";
TP[4]="1|Bremen";
TP[5]="1|Hamburg";
TP[6]="1|Hessen";
TP[7]="1|Mecklenburg-Vorpommern";
TP[8]="1|Niedersachsen";
TP[9]="1|Nordrhein-Westfalen";
TP[10]="1|Rheinland-Pfalz";
TP[11]="1|Saarland";
TP[12]="1|Sachsen";
TP[13]="1|Sachsen-Anhalt";
TP[14]="1|Schleswig-Holstein";
TP[15]="1|Thuringen";
TPA[2]="Argentine";
TP[16]="2|Buenos Aires";
TP[17]="2|Capital Federal";
TP[18]="2|Catamarca";
TP[19]="2|Chaco";
TP[20]="2|Chubut";
TP[21]="2|Cordoba";
TP[22]="2|Corrientes";
TP[23]="2|Entre Rios";
TP[24]="2|Formosa";
TP[25]="2|Jujuy";
TP[26]="2|La Pampa";
TP[27]="2|La Rioja";
TP[28]="2|Mendoza";
TP[29]="2|Misiones";
TP[30]="2|Neuquen";
TP[31]="2|Rio Negro";
TP[32]="2|Salta";
TP[33]="2|San Juan";
TP[34]="2|San Luis";
TP[35]="2|Santa Cruz";
TP[36]="2|Santa Fe";
TP[37]="2|Santiago del Estero";
TP[38]="2|Tierra del Fuego Antartida e Islas del Atlantico Sur";
TP[39]="2|Tucuman";
TPA[3]="Australie";
TP[40]="3|Australian Capital Territory";
TP[41]="3|New South Wales";
TP[42]="3|Northern Territory";
TP[43]="3|Queensland";
TP[44]="3|South Australia";
TP[45]="3|Tasmania";
TP[46]="3|Victoria";
TP[47]="3|Western Australia";
TPA[4]="Autriche";
TP[48]="4|Burgenland";
TP[49]="4|Karnten";
TP[50]="4|Lower Austria";
TP[51]="4|Salzburg";
TP[52]="4|Steiermark";
TP[53]="4|Tirol";
TP[54]="4|Upper Austria";
TP[55]="4|Vorarlberg";
TP[56]="4|Wien";
TPA[5]="Belgique";
TP[57]="5|Antwerpen";
TP[58]="5|Brussels";
TP[59]="5|Flemish Brabant";
TP[60]="5|Hainaut";
TP[61]="5|Liege";
TP[62]="5|Limburg";
TP[63]="5|Luxembourg";
TP[64]="5|Namur";
TP[65]="5|Oost-Vlaanderen";
TP[66]="5|Walloon Brabant";
TP[67]="5|West-Vlaanderen";
TPA[6]="Brésil";
TP[68]="6|Acre";
TP[69]="6|Alagoas";
TP[70]="6|Amapa";
TP[71]="6|Amazonas";
TP[72]="6|Bahia";
TP[73]="6|Ceara";
TP[74]="6|Distrito Federal";
TP[75]="6|Espirito Santo";
TP[76]="6|Goias";
TP[77]="6|Maranhao";
TP[78]="6|Mato Grosso";
TP[79]="6|Mato Grosso do Sul";
TP[80]="6|Minas Gerais";
TP[81]="6|Para";
TP[82]="6|Paraiba";
TP[83]="6|Parana";
TP[84]="6|Pernambuco";
TP[85]="6|Piaui";
TP[86]="6|Rio de Janeiro";
TP[87]="6|Rio Grande do Norte";
TP[88]="6|Rio Grande do Sul";
TP[89]="6|Rondonia";
TP[90]="6|Roraima";
TP[91]="6|Santa Catarina";
TP[92]="6|Sao Paulo";
TP[93]="6|Sergipe";
TP[94]="6|Tocantins";
TP[95]="6|Zona Litigiosa";
TPA[7]="Canada";
TP[96]="7|Alberta";
TP[97]="7|Colombie-Britannique";
TP[98]="7|Île-du-Prince-Édouard";
TP[99]="7|Manitoba";
TP[100]="7|Nouveau-Brunswick";
TP[101]="7|Nouvelle-Écosse";
TP[102]="7|Nunavut";
TP[103]="7|Ontario";
TP[104]="7|Québec";
TP[105]="7|Saskatchewan";
TP[106]="7|Terre-Neuve";
TP[107]="7|Territoires du Nord-Ouest";
TP[108]="7|Yukon";
TPA[8]="Chile";
TP[109]="8|Magallanes y Antartica Chilena";
TP[110]="8|Metropolitana de Santiago";
TP[111]="8|Region de Aisen del General Carlos Ibanez del Campo";
TP[112]="8|Region de Antofagasta";
TP[113]="8|Region de Atacama";
TP[114]="8|Region de Coquimbo";
TP[115]="8|Region de la Araucania";
TP[116]="8|Region de los Lagos";
TP[117]="8|Region de OrHiggins";
TP[118]="8|Region de Tarapaca";
TP[119]="8|Region de Valparaiso";
TP[120]="8|Region del Biobio";
TP[121]="8|Region del Maule";
TPA[9]="Chine";
TP[122]="9|Anhui";
TP[123]="9|Beijing";
TP[124]="9|Chongqing";
TP[125]="9|Fujian";
TP[126]="9|Gansu";
TP[127]="9|Guangdong";
TP[128]="9|Guangxi";
TP[129]="9|Guizhou";
TP[130]="9|Hainan";
TP[131]="9|Hebei";
TP[132]="9|Heilongjiang";
TP[133]="9|Henan";
TP[134]="9|Hubei";
TP[135]="9|Hunan";
TP[136]="9|Jiangsu";
TP[137]="9|Jiangxi";
TP[138]="9|Jilin";
TP[139]="9|Liaoning";
TP[140]="9|Nei Menggu";
TP[141]="9|Ningxia";
TP[142]="9|Qinghai";
TP[143]="9|Shaanxi";
TP[144]="9|Shandong";
TP[145]="9|Shanghai";
TP[146]="9|Shanxi";
TP[147]="9|Sichuan";
TP[148]="9|Tianjin";
TP[149]="9|Xinjiang Uygur";
TP[150]="9|Xizang";
TP[151]="9|Yunnan";
TP[152]="9|Zhejiang";
TPA[10]="Czech Republic";
TP[153]="10|Jihocesky Kraj";
TP[154]="10|Jihormoravsky Kraj";
TP[155]="10|Praha";
TP[156]="10|Severocesky Kraj";
TP[157]="10|Severomoravsky Kraj";
TP[158]="10|Stredocesky Kraj";
TP[159]="10|Vychodocesky Kraj";
TP[160]="10|Zapadocesky Kraj";
TPA[11]="Denmark";
TPA[12]="Finlande";
TP[161]="12|Ahvenanmaa";
TP[162]="12|Hame";
TP[163]="12|Keski-Suomi";
TP[164]="12|Kuopio";
TP[165]="12|Kymi";
TP[166]="12|Lappi";
TP[167]="12|Mikkeli";
TP[168]="12|Oulu";
TP[169]="12|Pohjois-Karjala";
TP[170]="12|Turku ja Pori";
TP[171]="12|Uusimaa";
TP[172]="12|Vaasa";
TPA[13]="France";
TP[173]="13|Ain";
TP[174]="13|Aisne";
TP[175]="13|Allier";
TP[176]="13|Alpes-de-Haute-Provence";
TP[177]="13|Alpes-Maritimes";
TP[178]="13|Ardeche";
TP[179]="13|Ardennes";
TP[180]="13|Ariege";
TP[181]="13|Aube";
TP[182]="13|Aude";
TP[183]="13|Aveyron";
TP[184]="13|Bas-Rhin";
TP[185]="13|Bouches-du-Rhone";
TP[186]="13|Calvados";
TP[187]="13|Cantal";
TP[188]="13|Charente";
TP[189]="13|Charente-Maritime";
TP[190]="13|Cher";
TP[191]="13|Correze";
TP[192]="13|Corse-du-Sud";
TP[193]="13|Cote-d`Or";
TP[194]="13|Cotes-d`Armor";
TP[195]="13|Creuse";
TP[196]="13|Deux-Sevres";
TP[197]="13|Dordogne";
TP[198]="13|Doubs";
TP[199]="13|Drome";
TP[200]="13|Essonne";
TP[201]="13|Eure";
TP[202]="13|Eure-et-Loir";
TP[203]="13|Finistere";
TP[204]="13|Gard";
TP[205]="13|Gers";
TP[206]="13|Gironde";
TP[207]="13|Haute-Corse";
TP[208]="13|Haute-Garonne";
TP[209]="13|Haute-Loire";
TP[210]="13|Haute-Marne";
TP[211]="13|Hautes-Alpes";
TP[212]="13|Haute-Saone";
TP[213]="13|Haute-Savoie";
TP[214]="13|Hautes-Pyrenees";
TP[215]="13|Haute-Vienne";
TP[216]="13|Haut-Rhin";
TP[217]="13|Hauts-de-Seine";
TP[218]="13|Herault";
TP[219]="13|Ille-et-Vilaine";
TP[220]="13|Indre";
TP[221]="13|Indre-et-Loire";
TP[222]="13|Isere";
TP[223]="13|Jura";
TP[224]="13|Landes";
TP[225]="13|Loire";
TP[226]="13|Loire-Atlantique";
TP[227]="13|Loiret";
TP[228]="13|Loir-et-Cher";
TP[229]="13|Lot";
TP[230]="13|Lot-et-Garonne";
TP[231]="13|Lozere";
TP[232]="13|Maine-et-Loire";
TP[233]="13|Manche";
TP[234]="13|Marne";
TP[235]="13|Mayenne";
TP[236]="13|Meurthe-et-Moselle";
TP[237]="13|Meuse";
TP[238]="13|Morbihan";
TP[239]="13|Moselle";
TP[240]="13|Nievre";
TP[241]="13|Nord";
TP[242]="13|Oise";
TP[243]="13|Orne";
TP[244]="13|Paris";
TP[245]="13|Pas-de-Calais";
TP[246]="13|Puy-de-Dome";
TP[247]="13|Pyrenees-Atlantiques";
TP[248]="13|Pyrenees-Orientales";
TP[249]="13|Rhone";
TP[250]="13|Saone-et-Loire";
TP[251]="13|Sarthe";
TP[252]="13|Savoie";
TP[253]="13|Seine-et-Marne";
TP[254]="13|Seine-Maritime";
TP[255]="13|Seine-Saint-Denis";
TP[256]="13|Somme";
TP[257]="13|Tarn";
TP[258]="13|Tarn-et-Garonne";
TP[259]="13|Territoire-de-Belfort";
TP[260]="13|Val-De-Marne";
TP[261]="13|Val-drOise";
TP[262]="13|Var";
TP[263]="13|Vaucluse";
TP[264]="13|Vendee";
TP[265]="13|Vienne";
TP[266]="13|Vosges";
TP[267]="13|Yonne";
TP[268]="13|Yvelines";
TPA[14]="Grèce";
TP[269]="14|Aitoloakarnania";
TP[270]="14|Akhaia";
TP[271]="14|Argolis";
TP[272]="14|Arkadhia";
TP[273]="14|Arta";
TP[274]="14|Attica";
TP[275]="14|Cephallonia";
TP[276]="14|Dodecanese";
TP[277]="14|Drama";
TP[278]="14|Evritania";
TP[279]="14|Evros";
TP[280]="14|Evvoia";
TP[281]="14|Florina";
TP[282]="14|Fokis";
TP[283]="14|Fthiotis";
TP[284]="14|Grevena";
TP[285]="14|Ilia";
TP[286]="14|Imathia";
TP[287]="14|Ioannina";
TP[288]="14|Iraklion";
TP[289]="14|Karditsa";
TP[290]="14|Kastoria";
TP[291]="14|Kavala";
TP[292]="14|Kerkira";
TP[293]="14|Khalkidhiki";
TP[294]="14|Khania";
TP[295]="14|Khios";
TP[296]="14|Kikladhes";
TP[297]="14|Kilkis";
TP[298]="14|Korinthia";
TP[299]="14|Kozani";
TP[300]="14|Laconia";
TP[301]="14|Larisa";
TP[302]="14|Lasithi";
TP[303]="14|Lesvos";
TP[304]="14|Levkas";
TP[305]="14|Magnisia";
TP[306]="14|Messinia";
TP[307]="14|Pella";
TP[308]="14|Pieria";
TP[309]="14|Preveza";
TP[310]="14|Rethimni";
TP[311]="14|Rodopi";
TP[312]="14|Samos";
TP[313]="14|Serrai";
TP[314]="14|Thesprotia";
TP[315]="14|Thessaloniki";
TP[316]="14|Thraki";
TP[317]="14|Trikala";
TP[318]="14|Voiotia";
TP[319]="14|Xanthi";
TP[320]="14|Zakinthos";
TPA[15]="Iceland";
TPA[16]="Inde";
TPA[17]="Irlande";
TP[321]="17|Carlow";
TP[322]="17|Cavan";
TP[323]="17|Clare";
TP[324]="17|Cork";
TP[325]="17|Donegal";
TP[326]="17|Dublin";
TP[327]="17|Galway";
TP[328]="17|Kerry";
TP[329]="17|Kildare";
TP[330]="17|Kilkenny";
TP[331]="17|Laois";
TP[332]="17|Leitrim";
TP[333]="17|Limerick";
TP[334]="17|Longford";
TP[335]="17|Louth";
TP[336]="17|Mayo";
TP[337]="17|Meath";
TP[338]="17|Monaghan";
TP[339]="17|Offaly";
TP[340]="17|Roscommon";
TP[341]="17|Sligo";
TP[342]="17|Tipperary";
TP[343]="17|Waterford";
TP[344]="17|Westmeath";
TP[345]="17|Wexford";
TP[346]="17|Wicklow";
TPA[18]="Italie";
TP[347]="18|Agrigento";
TP[348]="18|Alessandria";
TP[349]="18|Ancona";
TP[350]="18|Aosta";
TP[351]="18|Arezzo";
TP[352]="18|Ascoli Piceno";
TP[353]="18|Asti";
TP[354]="18|Avellino";
TP[355]="18|Bari";
TP[356]="18|Belluno";
TP[357]="18|Benevento";
TP[358]="18|Bergamo";
TP[359]="18|Biella";
TP[360]="18|Bologna";
TP[361]="18|Bolzano";
TP[362]="18|Brescia";
TP[363]="18|Brindisi";
TP[364]="18|Cagliari";
TP[365]="18|Caltanissetta";
TP[366]="18|Campobasso";
TP[367]="18|Caserta";
TP[368]="18|Catania";
TP[369]="18|Catanzaro";
TP[370]="18|Chieti";
TP[371]="18|Como";
TP[372]="18|Cosenza";
TP[373]="18|Cremona";
TP[374]="18|Crotone";
TP[375]="18|Cuneo";
TP[376]="18|Enna";
TP[377]="18|Ferrara";
TP[378]="18|Firenze";
TP[379]="18|Foggia";
TP[380]="18|Forli-Cesena";
TP[381]="18|Frosinone";
TP[382]="18|Genova";
TP[383]="18|Gorizia";
TP[384]="18|Grosseto";
TP[385]="18|Imperia";
TP[386]="18|Isernia";
TP[387]="18|L`Aquila";
TP[388]="18|La Spezia";
TP[389]="18|Latina";
TP[390]="18|Lecce";
TP[391]="18|Lecco";
TP[392]="18|Livorno";
TP[393]="18|Lodi";
TP[394]="18|Lucca";
TP[395]="18|Macerata";
TP[396]="18|Mantova";
TP[397]="18|Massa Carrara";
TP[398]="18|Matera";
TP[399]="18|Messina";
TP[400]="18|Milano";
TP[401]="18|Modena";
TP[402]="18|Napoli";
TP[403]="18|Novara";
TP[404]="18|Nuoro";
TP[405]="18|Oristano";
TP[406]="18|Padova";
TP[407]="18|Palermo";
TP[408]="18|Parma";
TP[409]="18|Pavia";
TP[410]="18|Pavia";
TP[411]="18|Perugia";
TP[412]="18|Pesaro e Urbino";
TP[413]="18|Pescara";
TP[414]="18|Piacenza";
TP[415]="18|Pisa";
TP[416]="18|Pistoia";
TP[417]="18|Pordenone";
TP[418]="18|Potenza";
TP[419]="18|Prato";
TP[420]="18|Ragusa";
TP[421]="18|Ravenna";
TP[422]="18|Reggio di Calabria";
TP[423]="18|Reggio nella Emilia";
TP[424]="18|Rieti";
TP[425]="18|Rimini";
TP[426]="18|Roma";
TP[427]="18|Rovigo";
TP[428]="18|Salerno";
TP[429]="18|Sassari";
TP[430]="18|Savona";
TP[431]="18|Siena";
TP[432]="18|Siracusa";
TP[433]="18|Sondrio";
TP[434]="18|Taranto";
TP[435]="18|Teramo";
TP[436]="18|Terni";
TP[437]="18|Torino";
TP[438]="18|Trapani";
TP[439]="18|Trento";
TP[440]="18|Treviso";
TP[441]="18|Trieste";
TP[442]="18|Udine";
TP[443]="18|Varese";
TP[444]="18|Venezia";
TP[445]="18|Verbano-Cusio-Ossola";
TP[446]="18|Vercelli";
TP[447]="18|Vercellio";
TP[448]="18|Verona";
TP[449]="18|Vibo Valentia";
TP[450]="18|Vicenza";
TP[451]="18|Viterbo";
TPA[19]="Japon";
TPA[20]="Mexique";
TP[452]="20|Aguascalientes";
TP[453]="20|Baja California";
TP[454]="20|Baja California Sur";
TP[455]="20|Campeche";
TP[456]="20|Chiapas";
TP[457]="20|Chihuahua";
TP[458]="20|Coahuila";
TP[459]="20|Colima";
TP[460]="20|Distrito Federal";
TP[461]="20|Durango";
TP[462]="20|Guanajuato";
TP[463]="20|Guerrero";
TP[464]="20|Hidalgo";
TP[465]="20|Jalisco";
TP[466]="20|Mexico";
TP[467]="20|Michoacan";
TP[468]="20|Morelos";
TP[469]="20|Nayarit";
TP[470]="20|Nuevo Leon";
TP[471]="20|Oaxaca";
TP[472]="20|Puebla";
TP[473]="20|Queretaro";
TP[474]="20|Quintana Roo";
TP[475]="20|San Luis Potosi";
TP[476]="20|Sinaloa";
TP[477]="20|Sonora";
TP[478]="20|Tabasco";
TP[479]="20|Tamaulipas";
TP[480]="20|Tlaxcala";
TP[481]="20|Veracruz";
TP[482]="20|Yucatan";
TP[483]="20|Zacatecas";
TPA[21]="Morocco";
TPA[22]="Norway";
TPA[23]="Peru";
TPA[24]="Poland";
TPA[25]="Portugal";
TPA[26]="Romania";
TPA[27]="Russian Federation";
TPA[28]="Spain";
TP[484]="28|Alava";
TP[485]="28|Albacete";
TP[486]="28|Alicante";
TP[487]="28|Almeria";
TP[488]="28|Asturias";
TP[489]="28|Avila";
TP[490]="28|Badajoz";
TP[491]="28|Baleares";
TP[492]="28|Barcelona";
TP[493]="28|Burgos";
TP[494]="28|Caceres";
TP[495]="28|Cadiz";
TP[496]="28|Castellon";
TP[497]="28|Ciudad Real";
TP[498]="28|Cordoba";
TP[499]="28|Cuenca";
TP[500]="28|Gerona";
TP[501]="28|Granada";
TP[502]="28|Guadalajara";
TP[503]="28|Guipuzcoa";
TP[504]="28|Huelva";
TP[505]="28|Huesca";
TP[506]="28|Jaen";
TP[507]="28|La Coruna";
TP[508]="28|La Rioja";
TP[509]="28|Las Palmas";
TP[510]="28|Leon";
TP[511]="28|Lleida";
TP[512]="28|Madrid";
TP[513]="28|Malaga";
TP[514]="28|Murcia";
TP[515]="28|Navarra";
TP[516]="28|Orense";
TP[517]="28|Palencia";
TP[518]="28|Provincia de Lugo";
TP[519]="28|Provincia de Pontevedra";
TP[520]="28|Salamanca";
TP[521]="28|Santa Cruz de Tenerife";
TP[522]="28|Santander";
TP[523]="28|Segovia";
TP[524]="28|Sevilla";
TP[525]="28|Soria";
TP[526]="28|Tarragona";
TP[527]="28|Teruel";
TP[528]="28|Toledo";
TP[529]="28|Valencia";
TP[530]="28|Valladolid";
TP[531]="28|Vizcaya";
TP[532]="28|Zamora";
TP[533]="28|Zaragoza";
TPA[29]="Sweden";
TP[534]="29|Alvsborgs";
TP[535]="29|Blekinge";
TP[536]="29|Dalarnas";
TP[537]="29|Gävleborg";
TP[538]="29|Goteborgs och Bohus";
TP[539]="29|Gotland";
TP[540]="29|Halland";
TP[541]="29|Jämtland";
TP[542]="29|Jönköping";
TP[543]="29|Kalmar";
TP[544]="29|Kristianstads";
TP[545]="29|Kronoberg";
TP[546]="29|Malmohus";
TP[547]="29|Norrbotten";
TP[548]="29|Orebro";
TP[549]="29|Ostergötland";
TP[550]="29|Skåne";
TP[551]="29|Skaraborgs";
TP[552]="29|Södermanland";
TP[553]="29|Stockholm";
TP[554]="29|Uppsala";
TP[555]="29|Värmland";
TP[556]="29|Västerbotten";
TP[557]="29|Västernorrland";
TP[558]="29|Västmanland";
TP[559]="29|Västra Götaland";
TPA[30]="Switzerland";
TP[560]="30|Aargau";
TP[561]="30|Appenzell";
TP[562]="30|Basel";
TP[563]="30|Bern";
TP[564]="30|Fribourg";
TP[565]="30|Geneve";
TP[566]="30|Glarus";
TP[567]="30|Graubunden";
TP[568]="30|Jura";
TP[569]="30|Luzern";
TP[570]="30|Neuchatel";
TP[571]="30|Sankt Gallen";
TP[572]="30|Schaffhausen";
TP[573]="30|Schwyz";
TP[574]="30|Solothurn";
TP[575]="30|Thurgau";
TP[576]="30|Ticino";
TP[577]="30|Unterwalden";
TP[578]="30|Uri";
TP[579]="30|Valais";
TP[580]="30|Vaud";
TP[581]="30|Zug";
TP[582]="30|Zurich";
TPA[31]="Ukraine";
TPA[32]="United Kingdom";
TPA[33]="United States";
TP[583]="33|Alabama";
TP[584]="33|Alaska";
TP[585]="33|Arizona";
TP[586]="33|Arkansas";
TP[587]="33|Californie";
TP[588]="33|Caroline du Nord";
TP[589]="33|Caroline du Sud";
TP[590]="33|Colorado";
TP[591]="33|Connecticut";
TP[592]="33|D.C.";
TP[593]="33|Delaware";
TP[594]="33|Floride";
TP[595]="33|Georgie";
TP[596]="33|Hawaï";
TP[597]="33|Idaho";
TP[598]="33|Illinois";
TP[599]="33|Indiana";
TP[600]="33|Iowa";
TP[601]="33|Kansas";
TP[602]="33|Kentucky";
TP[603]="33|Louisiane";
TP[604]="33|Maine";
TP[605]="33|Maryland";
TP[606]="33|Massachusetts";
TP[607]="33|Michigan";
TP[608]="33|Minnesota";
TP[609]="33|Mississippi";
TP[610]="33|Missouri";
TP[611]="33|Montana";
TP[612]="33|Nebraska";
TP[613]="33|Nevada";
TP[614]="33|New Hampshire";
TP[615]="33|New Jersey";
TP[616]="33|New York";
TP[617]="33|North Dakota ";
TP[618]="33|Nouveau-Mexique";
TP[619]="33|Ohio";
TP[620]="33|Oklahoma";
TP[621]="33|Oregon";
TP[622]="33|Pennsylvanie";
TP[623]="33|Rhode Island";
TP[624]="33|South Dakota ";
TP[625]="33|Tennessee";
TP[626]="33|Texas";
TP[627]="33|Utah";
TP[628]="33|Vermont";
TP[629]="33|Virginie";
TP[630]="33|Washington";
TP[631]="33|West Virginia";
TP[632]="33|Wisconsin";
TP[633]="33|Wyoming";
TPA[34]="Venezuela";
TP[634]="34|Amazonas";
TP[635]="34|Anzoategui";
TP[636]="34|Apure";
TP[637]="34|Aragua";
TP[638]="34|Barinas";
TP[639]="34|Bolivar";
TP[640]="34|Carabobo";
TP[641]="34|Cojedes";
TP[642]="34|Delta Amacuro";
TP[643]="34|Dependencias Federales";
TP[644]="34|Distrito Federal";
TP[645]="34|Estado Nueva Esparta";
TP[646]="34|Falcon";
TP[647]="34|Guarico";
TP[648]="34|Lara";
TP[649]="34|Merida";
TP[650]="34|Miranda";
TP[651]="34|Monagas";
TP[652]="34|Portuguesa";
TP[653]="34|Sucre";
TP[654]="34|Tachira";
TP[655]="34|Trujillo";
TP[656]="34|Yaracuy";
TP[657]="34|Zulia";
TPA[35]="Yugoslavia";



function MAJPays(pays){
nbOptions = pays.length;
for (indPays=0; indPays < nbOptions; indPays++)
pays[0] = null;
pays.options[0] = new Option('Sélectionnez un pays', '');
pays.options[1] = new Option('Canada', 'Canada');
pays.options[2] = new Option('United States', 'United States');
for (indPaysOpt=3; indPaysOpt<(TPA.length+1); indPaysOpt++)
pays.options[indPaysOpt] = new Option(TPA[indPaysOpt-1], TPA[indPaysOpt-1]);
pays.options[TPA.length + 1] = new Option('Autre', 'Autre');
}

function MAJProvinces(pays, province, formulaire){
var nomChamps = pays.name;
if (typeof(formulaire) == 'undefined')
formulaire = 'document.Donnees.';
obj = eval(formulaire + nomChamps + 'Autre');
if (typeof(obj) != 'undefined')
{
if(pays[pays.selectedIndex].value == 'Autre'){
 obj.disabled = false;
}else{
 obj.disabled = true;
 obj.value = "";
}
}

nbOptions = province.length;
for (indOpt=0; indOpt < nbOptions; indOpt++)
province[0] = null;

bonNoPays = -1;
//Trouver l'index du pays	
for (indPays=0; indPays<TPA.length; indPays++){
if (TPA[indPays] == pays[pays.selectedIndex].value){
bonNoPays = indPays;
i = TPA.length;
}
};

cptProvince = 0;
province.options[0] = new Option('Sélectionnez une province', '');
for (indProv=1; indProv<(TP.length+1); indProv++){
tableauProvincePaysValeur = TP[indProv-1].split("|");
if (tableauProvincePaysValeur[0] == bonNoPays){
cptProvince = cptProvince + 1;
province.options[cptProvince] = new Option(tableauProvincePaysValeur[1], tableauProvincePaysValeur[1]);
};
};
province.options[cptProvince + 1] = new Option('Autre', 'Autre');
if (province.selectedIndex == -1)
province.options[0].selected = true;
}

function MAJProvincesAutres(province, formulaire){
var nomChamps = province.name;
if (typeof(formulaire) == 'undefined')
formulaire = 'document.Donnees.';
obj = eval(formulaire + nomChamps + 'Autre');
if (typeof(obj) != 'undefined')
{
if(province[province.selectedIndex].value == 'Autre'){
 obj.disabled = false;
}else{
 obj.disabled = true;
 obj.value = "";
}
}
}

function ActiverChampsAutre(champsSi,champsParent,champsAutre)
{
obj = document.getElementById(champsSi);
obj2 = document.getElementById(champsAutre);
if (champsParent[champsParent.selectedIndex].value == "Autre"){
obj.className = '';
//	obj2.focus();
}
else{
obj.className = 'desactive';
	obj2.disabled = 'disabled';
	obj2.value = '';
}
}




