
function fillCategory(){
	// this function is used to fill the category list on load
	addOption(document.drop_list.Category, "Bostäder", "Bostäder", "");
	addOption(document.drop_list.Category, "Fordon", "Fordon", "");
	addOption(document.drop_list.Category, "Elektronik, ljud och bild", "Elektronik, ljud och bild", "");
	addOption(document.drop_list.Category, "Heminredning", "Heminredning", "");
	addOption(document.drop_list.Category, "Hobby och fritid", "Hobby och fritid", "");
	addOption(document.drop_list.Category, "Affärsverksamhet", "Affärsverksamhet", "");
	addOption(document.drop_list.Category, "Industri", "Industri", "");
	addOption(document.drop_list.Category, "Barnartiklar", "Barnartiklar", "");
	addOption(document.drop_list.Category, "Jobb", "Jobb", "");
	addOption(document.drop_list.Category, "Övrigt", "Övrigt", "");

}

function SelectSubCat(adpage){
	// ON selection of category this function will work

	removeAllOptions(document.drop_list.SubCat);
 if(adpage=='0')
	addOption(document.drop_list.SubCat, "", "Alla kategorier", "");

	if(document.drop_list.Category.value == 'Bostäder'){
		addOption(document.drop_list.SubCat,"Hyresrätter", "Hyresrätter");
		addOption(document.drop_list.SubCat,"Bostadrätter", "Bostadrätter");
		addOption(document.drop_list.SubCat,"Villor och radhus", "Villor och radhus");
		addOption(document.drop_list.SubCat,"Tomter och gårdar", "Tomter och gårdar");
		addOption(document.drop_list.SubCat,"Fritidshus", "Fritidshus");
		addOption(document.drop_list.SubCat,"Övriga bostäder", "Övriga bostäder");
	}
	if(document.drop_list.Category.value == 'Fordon'){
		addOption(document.drop_list.SubCat,"Bilar", "Bilar");
		addOption(document.drop_list.SubCat,"Bildelar och tillbehör", "Bildelar och tillbehör");
		addOption(document.drop_list.SubCat,"Båtar", "Båtar", "");
		addOption(document.drop_list.SubCat,"Båtdelar och tillbehör", "Båtdelar och tillbehör");
		addOption(document.drop_list.SubCat,"Cyklar", "Cyklar");
		addOption(document.drop_list.SubCat,"Husvagnar och husbilar", "Husvagnar och husbilar", "");
		addOption(document.drop_list.SubCat,"Mopeder", "Mopeder");
		addOption(document.drop_list.SubCat,"Motorcyklar", "Motorcyklar");
		addOption(document.drop_list.SubCat,"MC-delar och tillbehör", "MC-delar och tillbehör", "");
		addOption(document.drop_list.SubCat,"Lastbilar, truckar och bussar", "Lastbilar, truckar och bussar");
		addOption(document.drop_list.SubCat,"Lantbruksmaskiner", "Lantbruksmaskiner", "");
		addOption(document.drop_list.SubCat,"Snöskotrar", "Snöskotrar");
		addOption(document.drop_list.SubCat,"Snöskoterdelar och tillbehör", "Snöskoterdelar och tillbehör");
		addOption(document.drop_list.SubCat,"Övriga fordon", "Övriga fordon", "");
	}
	if(document.drop_list.Category.value == 'Elektronik, ljud och bild'){
		addOption(document.drop_list.SubCat,"Datorer", "Datorer");
		addOption(document.drop_list.SubCat,"Datordelar och tillbehör", "Datordelar och tillbehör");
		addOption(document.drop_list.SubCat,"TV-spel och PC-spel", "TV-spel och PC-spel");
		addOption(document.drop_list.SubCat,"Filmer och musik", "Filmer och musik");
		addOption(document.drop_list.SubCat,"Foto och videokameror", "Foto och videokameror");
		addOption(document.drop_list.SubCat,"Stereo/Radio/MP3 spelare", "Stereo/Radio/MP3 spelare");
		addOption(document.drop_list.SubCat,"Mobiler och telefoner", "Mobiler och telefoner");
		addOption(document.drop_list.SubCat,"Hemmabio", "Hemmabio");
		addOption(document.drop_list.SubCat,"TV", "TV");
		addOption(document.drop_list.SubCat,"Video och DVD-spelare", "Video och DVD-spelare");
		addOption(document.drop_list.SubCat,"Övrig elektronik", "Övrig elektronik");
	}
	if(document.drop_list.Category.value == 'Heminredning'){
		addOption(document.drop_list.SubCat,"Antikviteter och konst", "Antikviteter och konst");
		addOption(document.drop_list.SubCat,"Kläder", "Kläder");
		addOption(document.drop_list.SubCat,"Trädgård", "Trädgård", "");
		addOption(document.drop_list.SubCat,"Möbler och inredning", "Möbler och inredning");
		addOption(document.drop_list.SubCat,"Hushållsmaskiner och vitvaror", "Hushållsmaskiner och vitvaror");
		addOption(document.drop_list.SubCat,"Verktyg och maskiner", "Verktyg och maskiner", "");
		addOption(document.drop_list.SubCat,"Övrig heminredning", "Övrig heminredning");
	}
	if(document.drop_list.Category.value == 'Hobby och fritid'){
		addOption(document.drop_list.SubCat,"Biljetter och resor", "Biljetter och resor");
		addOption(document.drop_list.SubCat,"Böcker och studentlitteratur", "Böcker och studentlitteratur");
		addOption(document.drop_list.SubCat,"Husdjur", "Husdjur");
		addOption(document.drop_list.SubCat,"Hästar och ridsport", "Hästar och ridsport");
		addOption(document.drop_list.SubCat,"Övriga djur", "Övriga djur");
		addOption(document.drop_list.SubCat,"Golf", "Golf");
		addOption(document.drop_list.SubCat,"Hobby ovh samlarprylar", "Hobby ovh samlarprylar");
		addOption(document.drop_list.SubCat,"Jakt och fiske", "Jakt och fiske");
		addOption(document.drop_list.SubCat,"Klockor och smycken", "Klockor och smycken");
		addOption(document.drop_list.SubCat,"Musikinstrument", "Musikinstrument");
		addOption(document.drop_list.SubCat,"Sport och fritid", "Sport och fritid");
		addOption(document.drop_list.SubCat,"Övriga hobby och fritidsartiklar", "Övriga hobby och fritidsartiklar");
	}
	if(document.drop_list.Category.value == 'Affärsverksamhet'){
		addOption(document.drop_list.SubCat,"Affärsöverlåtelser", "Affärsöverlåtelser");
		addOption(document.drop_list.SubCat,"Butiks och restauranginventarier", "Butiks och restauranginventarier");
		addOption(document.drop_list.SubCat,"För kontoret", "För kontoret", "");
		addOption(document.drop_list.SubCat,"Lokaler och fastigheter", "Lokaler och fastigheter");
		addOption(document.drop_list.SubCat,"Övrig affärsverksamhet", "Övrig affärsverksamhet");
	}
	if(document.drop_list.Category.value == 'Industri'){
		addOption(document.drop_list.SubCat,"Verktyg", "Verktyg");
		addOption(document.drop_list.SubCat,"Byggnation och uppförande", "Byggnation och uppförande");
		addOption(document.drop_list.SubCat,"Industrimaskiner", "Industrimaskiner");
		addOption(document.drop_list.SubCat,"Övriga industri-artiklar", "Övriga industri-artiklar");
	}
	if(document.drop_list.Category.value == 'Barnartiklar'){
		addOption(document.drop_list.SubCat,"Baby och barnkläder", "Baby och barnkläder");
		addOption(document.drop_list.SubCat,"Barnsängar och barnstolar", "Barnsängar och barnstolar");
		addOption(document.drop_list.SubCat,"Barnvagnar", "Barnvagnar", "");
		addOption(document.drop_list.SubCat,"Bilbarnstolar", "Bilbarnstolar");
		addOption(document.drop_list.SubCat,"Leksaker", "Leksaker");
		addOption(document.drop_list.SubCat,"Skötbord och tillbehör", "Skötbord och tillbehör", "");
		addOption(document.drop_list.SubCat,"Övriga barnartiklar", "Övriga barnartiklar");
	}
	if(document.drop_list.Category.value == 'Jobb'){
		addOption(document.drop_list.SubCat,"Administration, ekonomi, juridik", "Administration, ekonomi, juridik");
		addOption(document.drop_list.SubCat,"Bygg och anläggning", "Bygg och anläggning");
		addOption(document.drop_list.SubCat,"Data/IT", "Data/IT");
		addOption(document.drop_list.SubCat,"Friskvård, kroppsvård", "Friskvård, kroppsvård");
		addOption(document.drop_list.SubCat,"Försäljning, inköp, marknadsföring", "Försäljning, inköp, marknadsföring");
		addOption(document.drop_list.SubCat,"Hantverksyrken", "Hantverksyrken");
		addOption(document.drop_list.SubCat,"Hotell, restaurang, storhushåll", "Hotell, restaurang, storhushåll");
		addOption(document.drop_list.SubCat,"Hälso- och sjukvård", "Hälso- och sjukvård");
		addOption(document.drop_list.SubCat,"Industriell tillverkning", "Industriell tillverkning");
		addOption(document.drop_list.SubCat,"Installation, drift, underhåll", "Installation, drift, underhåll");
		addOption(document.drop_list.SubCat,"Kultur, media, design", "Kultur, media, design");
		addOption(document.drop_list.SubCat,"Miljövård, hälsoskydd, renhållning", "Miljövård, hälsoskydd, renhållning");
		addOption(document.drop_list.SubCat,"Naturbruk", "Naturbruk");
		addOption(document.drop_list.SubCat,"Naturvetenskapligt arbete", "Naturvetenskapligt arbete");
		addOption(document.drop_list.SubCat,"Pedagogiskt arbete", "Pedagogiskt arbete");
		addOption(document.drop_list.SubCat,"Socialt arbete", "Socialt arbete");
		addOption(document.drop_list.SubCat,"Säkerhetsarbete", "Säkerhetsarbete");
		addOption(document.drop_list.SubCat,"Tekniskt arbete", "Tekniskt arbete");
		addOption(document.drop_list.SubCat,"Transport", "PTransport");
		addOption(document.drop_list.SubCat,"Övriga jobb", "Övriga jobb");
	}
	if(document.drop_list.Category.value == 'Övrigt'){
		addOption(document.drop_list.SubCat,"Övriga artiklar", "Övriga artiklar");
	}

}
//////////////////
function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
}

function addOption(selectbox, value, text )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;

	selectbox.options.add(optn);
}

