﻿function MinPhotoSize(actual, maxvalue) {
	return Math.min(actual, maxvalue) + "px";
}

function ShowFormatBytesStr(bytes) {
    if(bytes > 1073741824) {
		    document.write((Math.round((bytes/1073741824)*100)/100).toString()+' G');
    } 
	else if(bytes > 1048576) {
		    document.write((Math.round((bytes/1048576)*100)/100).toString()+' M');
    } 
	else if(bytes > 1024) {
		    document.write((Math.round((bytes/1024)*100)/100).toString()+' K');
    } 
	else {
		    document.write(bytes.toString()+' Bytes');
    }

}

function MouseCursor(obj) {
	if (is_ie)
		obj.style.cursor = 'hand';
	else
		obj.style.cursor = 'pointer';
}



function findobj(n, d) {
	var p, i, x;
	if(!d) d = document;
	if((p = n.indexOf("?"))>0 && parent.frames.length) {
		d = parent.frames[n.substring(p + 1)].document;
		n = n.substring(0, p);
	}
	if(x != d[n] && d.all) x = d.all[n];
	for(i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
	for(i = 0; !x && d.layers && i < d.layers.length; i++) x = findobj(n, d.layers[i].document);
	if(!x && document.getElementById) x = document.getElementById(n);
	return x;
}


//选择或取消选反列表中全部记录

function checkall(form, prefix, checkall) {
	var checkall = checkall ? checkall : 'chkall';
	for(var i = 0; i < form.elements.length; i++) {
		var e = form.elements[i];
		if(e.name != checkall && (!prefix || (prefix && e.name.match(prefix)))) {
			e.checked = form.elements[checkall].checked;
		}
	}
}







