function $(id){return document.getElementById(id);}
function getMatrix(){var A=window.document.body.offsetWidth;var B=0;if(A<580){if(B>=580||B<=0){B=A;return[7,3]}}else{if(A<810){if(B<580||B>=810){B=A;return[4,4]}}else{if(A<1034){if(B<810||B>=1034){B=A;return[4,5]}}else{if(A<1286){if(B<1034||B>=1286){B=A;return[3,6]}}else{if(B<1286||B>=2800){B=A;return[3,7]}}}}}}
function replacePoint(A){if(typeof (A)=="number"){A=A.toString()}return parseInt(A.replace(/\.[0-9]+/,""))}

function autoDisplay () {	
	if(!resultNums) {
		return '';
	}
	var dl = $("imageList").getElementsByTagName("dl");
	var dd = $("imageList").getElementsByTagName("dd");
	var A = getMatrix();
	for(i = 0; i < dl.length; i ++) {
		dl[i].style.height = parseInt(thumbHeight + 100) + 'px';
		dl[i].style.width = replacePoint(100/A[1]-0.1)+"%";
		dd[i].style.height = parseInt(thumbHeight) + 'px';
	}
	var bodyHeight = Math.ceil(resultNums/A[1] * (thumbHeight+100));
	bodyHeight = bodyHeight > thumbHeight ?  bodyHeight : (thumbHeight + 50);
	$("imageList").style.height = parseInt(bodyHeight) + 'px';
}
autoDisplay();
window.onresize = autoDisplay;