﻿//图片按比例缩放
var flag=false;
function DrawImage(ImgD,w,h){
    var image=new Image();
    var iwidth = w; //定义允许图片宽度
    var iheight = h; //定义允许图片高度
    image.src=ImgD.src;
    if(image.width>0 && image.height>0)
    {
        flag=true;
        if(image.width/image.height>= iwidth/iheight)
        {
            if(image.width>iwidth)
            { 
            ImgD.width=iwidth;
            ImgD.height=(image.height*iwidth)/image.width;
            }
            else
            {
            ImgD.width=image.width; 
            ImgD.height=image.height;
            }
        //ImgD.alt=image.width+"×"+image.height;
        }
        else
        {
            if(image.height>iheight)
            { 
                ImgD.height=iheight;
                ImgD.width=(image.width*iheight)/image.height; 
            }
            else
            {
                ImgD.width=image.width; 
                ImgD.height=image.height;
             }
        //ImgD.alt=image.width+"×"+image.height;
        }
        //ImgD.style.marginTop=(h-ImgD.height)/2+1;
    }
} 
/*<img src="图片" onload="javascript:DrawImage(this)">*/
function open_Dialog()
{
    var title="咨询";
    var url="Link.htm";
    var Width="400";
    var Height="245";
    var return_Value;
    if (document.all&&window.print)
    {
        return_Value = window.showModalDialog(url,window,"dialogWidth:" + Width + "px;dialogHeight:" + Height + "px;center:yes;status:no;scroll:no;help:no;");
        //alert(return_Value);
    }
    else
    {
        window.open(url,"","width=" + Width + "px,height=" + Height + "px,resizable=1,scrollbars=1");
    }
}

function open_bookDialog(prodid)
{
window.open("book.aspx?prodid="+prodid,"","","");
//var title="订购";
//var url="book.aspx?prodid="+prodid;
//var width="520";
//var height="350";
//window.showModalDialog(url,window,"dialogWidth:"+width+"px;dialogHeight:"+height+"px; center:yes;status:no;scroll:no;help:no;");
}

////<Script language="javascript">
////function SetVal()
////{
////  returnValue="qifei123";
////}
////</Script>
////<html>
////<head>
////<base target="_self">
////</head>
////<body>
////<form id="form1" action="1.htm">
////<input type="button" value="设置返回值" onClick="SetVal();">
////<input type="submit" value="提交">
////<input type="button" value="关闭" onClick="window.close();">
////</form>
////<br>
////<a href="http://www.baidu.com" target="_self">baidu</a>
////<br><br>
////当head中没有 &lt;base target="_self"&gt; 标记时，连接和表单中的 target="" 属性不管用，都是打开新窗口。
////当head中存在 &lt;base target="_self"&gt; 标记时，连接和表单中有 target="" 属性不管值是什莫一概新弹出窗<br>口，
////连接和表单中没有 target="" 属性时则在原窗口打开新页面。
////</body>
////</html>