﻿// JScript File


function ChiudiFinestra()
{
	window.close();
}	



function GoExcellExport()
{
	if (document.form1.txt_validate.value=="true")
		window.open('Utenti_Excel.aspx','','');
	else
		alert("Nessuna ricerca specificata.");
}



function GoAnotherWindow(pagetonavigate,pagestyle)
{	
	window.open(pagetonavigate,'',pagestyle);
}


function MM_openBrWindow(theURL) 
{ 
 window.open(theURL);
}



function stampagina() 
{
    var nav = navigator.appVersion;
    {
        window.print();
    }
}
	



//FUNZIONE PER CONTROLLARE SE I VALORI INSERITI NEL CAMPO SONO NUMERICI IN PRODUZIONE
function numbersonlyPro(myfield, e, nodecimals)
{
    var key;
    var keychar;

    if (window.event)
        key = window.event.keyCode;
    else if (e)
        key = e.which;
    else
        return true;

    keychar = String.fromCharCode(key);

    // control keys
    if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
        return true;

    // numbers
    else if (("0123456789").indexOf(keychar) >= 0)
        return true;

	
	
    else if( (".").indexOf(keychar) >= 0) 
    {
        if(nodecimals)
            return false;		
		
        var CanAdd=(myfield.value.indexOf(".")<0);// && myfield.value.indexOf(".")<0);   
		
        if(CanAdd)
        {
            myfield.value+="."; //Aggiungo il carattere ","
            return false;//non lo riaggiungo
        }
    }
   return false;
}



//FUNZIONE PER CONTROLLARE SE I VALORI INSERITI NEL CAMPO SONO NUMERICI IN LOCALE
function numbersonlyDev(myfield, e, nodecimals)
{
    var key;
    var keychar;

    if (window.event)
        key = window.event.keyCode;
    else if (e)
        key = e.which;
    else
        return true;

    keychar = String.fromCharCode(key);

    // control keys
    if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
        return true;

    // numbers
    else if (("0123456789").indexOf(keychar) >= 0)
        return true;

	
	
    else if( (",").indexOf(keychar) >= 0) 
    {
        if(nodecimals)
            return false;		
		
        var CanAdd=(myfield.value.indexOf(",")<0);// && myfield.value.indexOf(".")<0);   
		
        if(CanAdd)
        {
            myfield.value+=","; //Aggiungo il carattere ","
            return false;//non lo riaggiungo
        }
    }
   return false;
}



//FUNZIONE PER CONTROLLARE CHE IL VALORE INSERITO NEL CAMPO EAN SIA SOLO NUMERICO
function numbersonlyEan(myfield, e, nodecimals)
{
    var key;
    var keychar;

    if (window.event)
        key = window.event.keyCode;
    else if (e)
        key = e.which;
    else
        return true;

    keychar = String.fromCharCode(key);

    // control keys
    if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
        return true;

    // numbers
    else if (("0123456789").indexOf(keychar) >= 0)
        return true;

    return false;
}		
