﻿// JScript File
<!--

//------------- foto show ------------------//
var c_foto = 1;
var tot = 0;

function openf(img,type) 
{
	//alert(img.src = document.getElementById('cf_' + c_foto).innerHTML);
	
	if(type == "next" && c_foto < tot) {
		c_foto++;
	}
	
	if(type == "back" && c_foto > 1){
		c_foto--;	
	}
	
	if(type == "set")
		c_foto = img;		
	document.getElementById('list_f').style.display = 'block';
	
	var img = document.getElementById('foto');	
	img.src = document.getElementById('cf_' + c_foto).innerHTML;
	var txt = document.getElementById('picname');
	txt.innerHTML = document.getElementById('tf_' + c_foto).innerHTML;
	img.onload = load_i;
}

function settot(t)
{
   tot = t;
}

function load_i() 
{
    document.getElementById('list_f').style.height = document.getElementById('foto').height + 60 + 'px';
}
//------------- / foto show ------------------//

function loadfirst()
{
    if(document.getElementById("ifCenter"))
    {
        document.getElementById("ifCenter").src = "Center/Home.htm";
        changepics(0);
    }
}

function replacefloat()
{
    if(document.getElementById("list_f"))
    {
        if (window.captureEvents)
            document.getElementById("list_f").style.left = 
                (window.innerWidth > 800 ? ((window.innerWidth - 800) / 2 + 125) : 140) + "px";
        else
            document.getElementById("list_f").style.left = 
                (document.body.clientWidth > 800 ? ((document.body.clientWidth - 800) / 2 + 140) : 140) + "px";
    }
}

function makevisible(cur,which)
{
    strength = (which == 0) ? 0.75 : 1;
    if (cur.style.MozOpacity)
        cur.style.MozOpacity = strength;
    else if (cur.filters)
        cur.filters.alpha.opacity = strength*100;
}

function changepage(idx)
{
    switch(idx)
    {
        case 0: 
            document.location.href = "main.htm";
            changepics(0);
            break;
        case 1:
            document.getElementById("ifCenter").src = "Center/Home.htm";
            changepics(0);
            break;
        case 2:
            document.getElementById("ifCenter").src = "Center/LaCucina.htm";
            changepics(0);
            break;
        case 3:
            document.getElementById("ifCenter").src = "Center/LaCarta.htm";
            changepics(1);
            break;
        case 4:
            document.getElementById("ifCenter").src = "Center/IMenu.htm";
            changepics(0);
            break;
        case 5:
            document.getElementById("ifCenter").src = "Center/LoChef.htm";
            changepics(2);
            break;
        case 6:
            document.getElementById("ifCenter").src = "Center/IlLocale.htm";
            changepics(3);
            break;
        case 7:
            document.getElementById("ifCenter").src = "Center/DoveSiamo.htm";
            changepics(0);
            break;
        case 8:
            document.getElementById("ifCenter").src = "Center/GuestBook.htm";
            changepics(0);
            break;
        case 9:
            document.getElementById("ifCenter").src = "Center/Links.htm";
            changepics(0);
            break;
    }           
}

function changepics(idx)
{
    switch(idx)
    {
        case 0: 
            document.getElementById("divRight").innerHTML = GetDefaultPics();
            break;
        case 1: // GESTIONE FOTO MENU
            document.getElementById("divRight").innerHTML = GetMenuPics();
            settot(13); //<-NUMERO TOTALE DI FOTO
            break;
        case 2: // GESTIONE FOTO CHEF
            document.getElementById("divRight").innerHTML = GetStaffPics();
            settot(1);
            break;
        case 3: // GESTIONE FOTO LOCALE
            document.getElementById("divRight").innerHTML = GetPlacePics();
            settot(4);
            break;
    }   
}

function EmptyPics() {document.getElementById("divRight").innerHTML = "&nbsp;";}

function GetDefaultPics()
{
    var str = "";
    str += "<p class='RMenu_2'>Fermati<br>a gustare<br>i sapori<br>della buona<br>cucina</p>"
    return str;
}

// GESTIONE FOTO MENU

function GetMenuPics()
{
    var str = "";
    str += "<p class='RMenu_1'>Menù Febbraio 2010</p><br>";
    str += "<img src='Images/InsalataRadicchio.jpg' width='100' height='100' border='0' onclick=\"openf('1','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_1'>Insalata di Radicchio e pancetta croccante</p><br><div id='cf_1' style='display: none'>Images/InsalataRadicchio.jpg</div>";

    str += "<img src='Images/PettoOca.jpg' width='100' height='100' border='0' onclick=\"openf('2','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_2'>Petto d'oca</p><br><div id='cf_2' style='display: none'>Images/PettoOca.jpg</div>";

    str += "<img src='Images/InsalataProsciutto.jpg' width='100' height='100' border='0' onclick=\"openf('3','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_3'>Insalata di Prosciutto di Modena all'Aceto Balsamico</p><br><div id='cf_3' style='display: none'>Images/InsalataProsciutto.jpg</div>";   

    str += "<img src='Images/Tortellini.jpg' width='100' height='100' border='0' onclick=\"openf('4','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_4'>Tortellini in brodo di cappone</p><br><div id='cf_4' style='display: none'>Images/Tortellini.jpg</div>";

    str += "<img src='Images/TortelloniZucca.jpg' width='100' height='100' border='0' onclick=\"openf('5','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_5'>Tortelloni di Zucca</p><br><div id='cf_5' style='display: none'>Images/TortelloniZucca.jpg</div>";

    str += "<img src='Images/MaccheroniPettine.jpg' width='100' height='100' border='0' onclick=\"openf('6','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_6'>Maccheroni al Pettine</p><br><div id='cf_6' style='display: none'>Images/MaccheroniPettine.jpg</div>";

    str += "<img src='Images/fiorentina.jpg' width='100' height='100' border='0' onclick=\"openf('7','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_7'>Fiorentina di Angus Irlandese</p><br><div id='cf_7' style='display: none'>Images/fiorentina.jpg</div>";

    str += "<img src='Images/DegustazioneFormaggi.jpg' width='100' height='100' border='0' onclick=\"openf('8','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_8'>Degustazione di Formaggi</p><br><div id='cf_8' style='display: none'>Images/DegustazioneFormaggi.jpg</div>";

    str += "<img src='Images/StrudelFunghi.jpg' width='100' height='100' border='0' onclick=\"openf('9','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_9'>Strudel ai Funghi</p><br><div id='cf_9' style='display: none'>Images/StrudelFunghi.jpg</div>";   

    str += "<img src='Images/CremaCatalana.jpg' width='100' height='100' border='0' onclick=\"openf('10','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_10'>Crema Catalana al Contreau</p><br><div id='cf_10' style='display: none'>Images/CremaCatalana.jpg</div>";

    str += "<img src='Images/TortinoCioccolato.jpg' width='100' height='100' border='0' onclick=\"openf('11','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_11'>Tortino al Cioccolato al profumo di cannella</p><br><div id='cf_11' style='display: none'>Images/TortinoCioccolato.jpg</div>";

    str += "<img src='Images/ZuppaInglese.jpg' width='100' height='100' border='0' onclick=\"openf('12','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_12'>Zuppa Inglese</p><br><div id='cf_12' style='display: none'>Images/ZuppaInglese.jpg</div>";

    return str;
}

// GESTIONE FOTO CHEF

function GetStaffPics()
{
    var str = "";
    str += "<p class='RMenu_1'>Lo Staff</p><br><div id='cf_1' style='display: none'>Images/Chef_1.jpg</div>";
    str += "<img src='Images/Chef_1.jpg' width='100' height='100' border='0' onclick=\"openf('1','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_1'>Lo Chef</p><br>";
    return str;
}

// GESTIONE FOTO LOCALE

function GetPlacePics()
{
    var str = "";
    str += "<p class='RMenu_1'>Il Locale</p><br><div id='cf_1' style='display: none'>Images/Ingresso.jpg</div>";
    str += "<img src='Images/Ingresso.jpg' width='100' height='100' border='0' onclick=\"openf('1','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_1'>Ingresso</p><br><div id='cf_2' style='display: none'>Images/Entrata.jpg</div>";
    str += "<img src='Images/Entrata.jpg' width='100' height='100' border='0' onclick=\"openf('2','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_2'>Entrata</p><br><div id='cf_3' style='display: none'>Images/sala1.jpg</div>";
    str += "<img src='Images/sala1.jpg' width='100' height='100' border='0' onclick=\"openf('3','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_3'>Sala 1</p><br><div id='cf_4' style='display: none'>Images/sala2.jpg</div>";
    str += "<img src='Images/sala2.jpg' width='100' height='100' border='0' onclick=\"openf('4','set');\" style='cursor:pointer;' /><br>";
    str += "<p class='RMenu_1' id='tf_4'>Sala 2</p><br>";
    return str;
}

// -->