{% load i18n l10n %}

<style type="text/css">
.group_by_and_title{
	min-width: 55px !important;
}

.ui-button-text {
	font-size: 1em !important;
}

</style>


{% get_current_language as LANGUAGE_CODE %}



{% if input_select == 'button' %}
	<div id="{{view_name}}_{{button_name}}_button" class="group_by_and_div">
		<form id="{{view_name}}_{{button_name}}_form_button" method ="GET" action ="">  
				<span id="{{view_name}}_group_by_and_title" class="group_by_and_title">{% trans text_button %}</span>
				{% for f in button %}
					<input type="radio" name ="button" id="{{view_name}}_button_div_{{f.0}}" value="{{f.0}}" for="{{f.0}}"/>
					<label for="{{view_name}}_button_div_{{f.0}}" id="{{view_name}}_{{f.0}}_label1">{% trans f.1 %}</label>
				{% endfor %}
		</form>
	</div><!-- / -->
{% else %}
	<div id="{{view_name}}_{{button_name}}_button" class="group_by_and_div">
		<form id="{{view_name}}_{{button_name}}_form_button" method ="GET" action ="">  
				<span class="group_by_and_title_select">{% trans text_button %}</span>
				<select name="button">
				{% for f in button %}
					{% if col1 == f.0 %}
						<option id ="{{view_name}}_{{f.0}}_label1" value="{{f.0}}" selected for="{{f.0}}"  >{% trans f.1 %}</option>
					{% else %}
						<option id ="{{view_name}}_{{f.0}}_label1" value="{{f.0}}" for="{{f.0}}"  >{% trans f.1 %}</option>
					{% endif %}
				{% endfor %}
				</select>
		</form>
	</div><!-- / -->

{% endif %}


<script type="text/javascript">
var view_name = {% autoescape off %} '{{view_name}}' {% endautoescape %}
var input_select = {% autoescape off %} '{{input_select}}' {% endautoescape %}

$('#{{view_name}}_{{button_name}}_form_button').buttonset();



$('#{{view_name}}_button_div_{{default_value}}').attr('checked',true);


$("#{{view_name}}_{{default_value}}_label1").addClass('ui-state-active');

$('#{{view_name}}_{{button_name}}_form_button').change(function(){

	var id_button = $(this).attr('id');

	if (input_select == 'button')
		button_select = $("input[name='button']:checked").val();		
	else
		button_select = $("option[name='button']:checked").val();

	if (STP[STP['VIEWS']['{{view_name}}']]['switch_auto'].actualValue == 'ON'){
		{{view_name}}_callback('button');
	}
	else{
		{{view_name}}_callback('waiting');
		STP[STP['VIEWS']['{{view_name}}']]['buttons_clup'].highlight('update')
	}
});

</script>


