web/test_files/jqresize.js
//resize the image, based on windows width and height
resize the image, based on windows width and height
resize the image based on windows width and height
function resize(obj){
        var windowH      = $(window).height();
        var windowW      = $(window).width();
        var theImage     = new Image();
        theImage.src     = obj.attr("src");
        var imgwidth     = theImage.width;
        var imgheight    = theImage.height;
        if((imgwidth > windowW)||(imgheight > windowH)) {
            if(imgwidth > imgheight){
                var newwidth = windowW;
                var ratio = imgwidth / windowW;
                var newheight = imgheight / ratio;
                theImage.height = newheight;
                theImage.width= newwidth;
                if(newheight > windowH) {
                    var newnewheight = windowH;
                    var newratio = newheight/windowH;
                    var newnewwidth =newwidth/newratio;
                    theImage.width = newnewwidth;
                    theImage.height= newnewheight;
                }
            }
            else{
                var newheight = windowH;
                var ratio = imgheight / windowH;
                var newwidth = imgwidth / ratio;
                theImage.height = newheight;
                theImage.width= newwidth;
                if(newwidth > windowW) {
                    var newnewwidth = windowW;
                    var newratio = newwidth/windowW;
                    var newnewheight =newheight/newratio;
                    theImage.height = newnewheight;
                    theImage.width= newnewwidth;
                }
            }
        }
        if((o.animate == true)&&(!$.browser.msie))
            obj.stop(true).animate({
                'width':theImage.width+'px',
                'height':theImage.height+'px'
            },o.speed);
        else
            obj.css({
                'width':theImage.width+'px',
                'height':theImage.height+'px'                
            });
    }
function resize ( obj ) { var windowH = $ ( window ) . height ( ) ; var windowW = $ ( window ) . width ( ) ; var theImage = new Image ( ) ; theImage . src = obj . attr ( "src" ) ; var imgwidth = theImage . width ; var imgheight = theImage . height ; if ( ( imgwidth > windowW ) || ( imgheight > windowH ) ) { if ( imgwidth > imgheight ) { var newwidth = windowW ; var ratio = imgwidth / windowW ; var newheight = imgheight / ratio ; theImage . height = newheight ; theImage . width = newwidth ; if ( newheight > windowH ) { var newnewheight = windowH ; var newratio = newheight / windowH ; var newnewwidth = newwidth / newratio ; theImage . width = newnewwidth ; theImage . height = newnewheight ; } } else { var newheight = windowH ; var ratio = imgheight / windowH ; var newwidth = imgwidth / ratio ; theImage . height = newheight ; theImage . width = newwidth ; if ( newwidth > windowW ) { var newnewwidth = windowW ; var newratio = newwidth / windowW ; var newnewheight = newheight / newratio ; theImage . height = newnewheight ; theImage . width = newnewwidth ; } } } if ( ( o . animate == true ) && ( ! $ . browser . msie ) ) obj . stop ( true ) . animate ( { 'width' : theImage . width + 'px' , 'height' : theImage . height + 'px' } , o . speed ) ; else obj . css ( { 'width' : theImage . width + 'px' , 'height' : theImage . height + 'px' } ) ; }
resize the image, based on windows width and height
resize the image based on windows width and height