//
// getResponse( url, params )
//
function getResponse(url, params)
{
	var response = $.ajax({
		type : "post",
		url : url,
		data : params,
		async : false
	}).responseText;
	return response;
}
//
// Get URL in target
//
function getResponseInTarget(url, params, target)
{
	var response = getResponse(url, params);
	$(document).ready(function() {
		$(target).html(response);
		return false;
	});
	return false;
}
//
// getHtmlSelectCountries(cid);
//
function getHtmlSelectCountries(cid)
{
	// alert("getHtmlSelectChains("+cid+")");
	var target = "#getHtmlSelectCountries";
	$(target).html("<img src='/media/common/loading.gif' alt='' />");
	getResponseInTarget('/ajax/get.html.select.countries.php', 'country_id='
			+ cid, target);
	return false;
}
//
// getHtmlSelectStates(cid,sid);
//
function getHtmlSelectStates(cid, sid)
{
	// alert("getHtmlSelectStates("+cid+","+sid+")");
	var target = "#getHtmlSelectStates";
	$(target).html("<img src='/media/common/loading.gif' alt='' />");
	getResponseInTarget('/ajax/get.html.select.states.php', 'country_id=' + cid
			+ '&state_id=' + sid, target);
	return false;
}
//
// getHtmlSelectCities(sid,lid);
//
function getHtmlSelectCities(sid, lid)
{
	// alert("getHtmlSelectCities("+sid+","+lid+")");
	var target = "#getHtmlSelectCities";
	$(target).html("<img src='/media/common/loading.gif' alt='' />");
	getResponseInTarget('/ajax/get.html.select.cities.php', 'state_id=' + sid
			+ '&city_id=' + lid, target);
	return false;
}
//
// getHtmlSelectChains(cid);
//
function getHtmlSelectChains(cid)
{
	//alert("getHtmlSelectChains("+cid+")");
	var target = "#getHtmlSelectChains";
	$(target).html("<img src='/media/common/loading.gif' alt='' />");
	getResponseInTarget('/ajax/get.html.select.chains.php', 'chain_id=' + cid,
			target);
	return false;
}
//
// getHtmlSelectGroup(gid);
//
function getHtmlSelectGroups(gid)
{
	//alert("getHtmlSelectGroups("+gid+")");
	var target = "#getHtmlSelectGroups";
	$(target).html("<img src='/media/common/loading.gif' alt='' />");
	getResponseInTarget('/ajax/get.html.select.groups.php', 'group_id=' + gid,
			target);
	return false;
}
//
// getHtmlSelectCategories(gid, cid);
//
function getHtmlSelectCategories(gid, cid)
{
	//alert("getHtmlSelectCategories("+gid+","+cid+")");
	var target = "#getHtmlSelectCategories";
	$(target).html("<img src='/media/common/loading.gif' alt='' />");
	getResponseInTarget('/ajax/get.html.select.categories.php', 'group_id='
			+ gid + '&category_id=' + cid, target);
	return false;
}

