netscape=(document.layers)? true:false
explorer=(document.all)? true:false

function PopupCentrer(page,largeur,hauteur,options) {
  	var top=(screen.height-hauteur)/2;
  	var left=(screen.width-largeur)/2;
  	var height=hauteur;
  	var pagePopup=page;
	
	if (pagePopup.substr(0,7)=='img.asp') {
		height=hauteur+30;
		pagePopup='pagejmp/displayPicture.asp' + page.substr(page.indexOf('?'));
	}

  	window.open(pagePopup,"popup","top="+top+",left="+left+",width="+largeur+",height="+height+","+options);
}

function PopupCollection(page,largeur,hauteur,options) {
  	var top=(screen.height-hauteur)/2;
  	var left=(screen.width-largeur)/2;
  	var height=hauteur;
  	var pagePopup=page;
	
  	window.open(pagePopup,"popup","top="+top+",left="+left+",width="+largeur+",height="+height+","+options);
}

//----------------------------------------
//E-card
//----------------------------------------
function openSendPostcard() { //v2.0
	var imgWidth=210;
	var imgHeight=210;

	if (! netscape) {
		location.href='sendCardWrite.asp?img='+document.images.picture.src+'&imgWidth='+imgWidth+'&imgHeight='+imgHeight;
		window.resizeTo(611,507);
	}
	else{
		window.resizeTo(611,507);
		location.href='sendCardWrite.asp?img='+document.images.picture.src+'&imgWidth='+imgWidth+'&imgHeight='+imgHeight;
	}
}

function validPostcard() {
	if (! netscape) {
		atPos=document.forms[0].fieldEmail1.value.indexOf('@');
		atPos2=document.forms[0].fieldEmail1.value.lastIndexOf('.');
		atPos3=document.forms[0].fieldEmail2.value.indexOf('@');
		atPos4=document.forms[0].fieldEmail2.value.lastIndexOf('.');

		if (document.forms[0].fieldEmail1.value =='') {
			document.all['layerMsg'].innerText="Vous n'avez pas indiqué votre e-mail.";
			document.all['layerMsg'].style.visibility='visible';

			return false;
		}
		else if (document.forms[0].fieldEmail2.value =='') {
			document.all['layerMsg'].innerText="Vous n'avez pas indiqué l'e-mail du destinataire.";
			document.all['layerMsg'].style.visibility='visible';

			return false;
		}
	    else if (atPos < 1 || atPos == (document.forms[0].fieldEmail1.value.length - 1) || atPos2<atPos 
			||(atPos2>=(document.forms[0].fieldEmail1.value.length-2)) || ((document.forms[0].fieldEmail1.value.length-atPos2)>4) || ((document.forms[0].fieldEmail1.value.length-atPos2)<2)) {

			document.all['layerMsg'].innerText="Votre adresse e-mail n'est pas correcte.";
			document.all['layerMsg'].style.visibility='visible';

			return false;
	    }
		else if (atPos3 < 1 || atPos3 == (document.forms[0].fieldEmail2.value.length - 1) || atPos4<atPos3 
			||(atPos4>=(document.forms[0].fieldEmail2.value.length-2)) || ((document.forms[0].fieldEmail2.value.length-atPos4)>4) || ((document.forms[0].fieldEmail2.value.length-atPos4)<2)) {

			document.all['layerMsg'].innerText="L'adresse e-mail du destinataire n'est pas correcte.";
			document.all['layerMsg'].style.visibility='visible';

			return false;
	    }
		else {
			document.forms[0].img.value=document.images.picture.src;
			document.forms[0].imgWidth.value=document.images.picture.width;
			document.forms[0].imgHeight.value=document.images.picture.height;

			return true;
		}
	}
	else{
		atPos=document.layers['layerFormulaire'].document.forms[0].fieldEmail1.value.indexOf('@');
		atPos2=document.layers['layerFormulaire'].document.forms[0].fieldEmail1.value.lastIndexOf('.');
		atPos3=document.layers['layerFormulaire'].document.forms[0].fieldEmail2.value.indexOf('@');
		atPos4=document.layers['layerFormulaire'].document.forms[0].fieldEmail2.value.lastIndexOf('.');

		if (document.layers['layerFormulaire'].document.forms[0].fieldEmail1.value =='') {
			document.all['layerMsg'].innerText="Vous n'avez pas indiqué votre e-mail.";
			document.layers['layerMsg'].visibility='show';

			return false;
		}
		else if (document.layers['layerFormulaire'].document.forms[0].fieldEmail2.value =='') {
			document.all['layerMsg'].innerText="Vous n'avez pas indiqué l'e-mail du destinataire.";
			document.layers['layerMsg'].visibility='show';

			return false;
		}
	    else if (atPos < 1 || atPos == (document.layers['layerFormulaire'].document.forms[0].fieldEmail1.value.length - 1) || atPos2<atPos 
			||(atPos2>=(document.layers['layerFormulaire'].document.forms[0].fieldEmail1.value.length-2)) || ((document.layers['layerFormulaire'].document.forms[0].fieldEmail1.value.length-atPos2)>4) || ((document.layers['layerFormulaire'].document.forms[0].fieldEmail1.value.length-atPos2)<2)) {

          	document.all['layerMsg'].innerText="Votre adresse e-mail n'est pas correcte.";
			document.layers['layerMsg'].visibility='show';

			return false;
	    }
		else if (atPos3 < 1 || atPos3 == (document.layers['layerFormulaire'].document.forms[0].fieldEmail2.value.length - 1) || atPos4<atPos3 
			||(atPos4>=(document.layers['layerFormulaire'].document.forms[0].fieldEmail2.value.length-2)) || ((document.layers['layerFormulaire'].document.forms[0].fieldEmail2.value.length-atPos4)>4) || ((document.layers['layerFormulaire'].document.forms[0].fieldEmail2.value.length-atPos4)<2)) {

          	document.all['layerMsg'].innerText="L'adresse e-mail du destinataire n'est pas correcte.";
			document.layers['layerMsg'].visibility='show';

			return false;
	    }
		else {
			document.layers['layerFormulaire'].document.forms[0].img.value=document.images.picture.src;
			document.layers['layerFormulaire'].document.forms[0].imgWidth.value=document.images.picture.width;
			document.layers['layerFormulaire'].document.forms[0].imgHeight.value=document.images.picture.height;

			return true;
		}
	}
}

function maskMsg() {
	if (! netscape) {
		document.all['layerMsg'].style.visibility='hidden';
	}
	else {
		document.layers['layerMsg'].visibility='hide';
	}
}

