function popUp(url,largh,altez)
{
	//top = (screen.height-largh)/2
	//left = (screen.width-largh)/2
	sinistra=(screen.width-largh)/2;
	alto=(screen.height-largh)/2; 
	window.open(url,"_blank", "left="+sinistra+",top="+alto+",width="+largh+", height="+altez+",toolbar=no, location=no,status=yes,menubar=no,scrollbars=no,resizable=yes"); /*creo un oggetto*/
}


function miosubmit(objform,strAction,strTarget)
{
	if(strAction != "")
	{
		objform.action = strAction;
	}
	if(strTarget != "")
	{
		objform.target = strTarget;
	}
	else
	{
		objform.target = "_self";
	}
	
	//alert(objform.target)
	
	objform.submit();
}



function validazRicerca(objform)
{
		
	if (objform.name!='formSpese')
	{
		if (document.forms[0].TipoPagamento && document.forms[0].TipoPagamento.value == 5)
		{
		
			if(document.forms[0].ImportoContanti.value == "")
			{
				ImpCont = 0
			}
			else
			{
				ImpCont = parseFloat(document.forms[0].ImportoContanti.value)
			}
			
			if(document.forms[0].ImportoBancomat.value == "")
			{
				ImpBanc = 0
			}
			else
			{
				ImpBanc = parseFloat(document.forms[0].ImportoBancomat.value)
			}
			
			TotImp = ImpCont + ImpBanc
			Parziale = parseFloat(document.forms[0].Importo.value)
			if(TotImp!=Parziale)
			{
				alert("Controllare i totali")
				return false;
			}
			
		}
		//return false;
	
	}
	
	for(i=0;i<objform.length;i=i+1)
		{
				if(objform.elements[i].title=="campo obbligatorio")
					{
							if(objform.elements[i].type=="text" || objform.elements[i].type=="textarea" || objform.elements[i].type=="password")
							{
									if(objform.elements[i].value == "")
									{
										AlertObbligatorio(objform.elements[i]);
										return false; 
									}
									else
									{
										ripristina(objform.elements[i]);
									}
							}
							//------
							if(objform.elements[i].type=="select-one")
							{
								//alert(objform.elements[i].selectedIndex)
									if(objform.elements[i].selectedIndex == 0 )
									{
										AlertObbligatorio(objform.elements[i]);
										return false; 
									}
									else
									{
										ripristina(objform.elements[i]);
									}
							}
					}// if campo obbligatorio
					
		}//for
		
}


function AlertObbligatorio(obj)
{
	alert("riempire correttamente il campo: " + obj.alias);
	obj.focus();
	obj.className ="obbligatorio";
}


function AlertNumerico(obj)
{
	alert("campo numerico");
	obj.focus();
	obj.className ="obbligatorio";
}


function ripristina(obj)
{
		obj.className ="mioform";
}


function mioconfirm(testomsg)
{
	return (confirm(testomsg))
}


function controlloCompilazione(obj)
{
	if (obj.value == "")
	{
		alert("Riempire il campo " + obj.name)
		obj.focus();
		obj.className ="obbligatorio";
		return false;
	}
	else
	{
		obj.className ="mioform";
		return true;
	}
}


