/*
IMAGE RESIZER
This is the image resizer script for the front
page. It makes the image size so that it's as
wide or as tall as the space on the front page
--whichever doesn't cause overflow.
*/

var splashimg;

if(navigator.appName != "Microsoft Internet Explorer"){ //this is the non-internet explorer version of the function
	function imageresizer(){
		var imgheight = window.innerHeight - 150;
		splashimage.src='http://soniagill.com/phpThumb/phpThumb.php?src=../images/splash.jpg&h='+imgheight;
		splashimage.height=imgheight;
		splashimage.className = '';
		splashimage.width = imgheight / ratio;
	
		if( splashimage.width + 30 > window.innerWidth ){ //if the image is wider than the window
			splashimage.src='http://soniagill.com/phpThumb/phpThumb.php?src=../images/splash.jpg&w='+imgheight;
			splashimage.width = window.innerWidth;
			splashimage.className = 'change';
			splashimage.height = window.innerWidth * ratio;
		}
	}
}else{ //this is the internet explorer version it uses document.body.clientHeight instead of window.innerHeight
	function imageresizer(){
		var imgheight = document.body.clientHeight - 150;
		splashimage.src='http://soniagill.com/phpThumb/phpThumb.php?src=../images/splash.jpg&h='+imgheight;
		splashimage.height=imgheight;
		splashimage.className = '';
		splashimage.width = imgheight / ratio;
	
		if( splashimage.width + 30 > document.body.clientWidth ){
			splashimage.src='http://soniagill.com/phpThumb/phpThumb.php?src=../images/splash.jpg&w='+imgheight;
			splashimage.width = document.body.clientWidth;
			splashimage.className = 'change';
			splashimage.height = document.body.clientWidth * ratio;
		}
	}
}

window.onresize = imageresizer; //on resize of the window, reload the image

Event.observe(window,"load", function (){ //on the loading of window reload the image
	splashimage = document.getElementById('splash');
	ratio = splashimage.height / splashimage.width;
	imageresizer();
});
/*------ end IMAGE RESIZE script ------*/