var $ = function(obj)
{
    return document.getElementById(obj);
}

var freshAuthCode = function ()
{
    var timenow = new Date().getTime();
    $('authcodeImg').src= basePath+'/index.php?q=Default/Authcode&'+timenow;
}

var resizePic = function (ImgD,maxwidth,maxheight)
{
        var image=new Image();
        image.src = ImgD.src;
        ImgD.resized = false;

        iWidth  = image.width;
        iHeight = image.height;
        picwidth  = iWidth;
        picheight = iHeight;

        //大图缩小
        if(iWidth > maxwidth || iHeight > maxheight)
        {
            if (iWidth>iHeight)
            {
                if(iWidth>maxwidth)
                {
                    picwidth = maxwidth;
                    picheight = (iHeight*maxwidth)/iWidth;
                }
                if(picheight>maxheight)
                {
                    picheight = maxheight;
                    picwidth  = (iWidth*maxheight)/iHeight;
                }
            }
            else
            {
                if(iHeight>maxheight)
                {
                    picheight = maxheight;
                    picwidth  = (iWidth*maxheight)/iHeight;

                }
                if(picwidth>maxwidth)
                {
                    picwidth = maxwidth;
                    picheight = (iHeight*maxwidth)/iWidth;
                }
            }

            ImgD.resized = true;
        }
        else
        {
            //小图原样输出
            picwidth  = iWidth;
            picheight = iHeight;

        }

        ImgD.width  = parseInt(picwidth);
        ImgD.height = parseInt(picheight);
}

var doZoom = function (x)
{
    var textId = document.getElementById('text-body');
    textId.style.fontSize=x+'px';
}
