// JavaScript Document

function getUrlVars(){    
	var vars = [], hash;    
	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');     
	for(var i = 0; i < hashes.length; i++)    {
		hash = hashes[i].split('=');        
		vars.push(hash[0]);        
		vars[hash[0]] = hash[1];
	}    
	return vars;
}

var hash = getUrlVars();
var openId='';

function init() {
	myEffect = new fx.Height('moobox' , { duration: 500 });
	myEffect.hide();//sottomenu chiusi
}

function apri(stato){
	myEffect.toggle();
	id=document.getElementById("moobutton");
	if(stato!=0){
		id.innerHTML='<a href="javascript:void(0);" onclick="apri(0)" >Visualizza Tipologie Abitazioni</a>';
	}else{
		id.innerHTML='<a href="javascript:void(0);" onclick="apri(1)" return false;" >Chiudi</a>';	
	}
}

function opacityImage(id,opacity){
	obj=document.getElementById(id);
	opacity=(opacity==100) ? 99.999 : opacity;
	obj.style.filter = "alpha(opacity:"+opacity+")";
	obj.style.KHTMLOpacity = opacity/100;
	obj.style.MozOpacity = opacity/100;
	obj.style.opacity = opacity/100;
}

function initAbitazioni(){
	
	myEffect1 = new fx.Height('tipologia1', { duration: 500 });
	myEffect2 = new fx.Height('tipologia2', { duration: 500 });
	myEffect3 = new fx.Height('tipologia3', { duration: 500 });
	myEffect4 = new fx.Height('tipologia4', { duration: 500 });
	myEffect5 = new fx.Height('tipologia5', { duration: 500 });
	myEffect6 = new fx.Height('tipologia6', { duration: 500 });
	myEffect7 = new fx.Height('tipologia7', { duration: 500 });
	
	myEffect1.hide();
	myEffect2.hide();
	myEffect3.hide();
	myEffect4.hide();
	myEffect5.hide();
	myEffect6.hide();
	myEffect7.hide();
	
	if(hash['t']){
		eval("myEffect"+hash['t']+".toggle()");	
		openId=hash['t'];
		//alert(hash['t']);
	}
	
}

function openTipologia(id){
	
	if(openId!=''){
		eval("myEffect"+openId+".toggle()");
	}
	
	if(openId==id){ 
		openId="";
	}
	else{ 
		openId=id;
	}
	
	eval("myEffect"+id+".toggle()");
}