function onContent(f){//(C)webreflection.blogspot.com
var a=onContent,b=navigator.userAgent,d=document,w=window,c="onContent",e="addEventListener",o="opera",r="readyState",
s="<scr".concat("ipt defer src='//:' on",r,"change='if(this.",r,"==\"complete\"){this.parentNode.removeChild(this);",c,".",c,"()}'></scr","ipt>");
a[c]=(function(o){return function(){a[c]=function(){};for(a=arguments.callee;!a.done;a.done=1)f(o?o():o)}})(a[c]);
if(d[e])d[e]("DOMContentLoaded",a[c],false);
if(/WebKit|Khtml/i.test(b)||(w[o]&&parseInt(w[o].version())<9))(function(){/loaded|complete/.test(d[r])?a[c]():setTimeout(arguments.callee,1)})();
else if(/MSIE/i.test(b))d.write(s);
};

function boldLabel(cbox, label)
{
	if (cbox.checked == true)
	{
		document.getElementById(label).style.fontWeight = 'bold';
	}
	else
	{
		document.getElementById(label).style.fontWeight = 'normal';	
	}
}

function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

function chkEstensioneImmagine(file)
{
	var ext = file.substring(file.length - 3, file.length);
	
	if (ext != "png" && ext != "jpg" && ext != "gif")
	{
		return false;
	}
	else
	{
		return true;
	}
}

function trim(stringa)
{
	while (stringa.substring(0,1) == ' ')
	{
		stringa = stringa.substring(1, stringa.length);
	}
	while (stringa.substring(stringa.length-1, stringa.length) == ' ')
	{
		stringa = stringa.substring(0,stringa.length-1);
	}
	
	return stringa;
}

function isChecked(frm)
{
	var formElements = frm.elements;
	var el = new Array();
	j = 0;
	for (i=0; i<formElements.length;i++)
	{
		if (formElements[i].type == "checkbox")
		{
			el[j] = formElements[i];
			j++;
		}
	}
	
	countUnchecked = 0;
	
	for (j=0; j<el.length;j++)
	{
		if (!el[j].checked)
		{
			countUnchecked++;
		}
	}
	
	if (countUnchecked == el.length)
	{
		return false;
	}
	else
	{
		return true;
	}
}