﻿// JScript 文件 调整图片宽高
   function DT_image(img_id,limit_width,limit_height)
   {
    var   width,height;  
     if(img_id)  
     {  
         width=img_id.width;  
         height=img_id.height;
         if(width/height>limit_width/limit_height)  
             {
                img_id.width=limit_width;
                img_id.height=height*(limit_width/width);
                img_id.style.width = limit_width+"px";
                img_id.style.height = height*(limit_width/width)+"px";
             }    
         else    
             {
                img_id.height=limit_height;
                img_id.width=width*(limit_height/height);
                img_id.style.height = limit_height+"px";
                img_id.style.width = width*(limit_height/height)+"px";
             }  
      } 
   } 
 
  
function resize_image(img_id, limit_width, limit_height) 
{ 
     if(img_id)  
     {  
        myImage = new Image(); 
        myImage.src = img_id.src; 

        if (myImage.width>0 && myImage.height>0) 
        { 
            var rate = 1; 
            if (myImage.width>limit_width || myImage.height>limit_height) 
            { 
                if (limit_width/myImage.width<limit_height/myImage.height) 
                { 
                    rate = limit_width/myImage.width; 
                } 
                else 
                { 
                    rate = limit_height/myImage.height; 
                } 
            } 
            if (window.navigator.appName == "Microsoft Internet Explorer") 
            { 
                img_id.width = myImage.width*rate; 
                img_id.height = myImage.height*rate; 
                img_id.style.width = myImage.width*rate+"px";
                img_id.style.height = myImage.height*rate+"px";
            } 
            else 
            { 
                img_id.width = myImage.width*rate; 
                img_id.height = myImage.height*rate; 
                img_id.style.width = myImage.width*rate+"px";
                img_id.style.height = myImage.height*rate+"px";
            } 
        } 
    }
} 

  var i=0;
  function clickfrist(id)
  {
     if(i==0)
     {
        id.onclick;
        i++;
     }
  }
