﻿function setPicRange(oImage,Max_Width,Max_Height) 
{ 
  if(oImage.readyState!="complete") 
    { 
     return false; 
    }
  var MaxWidth=parseInt(Max_Width);
  var MaxHeight=parseInt(Max_Height);
  var imgobj=new Image();
  if(imgobj.src!=oImage.src)imgobj.src=oImage.src;
  
  var ImgHeight = imgobj.height; 
  var ImgWidth = imgobj.width; 

  if ((ImgWidth > MaxWidth) || (ImgHeight > MaxHeight))
     {
      if((ImgWidth/MaxWidth) == (ImgHeight/MaxHeight))
	    { 
         oImage.style.width=MaxWidth;       
         oImage.style.height=MaxHeight;       
        }
      else
	    {     
         if((ImgWidth/MaxWidth) > (ImgHeight/MaxHeight))
		   { 
            oImage.style.width=MaxWidth;    
            //alert(ImgHeight/(MaxWidth/ImgWidth));     
            oImage.style.height=ImgHeight/(ImgWidth/MaxWidth);       
           }
         else
		   {
            //alert(ImgWidth); 
            oImage.style.height=MaxHeight;
            oImage.style.width=ImgWidth/(ImgHeight/MaxHeight); 
		   }     
	    }  
     }
  else
     {
      oImage.style.width=ImgWidth;       
      oImage.style.height=ImgHeight; 
     }
      //oImage.style.visibility="visible";
      //oImage.style.display='';
} 
function confirmLink( link )
{
  re = /^http:\/\/[^\.]+.17high.com.tw/;
  if( link.match(re) ){
    window.open( link, "_blank", "menubar=1,status=1,location=1,scrollbars=1,resizable=1" );
  }
  else if( confirm("您現在所要開啟下列連結,我們無法保證連結是否安全,不明連結可能包含木馬程式!\n\n如果您要繼續,請按下\"確定\"\n\n或者按下\"取消\"以中止!") )
  {
    window.open( link, "_blank", "menubar=1,status=1,location=1,scrollbars=1,resizable=1" );
  }
}
