function isnumeric_field(sText)
{

   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
                     
   return IsNumber;
   
}

function submit_on_enter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;
if (keycode == 13)
{
myfield.form.submit();
return false;
}
else
return true;
}

function printon(){self.print();}

function popup(sPicURL) {
window.open("foto.htm?"+sPicURL, "", "resizable=0,HEIGHT=300,WIDTH=200");
}

function popupinvia(sPicURL) {
window.open("fotoinvia.asp?"+sPicURL, "", "resizable=0,HEIGHT=300,WIDTH=200");
}

function centra(page)
{
var w = screen.width; 
var h = screen.height; 
var x = Math.round(w / 2) - Math.round(700/2); 
var y = Math.round(h / 2) - Math.round(450/2); 
newwindow = window.open(page, null, 'scrollbars=1, left=' + x + ', screenX=' + x + ',top=' + y + 'screenY=' + y +',width=700,height=450'); 
window.opener=self
}

function vaisopra() {
window.top.scroll(0,0);
}


function ltrim(s) {return s.replace( /^\s*/, "" );}
function rtrim(s) {return s.replace( /\s*$/, "" );}
function trim (s) {return rtrim(ltrim(s));}

function verify(frm)
{

if (frm.name == 'carrello')
{
ok = 0;

if (frm.totalehidden.value == "0")
    {
     errorString = "Per procedere con gli acquisti è necessario selezionare almeno un prodotto";
     alert(errorString);
     ok = 1;
    }

if (ok == 1) return false;
}

if (frm.name == 'registra')
{

ok = 0;

Ctrl = frm.email;
result = false;
space_tokens = Ctrl.value.split(" ");
if (space_tokens.length == 1) {
at_tokens = Ctrl.value.split("@");
if (at_tokens.length == 2) {
if (at_tokens[1].length != 0) {
   right_dot_tokens = at_tokens[1].split(".");
   if (right_dot_tokens.length >= 2) {
   if (right_dot_tokens[1].length != 0) {
   result=true;}}}}}

if (frm.nickname.value == "")
    {
     errorString = "Il NICKNAME è obbligatorio";
     alert(errorString);
     frm.nickname.focus();
     ok = 1;
    }

else if (!result){
           errorString = "Inserisci un'indirizzo E-MAIL valido";
           alert(errorString);
           Ctrl.focus();
           ok = 1;
           }

else if (frm.email2.value != frm.email.value)
    {
     errorString = "Le e-mail inserite non corrispondono.";
     alert(errorString);
     frm.email.focus();
     ok = 1;
    }

else if (!frm.regolamento.checked)
    {
     errorString = "L'accettazione del regolamento è necessaria per poter procedere con la registrazioneo";
     alert(errorString);
     ok = 1;
    }

if (ok == 1)
   return false;

}


}
 
function start(winflash, x, y, bar)
{
window.open(winflash,'','scrollbars='+bar+',screenX=150,screenY=50,left=150,top=50,resizable=0,menubar=0,toolbar=0,status=0,width='+x+',height='+y);
}


function startchat(winflash, x, y, bar)
{
window.open(winflash,'CHAT','scrollbars='+bar+',screenX=150,screenY=50,left=150,top=50,resizable=0,menubar=0,toolbar=0,status=0,width='+x+',height='+y);
}


function openflash(winflash, x, y)
{
ind="immagini/"+winflash;
window.open(ind,'','scrollbars=0,screenX=150,screenY=50,left=150,top=50,resizable=0,menubar=0,toolbar=0,status=0,width='+x+',height='+y);
}
