﻿// JScript 文件

    function resizeimg(ImgD) 
    {
        var iwidth=110;
        var iheight=70;
        var image=new Image();
        image.src=ImgD.src;
        if(image.width>0 && image.height>0)
        {
            if(image.width/image.height>= iwidth/iheight)
            {
               if(image.width>iwidth)
               {
                   ImgD.width=iwidth;
                   ImgD.height=(image.height*iwidth)/image.width;
                   ImgD.style.margin=(iheight - ImgD.height)/2 + "px 0px 0px 0px;";
               }
               else
               {
                  ImgD.width=image.width;
                  ImgD.height=image.height;
                  ImgD.style.margin=(iheight - image.height)/2 + "px 0px 0px " + (iwidth - image.width)/2 + "px;";
                }
                ImgD.alt=ImgD.alt;
            }
            else
            {
                if(image.height>iheight)
                {
                   ImgD.height=iheight;
                   ImgD.width=(image.width*iheight)/image.height;
                   ImgD.style.margin="0px 0px 0px " + (iwidth - ImgD.width)/2 + "px;";
                }
                else
                {
                    ImgD.width=image.width;
                    ImgD.height=image.height;
                    ImgD.style.margin=(iheight - image.height)/2 + "px 0px 0px " + (iwidth - image.width)/2 + "px;";
                }
                ImgD.alt=ImgD.alt;                
            }
            
            ImgD.style.cursor= "pointer"; //改变鼠标指针
            ImgD.onclick = function() { window.open(this.name);} //打开URL地址
            ImgD.onmouseout=function ()
            {
//                     ImgD.style.position=""; 
//                     ImgD.style.top=""; 
//                     ImgD.style.left=""; 
//                     ImgD.style.zIndex=""; 
                     resizeimg(ImgD);
            }
           ImgD.onmouseover=function ()
            {
            popImage(ImgD,ImgD.src,ImgD.name);
            }
        }       
    }
    
    
function hideLayer()
{    
    var layer = document.getElementById("popImageLayer");
    layer.style.visibility='hidden';
}
function popImage(obj,dds,href) 
{ 
    var layer = document.getElementById("popImageLayer");
    if (layer==null) return;
    var t=obj.offsetTop;
    var l=obj.offsetLeft;
    while(obj=obj.offsetParent){
        t+=obj.offsetTop;
        l+=obj.offsetLeft;
    }
    
    var content = "<A href="+href+" target=_blank><img src='"+dds+"' onload='resizeimgIndex(this,170,120);'  onMouseOut='hideLayer();' style=' border:0px;'/></A>"; // onClick='hideLayer();'
            layer.innerHTML=content;
            layer.style.left =l + 35 -77;
            layer.style.top = t+35-60;
            layer.style.visibility='visible';
            var y=1;
            var i=1;
            var cc=0; 
            
            for (i=0;i<=100;i++){
            cc=cc+y;
            layer.style.filter='alpha(opacity='+cc+')';
            }
                                    
}
