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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
<?php
/**
* Gallery SVN info
* $Id: fitToWindow.js.php 13580 2006-05-02 10:22:26Z jenst $
*/
?>
<script type="text/javascript">
<!--
/*
** These values define the margin between your image and the navigation and or a left block.
** Change to your suites.
*/
var marginLeft = 100;
var marginTop = 275;
/*
** Dont touch
** Here are the dimensions of the original image
*/
var imagewidth = <?php echo $imageWidth; ?>;
var imageheight = <?php echo $imageHeight; ?>;
var imageratio = imagewidth/imageheight;
/*
** Get the window width. NS and IE use different methods
*/
function windowWidth() {
if (window.innerWidth) {
return window.innerWidth;
}
else if (document.documentElement.clientWidth) {
return document.documentElement.clientWidth;
}
else {
return document.body.clientWidth;
}
}
/*
** Get the window height. NS and IE use different methods
*/
function windowHeight() {
if (window.innerHeight) {
return window.innerHeight;
}
else if (document.documentElement.clientHeight) {
return document.documentElement.clientHeight;
}
else {
return document.body.clientHeight;
}
}
/*
** We load this in the header, so the page is not fully rendered.
** save the windowdimensions.
*/
function calculateNewSize(){
windowWidth = windowWidth();
windowHeight= windowHeight();
newwidth = imagewidth;
newheight = imageheight;
if ( imagewidth > (windowWidth - marginLeft)) {
newwidth = windowWidth - marginLeft;
newheight = parseInt(newwidth / imageratio);
}
if ( newheight > (windowHeight - marginTop)) {
newheight = windowHeight - marginTop;
newwidth = parseInt( newheight * imageratio);
}
setReducedSize();
}
function setReducedSize() {
document.getElementById('galleryImage').height = newheight;
document.getElementById('galleryImage').width = newwidth;
if (document.getElementsByName('frameRR')) {
document.getElementsByName('frameRR').height = newheight;
document.getElementsByName('frameLL').height = newheight;
}
}
function sizeChange() {
this.full = false;
this.toggle = function toggle() {
if (this.full == true) {
this.full = false;
setReducedSize();
} else {
document.getElementById('galleryImage').height = imageheight;
document.getElementById('galleryImage').width = imagewidth;
this.full = true;
}
}
}
sizeChange = new sizeChange();
// -->
</script>
|