var names = new Array("", "Automobiles", "Electrical engineering and electronics", "Insurances", "For the office", "Internet and communications", "Institutions and organizations", "Computers", "Light industry", "Media and advertisement", "Medicine", "Fashion", "Furnishing", "Agriculture", "Building", "Heavy industry", "Tourism", "Services", "Finance", "Car sales", "Spare parts", "Service stations", "New cars", "Rent - a - car", "Driver schools", "", "Trucks", "", "Audio and video technics", "Electronics", "Industrial equipment", "Services", "", "Insurance companies", "Insurance brokers", "", "Office technics", "Stationery and consumables", "Shops", "", "", "Providers", "", "Internet services", "System integration", "Phones and faxes", "Agencies", "Associations", "Government", "Political organizations", "Tax administration", "Pensionary funds", "Diplomatic organizations", "Religious organizations", "Health funds", "Territorial administration", "Syndicates", "Foundations", "", "Software", "Hardware", "", "Children goods and foods", "Leatherware", "Packages", "Knitwear and textile", "Foods and drinks", "Trade centers", "Perfumery and cosmetics", "", "Publishing houses", "Printed media", "Online", "Advertising agencies", "Advertising materials and printing", "", "", "Hospitals", "Medical centers", "Doctor's offices", "Laboratories", "Dentistry", "Apparatuses and equipment", "Pharmacy and herbs", "", "Sanitary materials", "", "", "Designers", "Fashion agencies", "Beauty salons", "Shops", "Jewellery", "", "Interior", "Furniture", "Technics", "Grassing", "", "Growers", "Distributors", "Agricultural technics", "", "", "Construction supervision", "Design and investigation", "Construction companies", "Equipment and materials", "Heating and ventilation", "Real estate", "", "", "Energetics", "Machine Building", "Metallurgy", "Chemical industry", "", "Tour - operators", "Travel agencies", "Hotels", "", "Restaurants and bars", "", "Tickets and transport", "Accounting", "Security", "Consultants", "Translation and legalization", "Forwarding", "Couriers", "Cleaning", "", "", "Banks", "Markets and brokers", "", "Pawnshops", "Exchange bureaus", "", "Veterinary medicine", "Law", "Lawyers", "Notaries", "Law  information", "", "Education", "Universities", "Institutes", "Colleges", "Courses", "Schools", "Catering", "Funerary services", "", "Industrial health", "Leasing and loans", "", "Art", "Galleries and artists", "Music", "Cinema and Theatre", "Sport", "Equipment", "Installations", "Sport Centers", "Hunting and fishing", "Hobby", "Sport information", "E-Shops", "Fine mechanics and optics", "Entertainments", "Radio and television", "Literature", "Electrical materials", "Motorcycles", "Kindergartens", "Mental health", "Photography");



var ids = new Array();

ids[0] = new Array( 0, 13, 157, 1, 14, 7, 145, 2, 11, 18, 4, 12, 15, 6, 3, 5, 140, 8, 9, 10, 17, 161, 16);
ids[13] = new Array(13, 101, 100, 99);
ids[157] = new Array(157, 160, 158, 172, 159);
ids[1] = new Array(1, 19, 24, 174, 22, 23, 21, 20, 26);
ids[14] = new Array(14, 106, 104, 105, 107, 108, 109);
ids[7] = new Array(7, 60, 59);
ids[145] = new Array(145, 148, 149, 147, 175, 150, 146);
ids[2] = new Array(2, 28, 173, 29, 30, 31);
ids[11] = new Array(11, 90, 88, 89, 92, 91);
ids[18] = new Array(18, 133, 137, 155, 134, 136);
ids[4] = new Array(4, 36, 37);
ids[12] = new Array(12, 95, 97, 94, 96);
ids[15] = new Array(15, 115, 112, 113, 114);
ids[6] = new Array(6, 46, 47, 52, 57, 48, 54, 51, 49, 53, 50, 55);
ids[3] = new Array(3, 34, 33);
ids[5] = new Array(5, 168, 43, 45, 41, 44);
ids[140] = new Array(140, 143, 141, 142);
ids[8] = new Array(8, 62, 169, 66, 65, 63, 64, 68, 67);
ids[9] = new Array(9, 73, 74, 72, 177, 71, 70, 171);
ids[10] = new Array(10, 82, 81, 79, 77, 154, 80, 78, 176, 83, 85, 139);
ids[17] = new Array(17, 124, 151, 130, 126, 129, 128, 152, 125, 127);
ids[161] = new Array(161, 162, 166, 165, 163, 164, 167);
ids[16] = new Array(16, 170, 119, 121, 123, 117, 118);



function set_select(sc, ssc){
	// set category, set selected category
	c = document.search_form.category;

	c.options.length = 2;
	c.selectedIndex = 0;

	c.options[0].value = ids[sc][0];
	c.options[0].text = "All categories";

	c.options[1].value = ids[sc][0];
	c.options[1].text = "Category " + names[ids[sc][0]];

	for(i=1;i<ids[sc].length;i++){
		c.options.length = i+1+1;
		c.options[i+1].value = ids[sc][i];
		c.options[i+1].text = names[ids[sc][i]];
		//if(ssc == ids[sc][i]) c.options[i+1].selected = true;
	}
	c.options[1].selected = true
	//document.all.cat_div.innerHTML = "subcategory:";
}

function set_top_select(ssc){
	// set category, set selected category
	c = document.search_form.category;

	c.options.length = 1;
	c.selectedIndex = 0;

	for(i=0;i<ids[0].length;i++){
		c.options.length = i+1;
		c.options[i].value = ids[0][i];
		c.options[i].text = names[ids[0][i]];
		if(ssc == ids[0][i]) c.options[i].selected = true;
	}

	//document.all.cat_div.innerHTML = "category:";
}



function set_category(){
	c = document.search_form.category;
	cs = c.selectedIndex;
	cid = c[cs].value;
	cn = c[cs].text;

	if(cs){
		if(cs == 1){
			if(c.options[0].value == 0){set_select(cid, 0);}
			else{set_top_select(cid);}
		}else{ if(c.options[0].value == 0){set_select(cid, 0);}}
	}else{set_top_select(0);}
}

