function fillCategory(){ 
 // this function is used to fill the category list on load
addOption(document.search.Category, "wedappareljewelry, showsub", "Apparel & Jewelry", "");
addOption(document.search.Category, "wedbeautyhealth, showsub", "Beauty & Health", "");
addOption(document.search.Category, "wedcakescateringfavors, showsub", "Cakes, Catering, & Favors", "");
addOption(document.search.Category, "wedceremonymarriage, showsub", "Ceremony & Marriage", "");
addOption(document.search.Category, "wedfloristsdecorrental, showsub", "Florists, Decor, & Rentals", "");
addOption(document.search.Category, "wedgifts, showsub", "Gifts", "");
addOption(document.search.Category, "wedhomeinsurance, showsub", "Home & Insurance", "");
addOption(document.search.Category, "wedhoneymoonhotel, showsub", "Honeymoon, Hotels, & Travel Agencies", "");
addOption(document.search.Category, "wedinvitations, showsub", "Invitations", "");
addOption(document.search.Category, "wedmusicentertainment, showsub", "Music & Entertainment", "");
addOption(document.search.Category, "wedphotography, showsub", "Photography & Videography", "");
addOption(document.search.Category, "wedreceptionrehearsal, showsub", "Reception & Rehearsal Dinner Venues", "");
addOption(document.search.Category, "wedtransportation, showsub", "Transportation Services", "");
addOption(document.search.Category, "wedconsultants, showsub", "Wedding Consultants & Planning", "");
}

function SelectSubCat(){
// ON selection of category this function will work

removeAllOptions(document.search.wedsubcategory);

if(document.search.Category.value == 'wedappareljewelry, showsub'){
addOption(document.search.subcategory,"wedajbridal, wedajfabric, wedajformal, wedajjewelry, wedajmother, wedajpreservation", "Select Subcategory");
addOption(document.search.subcategory,"wedajbridal", "Bridal");
addOption(document.search.subcategory,"wedajfabric", "Fabric & Lace");
addOption(document.search.subcategory,"wedajformal", "Formal Wear");
addOption(document.search.subcategory,"wedajjewelry", "Jewelry");
addOption(document.search.subcategory,"wedajmother", "Mother of the Bride");
addOption(document.search.subcategory,"wedajpreservation", "Preservation, Cleaning & Alterations");
}
if(document.search.Category.value == 'wedbeautyhealth, showsub'){
addOption(document.search.subcategory,"wedbhbeauty", "Select Subcategory");
addOption(document.search.subcategory,"wedbhbeauty", "Beauty, Day Spa & Skin Care");
}
if(document.search.Category.value == 'wedcakescateringfavors, showsub'){
addOption(document.search.subcategory,"wedccfcakes, wedccfcaterers, wedccfchocolates, wedccfice", "Select Subcategory");
addOption(document.search.subcategory,"wedccfcakes", "Cakes");
addOption(document.search.subcategory,"wedccfcaterers", "Caterers");
addOption(document.search.subcategory,"wedccfchocolates", "Chocolates, Candies & Favors");
addOption(document.search.subcategory,"wedccfice", "Ice Carvings");
}
if(document.search.Category.value == 'wedceremonymarriage, showsub'){
addOption(document.search.subcategory,"wedcmofficiantsclergy, wedcmofficiantsjudges, wedcmsitesgeneral, wedcmsiteshistoric, wedcmpreparation, wedcmoutdoor", "Select Subcategory");
addOption(document.search.subcategory,"wedcmofficiantsclergy", "Ceremony Officiants – Clergy");
addOption(document.search.subcategory,"wedcmofficiantsjudges", "Ceremony Officiants – Judges");
addOption(document.search.subcategory,"wedcmsitesgeneral", "Ceremony Sites – General");
addOption(document.search.subcategory,"wedcmsiteshistoric", "Ceremony Sites – Historic Places & Mansions");
addOption(document.search.subcategory,"wedcmpreparation", "Marriage Preparation & Counseling");
addOption(document.search.subcategory,"wedcmoutdoor", "Outdoor Weddings");
}
if(document.search.Category.value == 'wedfloristsdecorrental, showsub'){
addOption(document.search.subcategory,"wedfdrflorists, wedfdrrentals, wedfdrtents", "Select Subcategory");
addOption(document.search.subcategory,"wedfdrflorists", "Florists");
addOption(document.search.subcategory,"wedfdrrentals", "Rentals");
addOption(document.search.subcategory,"wedfdrtents", "Tents");
}
if(document.search.Category.value == 'wedgifts, showsub'){
addOption(document.search.subcategory,"wedgregistries, wedgattendants", "Select Subcategory");
addOption(document.search.subcategory,"wedgregistries", "Gift Registries");
addOption(document.search.subcategory,"wedgattendants", "Gifts: Attendants & Personalized");
}
if(document.search.Category.value == 'wedhomeinsurance, showsub'){
addOption(document.search.subcategory,"wedhirealtors, wedhiwedding", "Select Subcategory");
addOption(document.search.subcategory,"wedhirealtors", "Realtors & Mortgages");
addOption(document.search.subcategory,"wedhiwedding", "Wedding Insurance");
}
if(document.search.Category.value == 'wedhoneymoonhotel, showsub'){
addOption(document.search.subcategory,"wedhhtahoneymoon, wedhhtahotels, wedhhtaromantic, wedhhtatravel", "Select Subcategory");
addOption(document.search.subcategory,"wedhhtahoneymoon", "Honeymoon & Destination Weddings");
addOption(document.search.subcategory,"wedhhtahotels", "Hotels");
addOption(document.search.subcategory,"wedhhtaromantic", "Romantic Hideaways");
addOption(document.search.subcategory,"wedhhtatravel", "Travel Agencies");
}
if(document.search.Category.value == 'wedmusicentertainment, showsub'){
addOption(document.search.subcategory,"wedmebands, wedmeceremony, wedmedance, wedmedisc", "Select Subcategory");
addOption(document.search.subcategory,"wedmebands", "Bands");
addOption(document.search.subcategory,"wedmeceremony", "Ceremony & Reception");
addOption(document.search.subcategory,"wedmedance", "Dance Instruction");
addOption(document.search.subcategory,"wedmedisc", "Disc Jockeys");
}
if(document.search.Category.value == 'wedinvitations, showsub'){
addOption(document.search.subcategory,"wediinvitations, wediprinting", "Select Subcategory");
addOption(document.search.subcategory,"wediinvitations", "Invitations & Stationery");
addOption(document.search.subcategory,"wediprinting", "Printing");
}
if(document.search.Category.value == 'wedphotography, showsub'){
addOption(document.search.subcategory,"wedpvphotobooth, wedpvphotography, wedpvvideography", "Select Subcategory");
addOption(document.search.subcategory,"wedpvphotobooth", "Photo Booths");
addOption(document.search.subcategory,"wedpvphotography", "Photography");
addOption(document.search.subcategory,"wedpvvideography", "Videography");
}
if(document.search.Category.value == 'wedreceptionrehearsal, showsub'){
addOption(document.search.subcategory,"wedreceptionrehearsal, wedrrdvboat, wedrrdvreception, wedrrdvgolf, wedrrdvhotel, wedrrdvmansion, wedrrdvrestaurant", "Select Subcategory");
addOption(document.search.subcategory,"wedrrdvboat", "Boat Charters");
addOption(document.search.subcategory,"wedrrdvreception", "Reception & Rehearsal Dinner Venues");
addOption(document.search.subcategory,"wedrrdvgolf", "Golf/Country Club");
addOption(document.search.subcategory,"wedrrdvhotel", "Hotel/Lodge");
addOption(document.search.subcategory,"wedrrdvmansion", "Historic Site/Mansion");
addOption(document.search.subcategory,"wedrrdvrestaurant", "Restaurant");
}
if(document.search.Category.value == 'wedtransportation, showsub'){
addOption(document.search.subcategory,"wedtshorse, wedtslimousines", "Select Subcategory");
addOption(document.search.subcategory,"wedtshorse", "Horse Drawn Carriages");
addOption(document.search.subcategory,"wedtslimousines", "Limousines");
}
if(document.search.Category.value == 'wedconsultants, showsub'){
addOption(document.search.subcategory,"wedwcpbridal, wedwcpwedding", "Select Subcategory");
addOption(document.search.subcategory,"wedwcpbridal", "Bridal Shows");
addOption(document.search.subcategory,"wedwcpwedding", "Wedding Consultants");
}

}
////////////////// 

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);
}


function display(obj,id1)
{
	txt = obj.options[obj.selectedIndex].value;
	document.getElementById(id1).style.display = 'none';
	if ( txt.match(id1) ) {
	document.getElementById(id1).style.display = 'block';
}
}
