// JavaScript Document
function emptyDivs(){
document.getElementById('showLocation').innerHTML = "";
document.getElementById('showProperty').innerHTML = "";
document.getElementById('showBedrooms').innerHTML = "";
document.getElementById('showBudget').innerHTML = "";
document.getElementById('showSearchButton').innerHTML = "";	
}


function displayNextDiv(elementName) {
emptyDivs();
var p = document.getElementById(elementName).value;

//now call the function with the var p parameter
commonInnerHTMLWrite('showLocation', '../includes/returnSelectOptions.php?returnSelectFunctionToCall=2&selectName=pafiliaLocation&cssStyle=roundBox&paramVar=' + p +'&rowOption=provinceName&rowVal=provinceID&commonSQLFunc=5&anyOrSelect=Location&executeFunction=displayPropertyTypeDiv()');	
}

function displayPropertyTypeDiv() {
//var p = document.getElementById('pafiliaPropertyTypes').value;
//now call the function with the var p parameter
if(document.getElementById('pafiliaLocation').value == "") {
document.getElementById('showProperty').innerHTML = "";
document.getElementById('showBedrooms').innerHTML = "";
document.getElementById('showBudget').innerHTML = "";
document.getElementById('showSearchButton').innerHTML = "";
} else {

commonInnerHTMLWrite('showProperty', '../includes/returnSelectOptions.php?returnSelectFunctionToCall=2&selectName=pafiliaPropertyTypes&cssStyle=roundBox&paramVar=' +document.getElementById('pafiliaLocation').value +'&rowOption=propertyPrimaryType&rowVal=propertyPrimaryTypeID&commonSQLFunc=6&anyOrSelect=Type&executeFunction=displayPropertyBedsDiv()');	
}
}

function displayPropertyBedsDiv() {
if(document.getElementById('pafiliaPropertyTypes').value == "") {
document.getElementById('showSearchButton').innerHTML = "";
document.getElementById('showBedrooms').innerHTML = "";
document.getElementById('showBudget').innerHTML = "";

} else {

commonInnerHTMLWrite('showBedrooms', '../includes/returnSelectOptions.php?returnSelectFunctionToCall=2&selectName=pafiliaPropertyBeds&cssStyle=roundBox&paramVar=' +document.getElementById('pafiliaPropertyTypes').value +'&rowOption=propertyBedrooms&rowVal=propertyBedrooms&commonSQLFunc=7&anyOrSelect=Bedrooms&executeFunction=displayBudget()');	
}
	
}

function displayBudget() {

if(document.getElementById('pafiliaPropertyBeds').value == "") {
document.getElementById('showBudget').innerHTML = "";
document.getElementById('showSearchButton').innerHTML = "";
} else {
commonInnerHTMLWrite('showBudget', '../common/showSubMenu.php?tableID=5');	
}
}


function showSearchButton() {
commonInnerHTMLWrite('showSearchButton', '../common/showSubMenu.php?tableID=4');	
	
}


function sendPassword(userName, langID) {
	
if(userName.value == "") {
	//blank email address submitted
showTransAlert(33, langID)	
return false;	
}
	
}


function resetCompanyFields() {
	
//was unable to figure out why document.forms[0].elements could not grab
//all the elements on form addPersonal.php making this less modular.
//** hard coding for now.
	document.getElementById('personnelEmailAddress').value = '';
	document.getElementById('personnelEmailAddress2').value = '';
	document.getElementById('personnelContactName').value = '';
	document.getElementById('personnelCompanyAddress').value = '';
	document.getElementById('personnelZipCode').value = '';
	document.getElementById('pafiliaCountries').selectedIndex = 0;
	document.getElementById('personnelTelNumber').value = '';
}
//marianne

function showTransAlert(messageID, langID) {
	var alertsPath = '../includes/alerts.php?transReq=';
	var langReq = '&langID=';	
	genericTransAlertFunction(alertsPath + messageID + langReq + langID);
		
}

//marianne