function make_self_clearing(el)
			{
					el.original_value = el.value
					Event.observe(el, 'focus', function()
					{
							if(el.value == el.original_value)
									el.value = '';
					});
					Event.observe(el, 'blur', function(ev)
					{
							if(el.value == ''){
									if(el.id.indexOf('MIN')>0)
										el.value = 'min';
									if(el.id.indexOf('MAX')>0)
										el.value = 'max';
							}
					});
			}
	;


function change_clapeta(curent,total,id)
{
	for(i=1;i<=total;i++)
	{
		if($(id+'_tab_'+i).className=="item item_first item_act" || $(id+'_tab_'+i).className=="item item_act") //for up and down
			curent_now = i;
		if(i==1)
			$(id+'_tab_'+i).className="item item_first";
		else
			$(id+'_tab_'+i).className="item";
		$(id+'_cnt_'+i).style.display="none";
	}
	if(curent=='up' && curent_now<total) curent = curent_now+1;
	else if(curent=='up' && curent_now==total) curent=total;
	else if(curent=='down' && curent_now>1) curent = curent_now-1;
	else if(curent=='down' && curent_now==1) curent = 1;
	if(curent==1)
		$(id+'_tab_'+curent).className="item item_first item_act";
	else
		$(id+'_tab_'+curent).className="item item_act";
	$(id+'_cnt_'+curent).style.display="";
}
var ChangeClapetaEv = Class.create();
ChangeClapetaEv.prototype = {
	initialize: function(total,id,curent,evt) {
		this.total = total;
		this.id = id;
		this.curent = curent;
		this.evt = evt;
		if(this.evt=='mouseover')
			this.create_mouseover();
		else if(this.evt=='click')
			this.create_click();
	},
	create_mouseover: function() {
		Event.observe($(this.id+'_tab_'+this.curent),'mouseover',function() {
			this.to = setTimeout('change_clapeta('+this.curent+','+this.total+',"'+this.id+'")',250);
		}.bind(this));
		Event.observe($(this.id+'_tab_'+this.curent),'mouseout',function() {
			clearTimeout(this.to);
		}.bind(this));
	},
	create_click: function() {
		Event.observe($(this.id+'_tab_'+this.curent),'click',function() {
			change_clapeta(this.curent,this.total,this.id);
			var a = 1;
		}.bind(this));
	}
}
function change_clapeta_ev(curent,total,id,evt)
{
	if(curent!=0) change_clapeta(curent,total,id);
	for(i=1;i<=total;i++)
	{
		new ChangeClapetaEv(total,id,i,evt);
	}
	if($(id+'_tab_down')) new ChangeClapetaEv(total,id,'down',evt);
	if($(id+'_tab_up')) new ChangeClapetaEv(total,id,'up',evt);
}