function cmsConfirmAct(strDESC, strPage) {
//Chiede la conferma prima di eseguire un'azione, se confermato redirect su pagina strPAGE
	if (confirm(strDESC)) {
		window.location.href = strPage;		
		//window.location.href= strPage;
	}
}


function cmsControllaEMAIL(indirizzo) {
  if (window.RegExp) {
    var nonvalido = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
    var valido = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
    var regnv = new RegExp(nonvalido);
    var regv = new RegExp(valido);
    if (!regnv.test(indirizzo) && regv.test(indirizzo))
      return true;
    return false;
	}
  else {
    if(indirizzo.indexOf("@") >= 0)
      return true;
    return false;
  	}
}

function doRedirect(strUrl) { 
	location.href = strUrl;
}


function select_paese(frm) {
	if (frm.Paese.options[frm.Paese.selectedIndex].value!=132){ //.text!="Italia"
		frm.Provincia[1].selected = true
		frm.Provincia.disabled=true;
		}
	else{
		frm.Provincia.disabled=false;
		}
}


function DescriptionCharCount(frmTextArea, frmContaCar, frmMaxCar) {
	//alert();
	frmContaCar.value = (frmMaxCar.value-frmTextArea.value.length);
	if(frmTextArea.value.length>frmMaxCar.value){
		frmTextArea.value = Left(frmTextArea.value, frmTextArea.value.length-1)
		frmContaCar.value = (frmMaxCar.value-frmTextArea.value.length);
	}	
}

function Left(StringToLeft, EndOfCount) { 
	return StringToLeft.substr(0, EndOfCount); 
}

function ApriPopUp(str, nome, StrScrollbars, StrStatus, StrMenubar, StrToolbar, StrLocation, StrResizable, IntWidth, IntHeight)
{
	Finestra = window.open(str, nome, "scrollbars="+StrScrollbars+",status="+StrStatus+",menubar="+StrMenubar+",toolbar="+StrToolbar+",location="+StrLocation+",resizable="+StrResizable+",width="+IntWidth+",height="+IntHeight+"");
	Finestra.focus();
}

function confirm_ELI_admin(frm, tot_record)
{
	var sMsg0 = "";
	
	var blnElimina=false;
	var Contaelimina = 0;
	
	for (i=0; i<tot_record; i++) { 
		if(frm.chk_elimina[i].checked==true)
			blnElimina=true;
	} 
	
	blnReturn = true;
	if(blnElimina==true)
	{
		if(confirm(frm.msg_aggiorna.value))
			blnReturn = true
		else
			blnReturn = false;		
	}

	if(blnReturn==true){
		frm.submit();
		return true;
	}
}

function change_page(frm, pagina)
{
	frm.Pagina.value=pagina;
	frm.msg_aggiorna.value='';
	frm.submit();
	return true;
}


function DivVisibility(strDIV)
{		
	eval('IdDiv=document.getElementById("'+strDIV+'")');
	eval('IdDiv_Img=document.getElementById("img_'+strDIV+'")');
	if(IdDiv.style.visibility=='hidden')
	{	IdDiv.style.visibility = 'visible';
    	IdDiv.style.display ='inline';
	}
	else
	{	
		IdDiv.style.visibility = 'hidden';
    	IdDiv.style.display ='none';
	}	
}

function DivVisibility_Radio(strDIV, frmRadio)
{		
	valore_radio = frmRadio.value;
	eval('IdDiv=document.getElementById("'+strDIV+'")');
	eval('IdDiv_Img=document.getElementById("img_'+strDIV+'")');
	if(valore_radio=='N')
	{	IdDiv.style.visibility = 'visible';
    	IdDiv.style.display ='inline';
	}
	else
	{	
		IdDiv.style.visibility = 'hidden';
    	IdDiv.style.display ='none';
	}	
}


function DivVisibility_Select(strDIV, frmSelect)
{		
	valore_select = frmSelect.value;
	eval('IdDiv=document.getElementById("'+strDIV+'")');
	eval('IdDiv_Img=document.getElementById("img_'+strDIV+'")');
	if(valore_select=='-1')
	{	IdDiv.style.visibility = 'visible';
    	IdDiv.style.display ='inline';
	}
	else
	{	
		IdDiv.style.visibility = 'hidden';
    	IdDiv.style.display ='none';
	}	
}


function operazione_carrello(frm, operazione)
{		
	frm.operazione.value = operazione;
	frm.submit();
	return true;
}

function operazione_form(frm, operazione)
{		
	frm.operazione.value = operazione;
	frm.submit();
	return true;
}


