// Retour le nom de la page courante
function CurrentPage() {
	var urlCourant = document.location.pathname, i = 0, currentPageFile = "", pos = "", size = 0;
	size = urlCourant.length;
	for (i = size - 1; i >= 0; i--) {
		pos = urlCourant.charAt(i);
		if (pos == "/") {
			i = -1;
			return currentPageFile;
		}
		else {
			currentPageFile = pos + currentPageFile;
		}
	}
}

// Ouverture de la page de tracking et redirection des urls produit
function redirect_url_produit(param) {
	u = "/catalogues/redirect.php?"+param;
	l = (document.all ? screen.width : screen.width) * 0.9;
	h = (document.all ? screen.height : screen.height-100) * 0.9;
	conf = 'scrollbars=yes,toolbar=yes,location=yes,directories=yes,menubar=yes,resizable=yes,status=yes,width=' + l + ',height=' + h + ',screenX=0,screenY=0,top=0,left=0';
	var F;
	F=open(u,'',conf);
	F.focus();
}

// ouverture d'une popup avec le choix de la taille et de l'url
function popup_page(page,largeur,hauteur){
	fenetre = window.open(page,'Information','toolbar=0,statusbar=0,location=0,directories=0,status=1,scrollbars=1,resizable=1,copyhistory=0,menuBar=0,width='+largeur+',height='+hauteur+',left=150,top=120');
	fenetre.focus();
	return false;
}

// Affiche une image dans une popup en adaptant la taille automatiquement.
function afficheMaxi(chemin) {
	i1 = new Image();
	i1.src = chemin;
	html = '<HTML><HEAD><TITLE>Nom de la fenêtre</TITLE></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=5 MARGINHEIGHT=0 body bgcolor="#4D5B88"><CENTER><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+24,document.imageTest.height+80)"></CENTER></BODY></HTML>';
	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0, width=500, height=375, left=250, top=125');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close()
}
