﻿// JScript 文件

function autoSizephoto(objW,objH)
{	
	MAX_WIDTH=560;
	MAX_HEIGHT=420;
	var W=objW;
	var H=objH;
	if(W<MAX_WIDTH && H<MAX_HEIGHT){
		return {w:W,h:H};
	}
	if(W/H>MAX_WIDTH/MAX_HEIGHT)
	{
		return {w:MAX_WIDTH,h:MAX_WIDTH*H/W}
	}else{
		return {w:MAX_HEIGHT*W/H,h:MAX_HEIGHT} 
	}
}

var flag=false; 
function ResizeImages(ImgD)
{
/*
    var myimg,oldwidth;
    var maxwidth=698; //缩放系数
    
   
      myimg = url
      if(myimg.width > maxwidth)
      {
         oldwidth = myimg.width;
         myimg.width = maxwidth;
         myimg.height = myimg.height * (maxwidth/oldwidth);
      }
      */
      
      
      var image=new Image(); 
        image.src=ImgD.src; 
        if(image.width>0 && image.height>0){ 
            flag=true; 
            if(image.width/image.height>= 698/670){ 
                 if(image.width>698){
                     ImgD.width=698; 
                    ImgD.height=(image.height*670)/image.width; 
                 }else{ 
                     ImgD.width=image.width;
                     ImgD.height=image.height; 
                 } 

        } 
    else{ 
       if(image.height>670){
        ImgD.height=670; 
        ImgD.width=(image.width*670)/image.height; 
       }else{ 
        ImgD.width=image.width;
        ImgD.height=image.height; 
       } 
    
    } 
}

   
}


