1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| function displayImg(cheminImage, texte, hotspotName,highlightRowId)
{
if (!(typeof highlightRowId === "undefined" || highlightRowId=="")){
highlightRowById(highlightRowId,"tr");
}else{
if(!(typeof hotspotName === "undefined" || hotspotName=="")){
highlightRowById("rep"+('000' + hotspotName).slice(-3),"tr",6);
}else{
highlightRowById("","tr");
}
}
newImage = new Image;
newImage.src = cheminImage;
if (cheminImage.lastIndexOf(".")>1)
{
extImage = cheminImage.substring(cheminImage.lastIndexOf(".")+1).toLowerCase();
if (extImage.toLowerCase() == 'cgm' || 1)
{
heightWindow = screen.availHeight-100;
widthWindow = screen.availWidth-300;
var mTitre=cheminImage.substring(cheminImage.lastIndexOf("/")+1).toUpperCase();
mTitre=mTitre.substring(0,mTitre.lastIndexOf("."));
var mHeightWindow = heightWindow - 50;
html = '<!DOCTYPE html><html><head><title>' + mTitre + '</title></head><body><img src="' + cheminImage.toUpperCase() + '" height="' + mHeightWindow + 'px" /></body></html>';
} else {
if ((screen.availWidth/screen.availHeight) < (newImage.width/newImage.height))
{
//ajuste sur la largeur
reduc = (0.9*screen.availWidth)/newImage.width;
} else {
//ajuste sur la hauteur
reduc = (0.9*screen.availHeight)/newImage.height;
}
heightWindow = Math.floor(reduc*newImage.height);
widthWindow = Math.floor(reduc*newImage.width);
html = '<html><head>'
+ '<title>' + texte + '</title></head><BODY leftmargin="0" marginwidth="0" topmargin="0" marginheigth="0" ><CENTER>'
+ '<div><img align="middle" border="1" src="' + cheminImage + '" width="100%" height="100%" />'
+ '</div></CENTER></BODY></html>'; /*oncontextmenu="return false"*/
}
} else {
alert("Erreur chemin image");
return;
}
///if (fois == 1 ) ouvrirImage.close();
if (!(typeof ouvrirImage === "undefined" || ouvrirImage==""))
{
try{
ouvrirImage.loadCGMselectHotspot(cheminImage,hotspotName);
ouvrirImage.document.title=texte;
}catch(err){
ouvrirImage=undefined;
}
}
if (typeof ouvrirImage === "undefined" || ouvrirImage=="")
{
topWindow = Math.floor((screen.availHeight-heightWindow-30)/2);
leftWindow = Math.floor((screen.availWidth-widthWindow)/2);
ouvrirImage = window.open('','','scrollbars=yes,toolbar=0,location=0,menuBar=0,height='+heightWindow+',width='+widthWindow+',left='+leftWindow+',top='+topWindow+',resizable=1');
ouvrirImage.document.write(html);
fois = 1;
}
return;
} |
Partager