/**
* 图片缩放
* @param {Object} C img dom 对象
* @param {Object} I 宽
* @param {Object} H 高
* @param {Object} B 是否上下有空
* @param {Object} A 是否左右有空
*/
function resizeImage(C, I, H, B, A){
B = B || 1;
A = A || 1;
var D = new Image();
D.onload = function(){
this.onload = null;
var K = this.width, N = this.height;
if (K > 0 && N > 0) {
var M = (I / K < H / N) ? I / K : H / N;
var O = 0;
var J = 0;
if (M <= 1) {
O = C.width = Math.round(K * M);
J = C.height = Math.round(N * M)
}
else {
O = C.width = K;
J = C.height = N
}
if (B == 1) {
var L = (I - O) / 2;
C.style.marginLeft = C.style.marginRight = L + "px"
}
if (A == 1) {
var L = (H - J) / 2;
C.style.marginTop = C.style.marginBottom = L + "px"
}
}
C = null
};
C.onload = null;
D.src = C.src
}