function PopupImage(img) {
	myImage = new Image()
	myImage.src = img;

	xw    = myImage.width;
	xh    = myImage.height;
	ratio = myImage.width / myImage.height;

	if(ratio > 1) {
		if(xw > 800) { xw = 800; xh = 800 / ratio;	}
		if(xh > 600) { xh =600; xw = 600 * ratio; }
	} else {
		if(xh > 600) { xh = 600; xw = 600 * ratio; }
		if(xw > 800) { xw = 800; xh = 800 / ratio; }
	}

	titre=":: Image ::";
	w=open("",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=no');
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>");
	w.document.write("function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+40); window.focus();} else { setTimeout('check()',250) } }");
	w.document.write("</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
	w.document.write("<A href='javascript: self.close()'><IMG src='"+img+"' border=0 width='"+xw+"' height='"+xh+"'></a>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

function PopupImage(img) {
	myImage = new Image()
	myImage.src = img;

	xw    = myImage.width;
	xh    = myImage.height;
	ratio = myImage.width / myImage.height;

	if(ratio > 1) {
		if(xw > 800) { xw = 800; xh = 800 / ratio;	}
		if(xh > 600) { xh =600; xw = 600 * ratio; }
	} else {
		if(xh > 600) { xh = 600; xw = 600 * ratio; }
		if(xw > 800) { xw = 800; xh = 800 / ratio; }
	}

	titre=":: Image ::";
	w=open("",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=no');
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>");
	w.document.write("function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+40); window.focus();} else { setTimeout('check()',250) } }");
	w.document.write("</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
	w.document.write("<A href='javascript: self.close()'><IMG src='"+img+"' border=0 width='"+xw+"' height='"+xh+"'></a>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

function removeelements(){
	//store all elements with id=remove to "remove_el"
	var remove_el=document.all.remove
	//if there is only one element with id=remove
	if (remove_el!=''&&remove_el.length==null)
		remove_el.style.display='none'
	else {
		//for each element with id=remove
		for (i=0;i<remove_el.length;i++)
			remove_el[i].style.display='none'
	}
}
function revertback(){
	setTimeout("window.location.reload()",50)
}
window.onbeforeprint=removeelements
window.onafterprint=revertback
