2006-09-20 19:46:52 +00:00
|
|
|
var maxHeight = 550;
|
|
|
|
var maxListHeight = 120;
|
|
|
|
|
|
|
|
function init() {
|
2006-09-20 20:31:09 +00:00
|
|
|
if (document.getElementById("singleimage")) single();
|
|
|
|
/*else if (document.getElementById("pictures")) list();*/
|
2006-09-20 19:46:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function list() {
|
2006-09-20 20:31:09 +00:00
|
|
|
imageDivs = document.getElementsByName("listimage");
|
|
|
|
for (i=0; i < imageDivs.length; i++) {
|
|
|
|
currentHeight = imageDivs[i].offsetHeight;
|
|
|
|
currentWidth = imageDivs[i].offsetWidth;
|
2006-12-13 20:26:11 +00:00
|
|
|
|
2006-09-20 20:31:09 +00:00
|
|
|
if (currentHeight > maxListHeight) {
|
|
|
|
ratio = maxListHeight / currentHeight;
|
|
|
|
imageDivs[i].style.width = (currentWidth*ratio) + 'px';
|
|
|
|
imageDivs[i].style.height = (currentHeight*ratio) + 'px';
|
|
|
|
imageDivs[i].firstChild.style.height = '100%';
|
|
|
|
imageDivs[i].firstChild.style.width = '100%';
|
|
|
|
}
|
|
|
|
}
|
2006-09-20 19:46:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function single() {
|
2006-09-20 20:31:09 +00:00
|
|
|
var imageDiv = document.getElementById("singleimage");
|
2006-09-20 19:46:52 +00:00
|
|
|
|
2006-09-20 20:31:09 +00:00
|
|
|
if (imageDiv) {
|
|
|
|
currentHeight = imageDiv.offsetHeight;
|
|
|
|
currentWidth = imageDiv.offsetWidth;
|
2006-12-13 20:26:11 +00:00
|
|
|
|
2006-09-20 20:31:09 +00:00
|
|
|
if (currentHeight > maxHeight) {
|
|
|
|
ratio = maxHeight / currentHeight;
|
|
|
|
imageDiv.style.width = (currentWidth*ratio) + 'px';
|
|
|
|
imageDiv.style.height = (currentHeight*ratio) + 'px';
|
2006-12-13 20:26:11 +00:00
|
|
|
|
2006-09-20 20:31:09 +00:00
|
|
|
}
|
|
|
|
}
|
2006-09-20 19:46:52 +00:00
|
|
|
}
|
|
|
|
|
2006-09-19 01:21:13 +00:00
|
|
|
window.onload = init;
|