/*
      * auto resize image
      * @param    img     img obj
      * @param    w       custom width
      * @param    h       custom height
      */
      function resizeImage(img,w,h) {
          //remove default attribute

          img.removeAttribute("width");

          img.removeAttribute("height");

          var pic;

          //if is ie

          if(window.ActiveXObject) {

              var pic=new Image();

              pic.src=img.src;

          } else pic=img;

          if(pic && pic.width && pic.height && w) {

              if(!h) h=w;

              if(pic.width>w||pic.height>h) {

                  var scale=pic.width/pic.height;
				  var fit=scale>=w/h;

                  if(window.ActiveXObject) img=img.style;

                      img[fit?'width':'height']=fit?w:h;

                  //if is ie6

                  if(window.ActiveXObject)

                      img[fit?'height':'width']=(fit?w:h)*(fit?1/scale:scale);

              }

          }
      };


