//Funzioni javascript Shadow Sport Center
//By Fabio Tosini

//verifica se ho campi vuoti nel form delle pagine Contatti
function Controllo()
 {
	 str = document.Form1.MAIL.value;
	 if (document.Form1.NOME.value=="")
             {
               alert('Nome obbligatorio!');
               document.Form1.NOME.focus();	
               window.event.returnValue = false;			   
              }
              else if (document.Form1.COGME.value=="")
                        {
                          alert('Cognome obbligatorio!');
                          document.Form1.COGME.focus();	
                          window.event.returnValue = false;   
                        }
                         else if (document.Form1.MAIL.value=="")
                        {
                          alert('Il campo E-mail del destinatario non puņ essere vuoto!');
                          document.Form1.MAIL.focus();	
                          window.event.returnValue = false;  
                        }
                        else if (document.Form1.TEXTAREA1.value=="")
                        {
                          alert('Il testo del messaggio č vuoto!!');
                          document.Form1.TEXTAREA1.focus();	
                          window.event.returnValue = false;			   
                        }
                        else
                        { window.event.returnValue = true;}
 }

//verifica la correttezza del campo E-mail nelle pagine Contatti/Contacts
function ControlloMail()
{
    //alert(document.location.search.substring(8,9));
    if (document.Form1.MAIL.value != "")
    {
        str = document.Form1.MAIL.value;
		if (!(/^[\w\.]+@[a-z\.]+[.]+[\D\.]+$/.test(str)))
			{
			alert("E-mail inserita non valida!");
			document.Form1.MAIL.focus();
			window.event.returnValue = false;
			}   
    }     
 }
 
 //Controlli per la pagina del guestbook
 function Ctrl_Guest()
 {
		 strmail = document.Form1.email.value;
		 if (document.Form1.oTxtTitle.value=="")
				{
               alert('Il titolo del messaggio č obbligatorio!');
               document.Form1.oTxtTitle.focus();	
               window.event.returnValue = false;  
            }
            else if(document.Form1.oTxtName.value=="")
				{
					alert('Nome (o Nickname) obbligatorio!');
					document.Form1.oTxtName.focus();	
					window.event.returnValue = false;			   
				}
            else if (document.Form1.oTxtMail.value=="")
            {
               alert('Il campo E-mail non puņ essere vuoto!');
               document.Form1.oTxtMail.focus();	
               window.event.returnValue = false;  
            }
            else if (document.Form1.oTxtMsg.value=="")
            {
               alert('Il testo del messaggio č vuoto!!');
               document.Form1.oTxtMsg.focus();	
               window.event.returnValue = false;			   
            }
            else  if (document.Form1.oTxtMail.value != "")
				{
					if (!(/^[\w\.]+@[a-z\.]+[.]+[\D\.]+$/.test(strmail)))
						{
						alert("E-mail inserita non valida!");
						document.Form1.oTxtMail.focus();
						window.event.returnValue = false;
						}   
				}    
            else
            { window.event.returnValue = true;}
 }
 
 
function FitPic() 
{ 
	iWidth = (NS)?window.innerWidth:document.body.clientWidth; 
   iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
   iWidth = document.images[0].width - iWidth; 
   iHeight = document.images[0].height - iHeight; 
   //alert('Altezza ' + iHeight + ' -- Larghezza ' + iWidth);
   window.resizeBy(iWidth, iHeight);
   self.focus(); 
}

function nocopy()
{
	if (event.button==2) {alert ("Shadow Sport Center©"); }
}

 
