//**************************************************************************************
//ELENCO FUNZIONI PRESENTI
//
//	ValNull		-> Verifica se ha un valore nullo	
//	ValidEmail	-> Verifica la validità di un email
//	ValidNumber	-> Verifica se è un numero valido
//	ValiLength	-> Verifica se una stringa supera un certo numero di caratteri
//	CreateWindows    -> Crea una finestra PopUp
//  CreateWindowsOp  -> Uguale alla precedente solo che accetta le opzioni di creazione
//	CreateCode 	-> Crea un codice univoco
//  IsItEqual       -> Dati due campi dice se sono =
//  mouseDx         -> Funzione da chimare quando si deve disabilitare il tasto destro del
//                     mouse
//  toolTipShow     -> Visualizza i tooltip (richiede Easy Popup rel 1.1 e succ.)
//  toolTipHide     -> Nasconde i tooltip (richiede Easy Popup rel 1.1 e succ.)
//
//**************************************************************************************
var FOCUS_YES = 1; //abilita il focus della finestra
var FOCUS_NO = 0;  //disabilita il focus della finestra
var ALL_WIN = "_top" //target della finestra a tutto schermo
var NEW_WIN = "_blank" //target in una nuova finestra
var FIRST_FRAME = "_parent" //target nello stesso frame principale
var finestra;  //Mi serve x le finestre

//****************************************************
//Nome Funzione: ValNull
//Funzione: Restituisce TRUE se il valore di ITEM = ""
//Creata da Rosario Sensale
//il 18.52 04/04/2003
//****************************************************
function ValNull(item) {
  if (item == "") return false; 
     return true;
}
//****************************************************
//Nome Funzione: IsItEqual
//Funzione: Restituisce TRUE se il valore di ITEM1 è
//          = a ITEM2
//Creata da Rosario Sensale
//il 9.10 04/08/2003
//****************************************************
function IsItEqual(item1,item2) {
  if (item1 == item2) return true; 
     return false;
}
//****************************************************
//Nome Funzione: ValidLength
//Funzione: Verifica se una stringa è > di LEN
//Creata da Rosario Sensale
//il 18.52 04/04/2003
//****************************************************
function ValidLength(item, len) {
   return (item.length >= len);
}
//****************************************************
//Nome Funzione: ValidNumber
//Funzione: Verifica se un valore passato è un numero
//Creata da Rosario Sensale
//il 18.52 04/04/2003
//****************************************************
function ValidNumber(item) {
 if (isNaN(item) == true) return false; 
    return true;
}
//****************************************************
//Nome Funzione: ValidEmail
//Funzione: Verifica la validità di un EMAIL
//Parametri Passati: l'indirizzo Email
//Creata da Rosario Sensale
//il 18.52 04/04/2003
//****************************************************
function ValidEmail(item) {
   if (!ValidLength(item, 5)) return false;
   if (item.indexOf ('@', 0) == -1) return false;
   if (item.indexOf ('.', 0) == -1) return false;
   if (item.indexOf (':', 0) != -1) return false;
   if (item.indexOf ('#', 0) != -1) return false;
   if (item.indexOf ('/', 0) != -1) return false;
   if (item.indexOf ('ç', 0) != -1) return false;
   if (item.indexOf ('ÿ', 0) != -1) return false;
   if (item.indexOf ('ÿ', 0) != -1) return false;
   if (item.indexOf ('ý', 0) != -1) return false;
   if (item.indexOf ('ü', 0) != -1) return false;
   if (item.indexOf ('û', 0) != -1) return false;
   if (item.indexOf ('ú', 0) != -1) return false;
   if (item.indexOf ('ù', 0) != -1) return false;
   if (item.indexOf ('ö', 0) != -1) return false;
   if (item.indexOf ('õ', 0) != -1) return false;      
   if (item.indexOf ('ô', 0) != -1) return false;      
   if (item.indexOf ('ó', 0) != -1) return false;      
   if (item.indexOf ('ò', 0) != -1) return false;      
   if (item.indexOf ('ñ', 0) != -1) return false;      
   if (item.indexOf ('ð', 0) != -1) return false;      
   if (item.indexOf ('ï', 0) != -1) return false;      
   if (item.indexOf ('î', 0) != -1) return false;         
   if (item.indexOf ('ë', 0) != -1) return false;            
   if (item.indexOf ('ê', 0) != -1) return false;            
   return true;
}

//*****************************************************************
//Nome Funzione: CreateWindows
//Funzione: Crea una finestra in PopUp
//Parametri Passati: Focus (0 o 1) indica se la finestra 
//	             deve avere il focus
//		     WinPage indica la pagina che deve
//		     essere aperta
//		     WinTarget è il target della finestra
//		     WidthWin larghezza della finestra
//		     HeightWin altezza della finestra 
//                   WinFocus se > 0 la finestra riceve il focus
//Creata da Rosario Sensale
//il 12.31 20/04/2003
//*****************************************************************
function CreateWindows(WinPage,WinTarget,WidthWin,HeightWin,WinFocus){
    finestra=window.open(WinPage,WinTarget,"width=500,height=250,history=no,resizable=yes,status=no,scrollbars=YES,menubar=no")
    finestra.resizeTo(WidthWin, HeightWin);
    finestra.moveTo((screen.width/2)-(WidthWin/2),(screen.height/2)-(HeightWin/2));
    if (WinFocus > 0) 
	{
		finestra.focus();
	}
    return finestra;
}

//*****************************************************************
//Nome Funzione: CloseFrame
//Funzione: chiuna una finestra popup con frame
//Creata da Rosario Sensale
//il 8:00 del 18/12/2003
//*****************************************************************
function CloseFrame(){
    parent.close()
}

//*****************************************************************
//Nome Funzione: CreateWindowsOp
//Funzione: Crea una finestra in PopUp specificando le opzioni
//Parametri Passati: Focus (0 o 1) indica se la finestra
//	             deve avere il focus
//		     WinPage indica la pagina che deve
//		     essere aperta
//		     WinTarget è il target della finestra
//		     WidthWin larghezza della finestra
//		     HeightWin altezza della finestra
//                   WinFocus se > 0 la finestra riceve il focus
//Creata da Rosario Sensale
//il 12.31 20/04/2003
//*****************************************************************
function CreateWindowsOp(WinPage,WinTarget,WidthWin,HeightWin,strOp,WinFocus){
var finestra;
    finestra=window.open(WinPage,WinTarget,strOp)
    finestra.resizeTo(WidthWin, HeightWin);
    finestra.moveTo((screen.width/2)-(WidthWin/2),(screen.height/2)-(HeightWin/2));
    if (WinFocus > 0)
	{
		finestra.focus();
	}
    return finestra;
}
//****************************************************
//Nome Funzione: CreateCode
//Funzione: crea un codice univoco
//Parametri Passati: Nessuno
//Creata da Rosario Sensale
//il 12.31 20/04/2003
//****************************************************
function CreateCode()
{
	var Data = new Date();
	var Giorno= Data.getDate();
	var Mese= Data.getMonth();
	var Anno= Data.getYear();
	var Ora=Data.getHours();
	var Minuti=Data.getMinutes();
	var Secondi=Ora=Data.getSeconds();
	return (Secondi +  Minuti) + Minuti + "" + Ora + "" + Anno + "" + Mese + "" + Giorno;
}

//****************************************************
//Nome Funzione: mouseDx
//Funzione: è la funziona da chiamare per disabilitare
//          il tasto destro del mouse
//Esempio:  per chimare la funzione basta mettere nel
//          tag <body onContextMenu="return mouseDx();">
//Parametri Passati: Nessuno
//Creata da Rosario Sensale
//il 12.31 17/02/2004
//****************************************************
function mouseDx(){
    window.alert("© 2004-2005 by INFOSERV srl - Tutti i diritti sono riservati!  ");
    return false;
}

//****************************************************

//Nome Funzione: ToolTipShow

//Funzione: visualizza un tooltip al passaggio del mouse

//Parametri Passati: Id del tooltip da gestire

//Creata da Gianluca Celentano

//il 17.40 23/10/2004

//****************************************************
function toolTipShow(nomeToolTip){
	var oggettoToolTip;
	var toolTipCoordX;
	var toolTipCoordY;
	oggettoToolTip = document.getElementById(nomeToolTip);
	toolTipCoordX = (EP016969 - 325);
	toolTipCoordY = (EP019696 - 25);
	oggettoToolTip.style.top = toolTipCoordY;
	oggettoToolTip.style.left = toolTipCoordX;
	epPopupPosition=''; easyPopup(nomeToolTip,epShow,100,epShow);
	epPopupPosition=''; easyPopup(nomeToolTip,epShow,100,epShow);
}

//****************************************************

//Nome Funzione: ToolTipHide

//Funzione: nasconde un tooltip

//Parametri Passati: Id del tooltip da nascondere

//Creata da Gianluca Celentano

//il 17.54 25/10/2004

//****************************************************
function toolTipHide(nomeToolTip){
	var oggettoToolTip;
	oggettoToolTip = document.getElementById(nomeToolTip);
	epPopupPosition='';
	easyPopup(nomeToolTip,epHide,100,epHide);
}

