function getPageCoords (element) { // thanks to 'Martin Honnen' for this function
var coords = {x: 0, y: 0};
while (element) {
coords.x += element.offsetLeft;
coords.y += element.offsetTop;
element = element.offsetParent;
}
return coords;
}




function vai(dove){///spost ala pagina, basta passargli l'id dell'elemento da raggiungere
elemento=document.getElementById(dove);
var yelemento=getPageCoords (elemento).y;
yelemento-=30;
$('html, body').animate({
scrollTop: $(elemento).offset().top-10
}, 500);

}



  form_aperta=false;
  function apri_form(){
  if(!form_aperta){
  $('div#form_info').slideDown(300,function(){vai('richiedi_info');form_aperta=true;});
  }else{
  
  $('div#form_info').slideUp(300);
  form_aperta=false;
  }
  
  
  }





jQuery.debug = function(message) {
    if(window.console) {
        alert(message);
    } else {
        alert(message);
    }
};



	function apri_modulo(variabile,dim_x,dim_y){
	
	if(win_dim=="sì"){dim_x=dim_x+100};
	
	var wi = (l-dim_x)/2;
	var he = (a-dim_y)/2;
	
	
	win=window.open(variabile,"dd","location=no,menubar=no,status=no,toolbar=no,scrollbars=yes,width="+dim_x+",height="+dim_y);
       //win.moveTo(wi,he)  
       //win.focus();
	

                }





function check() {

   if (document.informazioni.nome.value.length==0) {
        alert( "Il campo Nome é obbligatorio.") ;
        document.informazioni.nome.focus();
        return;      
   }
   if (document.informazioni.cognome.value.length==0) {
        alert( "Il campo Cognome é obbligatorio.") ;
        document.informazioni.cognome.focus();
        return;      
   }

   if (document.informazioni.from.value.length==0) {
        alert( "Il campo E-mail é obbligatorio.") ;
        document.informazioni.from.focus();
        return;      
   }
   if (document.informazioni.domanda.value.length==0) {
        alert( "Il campo Domanda é obbligatorio.") ;
        document.informazioni.domanda.focus();
        return;      
   }
   if (document.informazioni.privacy.checked==false) {
        alert( "Per la richiesta informazioni é necessario autorizzare il trattamento dei dati.") ;
        document.informazioni.privacy.focus();
        return;      
   }


   document.informazioni.submit();
}



function appari_testi(){

new Effect.Opacity('testo_descrizione', { delay:1,from: 0, to: 1 , duration: 1.0}); return false;

}



function cambia(dove){

var elem = document.getElementById(dove);
elem.src="/images/foglia.png"


}
function riporta(dove){

var elem = document.getElementById(dove);
elem.src="/images/vuoto.png"


}


function cambia_foto(dove,cosa){
		
		
		var elem = document.getElementById(dove);
		
		if(dove=="prima_foto"){
		elem.style.backgroundImage="url(/images/fotodb/normal/"+cosa+")"
		}else{
		elem.style.backgroundImage="url(/mages/fotodb/big/"+cosa+")"
		}
		
		elem.style.backgroundRepeat="no-repeat"
		
		elem.style.backgroundPosition="center";
		elem.style.backgroundColor="#b1b1b1";
		
		
}

function sfondo_evidenziato(come,nome){

var elem = document.getElementById(nome);

if(come==true){
//elem.style.backgroundColor="#8d8d8d";
elem.style.backgroundColor="#dedede";
}else{
elem.style.backgroundColor="#ffffff";

}



}



function sfondo_alpha(come,nome){

var elem = document.getElementById(nome);

if(come==true){
if (navigator.appName == "Netscape"){
elem.style.opacity= 0.6;
}else{

elem.style.filter="alpha (opacity=60)";
}

}else{
if (navigator.appName == "Netscape"){
elem.style.opacity= 1;
}else{
elem.style.filter="alpha (opacity=100)";
}


}



}

 
 function musica( ) 
{
name="musica"
path="/gestione"
value="si";
 expires="";
secure=""
domain="";
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}





function creamusica(){

		name="musica"
path="/gestione"
value="si";
 expires="";
secure=""
domain="";
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );

top.musica.location.href="http://www.bellostare.it/musica.htm"


}






 
 
 
 
function musicaNo(){
 
parent.musica.location.href="http://www.bellostare.it/musica_no.htm"
 
Set_Cookie("musica","no","","/gestione","","")
//document.cookie = "musica=no"
 

}

