var pic = 0;
var remove = 0;

function addPh() {
if (pic == 0) {
//document.getElementById('pp').style.border='1px solid #666666';
document.getElementById('addph1').style.display='none';
}
if (pic == 1) {
document.getElementById('right').style.display='block';
}
if (remove == 0) {
if (pic < 5) {
var div = 'ph'+pic;
document.getElementById(div).style.display='block';
pic++;
}
else {
alert("Vous avez sélectionné 5 photos !");
}
}
}

function noPic1() {
remove = 1;
if(document.formAcquereur.photo0) {
document.formAcquereur.photo0.focus();
document.formAcquereur.photo0.select();
document.execCommand('Cut');
document.getElementById('ph0').style.display='none';
}

if(document.formAcquereur.photo1) {
document.formAcquereur.photo1.focus();
document.formAcquereur.photo1.select();
document.execCommand('Cut');
document.getElementById('ph1').style.display='none';
}

if(document.formAcquereur.photo2) {
document.formAcquereur.photo2.focus();
document.formAcquereur.photo2.select();
document.execCommand('Cut');
document.getElementById('ph2').style.display='none';
}

if(document.formAcquereur.photo3) {
document.formAcquereur.photo3.focus();
document.formAcquereur.photo3.select();
document.execCommand('Cut');
document.getElementById('ph3').style.display='none';
}

if(document.formAcquereur.photo4) {
document.formAcquereur.photo4.focus();
document.formAcquereur.photo4.select();
document.execCommand('Cut');
document.getElementById('ph4').style.display='none';
}


document.getElementById('pp').style.border='0px solid #666666';
document.getElementById('right').style.display='none';
document.getElementById('addph1').style.display='block';

remove = 0;
pic = 0;
alert("Vous avez supprimé toutes les photos !");

}

function noPic() {
remove = 1;

for (i=0; i<(pic+1); i++) {
removePic(i);
}
document.getElementById('ph0').style.display='none';
document.getElementById('ph1').style.display='none';
document.getElementById('ph2').style.display='none';
document.getElementById('ph3').style.display='none';
document.getElementById('ph4').style.display='none';

document.getElementById('pp').style.border='0px solid #666666';
document.getElementById('right').style.display='none';
document.getElementById('addph1').style.display='block';

remove = 0;
pic = 0;
alert("Vous avez supprimé toutes les photos !");
}

function removePic(id) {
remove = 1;

if (id == 0) {
if (document.formAcquereur.photo0) {
document.formAcquereur.photo0.focus();
document.formAcquereur.photo0.select();
document.execCommand('Cut');
}
document.getElementById('ph0').style.display='none';
}

if (id == 1) {
if (document.formAcquereur.photo1) {
document.formAcquereur.photo1.focus();
document.formAcquereur.photo1.select();
document.execCommand('Delete');
}
document.getElementById('ph1').style.display='none';
}

if (id == 2) {
if (document.formAcquereur.photo2) {
document.formAcquereur.photo2.focus();
document.formAcquereur.photo2.select();
document.execCommand('Cut');
}
document.getElementById('ph2').style.display='none';
}

if (id == 3) {
if (document.formAcquereur.photo3) {
document.formAcquereur.photo3.focus();
document.formAcquereur.photo3.select();
document.execCommand('Cut');
}
document.getElementById('ph3').style.display='none';
}

if (id == 4) {
if (document.formAcquereur.photo4) {
document.formAcquereur.photo4.focus();
document.formAcquereur.photo4.select();
document.execCommand('Cut');
}
document.getElementById('ph4').style.display='none';
}

pic--;
remove = 0;
if (pic == 1) {
document.getElementById('right').style.display='none';
}
if (pic == 0) {
document.getElementById('pp').style.border='0px solid #666666';
document.getElementById('addph1').style.display='block';
document.getElementById('right').style.display='none';
}

}



