function popup(id,hauteur,largeur){  
	window.open("image.php?id="+id,"Popup","status=no,height="+hauteur+",width="+largeur+",top=0,left=0");  
} 
function ahah(url,target) { 
	document.getElementById(target).innerHTML = 'loading data...'; 
	if (window.XMLHttpRequest) { req = new XMLHttpRequest();
        req.onreadystatechange = function() {ahahDone(target);};
        req.open("GET", url, true);
        req.send(null);
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = function() {ahahDone(target);};
            req.open("GET", url, true);
            req.send();
        }
    }
} 
function ahahDone(target) {
   // only if req is "loaded"
   if (req.readyState == 4) {
       // only if "OK"
       if (req.status == 200 || req.status == 304) {
           results = req.responseText;
           document.getElementById(target).innerHTML = results;
       } else {
           document.getElementById(target).innerHTML="ahah error:\n" +
               req.statusText;
       }
   }
}
function getPic(fichier,id){
	ahah('ahah.php?img='+fichier+'&id='+id,'image');
	ahahDone('image');
	$('image').makeDraggable();
}

function closePic(){
	ahah('ahah.php?img=none','image');
	ahahDone('image');
}

function nextPic(id){
	var next = $('img'+id).getNext().getChildren();
	getPic(next[0].title,next[0].id);
}
function pizza(text){
	$('ecran').setStyles({
	   position: 'absolute',
	   top:'0',
	   left:'0',
	   width: '100%',
	   height: 8000
	});	
	if(text && text != 'sans titre') {
	document.getElementById('legend').innerHTML='<img src="dotitre.php?text='+escape(text)+'&size=20&fond=102-102-102&font=VINERITC" alt="'+escape(text)+'" />';
	} else {
	document.getElementById('legend').innerHTML='';
	}
}
function nopizza(){
	$('ecran').setStyles({
	   width: '0',
	   height: '0'
	});	
}