﻿function SendAjax(url, target) {
    $("#" + target).html("<img src='/image/Loading.gif'/>");
    
    $.post(url, null, function (responsexx) {
        $("#" + target).html(responsexx);
        $.cleanup;
    });
}

 
//扩展jquery插件,增加面版与图片集按指定宽度自动缩放
jQuery.fn.extend({
     Auto_Panel_Add: function (url, target) {
        SendAjax(url, target);
    },
    Auto_Zoom: function (obj,fontsize) {//设置指定对象字体大小
         document.getElementById(obj).style.fontSize =fontsize;
     },
     Auto_QueryString: function (name) {
         var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
         var r = window.location.search.substr(1).match(reg);
         if (r != null) return unescape(r[2]); return null;
     },
    Auto_Check: function (o) {//设置所有check为o-true,false,例：$("#chk input[type=checkbox]").Auto_Check(true);
        return this.each(function () { this.checked = o; });
    },
    Auto_Images_checkSize: function chimg(target, ImgSizeWidth) {
        //效果还可以 (^_^)
        var v = $("#" + target).html();

        if (v.length > 7) {//7为target默认的内容长度 load...
            $("#" + target + " img").each(function (i) {
                if ($(this).width() > ImgSizeWidth) {
                    var h = ImgSizeWidth / $(this).width();
                    h = $(this).height() * h; //设置等比例高度
                    $(this).css("max-width", ImgSizeWidth + "px").width(ImgSizeWidth).height(h);
                }
                window.clearInterval(iid);
                iid = 0;
            });
        }
        else {
            var iid = window.setInterval("chimg('" + target + "','" + ImgSizeWidth + "')", 3000);
        }
    }
});
