﻿<!--
window.onload = function(){  
 if(document.getElementById("divPageCarDatiBody")!=null && document.getElementById("ctl00_StaticPostBackScrollVerticalPosition")!=null)
    document.getElementById("divPageCarDatiBody").scrollTop = document.getElementById("ctl00_StaticPostBackScrollVerticalPosition").value;    
}


function SetDivPosition(){
 if(document.getElementById("divPageCarDatiBody")!=null && document.getElementById("ctl00_StaticPostBackScrollVerticalPosition")!=null)
    document.getElementById("ctl00_StaticPostBackScrollVerticalPosition").value=document.getElementById("divPageCarDatiBody").scrollTop;
}
      
//Funzione per controllare la login da web control
function CtrlUserLoginForm(){
   var UID="";
   var PWD="";
   
   if(document.getElementById('ctl00_CtrlLogin_txtLogin')!=null)
      UID=document.getElementById('ctl00_CtrlLogin_txtLogin').value;
               
   if(document.getElementById('ctl00_CtrlLogin_txtPassword')!=null)
      PWD=document.getElementById('ctl00_CtrlLogin_txtPassword').value;
         
   if(Trim(UID)=="" || Trim(PWD)=="")
   {
      alert('Inserire le credenziali di accesso...');
      return false;
   }
   
   return true;
}

//Funzione per controllare la login da pagina
function CtrlUserLoginFormWeb(){   
   var UID="";
   var PWD="";

   if(document.getElementById('ctl00_cphUserMaster_txtUser_UID')!=null)
      UID=document.getElementById('ctl00_cphUserMaster_txtUser_UID').value;
               
   if(document.getElementById('ctl00_cphUserMaster_txtUser_PWD')!=null)
      PWD=document.getElementById('ctl00_cphUserMaster_txtUser_PWD').value;
         
   if(Trim(UID)=="" || Trim(PWD)=="")
   {
      alert('Inserire le credenziali di accesso...');
      return false;
   }
   
   return true;
}

//Funzione per controllare la form delle newsletter
function CtrlNewslettersForm(){   

   var cat;
   
   if(document.getElementById('ctl00_CtrlNewsletter_ddlNewsletter')!= null)   
   {   
      cat=document.getElementById('ctl00_CtrlNewsletter_ddlNewsletter');
    
      if((cat.value==null)||(cat.value=="")){
         alert("Selezionare la categoria");
         cat.focus();
         return false;
      }
   }
   
   var emailID=document.getElementById('ctl00_CtrlNewsletter_txtMail');

   if ((emailID.value==null)||(emailID.value=="")){
	   alert("Inserire l'indirizzo E-Mail");
	   emailID.focus();
	   return false;
   }
   if (CheckEMail(emailID.value) == false) {
    alert("Indirizzo E-Mail non valido.")
	   emailID.value="";
	   emailID.focus();
	   return false;
   }
   return true
}

//Funzione per controllare la mail per il profilo
function CtrlProfileForm(){  
    
    var emailID=document.getElementById("ctl00_cphUserMaster_txtMail");
    
   	if ((emailID.value==null)||(emailID.value=="")){
		   alert("Inserire l'indirizzo E-Mail")
		   emailID.focus()
		   return false
	   }
	   if (CheckEMail(emailID.value)==false){
	   alert("Indirizzo E-Mail non valido.")
		   emailID.value=""
		   emailID.focus()
		   return false
	   }
	   return true	
}

//Funzione per controllare la form di request password
function ValidateRememberPwd(){

var emailID = document.getElementById("ctl00_cphUserMaster_txtUser_Email");      

if ((emailID.value==null)||(emailID.value=="")){
	   alert("Inserire l'indirizzo E-Mail")
	   emailID.focus()
	   return false
   }
   if (CheckEMail(emailID.value)==false){
        alert("Indirizzo E-Mail non valido.")
	   emailID.value=""
	   emailID.focus()
	   return false
   }
   return true
}

//Funzione per visualizzare/nascondere i menu
function ShowHidden(id){
  var divElement = document.getElementById(id);

  if (divElement.style.display=='none'){
     divElement.style.display='block';
  } else {
     divElement.style.display='none';
  }
}

//Funzione per visualizzare i contatti
function ShowFormMail() {    
    var divContatti=document.getElementById("divContatti");

    if (divContatti.style.display=='none'){
        divContatti.style.display='block';
    } else {
        divContatti.style.display='none';
    }
}

//Funzione per controllare la form dei commenti
function CtrlCommentForm(){
    var Nome="";
    var Testo="";

    if(document.getElementById('ctl00_cphUserMaster_txtNome')!=null)
      Nome=document.getElementById('ctl00_cphUserMaster_txtNome').value;
               
    if(document.getElementById('ctl00_cphUserMaster_txtTesto')!=null)
      Testo=document.getElementById('ctl00_cphUserMaster_txtTesto').value;
         
    if(Trim(Nome)=="" || Trim(Testo)=="")
    {
      alert('Inserire il nome ed il testo per il commento...');
      return false;
    }

    return true;
}
//-->