//funzione di DEBUG per gli oggetti
function popUpProperties(inobj)
{
	op = window.open();
	op.document.open('text/plain');
	for (objprop in inobj) {
	op.document.write(objprop + ' => ' + inobj[objprop] + '\n');
	}
	op.document.close();
}

function isNS4()
{
	if(navigator.appName == "Netscape" && navigator.appVersion.substr(0,1) == "4") return (true);
	return (false);
}

function pop()
{
// Argomenti : url,w,h,scrol=false,nome="popup"
	numargs = pop.arguments.length;
	if(numargs < 3) return false;
	url = pop.arguments[0];
	w = pop.arguments[1];
	h = pop.arguments[2];
	if(numargs >= 4)
		scrol = pop.arguments[3];
	else
		scrol = false;

	if(numargs >= 5)
		nome = pop.arguments[4];
	else
		nome = "popup";

	if(isNS4() || scrol)
		scb ="yes";
	else
		scb ="no";

	window.open(url,nome,"top=10,left=10,toolbar=no,directories=no,menubar=no,scrollbars="+scb+",width="+w+",height="+h);
}

function Dimensiona(lar,alt,contenitore,offset)
{
	window.resizeTo(lar,alt);
	t = FIND(contenitore);
	var h = t.offsetHeight;
	window.resizeBy(0,h-offset);
	window.focus();
}

function FIND(item)
{
	if (document.all) return(document.all(item));
	if (document.getElementById) return(document.getElementById(item));
	if (document.layers) return(document.layers[item]);
	return(false);
}
function FINDStyle(item)
{
	if (document.all) return(document.all[item].style);
	if (document.getElementById) return(document.getElementById(item).style);
	if (document.layers) return(document.layers[item]);
	return(false);
}
function showObject(obj) {
	if (document.layers) obj.visibility = "show"
	else if (document.all) obj.visibility = "visible"
}

function hideObject(obj) {
	if (document.layers) obj.visibility = "hide"
	else if (document.all) obj.visibility = "hidden"
}
function nolink(target)
{
	t=FINDStyle(target);
	if(t)
		t.cursor = 'wait';
	return false;
}
function yeslink(target)
{
	t=FINDStyle(target);
	if(t)
		t.cursor = 'auto';
	return false;
}
// onMouseOver="return nolink('bdx');" onMouseOut="return yeslink('bdx');"
function CheckMail(param)
{
//Controlla la validità di un indirizzo email e torna true se è sbagliato.
	
	var mail = param;
	if (mail.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)
		return (true);
	else
		return (false);
}

function limita_testo(t,c,maxcar) {
	if (t.value.length > maxcar) {
		t.value = t.value.substring(0,maxcar);
		alert("Lunghezza del messaggio eccessiva");
		return false;
	}
	if(c) c.value = maxcar - t.value.length;
	return true;
}

function getRadioValue (radioButtonOrGroup) {
  var value = null;
  if (radioButtonOrGroup.length) { // group 
    for (var b = 0; b < radioButtonOrGroup.length; b++)
      if (radioButtonOrGroup[b].checked)
        value = radioButtonOrGroup[b].value;
  }
  else if (radioButtonOrGroup.checked)
    value = radioButtonOrGroup.value;
  return value;
}

function del(stringa)
{
	return confirm("Sei sicuro di voler cancellare '"+stringa+"'?");
}
