// JavaScript Document
$$(document).ready(function(e) {
	$$("#addPreferiti").click(function(){
		var url = document.location;
		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel("Agriturismo.me", url,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, "Agriturismo.me");
		}	
	});
});
var MenuLink = function(){
	var A = {
		minH: "auto",
		id_base: null,
		txtOpen: "vedi tutti",
		txtClose: "nascondi",
		Show: function(){
			if(GlobalVars[this.id_base+"_open"]){
			   var h = $$("#"+this.id_base).height();
			   if(h>this.minH){
				   GlobalVars[this.id_base+"_h"] = h;
				   
				   $$("#"+this.id_base).animate({'height': this.minH+'px'});
				   GlobalVars[this.id_base+"_open"]=false;
				   $$('#'+this.id_base+'_btn').html( this.txtOpen );
			   }else{
				   $$("#"+this.id_base+"_btn").css("display","none");
			   }
		   }else{
			   $$("#"+this.id_base).animate({'height': GlobalVars[this.id_base+"_h"]+"px" });
			   GlobalVars[this.id_base+"_open"]=true;
			   $$('#'+this.id_base+'_btn').html( this.txtClose );
		   }
		},
		Init: function(id_base){
			this.id_base = id_base;
			if(this.minH=="auto"){
				$$('#'+this.id_base).css('height','auto');
				$$('#'+this.id_base+"_btn").css("display","none");
			}else{
				$$('#'+this.id_base).css('overflow','hidden');
				var This = this;
				$$("#"+this.id_base+"_btn").click(function(){
										   This.Show();
										});
				GlobalVars[ this.id_base + "_open"] = true;
				this.Show();
			}
		}
	};
	return A;
};
