function loadXML(){
if (document.implementation && document.implementation.createDocument){docXml = document.implementation.createDocument('', '', null);}
else if (window.ActiveXObject){docXml = new ActiveXObject("Microsoft.XMLDOM");}
else {alert('Votre navigateur ne saurait pas éxécuter ce script.');}
docXml.load("modules/realisation/bdd.xml");
}
var lot = 7;
var position = 1;
var dossier='http://www.horizongraphik.com/modules/realisation/images/';
//var dossier='http://localhost/horizongraphik/modules/realisation/images/';
var lect='play';
function lecture(action){
lect=action;
}		
function change(sens) {
if ( sens == '+' ) {
var image = docXml.getElementsByTagName('image');
var client = docXml.getElementsByTagName('client');
if ( position+(lot-1) < image.length ) {
i= 1 ;
for ( ii = position; ii < (position + lot); ii++ ) {
var num = parseInt(ii,10);	
document.getElementById('img' + i).src = dossier + 'loading.gif';
document.getElementById('img' + i).src = dossier + image[num].firstChild.nodeValue;
document.getElementById('img' + i).alt =client[num].firstChild.nodeValue;
i++;
}
position += 1;
}
}
if ( sens == '-' ) {
var image = docXml.getElementsByTagName('image');
var client = docXml.getElementsByTagName('client');
if ( position >= 1 ) {
if ( position == image.length ) {
position -= lot;
}
position -= 1;
i= 1 ;
for ( ii = position; ii < (position + lot); ii++ ) {
var num = parseInt(ii,10);				
document.getElementById('img' + i).src = dossier + 'loading.gif';
document.getElementById('img' + i).src = dossier + image[num].firstChild.nodeValue;
document.getElementById('img' + i).alt =client[num].firstChild.nodeValue;
i++;
}
}
}
if(lect=='play'){
sens1=sens;
if(sens=='+'){
setTimeout('change(sens1)',750);
}
if(sens=='-'){
setTimeout('change(sens1)',750);
}
}
}
function present(img){
var sel_img=document.getElementById(img).src;
var dossier='http://www.horizongraphik.com/modules/realisation/images/';
//var dossier='http://localhost/horizongraphik/modules/realisation/images/';
var client = docXml.getElementsByTagName('client');
var type = docXml.getElementsByTagName('type');
var image = docXml.getElementsByTagName('image');
var img_lg = docXml.getElementsByTagName('img_lg');
var img_gd = docXml.getElementsByTagName('img_gd');	
var lien = docXml.getElementsByTagName('lien');
var categorie = docXml.getElementsByTagName('categorie');
var commentaire = docXml.getElementsByTagName('commentaire');
for (i3=0;i3<=image.length-1;i3++){
var numero = parseInt(i3,10);
if(sel_img==dossier+image[numero].firstChild.nodeValue){
document.getElementById('img_pres').src=dossier+img_lg[numero].firstChild.nodeValue;		
document.getElementById('categorie').innerHTML=categorie[numero].firstChild.nodeValue;
document.getElementById('client').innerHTML=client[numero].firstChild.nodeValue;
document.getElementById('type').innerHTML=type[numero].firstChild.nodeValue;

var commentaire1 = commentaire[numero].firstChild.nodeValue;
// utilisation des regex pour les liens
var expression = /\[l=(.+)\](.+)\[\/l\]/;
expression.exec(commentaire1);
var raplacant = '<a href="http://'+ RegExp.$1 +'" target="_blank">' + RegExp.$2 +'</a>';
var commentaire2 = commentaire1.replace(expression,raplacant);

document.getElementById('commentaire').innerHTML=commentaire2;

if(categorie[numero].firstChild.nodeValue!='Créations graphiques'){
document.getElementById('lien').innerHTML='Lien vers le site : <a href="http://'+lien[numero].firstChild.nodeValue+'" target="_blank">'+lien[numero].firstChild.nodeValue+'</a>';}
else{document.getElementById('lien').innerHTML='';}
}}}
function grosplan(img_pres){
document.getElementById('gros_plan').src=dossier+'loading.gif';
var sel_img=document.getElementById(img_pres).src;
var image = docXml.getElementsByTagName('image');
var img_lg = docXml.getElementsByTagName('img_lg');
var img_gd = docXml.getElementsByTagName('img_gd');
document.getElementById('grandscreen').style.display='block';
document.getElementById('grandscreen').style.position='absolute';
document.getElementById('grandscreen').style.left='50%';
document.getElementById('grandscreen').style.top='60%';
document.getElementById('grandscreen').style.marginLeft='-320px';
document.getElementById('grandscreen').style.marginTop='-300px';
document.getElementById('grandscreen').style.width='640px';
document.getElementById('grandscreen').style.height='480px';
document.getElementById('grandscreen').style.background='#F8F8F8';
document.getElementById('grandscreen').style.border='2px solid #C3E20D';
document.getElementById('grandscreen').style.paddingLeft='16px';
document.getElementById('grandscreen').style.paddingRight='16px';
for (i3=0;i3<=image.length-1;i3++){	
var numero = parseInt(i3,10);
if(sel_img==dossier+img_lg[numero].firstChild.nodeValue){var pop_up=dossier+img_gd[numero].firstChild.nodeValue;}}
document.getElementById('preload').src=pop_up;	
preload(pop_up);
}
function fermer(id){
document.getElementById(id).style.display='none';
}
function cliquer(id){
document.getElementById('clic').style.display='block';
}
function recharge(){
var pop_up=document.getElementById('preload').src;
preload(pop_up);
}
function preload(pop_up){
var img=pop_up;
if(document.getElementById('preload').complete==true){
document.getElementById('gros_plan').src=img;
document.getElementById('preload').src=dossier+'loading.gif';
}
else{setTimeout('recharge()',1000);}}