function resizeImage()
	{
	
//		var window_height = document.body.clientHeight;
//		var window_width = document.body.clientWidth;
//		
//		var image_width = document.getElementById('bgImg').width;
//		var image_height = document.getElementById('bgImg').height;
//		
//		var height_ratio = image_height / window_height;
//		var width_ratio = image_width / window_width;
//		
//		if (height_ratio > width_ratio) // taller than it is wide
//		{
//			document.getElementById('bgImg').style.width = 'auto';
//			document.getElementById('bgImg').style.height = '100%';
//		}
//		else // wider than it is tall
//		{
//			document.getElementById('bgImg').style.width = '100%';
//			document.getElementById('bgImg').style.height = 'auto';
//		}
	}
	
	function random_imglink(){
		var myimages=new Array()
		//specify random images below. You can have as many as you wish
		myimages[1] = "images/bg.jpg"
        myimages[2] = "images/bg.jpg"
		
		var ry=Math.floor(Math.random()*myimages.length)
							
			if (ry==0) ry=1;
			//document.write('<div style="background:url('+myimages[ry]+') no-repeat; height:100%; position:absolute; width:100%; overflow:auto;overflow-x:hidden;overflow-y:hidden;"></div>')
			
			document.getElementById('bgImg').src = myimages[ry];
			
			resizeImage();

}

var mooSize = new Class({
    Image: null,
    MinimumWidth: 1150,
    MinimumHeight: 700,
    initialize: function() {
        window.addEvent('resize', this.resized.bind(this));
        this.doResize();
    },
    getWindowWidth: function() {
        var myWidth = 0
        if (typeof (window.innerWidth) == 'number') {
            //Non-IE
            myWidth = window.innerWidth;
        } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
        } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
        }


        return myWidth;
    },
    getWindowHeight: function() {
        var myHeight = 0;
        if (typeof (window.innerWidth) == 'number') {
            //Non-IE
            myHeight = window.innerHeight;
        } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
            //IE 6+ in 'standards compliant mode'
            myHeight = document.documentElement.clientHeight;
        } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
            //IE 4 compatible
            myHeight = document.body.clientHeight;
        }

        return myHeight;
    },
    doResize: function() {
        if (this.Image == null) {
            this.Image = $('bgImg');
        }

        this.Image.style.width = '100%';
        this.Image.style.height = 'auto';

        if (this.Image.width.toInt() <= this.MinimumWidth) {
            this.Image.style.width = this.MinimumWidth;
        }

//        var window_height = this.getWindowHeight();
//        var window_width = this.getWindowWidth();
//        var image_width = this.Image.width;
//        var image_height = this.Image.height;


//        if (image_height < window_height) {

//            this.Image.setStyle('height', window_height);
//            this.Image.setStyle('width', 'auto');

//        }
    },
    resized: function(event) {
        this.doResize();
    }
});
