function CancelValueText(txt) {
	txtObj = document.getElementById(txt);
	if (txtObj) { 
		txtObj.value = "";
		if (txtObj.onchange) txtObj.onchange();
	}
}

function CancelValueTextCombo(txt, cmb, copia) {
	txtObj = document.getElementById(txt);
	copObj = document.getElementById(copia);
	cmbObj = document.getElementById(cmb);
	if (copObj) txtObj.value = ""; 
	if (txtObj) txtObj.value = ""; 
	if (cmbObj) cmbObj.selectedIndex = 0;
}

function FieldCopyFromList(nTxt, nSel, checkKey, closeWindow, nCheck) {
	var idxSel, strSel;
	
	var thisWnd = (opener) ? opener : dialogArguments ;	
	var txtObj = thisWnd.document.getElementById(nTxt);
	var checkInput = thisWnd.document.getElementById(nCheck);

	selValues = document.getElementById(nSel);
	if (!txtObj || !selValues) return;
		
    if (checkKey) {
		var rKey ;
		rKey=0;	rKey= event.keyCode;
		if (rKey!=13)	return;
	}

	idxSel = selValues.selectedIndex;
	strSel = (idxSel>-1) ? selValues.options[idxSel].value : "";
	txtObj.value=strSel;
	if (checkInput != null) {
		checkInput.value = strSel;
	}
	if (closeWindow) window.close();
}	

/*
	--------------------------------
	per restituire la stringa al CMS
	--------------------------------
*/
function FieldCopyCMS(nTxt, nSel, closeWindow) {
	var thisWnd = (opener) ? opener : dialogArguments ;	
	var txtObj = thisWnd.document.getElementById(nTxt);
	if (nSel != null)
	{
		window.opener.document.forms['Form1'].stringa.value = nSel;
		// txtObj.value = nSel;
		if (closeWindow) {
			window.close();
		}
	}
}	


function GotoVocabAut(pKey, pField, pTxtId) {
	var winPage;
	var hWnd_Vocab; 				
	winPage = "Vocabolario.aspx?G=3&KEY="+pKey+"&F="+pField+"&ID="+pTxtId;
	hWnd_Vocab = window.open(winPage,null,"height=410,width=500,status=no,toolbar=no,menubar=no,location=no,resizable=yes,top=100,left=100");
}

function GotoVocabAut_En(pKey, pField, pTxtId) {
	var winPage;
	var hWnd_Vocab; 				
	winPage = "Vocabolario_En.aspx?G=3&KEY="+pKey+"&F="+pField+"&ID="+pTxtId;
	hWnd_Vocab = window.open(winPage,null,"height=410,width=500,status=no,toolbar=no,menubar=no,location=no,resizable=yes,top=100,left=100");
}

function GotoVocab(pTSK, pKey, pField, pTxtId, pCheckId) {
	var winPage;
	var hWnd_Vocab; 				
	winPage = "Vocabolario.aspx?G=1&TSK="+pTSK+"&KEY="+pKey+"&F="+pField+"&ID="+pTxtId+"&CHECK="+pCheckId;
	hWnd_Vocab = window.open(winPage,null,"height=410,width=500,status=no,toolbar=no,menubar=no,location=no,resizable=yes,top=100,left=100");
}

function GotoVocab_En(pTSK, pKey, pField, pTxtId) {
	var winPage;
	var hWnd_Vocab; 				
	winPage = "Vocabolario_En.aspx?G=1&TSK="+pTSK+"&KEY="+pKey+"&F="+pField+"&ID="+pTxtId;
	hWnd_Vocab = window.open(winPage,null,"height=410,width=500,status=no,toolbar=no,menubar=no,location=no,resizable=yes,top=100,left=100");
}

function GotoVocabLoc(pGetField, pProv, pTxtId) {
	var winPage;
	var hWnd_Vocab; 				
	winPage = "Vocabolario.aspx?G=2&F="+pGetField+"&P="+pProv+"&ID="+pTxtId;
	hWnd_Vocab = window.open(winPage,null,"height=410,width=500,status=no,toolbar=no,menubar=no,location=no,resizable=yes,top=100,left=100");
}

function GotoVocabLoc_En(pGetField, pProv, pTxtId) {
	var winPage;
	var hWnd_Vocab; 				
	winPage = "Vocabolario_En.aspx?G=2&F="+pGetField+"&P="+pProv+"&ID="+pTxtId;
	hWnd_Vocab = window.open(winPage,null,"height=410,width=500,status=no,toolbar=no,menubar=no,location=no,resizable=yes,top=100,left=100");
}

function GotoInfoScheda(pTSK, pID) {
	var winPage;
	var hWnd_Vocab; 				
	winPage = "../common/ViewInfoScheda.aspx?TSK="+pTSK+"&ID="+pID;
	hWnd_Vocab = window.open(winPage,null,"height=250,width=500,status=no,toolbar=no,menubar=no,location=no,resizable=auto,top=100,left=100");
}

function GotoInfoScheda_En(pTSK, pID) {
	var winPage;
	var hWnd_Vocab; 				
	winPage = "../common/ViewInfoScheda_En.aspx?TSK="+pTSK+"&ID="+pID;
	hWnd_Vocab = window.open(winPage,null,"height=250,width=500,status=no,toolbar=no,menubar=no,location=no,resizable=auto,top=100,left=100");
}

function GotoInfoEnte_En(pID) {
	var winPage;
	var hWnd_Vocab; 				
	winPage = "../common/ViewInfoEnte_En.aspx?ID="+pID;
	hWnd_Vocab = window.open(winPage,null,"height=175,width=500,status=no,toolbar=no,menubar=no,location=no,resizable=auto,top=100,left=100");
}

function GotoInfoEnte(pID) {
	var winPage;
	var hWnd_Vocab; 				
	winPage = "../common/ViewInfoEnte.aspx?ID="+pID;
	hWnd_Vocab = window.open(winPage,null,"height=175,width=500,status=no,toolbar=no,menubar=no,location=no,resizable=auto,top=100,left=100");
}

function GotoViewImg_En(pScheda, pId, pImg, pIsJpg) {
	var winPage;
	var hWnd_Ricorr; 				
	winPage = "../common/ViewImage_En.aspx?TSK="+pScheda+"&id="+pId+"&img="+pImg+"&jpg="+pIsJpg;
	hWnd_Ricorr = window.open(winPage,null,"height=500,width=700,status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes,top=100,left=100");
}

function GotoViewImg(pScheda, pId, pImg, pIsJpg) {
	var winPage;
	var hWnd_Ricorr; 				
	winPage = "../common/ViewImage.aspx?TSK="+pScheda+"&id="+pId+"&img="+pImg+"&jpg="+pIsJpg;
//	hWnd_Ricorr = window.open(winPage,null,"height=500,width=700,status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes,top=100,left=100");
//	hWnd_Ricorr = window.open(winPage,null,"height=500,width=700,status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes");
	hWnd_Ricorr = window.open(winPage,null,"status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes");
}

function GotoPrintScheda(pTSK, pID) {
	var winPage;
	var hWnd_StampaScheda; 				
	winPage = "PrintSK.aspx?TSK="+pTSK+"&ID="+pID;
	hWnd_StampaScheda = window.open(winPage,null,"status=yes,menubar=yes,resizable=yes,scrollbars=yes,location=no,height=400,width=800");
}

function GotoPrintScheda_En(pTSK, pID) {
	var winPage;
	var hWnd_StampaScheda; 				
	winPage = "PrintSK_En.aspx?TSK="+pTSK+"&ID="+pID;
	hWnd_StampaScheda = window.open(winPage,null,"status=yes,menubar=yes,resizable=yes,scrollbars=yes,location=no,height=400,width=800");
}

function GotoSitbecById(pTSK, pID) {
	var winPage;
	var hWnd_goSitbec; 		
	winPage = "http://servizi.informsrl.it/test_linux/Informcity/sitbec/ic_ext_call.php?tsk="+pTSK+"&id="+pID+"&id_ruolo=3";	
	hWnd_goSitbec = window.open(winPage, "main","toolbar=no,status=yes,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,width=985,height=702,left=0,top=0");
}

function GotoSitbecByComune(pComune) {
	var winPage;
	var hWnd_goSitbec; 		
	winPage = "http://servizi.informsrl.it/test_linux/Informcity/sitbec/ic_ext_call.php?comune="+pComune+"&id_ruolo=2";	
	hWnd_goSitbec = window.open(winPage, "main","toolbar=no,status=yes,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,width=985,height=702,left=0,top=0");
}

function TestForEnter(btnToClick) {
 if (event.keyCode == 13) {
	var btnObj = document.getElementById(btnToClick);
	if (btnObj) {
		btnObj.click();
	} 
	event.returnValue = false;
 }
 
}

