﻿function SwitchDisplay(flag)
{
    document.getElementById("myImage").src="BookCover.ashx?ISBN=IBM"+flag;
}
function ChangeColor(id)
{
ClearColor();
    document.getElementById(id).style.backgroundColor="#999999";
}
function ChangeColorOut(id)
{
    document.getElementById(id).style.backgroundColor="#ffffff";
}
function ClearColor()
{
    document.getElementById("btn1").style.backgroundColor="#ffffff";
    document.getElementById("btn2").style.backgroundColor="#ffffff";
    document.getElementById("btn3").style.backgroundColor="#ffffff";
    document.getElementById("btn4").style.backgroundColor="#ffffff";
}
function LoopPic()
{
    var img=document.getElementById("myImage");
    if(img.src.indexOf("pic_1")!=-1)
    {
        img.src="../Images/pic_2.jpg";
        return;
    }
    if(img.src.indexOf("pic_2")!=-1)
    {
        img.src="../Images/pic_3.jpg";
        return;
    }
    if(img.src.indexOf("pic_3")!=-1)
    {
        img.src="../Images/pic_4.jpg";
        return;
    }
    if(img.src.indexOf("pic_4")!=-1)
    {
        img.src="../Images/pic_5.jpg";
        return;
    }
    if(img.src.indexOf("pic_5")!=-1)
    {
        img.src="../Images/pic_1.jpg";
        return;
    }
}
/*重新设置图片大小*/
function resizeImg(imgs, maxw) {
    if(imgs.width>maxw) 
    {
        var oldw = imgs.width;
        var oldh = imgs.height;
        imgs.style.width = maxw +'px';
        imgs.style.height = (maxw/oldw*oldh) +'px';
    }
}
function zoom(url)
{
    window.open(url);
}
/*根据高度，重新设置图片大小*/
function resizeImgByHight(imgs, maxH) {
    if(imgs.hight>maxH) 
    {
        var oldw = imgs.width;
        var oldh = imgs.height;
        imgs.style.hight = maxH +'px';
        imgs.style.width = (maxH/oldh)*oldw +'px';
    }
}
