var Comm = Class.create();

Comm.prototype = {
	initialize: function( ask, phone, askAnchor, phoneAnchor ){
		this.askId = ask;
		this.phoneId = phone;
		this.ask = $( ask );
		this.phone = $( phone );
		this.phoneAnchor = $( phoneAnchor );
		this.askAnchor = $( askAnchor );
		this.id = null;
		
		Event.observe(this.ask,"click",this.onClick.bind(this, this.ask),false);
		Event.observe(this.phone,"click",this.onClick.bind(this, this.phone),false);
		Event.observe(this.askAnchor,"click",this.onAnchorClick.bind(this, this.ask),false);
		Event.observe(this.phoneAnchor,"click",this.onAnchorClick.bind(this, this.phone),false);
	},

	onAnchorClick: function(el, event){
		Event.stop(event);
		var id = el.readAttribute( '_param' );
		var form = $(id);
		if(form.visible()){
		}else{
			if(this.id) $(this.id).hide();
			form.show();
		}
		this.id = id;
		window.location='#send';
	},
	
	onClick: function(el, event){
		Event.stop(event);
		var id = el.readAttribute( '_param' );
		var form = $(id);
		
		if(form.visible()){
			form.hide();
		}else{
			if(this.id) $(this.id).hide();
			form.show();
		}
		this.id = id;
	}
};
