	
	function select_view_report_generator_row(id,table_rnd,mainid,get){
		
		var open_row=true;
		if 
		(
			($('#contents_ajax_table_body_'+table_rnd).find('tr.odd_selected').attr('id')=='contents_ajax_row_'+table_rnd+'_'+mainid)
			||
			($('#contents_ajax_table_body_'+table_rnd).find('tr.even_selected').attr('id')=='contents_ajax_row_'+table_rnd+'_'+mainid)
		)
		{
			open_row=false;
			
			
			
			
		}
		
		
		$('#contents_ajax_table_body_'+table_rnd).find('tr.odd_selected').removeClass('odd_selected').addClass('odd');
		$('#contents_ajax_table_body_'+table_rnd).find('tr.even_selected').removeClass('even_selected').addClass('even');
		
		
		if (open_row){
			if ($('#contents_ajax_row_'+table_rnd+'_'+mainid).attr("class")=="odd"){
				$('#contents_ajax_row_'+table_rnd+'_'+mainid).removeClass('odd').addClass('odd_selected');
			} else {
				$('#contents_ajax_row_'+table_rnd+'_'+mainid).removeClass('even').addClass('even_selected');
			}
		}
		

		
			
		if (open_row){
			$('.contents_ajax_single_row_div').hide();
			$('.contents_ajax_single_rows_tr').hide();		
		
			$('#contents_ajax_single_row_'+table_rnd+'_'+mainid).html('<br>');
			//$('#contents_ajax_single_row_'+table_rnd+'_'+mainid).css('height','100px');
			$('#contents_ajax_single_row_'+table_rnd+'_'+mainid).show();
			$('#contents_ajax_single_row_tr_'+table_rnd+'_'+mainid).show();
			
			
			
			//pod strokoj
			changeMain('contents_ajax_single_row_'+table_rnd+'_'+mainid,'report_generator.get_ajax_single_report_generator',id,mainid,get,table_rnd);
			
			//nad tablicej
			//changeMain('contents_ajax_single_report_generator_'+table_rnd,'report_generator.get_ajax_single_report_generator',id,mainid,get,table_rnd);
			
			//v tablice
			//changeMain('contents_ajax_full_table_'+table_rnd,'report_generator.get_ajax_single_report_generator',id,mainid,get,table_rnd);
		} else {
			$('.contents_ajax_single_row_div').hide();
			$('.contents_ajax_single_rows_tr').hide();				
		}
		return false;
	}
	
	
	
	
	
	function select_sortmenu_report_generator(table_rnd,cell_id,sort_dir,div_name,get_go,get_param1,get_param2){
		
		//alert(sort_dir);
		//alert("Asked sorting: "+sort_dir);
		//making all TH - passive
		var tmp_th = document.getElementById('sortmenu_'+table_rnd).getElementsByTagName('th');
		
		for(var i = 0; i < tmp_th.length; i++) {
			//taking from all A arrows
			var tmp_but = document.getElementById('sortmenu_'+table_rnd).getElementsByTagName("th")[i].getElementsByTagName('a');
		
			
			if (tmp_th[i].className=='sort_active'){
				tmp_th[i].className='sort_passive';
			}
				
			if (tmp_th[i].className=='sort_passive'){
				for(var i2 = 0; i2 < tmp_but.length; i2++) {
					
					tmp_but[i2].style.backgroundImage='url(design/updown/updown_small.gif)';
					//='url(design/updown/updown_up_solid.gif);';
					//document.getElementById('sortmenu_'+table_rnd).getElementsByTagName("th")[i].getElementsByTagName('a')[i2].title=sort_dir;
					tmp_but[i2].title=sort_dir;
					//alert(tmp_but[i2].title);
					//alert(sort_dir);
 
					if (sort_dir=="ASC"){
							tmp_but[i2].onmouseover=function onmouseover(event) {this.style.backgroundImage='url(design/updown/updown_ASC_trans.gif)'};
							tmp_but[i2].onmouseout=function onmouseout(event) {this.style.backgroundImage='url(design/updown/updown_small.gif)'};
							tmp_but[i2].onmousedown=function onmousedown(event) {this.style.backgroundImage='url(design/updown/updown_ASC_solid.gif)'};
					} else {
							tmp_but[i2].onmouseover=function onmouseover(event) {this.style.backgroundImage='url(design/updown/updown_DESC_trans.gif)'};
							tmp_but[i2].onmouseout=function onmouseout(event) {this.style.backgroundImage='url(design/updown/updown_small.gif)'}; 
							tmp_but[i2].onmousedown=function onmousedown(event) {this.style.backgroundImage='url(design/updown/updown_DESC_solid.gif)'}; 
					}
				}
			}
 
			
		}
		
		
 
		document.getElementById('sortmenu_'+table_rnd+'['+cell_id+']').className='sort_active';
		
		//making button hoverable
		
		
		
		
		
		//document.getElementById('sortmenu_'+table_rnd+'['+cell_id+'_a]').style.backgroundImage='url(http://prime/cat/design/icons/ajax_sm.png)';		
		
		
		var sel_but = document.getElementById('sortmenu_'+table_rnd+'['+cell_id+'_a]');	
		//alert("Sel but title in the start: "+sel_but.title);
		if (sort_dir=="ASC"){
				sel_but.style.backgroundImage="url(design/updown/updown_ASC_solid.gif)"; 
				
				sel_but.onmouseover=function onmouseover(event) {this.style.backgroundImage='url(design/updown/updown_DESC_ASC_solid.gif)'};
				sel_but.onmouseout=function onmouseout(event) {this.style.backgroundImage='url(design/updown/updown_ASC_solid.gif)'};
				sel_but.onmousedown=function onmousedown(event) {this.style.backgroundImage='url(design/updown/updown_DESC_solid.gif)'};
		} else {
				sel_but.style.backgroundImage="url(design/updown/updown_DESC_solid.gif)";
 
				sel_but.onmouseover=function onmouseover(event) {this.style.backgroundImage='url(design/updown/updown_ASC_DESC_solid.gif)'};				
				sel_but.onmouseout=function onmouseout(event) {this.style.backgroundImage='url(design/updown/updown_DESC_solid.gif)'}; 
				sel_but.onmousedown=function onmousedown(event) {this.style.backgroundImage='url(design/updown/updown_ASC_solid.gif)'}; 
		}
		
		//making this active box title different from others....
		if (sort_dir=="ASC"){
			sort_dir_new='DESC';
			sel_but.title=sort_dir_new;
		} else {
			sort_dir_new='ASC';
			sel_but.title=sort_dir_new;
		}
 
		//alert("Sel but title in the end: "+sel_but.title);
		
		
		changeMain(div_name,get_go,get_param1,get_param2,sort_dir,table_rnd);
	}
	
	
	
	
		