function editPhoto(photoNum)
{
	var PhotoDesc   = document.getElementById("photoSpan" + photoNum + "_1");
	var PhotoDetail = document.getElementById("photoSpan" + photoNum + "_2");
	
	PhotoDesc.style.display = "none";
	PhotoDetail.style.display = "inline";
}

function validateDirectoryForm()
{  
	var aAdType = document.getElementsByName("rdoAdType");
	
	var x;
	for(x = 0; x < aAdType.length; x++)
	{
		if(aAdType[x].checked) break;
	}

	if(x == aAdType.length) { alert("A category must be chosen."); return false; }
	
	var eDirProvince = document.getElementsByName("sltDirProvince");
	if(eDirProvince[0].selectedIndex < 1) { alert("A province must be listed for your business listing."); return false; }
	
	var eFirstName = document.getElementsByName("first_name");
	if(eFirstName[0].value == "") { alert("You have not entered your first name."); return false; }
	
	var eLastName = document.getElementsByName("last_name");
	if(eLastName[0].value == "") { alert("You have not entered your last name."); return false; }
	
	var eMailingAddress = document.getElementsByName("txtMailingAddress");
	if(eMailingAddress[0].value == "") { alert("You have not entered a mailing address"); return false; }
	
	var eStreetAddress = document.getElementsByName("address1");
	if(eStreetAddress[0].value == "") { alert("You have not entered a street address"); return false; }
	
	var eCity = document.getElementsByName("city");
	if(eCity[0].value == "") { alert("You have not entered a city."); return false; }
	
	var eEmail = document.getElementsByName("email");
	//The email input tag is the second returned element.....the email META tag is the first.
	if(eEmail[1].value == "") { alert("You have not entered your email address."); return false; }
	
	var eEmailConfirm = document.getElementsByName("txtConfirmEmailAddress");
	if(eEmailConfirm[0].value == "") { alert("You have not entered a confirmation email address."); return false; }
	
	if(eEmail[1].value != eEmailConfirm[0].value) { alert("Your email addresses do not match."); return false; }
	
	var eProvince = document.getElementsByName("state");
	if(eProvince[0].value == "") { alert("You have not chosen a province."); return false; }
	
	var ePostalCode = document.getElementsByName("zip");
	if(ePostalCode[0].value == "") { alert("You have not entered a postal code."); return false; }
	if(ePostalCode[0].value.length != 6         || 
		!isNaN(ePostalCode[0].value.charAt(0))  ||
		isNaN(ePostalCode[0].value.charAt(1))   ||
		!isNaN(ePostalCode[0].value.charAt(2))  ||
		isNaN(ePostalCode[0].value.charAt(3))   ||
		!isNaN(ePostalCode[0].value.charAt(4))  ||
		isNaN(ePostalCode[0].value.charAt(5)) ) { alert("Your customer postal code is invalid.  It must be 6 characters long followed in the sequence of letter, number, letter, number, letter, number (Z5Z5Z5)."); return false; }			
	
	var eDayPhone = document.getElementsByName("txtDayPhone");
	if(eDayPhone[0].value == "") { alert("You have not entered a day time telephone number."); return false; }
	if(checkPhone(eDayPhone[0]) == false) { alert("You have entered an invalid day time telephone number.  It must be as follows: 555-555-5555."); return false;}
	
	var eNightPhone = document.getElementsByName("txtNightPhone");	
	if(eNightPhone[0].value.length > 0 && checkPhone(eNightPhone[0]) == false) { alert("You have entered an invalid night time telephone number.  It must be as follows: 555-555-5555."); return false;}

	var eFaxNumber = document.getElementsByName("txtFaxNumber");
	if(eFaxNumber[0].value.length > 0 && checkPhone(eFaxNumber[0]) == false) { alert("You have entered an invalid fax number.  It must be as follows: 555-555-5555."); return false;}	
	
	var eDescription = document.getElementsByName("txtDescription");
	if(eDescription[0].value == "") { alert("You have not entered a description.");	return false; }

	var aWords = eDescription[0].value.split(" ");
	var space = 0;
	for(x=0;x<aWords.length;x++) if(aWords[x] == " " || aWords[x] == "") space++;
	var words = aWords.length - space;
	if(words > 300) { alert("Your description can only contain 300 words or less."); return false; }
	
	return true;
}

function validateSaleForm()
{  
	var aAdType = document.getElementsByName("rdoAdType");
	var SizeReg = new RegExp("[ABCDEFGHIJKLMNOPQRSTUVWYZ_abcdefghijklmnopqrstuvwyz]");

	var x;
	var AdValue
	for(x = 0; x < aAdType.length; x++)
	{
		AdValue = aAdType[x].value;		
		if(aAdType[x].checked) break;
	}

	if(x == aAdType.length) { alert("An ad size must be chosen."); return false; }

	var eFirstName = document.getElementsByName("first_name");
	if(eFirstName[0].value == "") { alert("You have not entered your first name."); return false; }
	
	var eLastName = document.getElementsByName("last_name");
	if(eLastName[0].value == "") { alert("You have not entered your last name."); return false; }
	
	var eMailingAddress = document.getElementsByName("txtMailingAddress");
	if(eMailingAddress[0].value == "") { alert("You have not entered a mailing address"); return false; }
	
	var eStreetAddress = document.getElementsByName("address1");
	if(eStreetAddress[0].value == "") { alert("You have not entered a street address"); return false; }
	
	var eCity = document.getElementsByName("city");
	if(eCity[0].value == "") { alert("You have not entered a city."); return false; }
	
	var eEmail = document.getElementsByName("email");
	//The email input tag is the second returned element.....the email META tag is the first.	
	if(eEmail[1].value == "") { alert("You have not entered your email address."); return false; }
	
	var eEmailConfirm = document.getElementsByName("txtConfirmEmailAddress");
	if(eEmailConfirm[0].value == "") { alert("You have not entered a confirmation email address."); return false; }
	
	if(eEmail[1].value != eEmailConfirm[0].value) { alert("Your email addresses do not match."); return false; }
	
	var eProvince = document.getElementsByName("state");
	if(eProvince[0].value == "") { alert("You have not chosen a province."); return false; }
	
	var ePostalCode = document.getElementsByName("zip");
	if(ePostalCode[0].value == "") { alert("You have not entered a postal code."); return false; }
	if(ePostalCode[0].value.length != 6      || 
		!isNaN(ePostalCode[0].value.charAt(0))  ||
		isNaN(ePostalCode[0].value.charAt(1)) ||
		!isNaN(ePostalCode[0].value.charAt(2))  ||
		isNaN(ePostalCode[0].value.charAt(3)) ||
		!isNaN(ePostalCode[0].value.charAt(4))  ||
		isNaN(ePostalCode[0].value.charAt(5)) ) { alert("Your customer postal code is invalid.  It must be 6 characters long followed in the sequence of letter, number, letter, number, letter, number (Z5Z5Z5)."); return false; }	
	
	var eDayPhone = document.getElementsByName("txtDayPhone");
	if(eDayPhone[0].value == "") { alert("You have not entered a day time telephone number."); return false; }
	if(checkPhone(eDayPhone[0]) == false) { alert("You have entered an invalid day time telephone number.  It must be as follows: 555-555-5555."); return false;}
	
	var eNightPhone = document.getElementsByName("txtNightPhone");	
	if(eNightPhone[0].value.length > 0 && checkPhone(eNightPhone[0]) == false) { alert("You have entered an invalid night time telephone number.  It must be as follows: 555-555-5555."); return false;}

	var eFaxNumber = document.getElementsByName("txtFaxNumber");
	if(eFaxNumber[0].value.length > 0 && checkPhone(eFaxNumber[0]) == false) { alert("You have entered an invalid fax number.  It must be as follows: 555-555-5555."); return false;}
	
	var ePropertyAddress = document.getElementsByName("txtPropertyAddress");
	if(ePropertyAddress[0].value == "") { alert("You have not entered your property address."); return false; }
	
	var ePropertyCity = document.getElementsByName("txtPropertyCityTown");
	if(ePropertyCity[0].value == "") { alert("You have not entered a property city/town"); return false; }
	
	var ePropertyProvince = document.getElementsByName("sltPropProvince");
	if(ePropertyProvince[0].selectedIndex < 1) { alert("You have not chosen a province for your property."); return false; }	

	var ePropertyPostalCode = document.getElementsByName("txtPropertyPostalCode");
	if(ePropertyPostalCode[0].value == "") { alert("You have not entered a postal code for your property"); return false; }
	if(ePropertyPostalCode[0].value.length != 6      || 
		!isNaN(ePropertyPostalCode[0].value.charAt(0))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(1)) ||
		!isNaN(ePropertyPostalCode[0].value.charAt(2))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(3)) ||
		!isNaN(ePropertyPostalCode[0].value.charAt(4))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(5)) ) { alert("Your property postal code is invalid.  It must be 6 characters long followed in the sequence of letter, number, letter, number, letter, number (Z5Z5Z5)."); return false; }		

	var eAskingPrice = document.getElementsByName("txtAskingPrice");
	if(eAskingPrice[0].value == "") { alert("You have not entered an asking price for your property."); return false; }
	if(isNaN(eAskingPrice[0].value)) { alert("You have entered an invalid asking price for your property.  The value must be a number."); return false; }	
	
	var eTerms = document.getElementsByName("sltTerms");
	if(eTerms[0].selectedIndex < 1) { alert("You have not selected a term for your property."); return false; }

	var aFinancing = document.getElementsByName("rdoOwnerFinance");
	
	var x;
	for(x = 0; x < aFinancing.length; x++)
	{
		if(aFinancing[x].checked) break;
	}

	if(x == aFinancing.length) { alert("A financing option must be chosen."); return false; }

	var eYearBuilt = document.getElementsByName("txtYearBuilt");
	if(eYearBuilt[0].value == "") { alert("You have not entered the year built for your property."); return false; }
	if(eYearBuilt[0].value.length < 4 || isNaN(eYearBuilt[0].value)) { alert("You have entered an invalid value for year built for your property.  The year must be stated in full as the example: 1908."); return false; }	
	
	var ePropertyTaxes = document.getElementsByName("txtPropertyTaxes");
	if(ePropertyTaxes[0].value == "") { alert("You have not entered property taxes."); return false; }
	if(isNaN(ePropertyTaxes[0].value)) { alert("You have entered an invalid property taxes for your property.  The value must be a number."); return false; }		
	
	var eLotSize = document.getElementsByName("txtLotSize");
	var eLotSize2 = document.getElementsByName("sltLotSize");	
	if(eLotSize[0].value == "" || eLotSize2[0].value == "select") { alert("You have not entered a lot size for your property."); return false; }
	if(SizeReg.exec(eLotSize[0].value) != null) { alert("You have entered an invalid lot size for your property.  The value cannot contain letters (excluding x)."); return false; }		
	
	var eBuildingSize = document.getElementsByName("txtBuildingSize");
	var eBuildingSize2 = document.getElementsByName("sltBuildingSize");	
	if(eBuildingSize[0].value == "" || eBuildingSize2[0].value == "select") { alert("You have not entered a building size for your property."); return false; }	
	if(SizeReg.exec(eBuildingSize[0].value) != null) { alert("You have entered an invalid building size for your property.  The value cannot contain letters (excluding x)."); return false; }		

	var eLevels = document.getElementsByName("sltLevels");
	if(eLevels[0].selectedIndex < 1) { alert("You have not selected the number of levels."); return false; }

	var eBedrooms = document.getElementsByName("sltBedrooms");
	if(eBedrooms[0].selectedIndex < 1) { alert("You have not selected the number of bedrooms."); return false; }

	var eBathrooms = document.getElementsByName("sltBathrooms");
	if(eBathrooms[0].selectedIndex < 1) { alert("You have not selected the number of bathrooms."); return false; }
	
	var eHeating = document.getElementsByName("sltHeating");
	if(eHeating[0].selectedIndex < 1) { alert("You have not selected the type of heating."); return false; }
	
	var eRoof = document.getElementsByName("sltRoof");
	if(eRoof[0].selectedIndex < 1) { alert("You have not selected the type of roof."); return false; }	
	
	var eExterior = document.getElementsByName("sltExterior");
	if(eExterior[0].selectedIndex < 1) { alert("You have not selected the type of exterior."); return false; }	
	
	var eGarages = document.getElementsByName("sltGarages");
	if(eGarages[0].selectedIndex < 1) { alert("You have not selected the number of garages."); return false; }	
	
	var eDescription = document.getElementsByName("txtDescription");
	if(eDescription[0].value == "") { alert("You have not entered a description.");	return false; }
	
	var maxWords
	
	if     (AdValue == "A_S") maxWords = 100;
	else if(AdValue == "A_M") maxWords = 200;
	else if(AdValue == "A_L") maxWords = 300;
	else if(AdVAlue == "A_E") maxWords = 400;

	var aWords = eDescription[0].value.split(" ");
	var space = 0;
	for(x=0;x<aWords.length;x++) if(aWords[x] == " " || aWords[x] == "") space++;
	var words = aWords.length - space;

	if(words > maxWords) { alert("Your description can only contain " + maxWords + " words or less."); return false; }
	
	return true;
}

function validateRentForm()
{  
	var aAdType = document.getElementsByName("rdoAdType");
	
	var x;
	var AdValue
	for(x = 0; x < aAdType.length; x++)
	{
		AdValue = aAdType[x].value;		
		if(aAdType[x].checked) break;
	}

	if(x == aAdType.length) { alert("An ad size must be chosen."); return false; }
	
	var eFirstName = document.getElementsByName("first_name");
	if(eFirstName[0].value == "") { alert("You have not entered your first name."); return false; }
	
	var eLastName = document.getElementsByName("last_name");
	if(eLastName[0].value == "") { alert("You have not entered your last name."); return false; }
	
	var eMailingAddress = document.getElementsByName("txtMailingAddress");
	if(eMailingAddress[0].value == "") { alert("You have not entered a mailing address"); return false; }
	
	var eStreetAddress = document.getElementsByName("address1");
	if(eStreetAddress[0].value == "") { alert("You have not entered a street address"); return false; }
	
	var eCity = document.getElementsByName("city");
	if(eCity[0].value == "") { alert("You have not entered a city."); return false; }
	
	var eEmail = document.getElementsByName("email");
	//The email input tag is the second returned element.....the email META tag is the first.	
	if(eEmail[1].value == "") { alert("You have not entered your email address."); return false; }
	
	var eEmailConfirm = document.getElementsByName("txtConfirmEmailAddress");
	if(eEmailConfirm[0].value == "") { alert("You have not entered a confirmation email address."); return false; }
	
	if(eEmail[1].value != eEmailConfirm[0].value) { alert("Your email addresses do not match."); return false; }
	
	var eProvince = document.getElementsByName("state");
	if(eProvince[0].value == "") { alert("You have not chosen a province."); return false; }
	
	var ePostalCode = document.getElementsByName("zip");
	if(ePostalCode[0].value == "") { alert("You have not entered a postal code."); return false; }
	if(ePostalCode[0].value.length != 6         || 
		!isNaN(ePostalCode[0].value.charAt(0))  ||
		isNaN(ePostalCode[0].value.charAt(1))   ||
		!isNaN(ePostalCode[0].value.charAt(2))  ||
		isNaN(ePostalCode[0].value.charAt(3))   ||
		!isNaN(ePostalCode[0].value.charAt(4))  ||
		isNaN(ePostalCode[0].value.charAt(5)) ) { alert("Your customer postal code is invalid.  It must be 6 characters long followed in the sequence of letter, number, letter, number, letter, number (Z5Z5Z5)."); return false; }			
	
	var eDayPhone = document.getElementsByName("txtDayPhone");
	if(eDayPhone[0].value == "") { alert("You have not entered a day time telephone number."); return false; }
	if(checkPhone(eDayPhone[0]) == false) { alert("You have entered an invalid day time telephone number.  It must be as follows: 555-555-5555."); return false;}	
	
	var eNightPhone = document.getElementsByName("txtNightPhone");	
	if(eNightPhone[0].value.length > 0 && checkPhone(eNightPhone[0]) == false) { alert("You have entered an invalid night time telephone number.  It must be as follows: 555-555-5555."); return false;}

	var eFaxNumber = document.getElementsByName("txtFaxNumber");
	if(eFaxNumber[0].value.length > 0 && checkPhone(eFaxNumber[0]) == false) { alert("You have entered an invalid fax number.  It must be as follows: 555-555-5555."); return false;}	
	
	var ePropertyAddress = document.getElementsByName("txtPropertyAddress");
	if(ePropertyAddress[0].value == "") { alert("You have not entered your property address."); return false; }
	
	var ePropertyCity = document.getElementsByName("txtPropertyCityTown");
	if(ePropertyCity[0].value == "") { alert("You have not entered a property city/town"); return false; }
	
	var ePropertyProvince = document.getElementsByName("sltPropProvince");
	if(ePropertyProvince[0].selectedIndex < 1) { alert("You have not chosen a province for your property."); return false; }	
	
	var ePropertyPostalCode = document.getElementsByName("txtPropertyPostalCode");
	if(ePropertyPostalCode[0].value == "") { alert("You have not entered a postal code for your property"); return false; }
	if(ePropertyPostalCode[0].value.length != 6         || 
		!isNaN(ePropertyPostalCode[0].value.charAt(0))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(1))   ||
		!isNaN(ePropertyPostalCode[0].value.charAt(2))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(3))   ||
		!isNaN(ePropertyPostalCode[0].value.charAt(4))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(5)) ) { alert("Your property postal code is invalid.  It must be 6 characters long followed in the sequence of letter, number, letter, number, letter, number (Z5Z5Z5)."); return false; }				
	
	var eRentalRate = document.getElementsByName("txtRentalRate");
	if(eRentalRate[0].value == "") { alert("You have not entered a rental rate for your property."); return false; }
	if(isNaN(eRentalRate[0].value)) { alert("You have entered an invalid rental rate for your property.  The value must be a number."); return false; }			
	
	var eRentalPer = document.getElementsByName("sltRentalPer");
	if(eRentalPer[0].selectedIndex < 1) { alert("You have not entered a rental rate for your property."); return false; }

	var eLevels = document.getElementsByName("sltLevels");
	if(eLevels[0].selectedIndex < 1) { alert("You haven't selected the number of levels."); return false; }

	var eBedrooms = document.getElementsByName("sltBedrooms");
	if(eBedrooms[0].selectedIndex < 1) { alert("You haven't selected the number of bedrooms."); return false; }

	var eBeds = document.getElementsByName("sltBeds");
	if(eBeds[0].selectedIndex < 1) { alert("You haven't selected the number of beds."); return false; }

	var eOccupancy = document.getElementsByName("sltOccupancy");
	if(eOccupancy[0].selectedIndex < 1) { alert("You haven't selected the maximum occupancy."); return false; }

	var eBathrooms = document.getElementsByName("sltBathrooms");
	if(eBathrooms[0].selectedIndex < 1) { alert("You haven't selected the number of bathrooms."); return false; }
	
	var ePets = document.getElementsByName("sltPetsAllowed");
	if(ePets[0].selectedIndex < 1) { alert("You haven't selected if pets are allowed."); return false; }
	
	var eChildren = document.getElementsByName("sltChildrenAllowed");
	if(eChildren[0].selectedIndex < 1) { alert("You haven't selected if children are allowed."); return false; }	
	
	var eSmoking = document.getElementsByName("sltSmokingAllowed");
	if(eSmoking[0].selectedIndex < 1) { alert("You haven't selected if smoking is allowed."); return false; }	
	
	var eLinensBedding = document.getElementsByName("sltLinensBedding");
	if(eLinensBedding[0].selectedIndex < 1) { alert("You haven't selected if there is linens and bedding."); return false; }	
	
	var eDishesCutlery = document.getElementsByName("sltDishesCutlery");
	if(eDishesCutlery[0].selectedIndex < 1) { alert("You haven't selected if there is dishes and cutlery."); return false; }		
	
	var eDescription = document.getElementsByName("txtDescription");
	if(eDescription[0].value == "") { alert("You have not entered a description.");	return false; }
	
	var maxWords
	
	if     (AdValue == "B_S") maxWords = 100;
	else if(AdValue == "B_M") maxWords = 200;
	else if(AdValue == "B_L") maxWords = 300;
	else if(AdVAlue == "B_E") maxWords = 400;

	var aWords = eDescription[0].value.split(" ");
	var space = 0;
	for(x=0;x<aWords.length;x++) if(aWords[x] == " " || aWords[x] == "") space++;
	var words = aWords.length - space;

	if(words > maxWords) { alert("Your description can only contain " + maxWords + " words or less."); return false; }
	
	return true;
}

function checkPhone(numbox)
{
	if(numbox.value.length == 10)
	{
		var pnum1 = numbox.value.substring(0, 3);
		var pnum2 = numbox.value.substring(3, 6);
		var pnum3 = numbox.value.substring(6, 10);
		if(isNaN(pnum1) || isNaN(pnum2) || isNaN(pnum3)) return false;
		numbox.value = pnum1 + "-" + pnum2 + "-" + pnum3;
		return true;
	}
	if(numbox.value.length == 12)
	{
		var pnum1 = numbox.value.substring(0, 3);
		var pnum2 = numbox.value.substring(4, 7);
		var pnum3 = numbox.value.substring(8, 12);		
		if(isNaN(pnum1) || isNaN(pnum2) || isNaN(pnum3)) return false;
		return true;
	}
	//number of characters must be too little or not enough ( less than 10 or 11)
	return false;
}


function selectPhotoAmount(eObject)
{
	var photo2_1 = document.getElementById("photoSpan2_1");
	var photo2_2 = document.getElementById("photoSpan2_2");
	var photo3_1 = document.getElementById("photoSpan3_1");
	var photo3_2 = document.getElementById("photoSpan3_2");
	var photo4_1 = document.getElementById("photoSpan4_1");
	var photo4_2 = document.getElementById("photoSpan4_2");	
	var wordAmt = document.getElementById("wordAmt");
	var numOfPhotos = document.getElementById("hdnNumOfPhotos");

	wordAmt.innerHTML = "100";
	numOfPhotos.value = 1;

	if(eObject.value == "A_M" || eObject.value == "B_M")
	{
		if(photo2_2 != null && photo2_1 == null) photo2_2.style.display = "inline"; else photo2_1.style.display = "inline";
		if(photo3_1 != null) photo3_1.style.display = "none";
		if(photo3_2 != null) photo3_2.style.display = "none";
		if(photo4_1 != null) photo4_1.style.display = "none";
		if(photo4_2 != null) photo4_2.style.display = "none";		
		wordAmt.innerHTML = "200";		
		numOfPhotos.value = 2;
		return;
	}
	
	if(eObject.value == "A_L" || eObject.value == "B_L")
	{
		if(photo2_2 != null && photo2_1 == null) photo2_2.style.display = "inline"; else photo2_1.style.display = "inline";
		if(photo3_2 != null && photo3_1 == null) photo3_2.style.display = "inline"; else photo3_1.style.display = "inline";		
		if(photo4_1 != null) photo4_1.style.display = "none";
		if(photo4_2 != null) photo4_2.style.display = "none";			
		wordAmt.innerHTML = "300";		
		numOfPhotos.value = 3;		
		return;
	}
	
	if(eObject.value == "A_E" || eObject.value == "B_E")
	{
		if(photo2_2 != null && photo2_1 == null) photo2_2.style.display = "inline"; else photo2_1.style.display = "inline";
		if(photo3_2 != null && photo3_1 == null) photo3_2.style.display = "inline"; else photo3_1.style.display = "inline";		
		if(photo4_2 != null && photo4_1 == null) photo4_2.style.display = "inline"; else photo4_1.style.display = "inline";		
		wordAmt.innerHTML = "400";		
		numOfPhotos.value = 4;
		return;
	}

	if(photo2_1 != null) photo2_1.style.display = "none";
	if(photo2_2 != null) photo2_2.style.display = "none";
	if(photo3_1 != null) photo3_1.style.display = "none";
	if(photo3_2 != null) photo3_2.style.display = "none";
	if(photo4_1 != null) photo4_1.style.display = "none";
	if(photo4_2 != null) photo4_2.style.display = "none";		

}

function confirmationText(option)
{ 
	if(option == "credit") 
	{
		document.getElementById("spanConfirmCredit").style.display="inline";
		document.getElementById("spanConfirmCheque").style.display="none";
	}
	else if(option == "cheque") 
	{
		document.getElementById("spanConfirmCredit").style.display="none";
		document.getElementById("spanConfirmCheque").style.display="inline";
	}	
}


function ConfirmDeletion()
{
	return confirm("Are you sure you want to delete this directory?");	
}

function PrintScreen()
{
	var win = window.open("blank.php","_blank");
}

function validateAdminDirectoryForm()
{  	
	var eDescription = document.getElementsByName("txtDescription");
	if(eDescription[0].value == "") { alert("You have not entered a description.");	return false; }

	var aWords = eDescription[0].value.split(" ");
	var space = 0;
	for(x=0;x<aWords.length;x++) if(aWords[x] == " " || aWords[x] == "") space++;
	var words = aWords.length - space;
	if(words > 300) { alert("Your description can only contain 300 words or less."); return false; }
	
	return true;
}

function validateAdminSaleForm()
{  
	var SizeReg = new RegExp("[ABCDEFGHIJKLMNOPQRSTUVWYZ_abcdefghijklmnopqrstuvwyz]");
	
	var ePropertyAddress = document.getElementsByName("txtPropertyAddress");
	if(ePropertyAddress[0].value == "") { alert("You have not entered your property address."); return false; }
	
	var ePropertyCity = document.getElementsByName("txtPropertyCityTown");
	if(ePropertyCity[0].value == "") { alert("You have not entered a property city/town"); return false; }
	
	var ePropertyProvince = document.getElementsByName("sltPropProvince");
	if(ePropertyProvince[0].selectedIndex < 1) { alert("You have not chosen a province for your property."); return false; }	

	var ePropertyPostalCode = document.getElementsByName("txtPropertyPostalCode");
	if(ePropertyPostalCode[0].value == "") { alert("You have not entered a postal code for your property"); return false; }
	if(ePropertyPostalCode[0].value.length != 6      || 
		!isNaN(ePropertyPostalCode[0].value.charAt(0))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(1)) ||
		!isNaN(ePropertyPostalCode[0].value.charAt(2))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(3)) ||
		!isNaN(ePropertyPostalCode[0].value.charAt(4))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(5)) ) { alert("Your property postal code is invalid.  It must be 6 characters long followed in the sequence of letter, number, letter, number, letter, number (Z5Z5Z5)."); return false; }		

	var eAskingPrice = document.getElementsByName("txtAskingPrice");
	if(eAskingPrice[0].value == "") { alert("You have not entered an asking price for your property."); return false; }
	if(isNaN(eAskingPrice[0].value)) { alert("You have entered an invalid asking price for your property.  The value must be a number."); return false; }	
	
	var eTerms = document.getElementsByName("sltTerms");
	if(eTerms[0].selectedIndex < 1) { alert("You have not selected a term for your property."); return false; }

	var aFinancing = document.getElementsByName("rdoOwnerFinance");
	
	var x;
	for(x = 0; x < aFinancing.length; x++)
	{
		if(aFinancing[x].checked) break;
	}

	if(x == aFinancing.length) { alert("A financing option must be chosen."); return false; }

	var eYearBuilt = document.getElementsByName("txtYearBuilt");
	if(eYearBuilt[0].value == "") { alert("You have not entered the year built for your property."); return false; }
	if(eYearBuilt[0].value.length < 4 || isNaN(eYearBuilt[0].value)) { alert("You have entered an invalid value for year built for your property.  The year must be stated in full as the example: 1908."); return false; }	
	
	var ePropertyTaxes = document.getElementsByName("txtPropertyTaxes");
	if(ePropertyTaxes[0].value == "") { alert("You have not entered property taxes."); return false; }
	if(isNaN(ePropertyTaxes[0].value)) { alert("You have entered an invalid property taxes for your property.  The value must be a number."); return false; }		
	
	var eLotSize = document.getElementsByName("txtLotSize");
	var eLotSize2 = document.getElementsByName("sltLotSize");	
	if(eLotSize[0].value == "" || eLotSize2[0].value == "select") { alert("You have not entered a lot size for your property."); return false; }
	if(SizeReg.exec(eLotSize[0].value) != null) { alert("You have entered an invalid lot size for your property.  The value cannot contain letters (excluding x)."); return false; }		
	
	var eBuildingSize = document.getElementsByName("txtBuildingSize");
	var eBuildingSize2 = document.getElementsByName("sltBuildingSize");	
	if(eBuildingSize[0].value == "" || eBuildingSize2[0].value == "select") { alert("You have not entered a building size for your property."); return false; }	
	if(SizeReg.exec(eBuildingSize[0].value) != null) { alert("You have entered an invalid building size for your property.  The value cannot contain letters (excluding x)."); return false; }		

	var eLevels = document.getElementsByName("sltLevels");
	if(eLevels[0].selectedIndex < 1) { alert("You have not selected the number of levels."); return false; }

	var eBedrooms = document.getElementsByName("sltBedrooms");
	if(eBedrooms[0].selectedIndex < 1) { alert("You have not selected the number of bedrooms."); return false; }

	var eBathrooms = document.getElementsByName("sltBathrooms");
	if(eBathrooms[0].selectedIndex < 1) { alert("You have not selected the number of bathrooms."); return false; }
	
	var eHeating = document.getElementsByName("sltHeating");
	if(eHeating[0].selectedIndex < 1) { alert("You have not selected the type of heating."); return false; }
	
	var eRoof = document.getElementsByName("sltRoof");
	if(eRoof[0].selectedIndex < 1) { alert("You have not selected the type of roof."); return false; }	
	
	var eExterior = document.getElementsByName("sltExterior");
	if(eExterior[0].selectedIndex < 1) { alert("You have not selected the type of exterior."); return false; }	
	
	var eGarages = document.getElementsByName("sltGarages");
	if(eGarages[0].selectedIndex < 1) { alert("You have not selected the number of garages."); return false; }	
	
	var eDescription = document.getElementsByName("txtDescription");
	if(eDescription[0].value == "") { alert("You have not entered a description.");	return false; }
	
	var maxWords
	
	if     (AdValue == "A_S") maxWords = 100;
	else if(AdValue == "A_M") maxWords = 200;
	else if(AdValue == "A_L") maxWords = 300;
	else if(AdVAlue == "A_E") maxWords = 400;

	var aWords = eDescription[0].value.split(" ");
	var space = 0;
	for(x=0;x<aWords.length;x++) if(aWords[x] == " " || aWords[x] == "") space++;
	var words = aWords.length - space;

	if(words > maxWords) { alert("Your description can only contain " + maxWords + " words or less."); return false; }
	
	return true;
}

function validateAdminRentForm()
{  
	var ePropertyAddress = document.getElementsByName("txtPropertyAddress");
	if(ePropertyAddress[0].value == "") { alert("You have not entered your property address."); return false; }
	
	var ePropertyCity = document.getElementsByName("txtPropertyCityTown");
	if(ePropertyCity[0].value == "") { alert("You have not entered a property city/town"); return false; }
	
	var ePropertyProvince = document.getElementsByName("sltPropProvince");
	if(ePropertyProvince[0].selectedIndex < 1) { alert("You have not chosen a province for your property."); return false; }	
	
	var ePropertyPostalCode = document.getElementsByName("txtPropertyPostalCode");
	if(ePropertyPostalCode[0].value == "") { alert("You have not entered a postal code for your property"); return false; }
	if(ePropertyPostalCode[0].value.length != 6         || 
		!isNaN(ePropertyPostalCode[0].value.charAt(0))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(1))   ||
		!isNaN(ePropertyPostalCode[0].value.charAt(2))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(3))   ||
		!isNaN(ePropertyPostalCode[0].value.charAt(4))  ||
		isNaN(ePropertyPostalCode[0].value.charAt(5)) ) { alert("Your property postal code is invalid.  It must be 6 characters long followed in the sequence of letter, number, letter, number, letter, number (Z5Z5Z5)."); return false; }				
	
	var eRentalRate = document.getElementsByName("txtRentalRate");
	if(eRentalRate[0].value == "") { alert("You have not entered a rental rate for your property."); return false; }
	if(isNaN(eRentalRate[0].value)) { alert("You have entered an invalid rental rate for your property.  The value must be a number."); return false; }			
	
	var eRentalPer = document.getElementsByName("sltRentalPer");
	if(eRentalPer[0].selectedIndex < 1) { alert("You have not entered a rental rate for your property."); return false; }

	var eLevels = document.getElementsByName("sltLevels");
	if(eLevels[0].selectedIndex < 1) { alert("You haven't selected the number of levels."); return false; }

	var eBedrooms = document.getElementsByName("sltBedrooms");
	if(eBedrooms[0].selectedIndex < 1) { alert("You haven't selected the number of bedrooms."); return false; }

	var eBeds = document.getElementsByName("sltBeds");
	if(eBeds[0].selectedIndex < 1) { alert("You haven't selected the number of beds."); return false; }

	var eOccupancy = document.getElementsByName("sltOccupancy");
	if(eOccupancy[0].selectedIndex < 1) { alert("You haven't selected the maximum occupancy."); return false; }

	var eBathrooms = document.getElementsByName("sltBathrooms");
	if(eBathrooms[0].selectedIndex < 1) { alert("You haven't selected the number of bathrooms."); return false; }
	
	var ePets = document.getElementsByName("sltPetsAllowed");
	if(ePets[0].selectedIndex < 1) { alert("You haven't selected if pets are allowed."); return false; }
	
	var eChildren = document.getElementsByName("sltChildrenAllowed");
	if(eChildren[0].selectedIndex < 1) { alert("You haven't selected if children are allowed."); return false; }	
	
	var eSmoking = document.getElementsByName("sltSmokingAllowed");
	if(eSmoking[0].selectedIndex < 1) { alert("You haven't selected if smoking is allowed."); return false; }	
	
	var eLinensBedding = document.getElementsByName("sltLinensBedding");
	if(eLinensBedding[0].selectedIndex < 1) { alert("You haven't selected if there is linens and bedding."); return false; }	
	
	var eDishesCutlery = document.getElementsByName("sltDishesCutlery");
	if(eDishesCutlery[0].selectedIndex < 1) { alert("You haven't selected if there is dishes and cutlery."); return false; }		
	
	var eDescription = document.getElementsByName("txtDescription");
	if(eDescription[0].value == "") { alert("You have not entered a description.");	return false; }
	
	var maxWords
	
	if     (AdValue == "B_S") maxWords = 100;
	else if(AdValue == "B_M") maxWords = 200;
	else if(AdValue == "B_L") maxWords = 300;
	else if(AdVAlue == "B_E") maxWords = 400;

	var aWords = eDescription[0].value.split(" ");
	var space = 0;
	for(x=0;x<aWords.length;x++) if(aWords[x] == " " || aWords[x] == "") space++;
	var words = aWords.length - space;

	if(words > maxWords) { alert("Your description can only contain " + maxWords + " words or less."); return false; }
	
	return true;
}