var ajax = new sack();
var rowstyle;
var gpos = 0;
/*
function hide(id) 
{
    document.getElementById(id).style.display = 'none';
}
  
function show(id) 
{
	document.getElementById(id).style.display = rowstyle;
}

*/	
function get_location_list(sel,filename)
{
	var locationid = sel.options[sel.selectedIndex].value;
	document.getElementById('region_id').options.length = 0;
	if(locationid.length>0){
		ajax.requestFile = filename+'?locationid='+locationid;
		ajax.onCompletion = create_region_list;
		ajax.runAJAX();
	}
}

function create_region_list()
{
	var obj = document.getElementById('region_id');
	eval(ajax.response);	
}



function get_region_list(sel,filename)
{
	var stateid = sel.options[sel.selectedIndex].value;
	//document.getElementById('city').options.length = 0;
	if(stateid.length>0){
		ajax.requestFile = filename+'?regionid='+stateid;
		ajax.onCompletion = create_city_list;
		ajax.runAJAX();
	}
}

function create_city_list()
{
	var obj = document.getElementById('city');
	eval(ajax.response);	
}



/*
function create_school_list()
{
	var obj = document.getElementById('school');
	eval(ajax.response);	
}
*/

function get_cat_list(sel,filename)
{
	var cat_id = sel.options[sel.selectedIndex].value;
	document.getElementById('subcat_id').options.length = 0;
	//document.getElementById('school').options.length = 0;
	if(cat_id.length>0){
		ajax.requestFile = filename+'?cat_id='+cat_id;
		ajax.onCompletion = create_subcat_list;
		ajax.runAJAX();
	}
}

function create_subcat_list()
{
	var obj = document.getElementById('subcat_id');
	eval(ajax.response);	
}



function get_subcat_list(sel,filename)
{
	var stateid = sel.options[sel.selectedIndex].value;
	//document.getElementById('school').options.length = 0;
	if(stateid.length>0){
		ajax.requestFile = filename+'?subcat_id='+stateid;
		ajax.onCompletion = create_school_list;
		ajax.runAJAX();
	}
}


function get_cat_list_admin(sel,filename,pos)
{
	var cat_id = sel.options[sel.selectedIndex].value;
	document.getElementById('subcat_id'+pos).options.length = 0;
	gpos = pos;
	//document.getElementById('school').options.length = 0;
	if(cat_id.length>0){
		ajax.requestFile = filename+'?cat_id='+cat_id;
		ajax.onCompletion = create_subcat_list_admin;
		ajax.runAJAX();
	}
}

function create_subcat_list_admin()
{
	var obj = document.getElementById('subcat_id'+gpos);
	eval(ajax.response);	
}

