var ajax = new sack();

function showhide(id){
if (document.getElementById){
obj = document.getElementById(id);
if (obj.style.display == "none"){
obj.style.display = "";
} else {
obj.style.display = "none";
}
}
}

function geo_district(sel)
{
	//var RegionCode = document.getElementById('reg_id').options.value;
	var RegionCode = document.forms["formularz"].elements["reg_id"].value;
	document.getElementById('dis_id').options.length = 0;
	document.getElementById('com_id').options.length = 0;
	if(RegionCode != 0) {
		if(sel != 0) {
		ajax.requestFile = '/s/ogloszenia/praca/ajax/geo_district.php?id='+RegionCode+"&dis_id="+sel; }
		else {
		ajax.requestFile = '/s/ogloszenia/praca/ajax/geo_district.php?id='+RegionCode; }
		ajax.method = 'POST';
		//ajax.onLoading = whenLoading;
		//ajax.onLoaded = whenLoaded;
		ajax.onCompletion = createREG;
		ajax.runAJAX();
	}
}

function geo_comm(sel)
{
	//var RegionCode = document.getElementById('reg_id').options.value;
	var RegionCode = document.forms["formularz"].elements["dis_id"].value;
	document.getElementById('com_id').options.length = 0;
	if(RegionCode != 0) {
		if(sel != 0) {
		ajax.requestFile = '/s/ogloszenia/praca/ajax/geo_comm.php?id='+RegionCode+"&com_id="+sel; }
		else {
		ajax.requestFile = '/s/ogloszenia/praca/ajax/geo_comm.php?id='+RegionCode; }
		ajax.method = 'POST';
		ajax.onLoading = whenLoading;
		ajax.onLoaded = whenLoaded;
		ajax.onCompletion = createCOMM;
		ajax.runAJAX();
	}
}

function geo_all(powiat,miasto)
{
	//var RegionCode = document.getElementById('reg_id').options.value;
	var RegionCode = document.forms["formularz"].elements["reg_id"].value;
	document.getElementById('dis_id').options.length = 0;
	document.getElementById('com_id').options.length = 0;
	if(RegionCode != 0) {
		if(powiat != 0) {
		ajax.requestFile = '/s/ogloszenia/praca/ajax/geo_all.php?reg_id='+RegionCode+"&dis_id="+powiat+"&com_id="+miasto; }
		else {
		ajax.requestFile = '/s/ogloszenia/praca/ajax/geo_all.php?reg_id='+RegionCode+"&dis_id="+powiat; }
		ajax.method = 'POST';
		ajax.onLoading = whenLoading;
		ajax.onLoaded = whenLoaded;
		ajax.onCompletion = createGEOALL;
		ajax.runAJAX();
}
}

function whenLoading(){
	var e = document.getElementById('status_text'); 
	e.innerHTML = "<br>Pobieranie kategorii<br><br>";
}

function whenLoaded(){
	var e = document.getElementById('status_text'); 
	e.innerHTML = "<br>Pobrane poprawnie<br><br>";
}

function createREG()
{
	var obj = document.getElementById('dis_id');
	eval(ajax.response);
}

function createCOMM()
{
	var obj = document.getElementById('com_id');
	eval(ajax.response);
}

function createGEOALL()
{
	var obj1 = document.getElementById('dis_id');
	var obj2 = document.getElementById('com_id');
	eval(ajax.response);
}

function hiden_k(v)
{

obj = document.getElementById('lokalizacja');

if(v != 25) {
obj.style.display = "none"; }
else {
obj.style.display = ""; }
}