/******** taille des popUps ŕ modifier si nécessaire*/
var spots=new Array();
spots['x']=300;
spots['y']=300;
var revue=new Array();
revue['x']=400;
revue['y']=600;
var images=new Array();
images['x']=600;
images['y']=600;
var bus=new Array();
bus['x']=500;
bus['y']=600;
/****************************************************/
var currentXML=1;
var nbXML;

oA._addEvent(window,'load',init);

function init(){
	var spots_elmt=document.getElementById('spots');
	if(spots_elmt){
		oA._addEvent(spots_elmt,'click',popUp);
	}
	var images_elmt=document.getElementById('images');
	if(images_elmt){
		oA._addEvent(images_elmt,'click',popUp);
	}
	var revue_elmt=document.getElementById('revue');
	if(revue_elmt){
		oA._addEvent(revue_elmt,'click',popUp);
	}
	var bus_elmt=document.getElementById('bus');
	if(bus_elmt){
		oA._addEvent(bus_elmt,'click',popUp);
	}
	var previous=document.getElementById('previous');
	if(previous){
		oA._addEvent(previous,'click',changeXML);
		oA._sendRequest('GET','presse_content/countXML.php',countXML);
	}
	var next=document.getElementById('next');
	if(next){
		oA._addEvent(next,'click',changeXML);
	}
}

function popUp(e){
	var target=oA._getTarget(e);
	var url=target.getAttribute('href');
	var taille=eval(target.id);
	window.open(url,'','width='+taille['x']+',height='+taille['y']+',top=20,left=20,scrollbars=yes,resizable=yes');
	return oA._cancelClick(e);
}
function loadXMLContent(xhr){
	var xml=xhr.responseText;
	document.getElementById('content').innerHTML=xml;
}
function changeXML(e){
	var target=oA._getTarget(e);
	docXML=target.getAttribute('id')=='previous'?currentXML-1:currentXML+1;
	docXML=docXML<1?nbXML:docXML;
	docXML=docXML>nbXML?1:docXML;
	oA._sendRequest('GET','presse_content/presse_'+docXML+'.xml',loadXMLContent);
	currentXML=docXML;
}
function countXML(xhr){
	nbXML=xhr.responseText;
	oA._sendRequest('GET','presse_content/presse_'+currentXML+'.xml',loadXMLContent);
}