var ajax_url = 'index.php?option=com_spec&no_html=1'; //'/s-osvita/administrator/index2.php?option=com_univers&no_html=1';

function loadSpecStep1Table(obj, id){
	if ($(obj).attr('class') == "tableToggled") {
		var tmp = '#Step1Table_'+id;
		$(tmp).load(ajax_url+'&model=spec_step1&search[spec_type_id]='+id);
	}
 	return false;
}
function loadSpecStep2Table(type_id,step1_code){
	var tmp = '#Step2Table_'+type_id+'_'+step1_code;
	$(tmp).load(ajax_url+'&model=spec_step2&search[spec_type_id]='+type_id+'&search[spec_step1_code]='+step1_code);
 	return false;
}
function loadSpecStep3Table(type_id,step2_code){
	var tmp = '#Step3Table_'+type_id+'_'+step2_code;
	$(tmp).load(ajax_url+'&model=spec_step3&search[spec_type_id]='+type_id+'&search[spec_step2_code]='+step2_code);
 	return false;
}
$(document).ready(function(){
	$('#spinning_image').ajaxStart(function(){
        $(this).show();
    }).ajaxStop(function() {
        $(this).hide();
    });
    
    $("a.tableToggle").click( function () { 
		tableToggle($(this));
   		return false;
	});
	$("a.tableToggle").addClass("tableToggled");
	$("a.tableToggle").removeClass("tableToggle");
	
});



function tableToggle(obj){
	obj.parent('th').parent('tr').parent('tbody').children('tr').toggle();
	obj.parent('th').parent('tr').show();	
}
