﻿// (c) ATXOOM 2005
if (typeof(strWebAdmin) == 'undefined') {
	var strWebAdmin = '';
}
var arrMain = new Array(WebRoot + 'soc/',WebRoot + 'off/',WebRoot + 'tra/',WebRoot + 'ctact/',WebRoot + 'cli/');
var arrAdmin = new Array(WebRoot + strWebAdmin + 'users.aspx',WebRoot + strWebAdmin + 'albums.aspx',WebRoot + strWebAdmin + 'albums_prives.aspx',WebRoot + strWebAdmin + 'refcom.aspx',WebRoot + '_outils/_securite/logout.aspx');
var intMain = null;
var intMain_Sel = null;

var intSub = null;
var intSub_Sel = null;
var blnSub_Exist = false;

var intDefault = null;
var intDefault_Sel = null;
var arrDefault = new Array(WebRoot + 'ctact/',WebRoot + 'tra/');

var	oWinDiapo = null;
var	newWin = null;
var strImgToLoad = null;
var intIndexToLoad = null;

var intTdWidth = 4;
var intTable = 0;
var arrImage = new Array();
var arrIndex = new Array();
var intImage = 0;
var intImagesCount0 = 0;
var	intImagesCount = 0;

var oDocAll	= null;
var blnIsIE	= false;
if (document.all) {
	oDocAll = document.all;
	blnIsIE	= true;
}
else {
	oDocAll = document;
}

function pmb_JavaDetect() {
	if (navigator.javaEnabled() == false) {
		document.write('<p style="color:red">Cette page Internet nécessite la présence d\'un composant Java. Ce composant n\'a pas été détecté sur votre ordinateur. Vous pouvez télécharger et installer gratuitement "Java Plug-in" à cette <a href="http://www.java.com/fr/download/" target="_blank" style="color:orange">adresse</a>.</p>');
	}
}

// =====================================
//
// Menu principal
//
// =====================================

function pmb_loaded() {

	atx_OutOfFrame();

	var sPathName = document.location.pathname;
	for (var i = 0; i < arrMain.length; i++) {
		if (sPathName.indexOf(arrMain[i]) >= 0) {
			intMain = i;
			try {
				oDocAll['button_' + i.toString()].src = oDocAll['button_' + i.toString()].src.replace(/_off/,'_on');
			}
			catch (e) {}
		}
	}
}

function pmb_main_over(i) {
	if (i != null && i != intMain) {
		intMain_Sel = i;
		oDocAll['button_' + i.toString()].src = oDocAll['button_' + i.toString()].src.replace(/_off/,'_on');
	}
	return atx_LinkOver('');
}

function pmb_main_out() {
	if (intMain_Sel != null && intMain_Sel != intMain) {
		oDocAll['button_' + intMain_Sel.toString()].src = oDocAll['button_' + intMain_Sel.toString()].src.replace(/_on/,'_off');
	}
	return atx_LinkOut('');
}

function pmb_main_nav(i) {
	if (i < arrMain.length) {
		if (arrMain[i] != null) {
			document.location = arrMain[i];
		}
	}
}

function pmb_admin_nav(i) {
	if (i < arrAdmin.length) {
		if (arrAdmin[i] != null) {
			document.location = arrAdmin[i];
		}
	}
}

// =====================================
//
// Sous-menus
//
// =====================================

function pmb_sub_draw() {

	var sHtml = '';
	for (var i = 0; i < arrSub.length; i++) {
		sHtml += '<a href="javascript:pmb_sub_nav(' + i.toString() + ');">';
		sHtml += '<img id="pmb_sub_' + i.toString() + '" onmouseover="return(pmb_sub_over(' + i.toString() + '));" onmouseout="return(pmb_sub_out(false));" src="' + WebRoot + '_commun/_images/_button/theme_' + arrSub[i] + '_off.jpg" border="0" width="120" height="38" alt="" title="" /></a>';
	}

	document.write(sHtml);
	blnSub_Exist = true;
}

function pmb_sub_draw_private() {
	var sHtml = '';
	for (var i = 0; i < arrSub.length; i++) {
		sHtml += '<a href="javascript:pmb_sub_nav_private(' + i.toString() + ');">\n';
		sHtml += '<img id="pmb_sub_' + i.toString() + '" onmouseover="return(pmb_sub_over(' + i.toString() + '));" onmouseout="return(pmb_sub_out(false));" src="' + WebRoot + '_commun/_images/_button/theme_' + arrSub[i] + '_off.jpg" border="0" width="120" height="38" alt="" title="" /></a>\n';
	}

	document.write(sHtml);
	blnSub_Exist = true;
}

function pmb_sub_over(i) {
	if (i != null) {
		intSub_Sel = i;
		try {
			if (oDocAll['pmb_sub_' + i.toString()] != null) oDocAll['pmb_sub_' + i.toString()].src = oDocAll['pmb_sub_' + i.toString()].src.replace(/_off/,'_on');
		}
		catch (e) {}
	}
	return atx_LinkOver();
}

function pmb_sub_out(bForce) {
	if (intSub_Sel != null && (intSub_Sel != intSub || bForce == true)) {
		try {
			oDocAll['pmb_sub_' + intSub_Sel.toString()].src = oDocAll['pmb_sub_' + intSub_Sel.toString()].src.replace(/_on/,'_off');
		}
		catch (e) {}
	}
	return atx_LinkOut();
}

function pmb_sub_nav(i) {

	if (i == -1) {
		i = 0;

		var sSearch = document.location.search;
		var intPos = sSearch.indexOf('theme=');
		if (intPos >= 0) {
			intPos += 'theme='.length;
			i = parseInt(sSearch.substring(intPos, intPos + 1));
		}
		else {
			var strNoCookieDetect = '<No cookie>';
			var strCookieString   = GetCookie('PMB_PUBLIC', strNoCookieDetect);
			if (strCookieString != strNoCookieDetect) {
				i = parseInt(strCookieString);
			}
		}
		if (i == -1) i = 0;
	}

	if (i != null) {
		pmb_sub_out(false);
		intSub_Sel = intSub;
		pmb_sub_out(true);
		pmb_sub_over(i);
		intSub = i;
		pmb_galerie_draw(i.toString(), true);

		var expdate = new Date();
		expdate.setTime(expdate.getTime() + (3650 * 86400000));
		SetCookie('PMB_PUBLIC', i.toString(), expdate);

	}
}

function pmb_sub_nav_private(i) {;

	pmb_pola_ShowOver();
	
	if (i == 8) {
		document.location = 'iptc_query.aspx';
	}

	if (i == -1) {
		i = 0;
		var strNoCookieDetect = '<No cookie>';
		var strCookieString   = GetCookie('PMB_PRIVATE', strNoCookieDetect);
		if (strCookieString != strNoCookieDetect) {
			i = parseInt(strCookieString);
			if (i == -1) i = 0;
		}
	}

	if (i != null) {
		pmb_sub_out(false);
		intSub_Sel = intSub;
		pmb_sub_out(true);
		pmb_sub_over(i);
		intSub = i;
		pmb_galerie_draw_private(i.toString(), false);

		var expdate = new Date();
		expdate.setTime(expdate.getTime() + (3650 * 86400000));
		SetCookie('PMB_PRIVATE', i.toString(), expdate);

	}
}

// =====================================
//
// Raccourcis (Page default)
//
// =====================================

function pmb_default_over(i) {
	if (i != null && i != intDefault) {
		intDefault_Sel = i;
		oDocAll['pmb_default_' + i.toString()].src = oDocAll['pmb_default_' + i.toString()].src.replace(/_off/,'_on');
	}

}

function pmb_default_out() {
	if (intDefault_Sel != null && intDefault_Sel != intDefault) {
		oDocAll['pmb_default_' + intDefault_Sel.toString()].src = oDocAll['pmb_default_' + intDefault_Sel.toString()].src.replace(/_on/,'_off');
	}
}

function pmb_default_nav(i) {
	if (i < arrDefault.length) {
		if (arrDefault[i] != null) {
			document.location = arrDefault[i];
		}
	}
}

// =====================================
//
// Galeries
//
// =====================================

function pmb_galerie_draw(intTheme, blnPub) {

	pmb_GetDiapData(intTheme);

	var intTd = 0;
	
	var sHtml = '';

	if (arrGalerie_D.length > 0) {
		sHtml += '<table border="0" cellpadding="0" cellspacing="0">';
		while(intTd < arrGalerie_D.length) {
			sHtml += '<tr>';
			for (var i = 0; i < intTdWidth; i++) {
				sHtml += '<td width="150" height="187">';
				if (intTd < arrGalerie_D.length) {
					sHtml += '<table width="150" border="0" cellpadding="0" cellspacing="0">';
					sHtml += '<tr>';
					sHtml += '<td width="13" height="187" rowspan="4">';
					sHtml += '<img src="' + WebRoot + '_commun/_images/_pola/slice_01.jpg" width="13" height="187" title="" alt="" /></td>';
					sHtml += '<td width="120" height="14">';
					sHtml += '<img src="' + WebRoot + '_commun/_images/_pola/slice_02.jpg" width="120" height="14" title="" alt="" /></td>';
					sHtml += '<td width="17" height="187" rowspan="4">';
					sHtml += '<img src="' + WebRoot + '_commun/_images/_pola/slice_03.jpg" width="17" height="187" title="" alt="" /></td>';
					sHtml += '</tr>';
					sHtml += '<tr>';
					sHtml += '<td width="120" height="128" background="' + WebRoot + '_commun/_images/_pola/slice_04.jpg" align="center" valign="middle">';
					if (arrGalerie_D[intTd] != null) {
						sHtml += '<a href="javascript:pmb_pola_SlideShow(' + intTd.toString() + ',' + blnPub + ');">';
						sHtml += '<img border="0" src="' + str_atx_imgdir + '/_data/_dossiers/' + arrGalerie_D[intTd] + '_index.jpg" title="Feuilleter l\'Album" alt="Feuilleter l\'Album" onmouseover="return atx_LinkOver(\'\');" onmouseout="return atx_LinkOut(\'\');" /></a>';
					}
					else {
						sHtml += '&nbsp;';
					}
					sHtml += '</td>';
					sHtml += '</tr>';
					sHtml += '<tr>';
					sHtml += '<td width="120" height="31" background="' + WebRoot + '_commun/_images/_pola/slice_05.jpg" align="center" valign="middle">';
					if (arrGalerie_T[intTd] != null) {
						sHtml += '<div class="diaporama_title" style="overflow:hidden;width:120px;height:26px;" onmouseover="return atx_LinkOver(\'\');" onmouseout="return atx_LinkOut(\'\');"><font size="1">';
						sHtml += '<a href="javascript:pmb_pola_SlideShow(' + intTd.toString() + ',' + blnPub + ');" title="Feuilleter l\'Album" onmouseover="atx_LinkOver();">';
						sHtml += arrGalerie_T[intTd]
						sHtml += '</a></font></div>';
					}
					else {
						sHtml += '&nbsp;';
					}
					sHtml += '</td>';
					sHtml += '</tr>';
					sHtml += '<tr>';
					sHtml += '<td width="120" height="14">';
					sHtml += '<img src="' + WebRoot + '_commun/_images/_pola/slice_06.jpg" width="120" height="14" title="" alt="" /></td>';
					sHtml += '</tr>';
					sHtml += '</table>';
				}
				else {
					sHtml += '&nbsp;';
				}
				sHtml += '</td>';
				intTd++;
			}
			sHtml += '</tr>';
		}
		sHtml += '</table>';
	}
	else {
		sHtml += '<p><b>Ce thème ne possède aucun album.</b><br /><br />Merci de bien vouloir nous contacter si vous pensez qu\'il s\'agit d\'une situation anormale.</p>';
	}

	var oP;
	if (blnIsIE == true) {
		oP = oDocAll.pmb_dia_list;
	}
	else {
		oP = document.getElementById('pmb_dia_list');
	}
	oP.innerHTML = sHtml;
}

function pmb_galerie_draw_private(intTheme, blnPub) {

	pmb_GetDiapData(intTheme);

	var intDossier = 0;

	var sHtml = '';

	if (arrGalerie_D.length > 0) {
		sHtml += '<ul>';
		while(intDossier < arrGalerie_D.length) {
			sHtml += '<li>';
			sHtml += '<a href="javascript:pmb_dossier_draw(' + intTheme.toString() + ', ' + intDossier.toString() + ',' + blnPub.toString() + ');">';
			sHtml += arrGalerie_T[intDossier];
			sHtml += '</a>';
			sHtml += '</li>';
			intDossier++;
		}
		sHtml += '</ul>';
	}
	else {
		sHtml += '<p><b>Ce thème ne possède aucun album.</b><br /><br />Merci de bien vouloir nous contacter si vous pensez qu\'il s\'agit d\'une situation anormale.</p>';
	}

	if (intDossier == 1) {
		pmb_dossier_draw(intTheme, 0, blnPub);
	}
	else {
		var oP;
		if (blnIsIE == true) {
			oP = oDocAll.pmb_dia_help;
		}
		else {
			oP = document.getElementById('pmb_dia_help');
		}
		oP.innerHTML = '<p>Pour ouvrir un album : sélectionnez un Thème (par exemple "Vie Privée") puis cliquez sur le titre de l\'Album de votre choix :</p>';
		
		if (blnIsIE == true) {
			oP = oDocAll.pmb_dia_list;
		}
		else {
			oP = document.getElementById('pmb_dia_list');
		}
		oP.innerHTML = sHtml;
	}
}

function pmb_dossier_draw(intTheme, intDossier, blnPub) {

	pmb_GetDiapData(intTheme);

	var sHtml = '';
	sHtml += '<table width="150" border="0" cellpadding="0" cellspacing="0">';
	sHtml += '<tr><td colspan="3">';
	sHtml += '<p align="center">';
	sHtml += '<a href="javascript:pmb_pola_SlideShow(' + intDossier.toString() + ',' + blnPub + ');">Album</a> / ';
	sHtml += '<a href="order_contact.aspx?IX=' + arrGalerie_D[intDossier] + '">Planches</a></p>';
	sHtml += '</td></tr>';
	sHtml += '<tr>';
	sHtml += '<td width="13" height="187" rowspan="4">';
	sHtml += '<img src="' + WebRoot + '_commun/_images/_pola/slice_01.jpg" width="13" height="187" title="" alt="" /></td>';
	sHtml += '<td width="120" height="14">';
	sHtml += '<img src="' + WebRoot + '_commun/_images/_pola/slice_02.jpg" width="120" height="14" title="" alt="" /></td>';
	sHtml += '<td width="17" height="187" rowspan="4">';
	sHtml += '<img src="' + WebRoot + '_commun/_images/_pola/slice_03.jpg" width="17" height="187" title="" alt="" /></td>';
	sHtml += '</tr>';
	sHtml += '<tr>';
	sHtml += '<td width="120" height="128" background="' + WebRoot + '_commun/_images/_pola/slice_04.jpg" align="center" valign="middle">';
	if (arrGalerie_D[intDossier] != null) {
		sHtml += '<a href="javascript:pmb_pola_SlideShow(' + intDossier.toString() + ',' + blnPub + ');">';
		sHtml += '<img border="0" src="' + str_atx_imgdir + '/_data/_dossiers/' + arrGalerie_D[intDossier] + '_index.jpg" title="Feuilleter l\'Album" alt="Feuilleter l\'Album" onmouseover="return atx_LinkOver(\'\');" onmouseout="return atx_LinkOut(\'\');" /></a>';
	}
	else {
		sHtml += '&nbsp;';
	}
	sHtml += '</td>';
	sHtml += '</tr>';
	sHtml += '<tr>';
	sHtml += '<td width="120" height="31" background="' + WebRoot + '_commun/_images/_pola/slice_05.jpg" align="center" valign="middle">';
	if (arrGalerie_T[intDossier] != null) {
		sHtml += '<div class="diaporama_title" onmouseover="return atx_LinkOver(\'\');" onmouseout="return atx_LinkOut(\'\');">';
		sHtml += '<a href="javascript:pmb_pola_SlideShow(' + intDossier.toString() + ',' + blnPub + ');"><font size="1">';
		sHtml += arrGalerie_T[intDossier] + '</a></font></div>';
	}
	else {
		sHtml += '&nbsp;';
	}
	sHtml += '</td>';
	sHtml += '</tr>';
	sHtml += '<tr>';
	sHtml += '<td width="120" height="14">';
	sHtml += '<img src="' + WebRoot + '_commun/_images/_pola/slice_06.jpg" width="120" height="14" title="" alt="" /></td>';
	sHtml += '</tr>';
	sHtml += '</table>';

	var	oP;
	if (blnIsIE == true) {
		oP = oDocAll.pmb_dia_help;
	}
	else {
		oP = document.getElementById('pmb_dia_help');
	}
	oP.innerHTML = '<p>Cliquez sur l\'image pour feuilleter l\'Album, ou bien utilisez les Planches Contact pour préparer votre commande (les images y apparaissent dans leur cadrage définitif).</p>';

	if (blnIsIE == true) {
		oP = oDocAll.pmb_dia_list;
	}
	else {
		oP = document.getElementById('pmb_dia_list');
	}
	oP.innerHTML = sHtml;
}

function pmb_pola_SlideShow(intMyTd, blnPub) {
	pmb_pola_ShowOver();
	if (blnPub == true) {
		oWinDiapo = window.open(WebRoot + 'tra/index.aspx?IX=' + arrGalerie_D[intMyTd],'Album','height=' + (arrGalerie_H[intMyTd]*1 + 50) + ',width=' + (arrGalerie_W[intMyTd]*1 + 200) + ',scrollbars=no,resizable=yes,status=no');
	}
	else {
		oWinDiapo = window.open(WebRoot + 'tra/index_prives.aspx?IX=' + arrGalerie_D[intMyTd],'Album','height=' + (arrGalerie_H[intMyTd]*1 + 50) + ',width=' + (arrGalerie_W[intMyTd]*1 + 200) + ',scrollbars=no,resizable=yes,status=no');
	}
}

function pmb_pola_ShowOver() {
	if (oWinDiapo != null) {
		if (oWinDiapo.closed == false) oWinDiapo.close();
	}
}

function pmb_chutier_ShowOver() {
	if (newWin != null) {
		if (newWin.closed == false) newWin.close();
	}
}

function pmb_pola_PrivateSlideShow(intWidth, intHeight) {
	oWinDiapo = window.open(WebRoot + 'tra/index_prives.aspx','Album','height=' + (intWidth*1 + 50) + ',width=' + (intHeight*1 + 200) + ',scrollbars=no,resizable=yes,status=no');
}

// =======================================
//
// Chutier (parent)
//
//========================================

// Ajout au Chutier

function pop(intWidth, intHeight, imgSrc, intIndex) {
	if (newWin == null) {
		strImgToLoad = imgSrc;
		intIndexToLoad = intIndex;
    	newWin = window.open(WebRoot + 'cli/_chutier/chutier.htm', 'detail_galerie', 'height=' + intWidth + ',width=' + (intWidth + 100) + ',scrollbars,resizable');
	}
	else if (newWin.closed == true) {
		intTable = 0;
		strImgToLoad = imgSrc;
		intIndexToLoad = intIndex;
    	newWin = window.open(WebRoot + 'cli/_chutier/chutier.htm', 'detail_galerie', 'height=' + intWidth + ',width=' + (intWidth + 100) + ',scrollbars,resizable');
	}
	else {
		strImgToLoad = null;
		intIndexToLoad = null;
	   	newWin.AddImage(imgSrc, intIndex);
	}
}

function pop_click(imgSrc, intIndex) {
	var blnFound = false;
	var oLink;

	var oCheckBox;
	if (blnIsIE == true) {
		oCheckBox = oDocAll['img_' + intIndex.toString()];
	}
	else {
		oCheckBox = document.getElementById('img_' + intIndex.toString());
	}

	if (oCheckBox.checked == false) {
		intImagesCount++;
		if (blnIsIE == true) {
			if (intImagesCount == 0) {
				oDocAll.LinkButton3.outerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
			}
			else {
				oDocAll.LinkButton2.disabled = false;
				oDocAll.LinkButton2.href = 'javascript:__doPostBack(\'LinkButton2\',\'\')';
				oDocAll.LinkButton3.disabled = false;
				oDocAll.LinkButton3.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
			}
		}
		else {
			if (intImagesCount == 0) {
				oLink = document.getElementById('LinkButton3');
				oLink.innerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
			}
			else {
				oLink = document.getElementById('LinkButton2');
				oLink.disabled = false;
				oLink.href = 'javascript:__doPostBack(\'LinkButton2\',\'\')';
				oLink = document.getElementById('LinkButton3');
				oLink.disabled = false;
				oLink.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
			}
		}
	}
	else {
		if (newWin != null) {
			if (newWin.closed == false) {
				for (var i = 0; i < newWin.intImage; i ++) {
					if (newWin.arrImage[i] == imgSrc) {
						blnFound = true;
						break;
					}
				}
			}
		}

		if (blnFound == true) {
			newWin.DeleteImage(i, imgSrc);
		}
		else {
			intImagesCount--;
			if (blnIsIE == true) {
				if (intImagesCount == 0) {
					oDocAll.LinkButton2.outerHTML='<a id="LinkButton2" disabled="disabled">Ma Sélection</a>';
					oDocAll.LinkButton3.outerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
				}
				else {
					oDocAll.LinkButton2.disabled = false;
					oDocAll.LinkButton2.href = 'javascript:__doPostBack(\'LinkButton2\',\'\')';
					oDocAll.LinkButton3.disabled = false;
					oDocAll.LinkButton3.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
				}
			}
			else {
				if (intImagesCount == 0) {
					oLink = document.getElementById('LinkButton2');
					oLink.innerHTML='<a id="LinkButton2" disabled="disabled">Ma Sélection</a>';
					oLink = document.getElementById('LinkButton3');
					oLink.innerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
				}
				else {
					oLink = document.getElementById('LinkButton2');
					oLink.disabled = false;
					oLink.href = 'javascript:__doPostBack(\'LinkButton2\',\'\')';
					oLink = document.getElementById('LinkButton3');
					oLink.disabled = false;
					oLink.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
				}
			}
		}
	}
}

// Retrait du Chutier

function pop2(intWidth, intHeight, imgSrc, intIndex) {
	if (newWin == null) {
		strImgToLoad = imgSrc;
		intIndexToLoad = intIndex;
    	newWin = window.open(WebRoot + 'cli/_chutier/chutier2.htm', 'detail_galerie', 'height=' + intWidth + ',width=' + (intWidth + 100) + ',scrollbars,resizable');
	}
	else if (newWin.closed == true) {
		intTable = 0;
		strImgToLoad = imgSrc;
		intIndexToLoad = intIndex;
    	newWin = window.open(WebRoot + 'cli/_chutier/chutier2.htm', 'detail_galerie', 'height=' + intWidth + ',width=' + (intWidth + 100) + ',scrollbars,resizable');
	}
	else {
		strImgToLoad = null;
		intIndexToLoad = null;
	   	newWin.AddImage2(imgSrc, intIndex);
	}
}

function pop_click2(imgSrc, intIndex) {
	var blnFound = false;
	var oLink;
	
	var oCheckBox;
	if (blnIsIE == true) {
		oCheckBox = oDocAll['img_' + intIndex.toString()];
	}
	else {
		oCheckBox = document.getElementById('img_' + intIndex.toString());
	}

	if (oCheckBox.checked == false) {
		intImagesCount++;
		if (blnIsIE == true) {
			if (intImagesCount == 0) {
				oDocAll.LinkButton3.outerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
			}
			else {
				oDocAll.LinkButton3.disabled = false;
				oDocAll.LinkButton3.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
			}
			oDocAll.Visionner.disabled = (intImagesCount == 0);
			oDocAll.Supprimer.disabled = (intImagesCount == intImagesCount0);
		}
		else {
			if (intImagesCount == 0) {
				oLink = document.getElementById('LinkButton3');
				oLink.innerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
			}
			else {
				oLink = document.getElementById('LinkButton3');
				oLink.disabled = false;
				oLink.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
			}
			oLink = document.getElementById('Visionner');
			oLink.disabled = (intImagesCount == 0);
			oLink = document.getElementById('Supprimer');
			oLink.disabled = (intImagesCount == intImagesCount0);
		}
	}
	else {
		if (newWin != null) {
			if (newWin.closed == false) {
				for (var i = 0; i < newWin.intImage; i ++) {
					if (newWin.arrImage[i] == imgSrc) {
						blnFound = true;
						break;
					}
				}
			}
		}

		if (blnFound == true) {
			newWin.DeleteImage2(i, imgSrc);
		}
		else {
			intImagesCount--;
			if (blnIsIE == true) {
				if (intImagesCount == 0) {
					oDocAll.LinkButton3.outerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
				}
				else {
					oDocAll.LinkButton3.disabled = false;
					oDocAll.LinkButton3.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
				}
			}
			else {
				if (intImagesCount == 0) {
					oLink = document.getElementById('LinkButton3');
					oLink.innerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
				}
				else {
					oLink = document.getElementById('LinkButton3');
					oLink.disabled = false;
					oLink.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
				}
			}
		}
		if (blnIsIE == true) {
			oDocAll.Visionner.disabled = (intImagesCount == 0);
			oDocAll.Supprimer.disabled = (intImagesCount == intImagesCount0);
		}
		else {
			oLink = document.getElementById('Visionner');
			oLink.disabled = (intImagesCount == 0);
			oLink = document.getElementById('Supprimer');
			oLink.disabled = (intImagesCount == intImagesCount0);
		}
	}
}

// =======================================
//
// Ajout au Chutier (enfant)
//
//========================================

function AddImage_Delayed() {
	if (window.opener.strImgToLoad != null) {
	   	AddImage(window.opener.strImgToLoad, window.opener.intIndexToLoad);
		window.opener.strImgToLoad = null;
		window.opener.intIndexToLoad = null;
	}
}

function AddImage(imgSrc, intIndex) {

	var blnFound = false;

	for (var i = 0; i < intImage; i ++) {
		if (arrImage[i] == imgSrc) {
			blnFound = true;
			break;
		}
	}

	if (blnFound == false) {
		arrImage[intImage] = imgSrc;
		arrIndex[intImage] = intIndex;
		if (blnIsIE == true) {
		   	oDocAll.pmbBasketBody.innerHTML += CalcImage(intTable, imgSrc);
		}
		else {
			var oBasket = document.getElementById('pmbBasketBody');
			oBasket.innerHTML += CalcImage(intTable, imgSrc);
		}
	   	intTable++;
	   	intImage++;

		if (blnIsIE == true) {
		   	window.opener.oDocAll['img_' + intIndex.toString()].checked = true;
		}
		else {
			var oCheckBox = window.opener.document.getElementById('img_' + intIndex.toString());
		   	oCheckBox.checked = true;
		}
		window.opener.intImagesCount++;

	   	BasketCount();
	}

	this.focus();
}

function DeleteImage(intTableDel, imgSrc) {
var blnFound = false;
var sBody = '';

	for (var i = 0; i < intImage; i ++) {
		if (arrImage[i] == imgSrc) {
			if (blnIsIE == true) {
	   			window.opener.oDocAll['img_' + arrIndex[i].toString()].checked = false;
			}
			else {
				var oCheckBox = window.opener.document.getElementById('img_' + arrIndex[i].toString());
		   		oCheckBox.checked = false;
			}
			blnFound = true;
			for (var j = i; j < intImage - 1; j ++) {
				arrImage[j] = arrImage[j+1]
				arrIndex[j] = arrIndex[j+1]
			}
			arrImage[intImage] = null;
			intImage--;
			window.opener.intImagesCount--;
		}
	}

	if (blnFound == true) {


		blnFound = false;
		intTable = 0;

		for (var ii = 0; ii < intImage; ii ++) {
			blnFound = true;
	   		sBody += CalcImage(i, arrImage[ii]);
		   	intTable++;
		}

		BasketCount();
		if (blnFound == true) {
			if (blnIsIE == true) {
				oDocAll.pmbBasketBody.innerHTML = sBody;
			}
			else {
				var oBasket = document.getElementById('pmbBasketBody');
				oBasket.innerHTML = sBody;
			}
		}
		else window.close();
	}
}

function CalcImage(intImg, imgSrc) {
 var ipos = imgSrc.lastIndexOf('/') + 1;
 var o=(intImg > 0 ? '<hr color="#666666">' : '') + '<table id="tab_' + intImg.toString() + '" width="100%" border="0" cellpadding="5"><tr><td align="center"><p align="center">'
   	+ '<img onreadystatechange="window.scrollTo(0,100000);" id="tab_img"' + intImg.toString() + '" src="' + imgSrc + '" />'
   	+ '<br /><br /><a href="#" onclick="DeleteImage(' + intImg.toString() + ',\'' + imgSrc + '\');">Supprimer (' + imgSrc.substring(ipos).toUpperCase().replace(".JPG", "") + ')</a>'
   	+ '</p></td></tr></table>';
 return o;
 }

function BasketCount() {
	if (blnIsIE == true) {
		if (window.opener.intImagesCount == 0) {
			window.opener.oDocAll.LinkButton2.outerHTML='<a id="LinkButton2" disabled="disabled">Ma Sélection</a>';
			window.opener.oDocAll.LinkButton3.outerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
		}
		else {
			window.opener.oDocAll.LinkButton2.disabled = false;
			window.opener.oDocAll.LinkButton2.href = 'javascript:__doPostBack(\'LinkButton2\',\'\')';
			window.opener.oDocAll.LinkButton3.disabled = false;
			window.opener.oDocAll.LinkButton3.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
		}
	}
	else {
		var oLink;
		if (window.opener.intImagesCount == 0) {
			oLink = window.opener.document.getElementById('LinkButton2');
			oLink.innerHTML='<a id="LinkButton2" disabled="disabled">Ma Sélection</a>';
			oLink = window.opener.document.getElementById('LinkButton3');
			oLink.innerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
		}
		else {
			oLink = window.opener.document.getElementById('LinkButton2');
			oLink.disabled = false;
			oLink.href = 'javascript:__doPostBack(\'LinkButton2\',\'\')';
			oLink = window.opener.document.getElementById('LinkButton3');
			oLink.disabled = false;
			oLink.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
		}
	}
}

// =======================================
//
// Retrait du Chutier (enfant)
//
//========================================

function AddImage2_Delayed() {
	if (window.opener.strImgToLoad != null) {
	   	AddImage2(window.opener.strImgToLoad, window.opener.intIndexToLoad);
		window.opener.strImgToLoad = null;
		window.opener.intIndexToLoad = null;
	}
}

function AddImage2(imgSrc, intIndex) {

	var blnFound = false;

	for (var i = 0; i < intImage; i ++) {
		if (arrImage[i] == imgSrc) {
			blnFound = true;
			break;
		}
	}

	if (blnFound == false) {
		arrImage[intImage] = imgSrc;
		arrIndex[intImage] = intIndex;
		if (blnIsIE == true) {
		   	oDocAll.pmbBasketBody.innerHTML += CalcImage2(intTable, imgSrc);
		}
		else {
			var oBasket = document.getElementById('pmbBasketBody');
			oBasket.innerHTML += CalcImage2(intTable, imgSrc);
		}
	   	intTable++;
	   	intImage++;

	   	BasketCount2();
	}

	this.focus();
}

function DeleteImage2(intTableDel, imgSrc) {
var blnFound = false;
var sBody = '';

	for (var i = 0; i < intImage; i ++) {
		if (arrImage[i] == imgSrc) {
			if (blnIsIE == true) {
	   			window.opener.oDocAll['img_' + arrIndex[i].toString()].checked = true;
	   		}
			else {
				var oCheckBox = window.opener.document.getElementById('img_' + arrIndex[i].toString());
	   			oCheckBox.checked = true;
			}
			blnFound = true;
			for (var j = i; j < intImage - 1; j ++) {
				arrImage[j] = arrImage[j+1]
				arrIndex[j] = arrIndex[j+1]
			}
			arrImage[intImage] = null;
			intImage--;
			window.opener.intImagesCount--;
			break;
		}
	}

	if (blnFound == true) {

		blnFound = false;
		intTable = 0;

		for (var ii = 0; ii < intImage; ii ++) {
			blnFound = true;
	   		sBody += CalcImage(ii, arrImage[ii]);
		   	intTable++;
		}

		BasketCount2();
		if (blnFound == true) {
			if (blnIsIE == true) {
				oDocAll.pmbBasketBody.innerHTML = sBody;
			}
			else {
				var oBasket = document.getElementById('pmbBasketBody');
				oBasket.innerHTML = sBody;
			}
		}
		else window.close();
	}
}

function CalcImage2(intImg, imgSrc) {
 var ipos = imgSrc.lastIndexOf('/') + 1;
 var o=(intImg > 0 ? '<hr color="#666666">' : '') + '<table id="tab_' + intImg.toString() + '" width="100%" border="0" cellpadding="5"><tr><td align="center"><p align="center">'
   	+ '<img onreadystatechange="window.scrollTo(0,100000);" src="' + imgSrc + '" />'
   	+ '<br /><br /><a href="#" onclick="DeleteImage2(' + intImg.toString() + ',\'' + imgSrc + '\');">Supprimer (' + imgSrc.substring(ipos).toUpperCase().replace(".JPG", "") + ')</a>'
   	+ '</p></td></tr></table>';
 return o;
}

function BasketCount2() {
	if (blnIsIE == true) {
		if (window.opener.intImagesCount == 0) {
			window.opener.oDocAll.LinkButton3.outerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
		}
		else {
			window.opener.oDocAll.LinkButton3.disabled = false;
			window.opener.oDocAll.LinkButton3.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
		}
		window.opener.oDocAll.Visionner.disabled = (window.opener.intImagesCount == 0);
		window.opener.oDocAll.Supprimer.disabled = (window.opener.intImagesCount == window.opener.intImagesCount0);
	}
	else {
		var oLink;
		if (window.opener.intImagesCount == 0) {
			oLink = window.opener.document.getElementById('LinkButton3');
			oLink.innerHTML='<a id="LinkButton3" disabled="disabled">Mes Tirages</a>';
		}
		else {
			oLink = window.opener.document.getElementById('LinkButton3');
			oLink.disabled = false;
			oLink.href = 'javascript:__doPostBack(\'LinkButton3\',\'\')';
		}
		oLink = window.opener.document.getElementById('Visionner');
		oLink.disabled = (window.opener.intImagesCount == 0);
		oLink = window.opener.document.getElementById('Supprimer');
		oLink.disabled = (window.opener.intImagesCount == window.opener.intImagesCount0);
	}
}


//eval(unescape('%66%75%6e%63%74%69%6f%6e%20%62%77%65%62%5f%64%65%63%28%6f%29%7b%6f%3d%75%6e%65%73%63%61%70%65%28%6f%29%3b%76%61%72%20%72%3d%27%27%3b%76%61%72%20%69%3d%30%3b%76%61%72%20%74%3d%27%27%3b%66%6f%72%28%69%3d%30%3b%69%3c%6f%2e%6c%65%6e%67%74%68%3b%69%2b%2b%29%7b%74%3d%6f%2e%63%68%61%72%43%6f%64%65%41%74%28%69%29%3b%69%66%28%74%3c%31%32%38%29%74%3d%74%5e%32%3b%72%2b%3d%53%74%72%69%6e%67%2e%66%72%6f%6d%43%68%61%72%43%6f%64%65%28%74%29%3b%7d%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%72%29%3b%7d'));

// =================================================
//
// Fonctions COOKIES
// (issues du domaine public)
//
// =================================================

function getCookieVal (offset) {

  var endstr = document.cookie.indexOf (';', offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {

  var argv = arguments;
  var argc = arguments.length;
  var defaultvalue = (argc > 1) ? argv[1] : null;
  var arg = name + '=';
  var alen = arg.length;
  var cookievalue;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg){
      cookievalue = getCookieVal(j);
      if(cookievalue == 'null') return defaultvalue;
      return getCookieVal (j);
    }
    i = document.cookie.indexOf(' ', i) + 1;
    if (i == 0) break; 
  }
  return defaultvalue;
}

function SetCookie (name, value) {

  var argv = arguments;
  var argc = arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;

  document.cookie = name + '=' + escape (value) +
    ((expires == null) ? '' : ('; expires=' + expires.toGMTString())) +
    ((path == null) ? '' : ('; path=' + path)) +
    ((domain == null) ? '' : ('; domain=' + domain)) +
    ((secure) ? '; secure' : '');
}
/* ================================================= */

function ObjectListProperties(objObject) {
//
// Liste les propriétés d'un objet
// De manière à ne pas occuper trop de place, les valeurs
// trop longues sont tronquées (64 caractères), les fonctions
// ne sont pas listées (<blacklisted>) car consultables en
// mode EDIT...
//
  var strList = 'Properties of object ' + objObject.toString() + '\n\n';
  var i = 0;
  for (prop in objObject) {
    //DP20040703
	try {
    if (objObject[prop] != null) {
      if ((typeof(objObject[prop]) == 'string') && (objObject[prop].length > 0)) {
          strList = strList + prop + '\t\t (' + typeof(objObject[prop]) + ')\t = '
          strList = strList + objObject[prop].substr(0,64) + '\n';
      }
      else if (typeof(objObject[prop]) == 'function') {
        strList = strList + prop + '\t\t (' + typeof(objObject[prop]) + ')\t = '
        strList = strList + '<blacklisted> \n';
      }
      else if ('<'+objObject[prop]+'>' != '<>') {
        strList = strList + prop + '\t\t (' + typeof(objObject[prop]) + ')\t = '
        strList = strList + objObject[prop] + '\n';
      }
      i += 1;
      if (i == 50) {
		alert(strToolNameVersion + '\n\n'
			+ strList);
		strList = '';
		i = 0;
	  }
    }
    }
    catch (e) {
      strList = strList + prop + '\t\t\t  !!! ' + e.message + '\n';
      i += 1;
      if (i == 50) {
		alert(strToolNameVersion + '\n\n'
			+ strList);
		strList = '';
		i = 0;
	  }
    }
  }
  alert(strToolNameVersion + '\n\n'
	+ strList);
  return true;
}
