﻿
function centraImmagine(id) {
    var vertical=screen.height;
    var objh=document.getElementById(id).height;
    var horizontal=screen.width;
    var objw=document.getElementById(id).width;

    document.getElementById(id).style.position="absolute";
    document.getElementById(id).style.top=(vertical-objh)/4-10+'px';
    document.getElementById(id).style.left=(horizontal-objw)/2+'px';
    document.getElementById(id).style.border=0;
}

//------------------------------------------------------------------------------------------

function objSwf(container,path,width,height,id,bkg,bkgvalue,flag){
    if (document.all){
        if (document.getElementById(container)){
            document.getElementById(container).innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" type="application/x-shockwave-flash" data="'+path+'" width="'+width+'" height="'+height+'" id="'+id+'">'
            +'<param name="allowScriptAccess" value="sameDomain" />'
            +'<param name="movie" value="'+path+'" />'
            +'<param name="menu" value="false" />'
            +'<param name="quality" value="high" />'
            +'<param name="'+bkg+'" value="'+bkgvalue+'" />'
            document.write('</object>');
            +'<p style="color:#C0C0C0;text-align:center">Flash Player non trovato: lo puoi scaricare <a href="http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player.exe" style="color:red;">qui</a></p>'
            }
        }
    else {
    document.write( '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" type="application/x-shockwave-flash" data="'+path+'" width="'+width+'" height="'+height+'" id="'+id+'">');
    document.write('<param name="allowScriptAccess" value="sameDomain" />');
    document.write('<param name="movie" value="'+path+'" />');
    document.write('<param name="menu" value="false" />');
    document.write('<param name="quality" value="high" />');
    document.write('<param name="'+bkg+'" value="'+bkgvalue+'" />');
    document.write('<embed src="'+path+'" quality="high" width="'+width+'" height="'+height+'" swLiveConnect=true id="'+id+'" name="'+id+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" /></object>');
    }
//centra l'animazione sulla pagina
    if (flag=='true'){
        var vertical=screen.height;
        var horizontal=screen.width;
        var obj=document.getElementById(id);
        var objh=obj.height;
        var objw=obj.width;
        obj.style.position="absolute";
        obj.style.top=(vertical-objh)/4;
        obj.style.left=(horizontal-objw)/2;
    }
}

//---------------------------------------------------------------------------------------------

function DescApp(aid,num,ctrlname,qualeid,ctrlsender,vedi,chiudi){
    var t = document.getElementById(aid).style.display;
    var oldtitle = "clicca per leggere l'evento"
    var newtitle = "clicca per nascondere l'evento"
    var x = new Array(num);
    var CheckBoxEspanso = new Array(num);
    for (var i = 0; i < num; i++) {
        x[i] = aid;
        var s = ctrlname + qualeid;
        if (ctrlsender != null) {
            var y = new Array(num);
            y[i] = ctrlsender
            y[i] = y[i].replace(s, ctrlname + i);
            var controllo = ctrlsender.split("_")
            CheckBoxEspanso[i] = controllo[0] + "_" + ctrlname + i + "_CheckBoxEspanso"
            x[i] = x[i].replace(s, ctrlname + i);

            //---------------------------------
            if (document.getElementById(CheckBoxEspanso[i]) != null) {//se CheckBoxEspanso esiste
                if (document.getElementById(CheckBoxEspanso[i]).checked == false) {//se CheckBoxEspanso non è checked
                    document.getElementById(x[i]).style.display = "none"; //nascondi la descrizione
                    document.getElementById(y[i]).innerHTML = vedi; //mantieni il testo vedi.....
                }
            }

            else { //altrimenti se CheckBoxEspanso non esiste
                document.getElementById(x[i]).style.display = "none"; //nascondi la descrizione

                if (y[i].indexOf('Image') != -1) {
                    document.getElementById(y[i]).src = vedi;
                }
                else document.getElementById(y[i]).innerHTML = vedi; //mantieni il testo vedi.....
            }
        }

        //---------------------------------


        document.getElementById(aid).style.display = "block";

        if (ctrlsender != null) {
            if (ctrlsender.indexOf('Image') != -1) {
                document.getElementById(ctrlsender).src = chiudi;
                document.getElementById(ctrlsender).title = newtitle;
                document.getElementById(ctrlsender).alt = newtitle;
            }
            else document.getElementById(ctrlsender).innerHTML = chiudi;
        }
    } // end for
    //---------------------------------

    if (t == "block") {//blocco x chiudere la descrizione su cui si clicca
        document.getElementById(aid).style.display = "none";
        if (ctrlsender != null) {
            if (ctrlsender.indexOf('Image') != -1) {
                document.getElementById(ctrlsender).src = vedi;
                document.getElementById(ctrlsender).title = oldtitle;
                document.getElementById(ctrlsender).alt = oldtitle;
            }
            document.getElementById(ctrlsender).innerHTML = vedi;
        }
    }
}

//fine funzione DescApp

//---------------------------------------------------------------------------

function fcs(el) {
    document.getElementById(el).focus();
}

//---------------------------------------------------------------------------

function evidenzia(el) {
    for (var i = 0; i < document.anchors.length; i++) {
           if (document.anchors[i].name == 'v' && document.anchors[i].style.color == "red" && document.anchors[i]!= el) document.anchors[i].style.color = "";
    }
    if (el.style.color == "red") {
        el.style.color = "";
    }
    else el.style.color = "red";
}		

//---------------------------------------------------------------------------------

function skype(lang){
var scritta="";

if (lang=='it') scritta="chiamaci con Skype";
if (lang=='en') scritta="call us by Skype";
if (lang=='de') scritta="kontakt uns mit Skype";
if (lang=='es') scritta="contactenos con Skype";
document.write('<img src="http://mystatus.skype.com/smallicon/topsicily" style="border: none;" width="16" height="16"><a href="skype:topsicily?call" style="color:#FFFF00;text-decoration:none;font-size:11px" onclick="return skypeCheck();">'+ scritta + '</a>');
}
//--------------------------------------------------------------------------------------------------
function bw(img, opacity) {
    if (navigator.appName.indexOf("Microsoft") != -1 && parseInt(navigator.appVersion) >= 4) {
        img.style.filter = "alpha(opacity=" + opacity + ")";
    }
    else if (navigator.appName.indexOf("Netscape") != -1 && parseInt(navigator.appVersion) >= 5) {
        img.style.MozOpacity = opacity / 100;
    }
}

//---------------------------------------------------------------------------------------------------

function stampa(){
self.print();
}

stampaIt='<input type="button" value="stampa questa pagina" onclick="stampa();" style="background-color:transparent;color:#ffffff;font-size:15px;font-weight:700;width:165"><br /><br />'

stampaEn='<input type="button" value="Print this page" onclick="stampa();" style="background-color:transparent;color:#ffffff;font-size:15px;font-weight:700;width:165"><br /><br />'

stampaDe='<input type="button" value="Seite drucken" onclick="stampa();" style="background-color:transparent;color:#ffffff;font-size:15px;font-weight:700;width:165"><br /><br />'

stampaEs='<input type="button" value="imprime esta página" onclick="stampa();" style="background-color:transparent;color:#ffffff;font-size:15px;font-weight:700;width:165"><br /><br />'


//--------------------------------------------------------------------------------------------------

//funzioni x galleria immagini

/*

function splitAddress() {
    splitIndirizzo = document.intro.src.split('/');
    num = splitIndirizzo.length - 1;
}

function rollOver(event) {
    if (event != null) {
        if (!event) { event = window.event; } // hook x IE
        splitAddress();
        if ((event.type == "mouseover") || (event.type == "mouseout")) {
            if (splitIndirizzo[num] == "intro1.jpg") {
                document.intro.src = "/img/lb/intro2.jpg";
            }
            else if (splitIndirizzo[num] == "intro2.jpg") {
                document.intro.src = "/img/lb/intro1.jpg";
            }
        }
    }
}
*/

function splitURL(){
//spezza l'url per leggere i valori della querystring
    var qs = location.href;
    if (qs.indexOf('?')>0){
        var sq = qs.split("=");
        sqs=sq[1].split("&");
        sqs=sqs[0];
        ln=sq[2];
        ln=parseInt(ln);
    }
    else {
        ln=0
        sqs=""
    }
}

var s=String.fromCharCode(176);

function on(n,cartella,mod){
    if (n==0){
        document.introbis.src="/img/intro.jpg"
        aa=true;
        document.intro1.style.visibility="hidden";
        document.intro2.style.visibility="hidden";
        document.intro3.style.visibility="hidden";
        document.getElementById("back").style.visibility="hidden";
        document.getElementById("forw").style.visibility="hidden";
        document.getElementById("reset").style.visibility="hidden";
        document.getElementById("lst").style.visibility="hidden";
        return;
    }
	pic = new Array(n);
	
	for (i=1;i<pic.length;i++){
		if (i<10) {
			a="0"+i;
		}
		else a=i;
        pic[i] = "/img/galleries/"+cartella+"/"+a+".jpg";
        document.getElementById("fotoNascoste").innerHTML+='<img src="'+pic[i]+'">'
    }
	var modIt=""; var modEn=""; var modDe=""; var modEs="";
    if (mod=="castellammare"){
        modIt = "castellammare del golfo";
        modEn = "castellammare del golfo";
        modDe = "castellammare del golfo";
        modEs = "castellammare del golfo";
    }
    else if (mod=="egadi"){
        modIt = "isole Egadi";
        modEn = "Aegadian Islands";
        modDe = "Ägadische Inseln";
        modEs = "Islas Egadis";
    }
    else if (mod=="eolie"){
        modIt = "isole Eolie";
        modEn = "Aeolian Islands";
        modDe = "Äolische Inseln";
        modEs = "Islas Eolias";
    }
    else {
        modIt = mod;
        modEn = mod;
        modDe = mod;
        modEs = mod;
    }
    c=pic.length-1
    document.introbis.src=pic[i=1];
    document.intro1.style.visibility="hidden";
    document.intro2.src=pic[i=1];
    document.intro3.src=pic[i+1];
    document.introbis.style.cursor="pointer";
    document.intro3.style.cursor="pointer";
    locIt = modIt;	
    locEn = modEn;
    locDe = modDe;
    locEs = modEs
    strIt = ' -- foto n'+s+' '+i+' di '+c;
    strEn = ' -- pic n'+s+' '+i+' of '+c;
    strDe = ' -- Bild n'+s+' '+i+' von '+c;
    strEs = ' -- foto n'+s+' '+i+' de '+c;
    aa=false;
    numeropix();
}

function backward(){
    if (i>1){
        i--;
        document.introbis.src=pic[i];	
        document.introbis.style.cursor="pointer";	
        document.intro1.src=pic[i-1];
        document.intro3.style.visibility="visible";
        document.intro3.style.cursor="pointer";
    }
    if (i==1){
        document.intro1.style.visibility="hidden";
    }
    else document.intro1.style.visibility="visible";
    document.intro2.src=pic[i];	
    document.intro3.src=pic[i+1];
    strIt = ' -- foto n'+s+' '+i+' di '+c;
    strEn = ' -- pic n'+s+' '+i+' of '+c;
    strDe = ' -- Bild n'+s+' '+i+' von '+c;
    strEs = ' -- foto n'+s+' '+i+' de '+c;
    numeropix();
}


function forward(){
    if (aa) return;
    if (i<pic.length-1){
        i++;
        document.introbis.src=pic[i];
        document.intro1.style.visibility="visible";
        document.intro1.src=pic[i-1];
        document.intro2.src=pic[i];
        document.intro1.style.cursor="pointer";
    }
    if (i==pic.length-1){
        document.intro3.style.visibility="hidden";
        document.introbis.style.cursor="default";
        strIt = ' -- fine galleria';
        strEn = ' -- End of gallery';
        strDe = ' -- Ende der Galerie';
        strEs = ' -- fin galería';
    }
    else {
        document.intro3.src=pic[i+1];	
        strIt = ' -- foto n'+s+' '+i+' di '+c;
        strEn = ' -- pic n'+s+' '+i+' of '+c;
        strDe = ' -- Bild n'+s+' '+i+' von '+c;
        strEs = ' -- foto n'+s+' '+i+' de '+c;
    }
    numeropix();
}

function annulla(){
    document.introbis.src=pic[i=1];
    document.introbis.style.cursor="pointer";
    document.intro1.style.visibility="hidden";
    document.intro2.src=pic[i=1];
    document.intro3.style.visibility="visible";
    document.intro3.src=pic[i+1];
    document.intro3.style.cursor="pointer";
    strIt = ' -- foto n'+s+' '+i+' di '+c;
    strEn = ' -- pic n'+s+' '+i+' of '+c;
    strDe = ' -- Bild n'+s+' '+i+' von '+c;
    strEs = ' -- foto n'+s+' '+i+' de '+c;
    numeropix();
}

function last(){
    document.introbis.src=pic[i=pic.length-1];
    document.introbis.style.cursor="default";
    document.intro1.style.visibility="visible";
    document.intro1.src=pic[i-1];
    document.intro1.style.cursor="pointer";
    document.intro2.src=pic[i=pic.length-1];
    document.intro3.style.visibility="hidden";
    strIt = ' -- fine galleria';
    strEn = ' -- End of gallery';
    strDe = ' -- Ende der Galerie';
    strEs = ' -- fin galería';
    numeropix();
}
	
function numeropix(){
    if (ln>0){
        if (document.getElementById("view")){
            didIt=locIt+strIt;
            document.getElementById("view").innerHTML=didIt.toUpperCase();
            //document.getElementById("view").style.marginLeft="20%";
        }
        if (document.getElementById("viewEn")){
            didEn=locEn+strEn;
            document.getElementById("viewEn").innerHTML=didEn.toUpperCase();
            //document.getElementById("viewEn").style.marginLeft="20%";
        }
        if (document.getElementById("viewDe")){
	        didDe=locDe+strDe;
	        document.getElementById("viewDe").innerHTML=didDe.toUpperCase();
	        //document.getElementById("viewDe").style.marginLeft="20%";
	    }
	    if (document.getElementById("viewEs")){
	        didEs=locEs+strEs;
	        document.getElementById("viewEs").innerHTML=didEs.toUpperCase();
	        //document.getElementById("viewEs").style.marginLeft="20%";
	    }
    }
}


//----------------------------------------------------------------------------

function oggi(){
setTimeout("oggi()",1000);
    var d, s;
    d=new Date();
    s=d.toLocaleDateString()+ ', ';
    s+=d.toLocaleTimeString();
    document.getElementById("watch").innerHTML=s;
}

//--------------------------------------------------------------------------------

function elimina(nome) {
    return confirm("sei sicuro di voler eliminare " + nome + "?");
}
//---------------------------------------------------------------------------------------


/* unused


function imgRotate(img) {
    var path = "/img/header/";
    //document.write('<table border="0" width="100%" cellpadding="0" cellspacing="0" class="borderrotator">')
    //document.write('<tr>')
    //document.write('<td>')
    document.write('<ul id="jw-sir">')
    document.write('<li id="jw-sir-loading"></li>')
    for (var i = 0; i < arguments.length; i++) {
        document.write('<li><img title="" alt="" ' +
                                'src="' + path + arguments[i] + '" /></li>')
    }
    document.write('</ul>')
    //document.write('</td>')
    //document.write('</tr>')
    //document.write('</table>')
}


function closeDiv(el) {
    document.getElementById(el).style.display = "none";
}


//----------------------------------------------------------------------------

function getMovie(width, height, value, src) {
    document.write('<object width="' + width + '" height="' + height + '">');
    document.write('<param name="movie" value="' + value + '" />');
    document.write('<param name="allowFullScreen" value="true" />');
    document.write('<param name="allowscriptaccess" value="always" />');
    document.write('<embed src="' + src + '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' + width + '" height="' + height + '"></embed>');
    document.write('</object>');
}

//-----------------------------------------------------------------------------

function showLabelPrivacy(radioName, lbl) {
    var el = document.getElementById(lbl);
    if (document.forms[0].elements[radioName][1].checked) {
        el.style.display = 'block';
        return false;
    }
    else el.style.display = 'none';
}


//---------------------------------------------------------------------------------------


function plan(pix, titolo, language) {

    var lng = language;

    if (lng == "it") lng = "stampa questa pagina";
    else if (lng == "en") lng = "print this page";
    else if (lng == "de") lng = "Seite drucken";

    msg = window.open("", "1", "top=0,Left=0,scrollbars,alwaysRaised");
    msg.document.write('<html>\n<head>\n<title>' + titolo + '</title>\n');
    msg.document.write('<script type="text/javascript">\n');
    msg.document.write('function stampa(){\n');
    msg.document.write('self.print();\n');
    msg.document.write('}\n');
    msg.document.write('</script>\n');
    msg.document.write('</head>\n');
    msg.document.write('<body leftmargin="10" rightmargin="10" marginwidth="0" topmargin="10" marginheight="0">\n');
    if ((pix.lastIndexOf('.jpg') != -1) || (pix.lastIndexOf('.gif') != -1)) {
        msg.document.write('<img src="/img/' + pix + '" name="big" onload="window.resizeTo(big.width+50,big.height+155)";>\n<p>\n');
    }
    msg.document.write('<div align="center">\n<form>\n<input type="button" value="&nbsp;&nbsp;&nbsp;' + lng + '&nbsp;&nbsp;&nbsp;" onclick="stampa();">\n</form>\n</div>\n</p>\n');
    msg.document.write('</body>\n');
    msg.document.write('</html>');
    msg.document.close();
}

//----------------------------------------------------------------------------
// funzione per menu popup ritardati lightbox
function banner(loc, title) {
    document.write('<a href="' + loc + '" title="' + title + '" rel="lightbox" id="link"></a>');
}

function delayload(id, quanto) {
    setTimeout('document.getElementById("' + id + '").onclick();', quanto);
}
//----------------------------------------------------------------------------

function resetForm(radioControl) {
    with (document.form1) {  
        for (var i=0; i < elements.length; i++) {		
            if (elements[i].type == 'text' && !elements[i].value ==''){	
                elements[i].value = '';
	        }		
	        if (elements[i].type == 'radio' && elements[i].name != radioControl && elements[i].checked){	
			    elements[i].checked = false;
		    }
		    if (elements[i].type == 'select-one' && elements[i].selectedIndex != 0){	
                elements[i].selectedIndex = 0;
	        }		
	        if (elements[i].type == 'textarea' && !elements[i].value ==''){	
                elements[i].value = '';
            }
	    }		
    }
}
 
//--------------------------------------------------------------------------------
 

function mostratesto(aid,s){
if (document.getElementById(aid).style.display=="none"){
document.getElementById(aid).style.display="block";
}
}

function nasconditesto(aid,s){
if (document.getElementById(aid).style.display=="block"){
document.getElementById(aid).style.display="none";
}
}


//-----------------------------------------------------------------------------------------------------------------------

*/
