function fillTitle(){ 
 // this function is used to fill the category list on load
 if(document.housing.title.value == 'Title'){
	 document.housing.situation.disabled=true;
 }else{
	 document.housing.situation.disabled=false;
 }
addOption(document.housing.title, "Apartment for Rent", "Apartment for Rent", "");
addOption(document.housing.title, "House for Rent", "House for Rent", "");
addOption(document.housing.title, "Room(s) for Rent", "Room(s) for Rent", "");
addOption(document.housing.title, "Student-Style Housing", "Student-Style Housing", "");
}

function SelectSituation(){
// ON selection of category this function will work
document.housing.situation.disabled=false;

removeAllOptions(document.housing.situation);
//addOption(document.housing.situation, "", "Situation", "");

if(document.housing.title.value == 'Apartment for Rent'){
addOption(document.housing.situation,"Unfurnished", "Unfurnished");
addOption(document.housing.situation,"Partially Furnished", "Partially Furnished");
addOption(document.housing.situation,"Furnished", "Furnished");
}
if(document.housing.title.value == 'House for Rent'){
addOption(document.housing.situation,"Unfurnished", "Unfurnished");
addOption(document.housing.situation,"Partially Furnished", "Partially Furnished");
addOption(document.housing.situation,"Furnished", "Furnished");
}
if(document.housing.title.value == 'Room(s) for Rent'){
addOption(document.housing.situation,"Seeking Female Roommate", "Seeking Female Roommate");
addOption(document.housing.situation,"Seeking Male Roommate", "Seeking Male Roommate");
addOption(document.housing.situation,"Seeking Female or Male Roommate", "Seeking Female or Male Roommate");
}
if(document.housing.title.value == 'Student-Style Housing'){
addOption(document.housing.situation,"Furnished", "Furnished");
addOption(document.housing.situation,"Partially Furnished", "Partially Furnished");
addOption(document.housing.situation,"Unfurnished", "Unfurnished");
}

}
////////////////// 

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 housingExpire(yesNo){
	if(yesNo == 1){
		document.housing.expireDays0.disabled=false;
		document.housing.expireDays1.disabled=false;
		document.housing.expireDays2.disabled=false;
		document.housing.expireDays3.disabled=false;
	}else if(yesNo == 0){
		document.housing.expireDays0.disabled=true;
		document.housing.expireDays1.disabled=true;
		document.housing.expireDays2.disabled=true;
		document.housing.expireDays3.disabled=true;
	}
}
