// debut module code cpv partie 2
var themes="themes";
// Cr�e un lien choisir/modifier pour pr�-remplir la popup CPV
function choisirModifier(clef, autre, principal, secondaires) {
var chaineP = "";
var chaine = "";
if (principal != null && principal[0] != "") {
chaineP = principal[0];
chaine = "&principal=" + chaineP;
}
var chaineS = "";
for (i = 0; i < secondaires.length ; i++) {
if (chaineS != "") {
chaineS += ",";
}
chaineS += secondaires[i][0];
}
if (secondaires.length != 0) {
chaine += "&secondaires=" + chaineS;
}
if (principal != null && principal[0] != "" && secondaires != null && secondaires.length < 1)
{
cssClass ="bouton-small";
textButtonCpv = "";
}
else
{
cssClass ="bouton-details-edit clear-both";
textButtonCpv = "";
}
folder=window.location.pathname.substr(0,window.location.pathname.lastIndexOf("/")).replace(/\//,"%2F");
return "" + textButtonCpv + "";
}
// Cr�e un span contenant le CPV et le code pour l'infobulle
function creeCodeBulle(id, cpv) {
var chaine = '' + cpv[0] + '';
chaine += '
';
return chaine;
}
// Fonction appel�e par la popup CPV
function retournerCPVs(clef, principal, secondaires) {
var min = document.getElementById("min").value;
var maxCPV = document.getElementById("max").value;
var langueCPV = document.getElementById("langueCPV").value;
var typeCPV = document.getElementById("typeCPV").value;
for (indexHidden = 1; indexHidden <=maxCPV; indexHidden++)
{
code_cpv_secondaire = document.getElementById(clef+indexHidden);
libeller_code_cpv_secondaire = document.getElementById(clef+ '_libelle'+indexHidden);
code_cpv_secondaire.value = '';
libeller_code_cpv_secondaire.value = '';
}
var p =0;
switch (typeCPV) {
case '0':
res = document.getElementById("resultat");
res.innerHTML = "R�sultats:
";
if (principal != null) {
res.innerHTML += "Principal: "
+ principal[0]
+ " : " + principal[1];
}
if (secondaires != null) {
chaine = "
Secondaires:
";
for (i = 0; i < secondaires.length; i++) {
chaine += secondaires[i][0] + ":" + secondaires[i][1] + "
";
}
res.innerHTML += chaine;
}
break;
case 'cas1':
res = document.getElementById('cas1');
res.innerHTML = choisirModifier(clef, "&min=" + min +"&max=" + maxCPV +"&demandeprincipal=true&locale="+ langueCPV +"", principal, secondaires);
code_cpv_principal = document.getElementById(''+clef+'_1');
libeller_code_cpv_principal = document.getElementById(clef+ '_libelle' + '_1');
code_cpv_principal.value = principal[0];
libeller_code_cpv_principal.value = principal[1];
break;
case 'cas2':
res = document.getElementById('cas2'+ clef);
chaineTableCPV = "";
if (principal[0] != null)
{
chaineTableCPV += "";
chaineTableCPV += "";
chaineTableCPV += creeCodeBulle('id2Bubulle'+ clef, principal);
chaineTableCPV += " | ";
chaineTableCPV +="(Code principal) | ";
chaineTableCPV += "
";
code_cpv_principal = document.getElementById(clef+'1');
libeller_code_cpv_principal = document.getElementById(clef+ '_libelle'+'1');
code_cpv_principal.value = principal[0];
libeller_code_cpv_principal.value = principal[1];
p = 1;
if (secondaires.length)
{
chaineTableCPV += "";
for (i = 0 ; i < secondaires.length ; i++) {
secondairesCPV = new Array()
secondairesCPV[0] = secondaires[i][0];
secondairesCPV[1] = secondaires[i][1];
chaineTableCPV += "";
if (i != 0) {
secondairesCPV[0] = ";"+secondairesCPV[0];
}
chaineTableCPV += creeCodeBulle('id2Bubulle'+ clef + i, secondairesCPV);
chaineTableCPV += " | ";
iCPV = i + 1 + p;
code_cpv_secondaire = document.getElementById(clef+''+iCPV);
libeller_code_cpv_secondaire = document.getElementById(clef+ '_libelle'+''+iCPV);
code_cpv_secondaire.value = secondaires[i][0];
libeller_code_cpv_secondaire.value = secondaires[i][1];
}
chaineTableCPV += "
";
}
}
chaineTableCPV += "";
chaineTableCPV += "";
chaineTableCPV += choisirModifier(clef, "&min=" + min +"&max=" + maxCPV +"&demandeprincipal=true&locale="+ langueCPV +"", principal, secondaires);
chaineTableCPV += " ";
chaineTableCPV += " ";
chaineTableCPV += " | ";
chaineTableCPV += "
";
chaineTableCPV += "
";
/*if (principal.length == 0 || principal[0] == null)
{
chaineTableCPV += " (Au moins une valeur � remplir si la case Codes CPV est coch�e)";
}*/
chaineTableCPV += "";
res.innerHTML = chaineTableCPV;
break;
case 'cas3':
res = document.getElementById('cas3' + clef);
chaine = "";
if (principal[0] != "") {
chaine = principal[0];
p = 1;
}
for (i = 0 ; i < secondaires.length ; i++) {
if (chaine != "") {
chaine += "; ";
}
chaine += secondaires[i][0];
iCPV = i + 1 + p;
code_cpv_secondaire = document.getElementById(clef+''+iCPV);
libeller_code_cpv_secondaire = document.getElementById(clef+ '_libelle'+''+iCPV);
code_cpv_secondaire.value = secondaires[i][0];
libeller_code_cpv_secondaire.value = secondaires[i][1];
}
res.innerHTML = chaine;
break;
case 'cas4':
res = document.getElementById('cas4'+ clef);
chaineTableCPV = "";
res.innerHTML = chaineTableCPV;
if (principal[0] != null)
{
chaineTableCPV += "";
chaineTableCPV += "";
chaineTableCPV += creeCodeBulle('id4Bubulle'+ clef, principal);
chaineTableCPV += " | ";
chaineTableCPV +="(Code principal) | ";
chaineTableCPV += "
";
code_cpv_principal = document.getElementById(clef+'1');
libeller_code_cpv_principal = document.getElementById(clef+ '_libelle'+'1');
code_cpv_principal.value = principal[0];
libeller_code_cpv_principal.value = principal[1];
p = 1;
if (secondaires.length)
{
chaineTableCPV += "";
for (i = 0 ; i < secondaires.length ; i++) {
secondairesCPV = secondaires[i];
chaineTableCPV += "";
if (i != 0) {
secondairesCPV[0] = ";"+secondairesCPV[0];
}
chaineTableCPV += creeCodeBulle('id4Bubulle'+ clef + i, secondairesCPV);
chaineTableCPV += " | ";
iCPV = i + 1 + p;
code_cpv_secondaire = document.getElementById(clef+''+iCPV);
libeller_code_cpv_secondaire = document.getElementById(clef+ '_libelle'+''+iCPV);
code_cpv_secondaire.value = secondaires[i][0];
libeller_code_cpv_secondaire.value = secondaires[i][1];
}
chaineTableCPV += "
";
}
}
chaineTableCPV += "
";
chaineTableCPV += "";
res.innerHTML = chaineTableCPV;
break;
case 'cas5':
res = document.getElementById('cas5' + clef);
var chaine = "";
chaine += "";
if (secondaires.length)
{
for (i = 0 ; i < secondaires.length ; i++) {
chaine += "";
chaine += "";
chaine += creeCodeBulle('id5Bubulle'+ clef + i, secondaires[i]);
chaine += " | ";
chaine += " : ";
if (secondaires[i][1].length >50)
chaine += secondaires[i][1].substring(0,51) + "...";
else
chaine += secondaires[i][1];
chaine += " | ";
chaine += "
";
iCPV = i + 1;
code_cpv_secondaire = document.getElementById(clef+''+iCPV);
libeller_code_cpv_secondaire = document.getElementById(clef+ '_libelle'+''+iCPV);
code_cpv_secondaire.value = secondaires[i][0];
libeller_code_cpv_secondaire.value = secondaires[i][1];
}
}
chaine += "";
chaine += "";
chaine += choisirModifier(clef, "&min=" + min +"&max=" + maxCPV +"&demandeprincipal=false&locale="+ langueCPV +"", principal, secondaires);
chaine += " ";
chaine += " | ";
chaine += "
";
chaine += "
";
chaine += "";
res.innerHTML = chaine;
break;
case 'cas6':
res = document.getElementById('cas6'+ clef);
chaineTableCPV = "";
if (secondaires.length)
{
chaineTableCPV += "";
for (i = 0 ; i < secondaires.length ; i++) {
secondairesCPV = new Array()
secondairesCPV[0] = secondaires[i][0];
secondairesCPV[1] = secondaires[i][1];
chaineTableCPV += "";
if (i != 0) {
secondairesCPV[0] = ";"+secondairesCPV[0];
}
chaineTableCPV += creeCodeBulle('id6Bubulle'+ clef + i, secondairesCPV);
chaineTableCPV += " | ";
iCPV = i + 1;
code_cpv_secondaire = document.getElementById(clef+''+iCPV);
libeller_code_cpv_secondaire = document.getElementById(clef+ '_libelle'+''+iCPV);
code_cpv_secondaire.value = secondaires[i][0];
libeller_code_cpv_secondaire.value = secondaires[i][1];
}
chaineTableCPV += "
";
}
chaineTableCPV += "";
chaineTableCPV += "";
chaineTableCPV += choisirModifier(clef, "&min=" + min +"&max=" + maxCPV +"&demandeprincipal=false&locale="+ langueCPV +"", principal, secondaires);
chaineTableCPV += " ";
chaineTableCPV += " | ";
chaineTableCPV += "
";
chaineTableCPV += "
";
chaineTableCPV += "";
res.innerHTML = chaineTableCPV;
break;
case 'cas7':
res = document.getElementById('cas7' + clef);
if (principal.length)
{
res.innerHTML = principal[0];
res.innerHTML += " (Code principal)
";
}
if (secondaires.length)
{
for (i = 0 ; i < secondaires.length ; i++) {
if (i != 0) {
res.innerHTML += ";";
}
res.innerHTML += secondaires[i][0];
}
}
break;
case 'cas8':
res = document.getElementById('cas8' + clef);
var chaine = "";
if (secondaires.length)
{
for (i = 0 ; i < secondaires.length ; i++) {
chaine += secondaires[i][0] + " : " + secondaires[i][1] + "
";
iCPV = i + 1;
code_cpv_secondaire = document.getElementById(clef+''+iCPV);
libeller_code_cpv_secondaire = document.getElementById(clef+ '_libelle'+''+iCPV);
code_cpv_secondaire.value = secondaires[i][0];
libeller_code_cpv_secondaire.value = secondaires[i][1];
}
}
res.innerHTML = chaine;
res.innerHTML += choisirModifier(clef, "&min=" + min +"&max=" + maxCPV +"&demandeprincipal=false&locale="+ langueCPV +"", principal, secondaires);
break;
default:
alert("");
}
}
// Remplissage dynamique de la page
function remplirCPV(clef, principal, secondaires, themesA)
{
themes="%2F" + themesA.replace(/\//,"%2F");
retournerCPVs(clef, principal, secondaires);
}
//////////////////////////////////////Infos-bulles//////////////////////////////////
/*Checks IE 6.0*/
var name = navigator.appName ;
var version = navigator.appVersion;
if (name == 'Microsoft Internet Explorer') {
id = version.indexOf('MSIE');
version = version.substring(id+5,id+9);
}
var idBulleT;
var chrono = null;
var delai = "500";
function afficheBulle(idBulle,parent)
{
var bulle = document.getElementById(idBulle);
var offset;
var exp = new RegExp("^td_","gi");
if (chrono!=null)
{
clearTimeout(chrono);
cacheBulleT();
}
bulle.style.display = "block";
var bulleLeft = parent.offsetLeft+10;
var bulleTop = parent.offsetTop-bulle.offsetHeight;
var windowWidth = 0;
if (typeof(window.innerWidth) == 'number') {
windowWidth= window.innerWidth;
}
else {
if (document.documentElement && document.documentElement.clientWidth) {
windowWidth= document.documentElement.clientWidth;
}
else {
if (document.body && document.body.clientWidth) {
windowWidth = document.body.clientWidth;
}
}
}
bulle.style.left = bulleLeft+'px';
bulle.style.top = bulleTop+'px';
if((bulleLeft+bulle.offsetWidth+20) > windowWidth) {
bulle.style.left = (bulleLeft-bulle.offsetWidth)+'px';
}
//check Internet Exporer VErsion
//create iframe to fix ie6 select z-index bug
if (version == '6.0;') {
var myBulleIframe = '';
var myMessage = bulle.innerHTML;
bulle.innerHTML = myBulleIframe + myMessage;
var myBulleHeight = bulle.offsetHeight;
var myBulleWidth = bulle.offsetWidth;
myNewID = idBulle+'-Iframe';
var myNewIframe = document.getElementById(myNewID);
var parentClass = myNewIframe.parentNode.className;
var iframeNewClass = parentClass+'-Iframe';
myNewIframe.className = iframeNewClass;
myNewIframe.style.height = myBulleHeight;
myNewIframe.style.width = myBulleWidth;
//alert(myNewIframe.style.height);
//alert(myNewIframe.className);
}
}
function cacheBulleT()
{
document.getElementById(idBulleT).style.display = "none";
chrono = null;
}
function cacheBulle(idBulle)
{
idBulleT = idBulle;
chrono = setTimeout("cacheBulleT()",delai);
//document.getElementById(idBulle).style.display = "none";
}
function mouseOverBulle()
{
clearTimeout(chrono);
chrono = null;
}
function mouseOutBulle()
{
chrono = setTimeout("cacheBulleT()",delai);
}
//////////////////////////////////////End Infos-bulles//////////////////////////////////
function isCheckedCPVObligatoire(myInput) {
if (myInput.checked == true)
{
var inputElems;
inputElems = document.getElementsByTagName("div");
for( i=0; i < inputElems.length; i++)
{
var inputName = inputElems[i].name;
if (inputName)
{
alert(inputName);
if(inputName.search(/bloccode_cpv/)==0)
{
inputElems[i].style.display = 'block';
}
}
}
//document.getElementsByTagName().getElementById(myDiv).style.display = 'block';
}
if (myInput.checked == false) {
var inputElems;
inputElems = document.getElementsByTagName("div");
for( i=0; i < inputElems.length; i++)
{
var inputName = inputElems[i].name;
if (inputName)
{
alert(inputName);
if(inputName.search(/bloccode_cpv/)==0)
{
inputElems[i].style.display = 'none';
}
}
}
//document.getElementById(myDiv).style.display = 'none';
}
}
// fin module code cpv partie 2