function openGuestBookForm()
{
	document.getElementById('blockTopItemsContainer').style.display = 'block';
	document.getElementById('guestBookSignFormContainer').style.display = 'block';

	document.inserimento.nickname.value = "";
	document.inserimento.testo.value = "";
	document.inserimento.codice_verifica.value = ""

	document.inserimento.nickname.style = "border solid 1px black";
	document.inserimento.testo.style = "border solid 1px black";
	document.inserimento.codice_verifica.style = "border solid 1px black";
	
}

function closeGuestBookForm()
{
	document.getElementById('blockTopItemsContainer').style.display = 'none';
	document.getElementById('guestBookSignFormContainer').style.display = 'none';

	document.inserimento.nickname.value = "";
	document.inserimento.testo.value = "";
	document.inserimento.codice_verifica.value = ""

	document.inserimento.nickname.style = "border solid 1px black";
	document.inserimento.testo.style = "border solid 1px black";
	document.inserimento.codice_verifica.style = "border solid 1px black";
}

function validateGuestbookForm() 
{

    var nickname = document.inserimento.nickname.value;
    var nicknameInput = document.inserimento.nickname;
    var text = document.inserimento.testo.value;
    var verifyCode = document.inserimento.codice_verifica.value;
    var verifyCodeInput = document.inserimento.codice_verifica
    
    var label = document.getElementById('validateLabel');
    var booleanReturn = true;

    if ((nickname == "") || (nickname == "undefined")) {

        label.style.display = "block";
        nicknameInput.style.border = "solid 1px red";
        booleanReturn = false;
    }
    else {
        nickname = "";
    }

    if ((text == "") || (text == "undefined")) {

        label.style.display = "block";
        text.style.border = "solid 1px red";
        booleanReturn = false;
    }
    else {
        text = "";
    }

    if ((verifyCode == "") || (verifyCode == "undefined")) {

        label.style.display = "block";
        verifyCodeInput.style.border = "solid 1px red";
        booleanReturn = false;
    }
    else {
        verifyCode = "";
    }   

    if (booleanReturn) {
        label.style.display = "none";
        alert('Messaggio inviato correttamente');
    }
    
    return booleanReturn;
}

function changeArchiveContent()
{
    var select = document.getElementById('yearSelect');

    var selectValue = select.value;

    document.location.href = "index.php?content=7&year=" + selectValue;
}

function changeGalleryContent()
{
    var select = document.getElementById('yearGallerySelect');

    var selectValue = select.value;

    document.location.href = "index.php?content=6&year=" + selectValue;
}
/*
function showGameWindow()
{
	//var gameName = '';
	
	document.getElementById('blockTopItemsContainer').style.display = 'block';
	document.getElementById('gameContainer').style.display = 'block';
	
	//document.location.href = "index.php?content=5&gameName=" + gameName;
	
}

function hideGameWindow()
{
	document.getElementById('blockTopItemsContainer').style.display = 'none';
	document.getElementById('gameContainer').style.display = 'none';
}*/

function changeGroupContent()
{
    var select = document.getElementById('yearGroupSelect');

    var selectValue = select.value;

    document.location.href = "index.php?content=10&year=" + selectValue;
}

/*function showGroup(schoolId) {
	
	/*var currentGruop = document.getElementById(school);
	
	if (currentGruop.style.display == "none")
	{
	currentGruop.style.display = "block";
	}
	else
	{
	currentGruop.style.display = "none";
	}*/
	
	/*if(schoolId.style.display != "none")
	{
		schoolId.style.display = "block";
	}
	else
	{
		schoolId.style.display = "none";
	}
	
	//document.getElementById('schoolId_5').style.display = "block";
}*/

function submitCalendarForm()
{
	var select = document.getElementById('calendarSelect');

    var selectValue = select.value;

    document.location.href = "index.php?content=11&cat=" + selectValue;
	
	//document.calendarForm.submit(selectValue);
   }

function closeShowInformationBox()
{
   	document.getElementById('blockTopItemsContainer').style.display = 'none';
   	document.getElementById('gameContainer').style.display = 'none';
}





//////////////////////////////////////////////////////////////////////////////////

//############################################################################
/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
	page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
	page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
	page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
	page_request.onreadystatechange=function(){
	loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
  fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript");
  fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
  fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet");
  fileref.setAttribute("type", "text/css");
  fileref.setAttribute("href", file);
}
}
if (fileref!=""){
  document.getElementsByTagName("head").item(0).appendChild(fileref)
  loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
//############################################################################

function pulisci(bersaglio){
	eval("document.inserimento."+bersaglio.name+".style.backgroundColor = '#FFFFFF'");
	eval("document.inserimento."+bersaglio.name+".style.color = '#000000'");
}
function errore(bersaglio){
	eval("document.inserimento."+bersaglio.name+".style.backgroundColor = '#dd0000'");
	eval("document.inserimento."+bersaglio.name+".style.color = '#FFFFFF'");
}


function scrivi_cartolina(){
 var dove = document.getElementById('cartolina_testo');
 var testo = document.getElementById('testo_messaggio');
 dove.innerHTML = testo.value;
}


function mostra(){
var bersaglio = document.getElementById('loading');
bersaglio.style.display= "block";
}

function nascondi(){
var bersaglio = document.getElementById('loading');
bersaglio.style.display= "none";
}

function ShowHide(id){
 if(document.getElementById){
  var el=eval("document.getElementById('"+id+"');");
  el.style.display = (el.style.display=="block") ? "none" : "block";
 }
}
