//重新设置图片显示大小
//示例   onload="DrawImage(this,90,120)"
function DrawImage(ImgD, nWidth, nHeight) {
    var image = new Image();
    image.src = ImgD.src;
    if (nWidth == "") {nWidth = image.width; }
    if (nHeight == "") { nHeight = image.height; }

    if (image.width > 0 && image.height > 0) {
        flag = true;
        if (image.width / image.height >= nHeight / nWidth) {
            if (image.width > nHeight) {
                ImgD.width = nHeight;
                ImgD.height = (image.height * nHeight) / image.width;
            }
            else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
            ImgD.alt = image.width + "×" + image.height;

        }
        else {
            if (image.height > nWidth) {
                ImgD.height = nWidth;
                ImgD.width = (image.width * nWidth) / image.height;
            }
            else {
                if (image.width > nHeight) {
                    ImgD.width = nHeight;
                    ImgD.height = (image.height * nHeight) / image.width;
                }
                else {
                    ImgD.width = image.width;
                    ImgD.height = image.height;
                }
            }
            ImgD.alt = image.width + "×" + image.height;
        }
    }
}


//初始化input说明
function initInnerText() {
    $('input:text').each(function () {
        var txt = $(this).attr('innertext');
        if ($(this).val() == "") {
            $(this).val(txt);
            $(this).addClass("inputInnerText");
        }
        $(this).focus(function () {
            if (txt == $(this).val()) {
                $(this).removeClass("inputInnerText");
                $(this).val("");
            }
            else
            { $(this).removeClass("inputInnerText"); }
        }).blur(function () {
            if ($(this).val() == "") {
                $(this).val(txt);
                $(this).addClass("inputInnerText");
            }
        });
    })
}

//初始化input说明--提交时清除说明文字
function submitInnerText() {
    $('input:text').each(function () {
        var txt = $(this).attr('innertext');
        if ($(this).val() == txt) {
            $(this).val('');
        }

    })
}