
// PANELLO

function pannello( b, toggler ){
	
	var closed = true;

	try{
		var box = document.id(b);
	
		var toggler = box.getElement( 'label[id='+toggler+']');
		var title = toggler.get('text');
		toggler.addEvent('click', tweenerFunction);
		
		box.fade('.94');
	}catch(e){
		//alert("?"+e);
	}
	
	 function tweenerFunction() {
		
		if(closed){
			//toggler.set('text', title+' -')
			//box.setStyle('overflow', 'auto');
			box.tween('top', '0');
			closed = false;
		}else{
			var h = box.getSize( ).y;
			alert( ( h ) + "?" ) ;
			//toggler.set('text', title+' +')
			box.getStyle('overflow', 'hidden');
			box.tween('top', ( 40 - h ) + 'px');
				closed = true;
		}
		
	}
	 

	 
	//.fade will also accept 'out' and 'in', equaling 0 and 1 respectively
	function tweenFadeOut() {
		box.fade('out');
	}

	
}

function invia( urlstr, form, msgbox ){
	
	form_obj = document.id( form );
	msgbox_obj = document.id( msgbox );
	
	form_obj.set('send', {url: urlstr, method: form_obj.get('method'),
			 onRequest: function(){
				msgbox_obj.set('text', 'loading...');
			},
		onSuccess: function( responseText ){
			msgbox_obj.set('html', responseText);
		},
		onFailure: function(){
			msgbox_obj.set('text', 'Sorry, your request failed :(');
		}
		});
	form_obj.send();
	alert( urlstr +"====="+form_obj.get('method')+"====="+form);
	
}
