function voidf()
{
	return;
}

function chooseStyle()
{
	if((navigator.userAgent.indexOf("MSIE")!=-1))
	{
		document.write("<LINK rel='stylesheet' type='text/css' href='/Include/stileexplorer.css'>")
	}
	else
	{
		document.write("<LINK rel='stylesheet' type='text/css' href='/Include/stilenetscape.css'>")
	}
}

function CheckUser(objForm)
{
	if(! IsnotEmpty(objForm.uid, "Il campo \'Nome utente\' &egrave; obbligatorio"))
		return (false);
	
	if(! IsnotEmpty(objForm.password, "Il campo \'Password\' &egrave obbligatorio"))
		return (false);
	
	if(! CheckEmail(objForm.email))
		return (false);
		
	if(! IsNumeric(objForm.redazionePosition, "Il campo \'Posizione nella lista dei redattori\' deve contenere un valore numerico"), true)
	
	return(true);
}

function CheckEditedUser(objForm)
{
	if(! CheckEmail(objForm.email))
		return (false);
		
	if(! IsNumeric(objForm.redazionePosition, "Il campo \'Posizione nella lista dei redattori\' deve contenere un valore numerico"), true)
	
	return(true);
}

function CheckCategories(objForm)
{
	if(! IsnotEmpty(objForm.TXT_Cat, "Il campo \'Nome categoria\' è obbligatorio"))
		return (false);
	
	if(! IsnotEmpty(objForm.NUM_Ord, "Il campo \'Ordine\' è obbligatorio"))
		return (false);

	if(! IsNumeric(objForm.NUM_Ord, "Il campo \'Ordine\' deve essere numerico"))
		return (false);
		
return(true);
}

function CheckCities(objForm)
{
	if(! IsnotEmpty(objForm.TXT_City, "Il campo \'Nome città\' è obbligatorio"))
		return (false);
		
return(true);
}

function CheckArticles(objForm)
{
	if(! IsnotEmpty(objForm.TXT_Titolo, "Il campo \'Titolo\' è obbligatorio"))
		return (false);
		
	if(! IsnotEmpty(objForm.TXT_Testo, "Il campo \'Testo articolo\' è obbligatorio"))
		return (false);
		
	if(! IsnotEmpty(objForm.TXT_Titolo, "Il campo \'Titolo\' è obbligatorio"))
		return (false);
		
	if(! IsnotEmpty(objForm.TXT_Titolo, "Il campo \'Titolo\' è obbligatorio"))
		return (false);
		
	if(! IsnotEmpty(objForm.TXT_Titolo, "Il campo \'Titolo\' è obbligatorio"))
		return (false);
		
	if(! IsnotEmpty(objForm.TXT_Titolo, "Il campo \'Titolo\' è obbligatorio"))
		return (false);
		
return(true);
}

function CheckSendPwd(objForm)
{
	if(! IsnotEmpty(objForm.Email, "Il campo \'Email\' è obbligatorio"))
		return (false);
	
	if(! CheckEmail(objForm.Email))
		return (false);
	
return(true);
}

function CheckRegistration(objForm)
{
	if(! objForm.acceptPrivacy[0].checked)
		{
		alert("E\' necessario accettare l'informativa sulla privacy");
		return (false);
		}

	if(! IsnotEmpty(objForm.Email, "Il campo \'Email\' è obbligatorio"))
		return (false);
	
	if(! CheckEmail(objForm.Email))
		return (false);
	
	if(! IsnotEmpty(objForm.Password, "Il campo \'Password\' è obbligatorio"))
		return (false);

	if(! IsnotEmpty(objForm.ConfirmPassword, "Il campo \'Conferma Password\' è obbligatorio"))
		return (false);
		
	if (objForm.ConfirmPassword.value != objForm.Password.value)
		{
		alert("La password di conferma è errata");
		objForm.ConfirmPassword.focus();
		return (false);
		}
		
return(true);
}

function CheckRgsUsr(objForm)
{
	if(! objForm.acceptPrivacy[0].checked)
		{
		alert("E\' necessario accettare l'informativa sulla privacy");
		return (false);
		}

	if(! IsnotEmpty(objForm.Email, "Il campo \'Email\' è obbligatorio"))
		return (false);
	
	if(! CheckEmail(objForm.Email))
		return (false);
	
	if(! IsnotEmpty(objForm.Password, "Il campo \'Password\' è obbligatorio"))
		return (false);
		
return(true);
}

function HandleCheckbox(objCheckbox, objRadio)
{
	//controlla se il checkbox è selezionato
	
	if (objCheckbox.checked == true)
	{
		//se si imposta il valore HTML a vero
		objRadio[0].checked=true;
	}
	else
	{
		//altrimenti li imposta entrambi a false
		objRadio[0].checked=false;
		objRadio[1].checked=false;
	}
	
return(true);
}

function CheckDelete(objForm)
{
	if(! IsnotEmpty(objForm.Email, "Il campo \'Email\' è obbligatorio"))
		return (false);
	
	if(! CheckEmail(objForm.Email))
		return (false);

	if(! IsnotEmpty(objForm.Password, "Il campo \'Password\' è obbligatorio"))
		return (false);

	if(! confirm("Sei sicuro di voler cancellare i dati?"))
		return (false);
		
return(true);
}

function CheckCompetitionInformation(objForm)
{
	if(! IsnotEmpty(objForm.FirstName, "Il campo \'Nome\' è obbligatorio"))
		return (false);

	if(! IsnotEmpty(objForm.LastName, "Il campo \'Cognome\' è obbligatorio"))
		return (false);

	if(! IsnotEmpty(objForm.Address, "Il campo \'Indirizzo\' è obbligatorio"))
		return (false);

	if(! IsnotEmpty(objForm.ZipCode, "Il campo \'CAP\' è obbligatorio"))
		return (false);

	if(! IsNumeric(objForm.ZipCode, "Il campo \'CAP\' non è corretto"))
		return (false);

	if(! LengthRequired(objForm.ZipCode, 5, "Il campo \'CAP\' non è corretto"))
		return (false);

	if(! IsnotEmpty(objForm.City, "Il campo \'Città\' è obbligatorio"))
		return (false);

	if(! IsOptionChecked(objForm.Gender, "Il campo \'Sesso\' è obbligatorio"))
	return (false);

	if(! IsnotEmpty(objForm.BornDay, "Il campo \'Giorno di nascita\' è obbligatorio"))
		return (false);

	if(! IsNumeric(objForm.BornDay, "Il campo \'Giorno di nascita\' è non è corretto"))
		return (false);
	
	if(! NumberInRange(objForm.BornDay, 1, 31, "Il campo \'Giorno di nascita\' è non è corretto"))
		return (false);
	
	if(! IsnotEmpty(objForm.BornMonth, "Il campo \'Mese di nascita\' è obbligatorio"))
		return (false);

	if(! IsNumeric(objForm.BornMonth, "Il campo \'Mese di nascita\' è non è corretto"))
		return (false);
	
	if(! NumberInRange(objForm.BornMonth, 1, 12, "Il campo \'Mese di nascita\' è non è corretto"))
		return (false);

}

function CheckPersonalInformation(objForm)
{
	if(! IsOptionChecked(objForm.InstructionLevel, "Il campo \'Livello di istruzione\' è obbligatorio"))
	return (false);

	if(! IsOptionChecked(objForm.Profession, "Il campo \'Professione\' è obbligatorio"))
	return (false);
	
	if(objForm.Profession.value < 7)
	{
		if(! IsOptionChecked(objForm.MerchantSector, "Il campo \'Settore merceologico azienda\' è obbligatorio"))
		return (false);

		if(! IsOptionChecked(objForm.CompanyDimension, "Il campo \'Dimensione Azienda\' è obbligatorio"))
		return (false);

		//if(! IsOptionChecked(objForm.ITProfession, "Il campo \'Ruolo IT\' è obbligatorio"))
		//return (false);

		//if(! IsOptionChecked(objForm.ITCompanyType, "Il campo \'Tipologia Azienda\' è obbligatorio"))
		//return (false);
	}

	if(! IsnotEmpty(objForm.BornDay, "Il campo \'Giorno di nascita\' è obbligatorio"))
		return (false);

	if(! IsNumeric(objForm.BornDay, "Il campo \'Giorno di nascita\' è non è corretto"))
		return (false);
	
	if(! NumberInRange(objForm.BornDay, 1, 31, "Il campo \'Giorno di nascita\' è non è corretto"))
		return (false);
	
	if(! IsnotEmpty(objForm.BornMonth, "Il campo \'Mese di nascita\' è obbligatorio"))
		return (false);

	if(! IsNumeric(objForm.BornMonth, "Il campo \'Mese di nascita\' è non è corretto"))
		return (false);
	
	if(! NumberInRange(objForm.BornMonth, 1, 12, "Il campo \'Mese di nascita\' è non è corretto"))
		return (false);

	if(! IsnotEmpty(objForm.State, "Il campo \'Provincia\' è obbligatorio"))
		return (false);
	
	if(! IsnotEmpty(objForm.BornYear, "Il campo \'Anno di nascita\' è obbligatorio"))
		return (false);

	if(! IsNumeric(objForm.BornYear, "Il campo \'Anno di nascita\' è non è corretto"))
		return (false);
		
	if(! LengthRequired(objForm.BornYear, 4, "Il campo \'Anno di nascita\' non è corretto (4 cifre)"))
		return (false);
		
	if(! NumberInRange(objForm.BornYear, 1880, 2001, "Il campo \'Anno di nascita\' è non è corretto"))
		return (false);
		
return(true);
}

function disableMandatories(NameObject)
{
	if(NameObject.value < 7)
	{
		// mostra il simbolo del campo obbligatorio
		document.images.MerchantSector.src = "images/ats.gif"
		document.images.CompanyDimension.src = "images/ats.gif"
		//document.images.ITProfession.src = "images/ats.gif"
		//document.images.ITCompanyType.src = "images/ats.gif"
	}
	else
	{
		// toglie il simbolo del campo obbligatorio
		document.images.MerchantSector.src = "/zdnet/images/space.gif"
		document.images.CompanyDimension.src = "/zdnet/images/space.gif"
		//document.images.ITProfession.src = "/zdnet/images/space.gif"
		//document.images.ITCompanyType.src = "/zdnet/images/space.gif"
	}
}

function CheckChangePassword(objForm)
{
	if(! IsnotEmpty(objForm.Password, "Il campo \'Password attuale\' è obbligatorio"))
		return (false);

	if(! IsnotEmpty(objForm.NewPassword, "Il campo \'Nuova password\' è obbligatorio"))
		return (false);

	if(! IsnotEmpty(objForm.ConfirmPassword, "Il campo \'Conferma password\' è obbligatorio"))
		return (false);
		
	if (objForm.ConfirmPassword.value != objForm.NewPassword.value)
		{
		alert("La password di conferma è errata");
		objForm.ConfirmPassword.focus();
		return (false);
		}

return(true);
}
//--------------------------------------------------------------------------------
// IsnotEmpty: Funzione per controllare  che un valore non abbia un valore nullo
// Campi: Nome Form,nome oggetto,Stringa da mettere nella MsgBox
//--------------------------------------------------------------------------------

function IsnotEmpty(NameObject,msgbox)
{
if (NameObject.value == "")
  {
    alert(msgbox);
    NameObject.focus();
    return (false);
  }
return (true);
}

//--------------------------------------------------------------------------------
// IsRadioSelected: Controlla che sia selezionato un radio button
// Campi: 
//			NameObject	= nome oggetto
//			msgbox		= stringa da mettere nella MsgBox
//--------------------------------------------------------------------------------
function IsRadioSelected(NameObject,msgbox)
{
	var IsChecked = false;
		
	if (isNaN(NameObject.length))
	{				
		if(NameObject.checked == true)
		{			
			IsChecked = true;							
		}								
	}
	else
	{		
		for (i=0; i<NameObject.length; i++)
		{
			if(NameObject[i].checked == true)
			{			
				IsChecked = true;
			}		
		}
	}	
		
	if (IsChecked == false)
	{
		alert(msgbox);			
		return(false);
	}
	
return(true);
}

//--------------------------------------------------------------------------------
// IsnotEmpty: Funzione per controllare la mail
// Campi: Nome Form,nome oggetto,Stringa da mettere nella MsgBox
//--------------------------------------------------------------------------------


function CheckEmail(NameObject)
{
var temp;
var space;

if (NameObject.value == "")
  {
    alert("Attenzione il  campo \"E-mail\" è obbligatorio");
    NameObject.focus();
    return (false);
  }
	// check validità email
txt=NameObject.value;
if (txt.indexOf("@")<2)
	// check presenza @
  {
    alert("Indirizzo E-mail non valido");
    NameObject.focus();
	return (false);
}
if (txt.lastIndexOf(".")<txt.indexOf("@"))
	// check presenza .
  {
	alert("Indirizzo E-mail non valido");
	NameObject.focus();
	return (false);
  }

if (txt.length<6)
	// check lunghezza almeno 6 char
  {
	alert("Indirizzo E-mail non valido");
	NameObject.focus();
	return (false);
  }

return (true);
}

function LengthRequired(NameObject, length, msgbox)
{
	if(NameObject.value.length < length)
	{
		alert(msgbox);
		NameObject.focus();
		return(false);
	}
	else
	{
		return(true);
	}	
}

//IsNumeric
// controlla se un valore è un numero
function IsNumeric(NameObject, msgbox, stripZero)
{
	var checkOK ="0123456789";
	var checkStr = NameObject.value;
	var allValid = true;
	for (i=0; i<checkStr.length; i++)
	{
		ch=checkStr.charAt(i);
		for(j=0; j<checkOK.length; j++)
		{
			if (ch==checkOK.charAt(j))
			{
				break;
			}
		}
	
		if (j==checkOK.length)
		{
			allValid=false;
			break;
		}
	}	

	if (!allValid)
	{
		alert(msgbox)
		NameObject.focus();
		return(false);
	}
	else
	{
		// elimina gli eventuali zeri
		if (stripZero)
		{
			NameObject.value = parseInt(checkStr, 10)
		}
		return(true);
	}
}

function IsPhoneNumber(NameObject, msgbox)
{
	var checkOK ="0123456789+/-. ";
	var checkStr = NameObject.value;
	var allValid = true;
	for (i=0; i<checkStr.length; i++)
	{
		ch=checkStr.charAt(i);
		for(j=0; j<checkOK.length; j++)
		{
			if (ch==checkOK.charAt(j))
			{
				break;
			}
		}
	
		if (j==checkOK.length)
		{
			allValid=false;
			break;
		}
	}	

	if (!allValid || checkStr.length == 0)
	{
		alert(msgbox)
		NameObject.focus();
		return(false);
	}
	else
	{
		return(true);
	}
}

function NumberInRange(NameObject, min, max, msgbox)
{
var tempVar;
	if (min > max)
		{
			alert('Swapping...')
			tempVar = min
			min = max
			max = tempVar
		}

	if (NameObject.value < min || NameObject.value > max)
	{
		alert(msgbox);
		NameObject.focus();
		return (false);
	}
	else
	{
		return (true);
	}
}

function IsOptionChecked(NameObject, msgbox)
{
if (!isNaN(NameObject.length))
	{
		if (NameObject.options[NameObject.selectedIndex].value.length == 0)
		{
			alert(msgbox);
			NameObject.focus();
			return (false);
		}
	}
	return (true);
}

function IsAlphabetic(NameObject, msgbox)
{
	var checkOK =".abcdefghijklmnopqrstuvwxyzàèìòù ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var checkStr = NameObject.value;
	var allValid = true;
	for (i=0; i<checkStr.length; i++)
	{
		ch=checkStr.charAt(i);
		for(j=0; j<checkOK.length; j++)
		{
			if (ch==checkOK.charAt(j))
			{
				break;
			}
		}
	
		if (j==checkOK.length)
		{
			allValid=false;
			break;
		}
	}	

	if (!allValid || checkStr.length == 0)
	{
		alert(msgbox)
		NameObject.focus();
		return(false);
	}
	else
	{
		return(true);
	}
}


//slider's width
var swidth=150

//slider's height
var sheight=150

//slider's speed
var sspeed=2

//messages: change to your own; use as many as you'd like; set up Hyperlinks to URLs as you normally do: <a target=... href="... URL ...">..message..</a>

function start()
{
	if (document.all)
	{
		//ieslider1.style.top=sheight
		//iemarquee(ieslider1)
	}
	else if (document.layers)
	{
		document.ns4slider.document.ns4slider1.top=sheight
		document.ns4slider.document.ns4slider1.visibility='show'
		ns4marquee(document.ns4slider.document.ns4slider1)
	}
	else if (document.getElementById&&!document.all)
	{
		document.getElementById('ns6slider1').style.top=sheight
		ns6marquee(document.getElementById('ns6slider1'))
	}
}

function iemarquee(whichdiv){
iediv=eval(whichdiv)
if (iediv.style.pixelTop>0&&iediv.style.pixelTop<=sspeed){
iediv.style.pixelTop=0
setTimeout("iemarquee(iediv)",100)
}
if (iediv.style.pixelTop>=sheight*-1){
iediv.style.pixelTop-=sspeed
setTimeout("iemarquee(iediv)",100)
}
else{
iediv.style.pixelTop=sheight
iediv.innerHTML=singletext[i]
if (i==singletext.length-1)
i=0
else
i++
}
}
function ns4marquee(whichlayer){
ns4layer=eval(whichlayer)
if (ns4layer.top>0&&ns4layer.top<=sspeed){
ns4layer.top=0
setTimeout("ns4marquee(ns4layer)",100)
}
if (ns4layer.top>=sheight*-1){
ns4layer.top-=sspeed
setTimeout("ns4marquee(ns4layer)",100)
}
else{
ns4layer.top=sheight
ns4layer.document.write(singletext[i])
ns4layer.document.close()
if (i==singletext.length-1)
i=0
else
i++
}
}
function ns6marquee(whichdiv){
ns6div=eval(whichdiv)
if (parseInt(ns6div.style.top)>0&&parseInt(ns6div.style.top)<=sspeed){
ns6div.style.top=0
setTimeout("ns6marquee(ns6div)",100)
}
if (parseInt(ns6div.style.top)>=sheight*-1){
ns6div.style.top=parseInt(ns6div.style.top)-sspeed
setTimeout("ns6marquee(ns6div)",100)
}
else{
ns6div.style.top=sheight
ns6div.innerHTML=singletext[i]
if (i==singletext.length-1)
i=0
else
i++
}
}

var isMSIE;

if(navigator.userAgent.toUpperCase().indexOf("MSIE") > 0)
{
	isMSIE = true;
}
else
{
	isMSIE = false;
}

function voidf()
{
	return;
}

/*
 * Show/Hide an element by ID
 */
function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

