// JavaScript Document -- handles xml file retrieval
var browserFlag = '';
	browserFlag = navigator.appName; // Netscape (Firefox), Opera, Microsoft
var req = null;  // used for ajax code below

// This function is an event handler which is triggered whenever the state of the request changes.
// The states run from zero (uninitialized) through to four (complete).
// This is required for asyncronous file retrieval
function processReqChange() {
    // only if req shows "complete"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200 || req.status == 0) {
            // ...processing statements go here...
	      xmlDoc  = req.responseXML.documentElement;  // dom object
		  try {
	      	parseMyXML(xmlDoc);
			return;
		  } catch (e) {
	   		alert('Control file format error!');		
		  }
	    } else {
         	alert("There was a problem retrieving the XML data:\n" + req.statusText);
        }
    }
}

getXML = function(xmlFile) {
//	var xmlFile = 'debug.xml';
   if( document.implementation && 
       document.implementation.createDocument){
	   	if (window.XMLHttpRequest) {
			var asyncSync = false;	// call for a syncronous file retrieval
        	req = new XMLHttpRequest();
        	req.open("GET", xmlFile, asyncSync);  // false calls for syncronous file retrieval
        	req.onreadystatechange = processReqChange;
        	req.send(null);
			if (!asyncSync) {
	    		xmlDoc  = req.responseXML.documentElement;  // dom object for syncronous retrieval
				parseMyXML(xmlDoc);
			}
        	return;
		}
   	} else {  // for IE5, IE6, IE7
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM") ;
   		try {
			xmlDoc.async=false;
			xmlDoc.load(xmlFile);
			parseMyXML(xmlDoc);
			return;
   		} catch (e) {
	   		alert('Control file format error!');
		}
   	}
}
// -------------------------------------------------
var allProp = new Array();  // array to hold the objects for each property
var propertyValid = false;
setupDummy();
getXML('listings.xml');
var totalListings = allProp.length;
// ---------------------------------------------
function parseMyXML(xmlDoc) {
	var allListings = xmlDoc.getElementsByTagName("listing"); // all property in xml document
//	alert("number of properties = " + allListings.length);
//	listNodesX = allListings[0].childNodes;
//	alert("number child of nodes = " + listNodesX.length);
//	alert("node type = " + listNodesX[0].nodeType); // node type = 1 for <property>
//	alert("node name = " + listNodesX[0].nodeName); // property
//	zz = listNodesX[0].childNodes;
//	alert("number of child nodes under property = " + zz.length);
//	alert("node type under property = " + zz[0].nodeType);  // node type is 3
//	alert("node value = " + zz[0].nodeValue);  
	var numPropNodes = allListings.length;
	var pA;
	var allPropIndex = 0;
	var myProperty = '';
	var y;
	if(numPropNodes <=0 ) alert("Data File reading error! Please reload this page.");
	for (propIndex=0; propIndex < numPropNodes; propIndex++) {
		listNodes=allListings[propIndex].childNodes; // one of the listings
		allProp[allPropIndex] = null;
		for (i=0; i < listNodes.length; i++){
			zType = listNodes[i].nodeType;     // type is 1 at this point
			if(zType == 1) {
			  zName = listNodes[i].nodeName;   // name of node
			  z = listNodes[i].childNodes;
			  if(z.length > 0) {
				for (j=0; j < z.length; j++){
					if(z[j].nodeType == 3) { // node type should be 3
						if(allProp[allPropIndex] == null){
							pObj = new Object();
							allProp[allPropIndex] = pObj;
							allProp[allPropIndex].listingAddress = '';
							allProp[allPropIndex].name = '';
								allProp[allPropIndex].owner = '';
								allProp[allPropIndex].openListing = 'no';
								allProp[allPropIndex].status = 'expired';
							allProp[allPropIndex].agent = '';
							allProp[allPropIndex].category = '';
								allProp[allPropIndex].secondType = '';
								allProp[allPropIndex].acres = '';
								allProp[allPropIndex].br = '';
								allProp[allPropIndex].ba = '';
								allProp[allPropIndex].sloft = '';
								allProp[allPropIndex].sleeps = '';
							allProp[allPropIndex].price = '';
							allProp[allPropIndex].description = '';
                            allProp[allPropIndex].thumb = '';
							allProp[allPropIndex].mlsGA = 'na';
							allProp[allPropIndex].cbId = '';
							allProp[allPropIndex].expiresDate = '';
							allProp[allPropIndex].newListingDate = '';
							allProp[allPropIndex].priceChangeDate = '';
							allProp[allPropIndex].map = '';
								allProp[allPropIndex].mapNum= 0;
								allProp[allPropIndex].mapType = 'jpg';
								allProp[allPropIndex].latitude = '';
								allProp[allPropIndex].latDeg = 0;
								allProp[allPropIndex].latMin = 0;
								allProp[allPropIndex].longitude = '';
								allProp[allPropIndex].lonDeg = 0;
								allProp[allPropIndex].lonMin = 0;
								allProp[allPropIndex].alt = 0;
							allProp[allPropIndex].topo = '';
							allProp[allPropIndex].virtualTour = 'none';
								allProp[allPropIndex].youTube = 'no';
								allProp[allPropIndex].local = 'no';
								allProp[allPropIndex].scene1 = '';
								allProp[allPropIndex].scene2 = '';								
								allProp[allPropIndex].scene3 = '';								
								allProp[allPropIndex].scene4 = '';								
								allProp[allPropIndex].scene5 = '';								
								allProp[allPropIndex].scene6 = '';								
							allProp[allPropIndex].aerial = '';
								allProp[allPropIndex].numAerial = 0;
								allProp[allPropIndex].aerialType = 'jpg';
							allProp[allPropIndex].flyer = '';
							allProp[allPropIndex].plat = 'no';
							allProp[allPropIndex].disclosure = 'no';
							allProp[allPropIndex].slideShow = '';
								allProp[allPropIndex].slideShowZoom = 'no';
								allProp[allPropIndex].slideShowPan = 'none';
								allProp[allPropIndex].slideShowWidth = '360';
								allProp[allPropIndex].numPhotos = '';
							allProp[allPropIndex].listType = 'na';
								allProp[allPropIndex].leasePurchase = 'no';
								allProp[allPropIndex].ownerFinance = 'no';
								allProp[allPropIndex].forRentShort = 'no';
								allProp[allPropIndex].forRentLong = 'no'
								allProp[allPropIndex].forSale = 'no';
							allProp[allPropIndex].features = '';
								allProp[allPropIndex].views = '';
								allProp[allPropIndex].lakeView = '';
								allProp[allPropIndex].lakeFront = '';
								allProp[allPropIndex].boat = 'no';
								allProp[allPropIndex].dock = 'no';
								allProp[allPropIndex].usfs = '';
								allProp[allPropIndex].water = '';
								allProp[allPropIndex].woods = '';
							allProp[allPropIndex].leaseAmount = 'na';
								allProp[allPropIndex].downPayment = '';
								allProp[allPropIndex].securityDeposit = '';
								allProp[allPropIndex].petFriendly = '';
								allProp[allPropIndex].petDeposit = '';
								allProp[allPropIndex].smokingDeposit = '';
								allProp[allPropIndex].cleaningFee = '';
								allProp[allPropIndex].lastMonthRent = 'yes';
							allProp[allPropIndex].gaMLSrent = 'na';
						}
						if(zName == 'property') {
							myProperty = trim(z[j].nodeValue);
							allProp[allPropIndex].name = convert(myProperty);
							allProp[allPropIndex].listingAddress = myProperty;
							pAttributes = listNodes[i].attributes;
							pA = pAttributes.getNamedItem("owner").nodeValue;	
							if(pA.length > 0) allProp[allPropIndex].owner = trim(pA);
							pA = pAttributes.getNamedItem("openListing").nodeValue;	
							if(pA.length > 0) {
								y = trim(pA).toLowerCase();
								if( y == "yes") allProp[allPropIndex].openListing = y;
							}
							pA = pAttributes.getNamedItem("status").nodeValue;	
							if(pA.length > 0) {
								y = trim(pA).toLowerCase();
								if( y == "active") allProp[allPropIndex].status = 'active';
							}
							continue;
						}
						if(zName == 'agent') {
							allProp[allPropIndex].agent = trim(z[j].nodeValue);
							continue;
						}
						if(zName == 'landHome') {
							allProp[allPropIndex].category = trim(z[j].nodeValue);
							pAttributes = listNodes[i].attributes;
							pA = pAttributes.getNamedItem("secondType").nodeValue;
							if(pA.length > 0) 
								allProp[allPropIndex].secondType = trim(pA);
							pA = pAttributes.getNamedItem("acres").nodeValue;
							if(pA.length > 0) 
								allProp[allPropIndex].acres = trim(pA);
							pA = pAttributes.getNamedItem("bd").nodeValue;
							if(pA.length > 0) 
								allProp[allPropIndex].bd = trim(pA);
							pA = pAttributes.getNamedItem("ba").nodeValue;
							if(pA.length > 0) 
								allProp[allPropIndex].ba = trim(pA);
							pA = pAttributes.getNamedItem("sloft").nodeValue;
							if(pA.length > 0)
								allProp[allPropIndex].sloft = trim(pA);
							pA = pAttributes.getNamedItem("sleeps").nodeValue;
							if(pA.length > 0) 
								allProp[allPropIndex].sleeps = trim(pA);							
							continue;
						}
						if(zName == 'price') {
							allProp[allPropIndex].price = trim(z[j].nodeValue);
							continue;
						}
						if(zName == 'description') {
							allProp[allPropIndex].description = trim(z[j].nodeValue);
							continue;
						}
                        if(zName == 'thumb') {
							allProp[allPropIndex].thumb = trim(z[j].nodeValue);
							continue;
						}
						if(zName == 'mlsGA') {
							allProp[allPropIndex].mlsGA = trim(z[j].nodeValue);
							pAttributes = listNodes[i].attributes;
							pA = pAttributes.getNamedItem("cbId").nodeValue;
							if(pA.length > 0) 
								allProp[allPropIndex].cbId = trim(pA);
							continue;
						}
						if(zName == 'expires') {
							allProp[allPropIndex].expiresDate = trim(z[j].nodeValue);
							continue;
						}
						if(zName == 'NewListingDate') {
							allProp[allPropIndex].newListingDate = trim(z[j].nodeValue);
							continue;
						}
						if(zName == 'PriceChangeDate') {
							allProp[allPropIndex].priceChangeDate = trim(z[j].nodeValue);
							continue;
						}
						if(zName == 'map') {
							allProp[allPropIndex].map = trim(z[j].nodeValue);
							pAttributes = listNodes[i].attributes;
							if(trim(allProp[allPropIndex].map).length == 0){
								allProp[allPropIndex].mapNum = 0;
								pA = 0;
							} else {
								pA = trim(pAttributes.getNamedItem("mapNum").nodeValue);
								if(pA.length > 0) {
									pA = parseInt(pA);
								}
							}
							if(trim(allProp[allPropIndex].map).length > 0) 
									allProp[allPropIndex].mapNum = pA;
							pA = trim(pAttributes.getNamedItem("mapType").nodeValue);
							if(pA.length > 0) allProp[allPropIndex].mapType = pA;
							pA = pAttributes.getNamedItem("latitude").nodeValue;
							if(pA.length > 0){
								allProp[allPropIndex].latitude = pA.toUpperCase();
							}
							pA = pAttributes.getNamedItem("latDeg").nodeValue;
							if(pA.length > 0){
								allProp[allPropIndex].latDeg = parseFloat(pA);
							}
							pA = pAttributes.getNamedItem("latMin").nodeValue;
							if(pA.length > 0){
								allProp[allPropIndex].latMin= parseFloat(pA);
							}
							pA = pAttributes.getNamedItem("longitude").nodeValue;
							if(pA.length > 0) {
								allProp[allPropIndex].longitude = pA.toUpperCase();	
							}
							pA = pAttributes.getNamedItem("lonDeg").nodeValue;
							if(pA.length > 0) {
								allProp[allPropIndex].lonDeg = parseFloat(pA);	
							}
							pA = pAttributes.getNamedItem("lonMin").nodeValue;
							if(pA.length > 0) {
								allProp[allPropIndex].lonMin = parseFloat(pA);	
							}
							pA = pAttributes.getNamedItem("alt").nodeValue;
							if(pA.length > 0) {
								allProp[allPropIndex].alt = parseInt(pA);	
							}
							continue;
						}
						if(zName == 'topo') {
							allProp[allPropIndex].topo = trim(z[j].nodeValue);
							continue;
						} 
						if(zName == 'virtualTour') {
							allProp[allPropIndex].virtualTour = trim(z[j].nodeValue);
							pAttributes = listNodes[i].attributes;
							if(trim(allProp[allPropIndex].virtualTour).length > 0) {
								pA = trim(pAttributes.getNamedItem("youTube").nodeValue);
								if(pA.length > 0){
									if(pA.toLowerCase() == 'yes') {
										allProp[allPropIndex].youTube = 'yes';
									}
								}
								pA = trim(pAttributes.getNamedItem("local").nodeValue);
								if(pA.length > 0){
									if(pA.toLowerCase() == 'yes') {
										allProp[allPropIndex].local = 'yes';
										setVTaddress(allPropIndex);
									}
								}
								pA = trim(pAttributes.getNamedItem("scene1").nodeValue);
								if(pA.length > 0) {
									allProp[allPropIndex].scene1 = pA;	
								}
								pA = trim(pAttributes.getNamedItem("scene2").nodeValue);
								if(pA.length > 0) {
									allProp[allPropIndex].scene2 = pA;	
								}
								pA = trim(pAttributes.getNamedItem("scene3").nodeValue);
								if(pA.length > 0) {
									allProp[allPropIndex].scene3 = pA;	
								}
								pA = trim(pAttributes.getNamedItem("scene4").nodeValue);
								if(pA.length > 0) {
									allProp[allPropIndex].scene4 = pA;	
								}
								pA = trim(pAttributes.getNamedItem("scene5").nodeValue);
								if(pA.length > 0) {
									allProp[allPropIndex].scene5 = pA;	
								}
								pA = trim(pAttributes.getNamedItem("scene6").nodeValue);
								if(pA.length > 0) {
									allProp[allPropIndex].scene6 = pA;	
								} 
							} 
							continue;
						}
						if(zName == 'aerial') {
							allProp[allPropIndex].aerial = trim(z[j].nodeValue);	
							pAttributes = listNodes[i].attributes;
							if(trim(allProp[allPropIndex].aerial).length > 0) {
								pA = trim(pAttributes.getNamedItem("numAerial").nodeValue);
								if(pA.length == 0) pA = 1;
								allProp[allPropIndex].numAerial = parseInt(pA);
								pA = trim(pAttributes.getNamedItem("aerialType").nodeValue);
								if(pA.length > 0) allProp[allPropIndex].aerialType = pA;
							} 
							continue;
						}
 					    if(zName == 'flyer') {
							allProp[allPropIndex].flyer = trim(z[j].nodeValue);
							continue;
						}
						if(zName == 'plat') {
							if(trim(z[j].nodeValue).length > 0) {
								if(trim(z[j].nodeValue).toLowerCase() == 'yes')
									allProp[allPropIndex].plat = 'yes';
							}
							continue;
						}
						if(zName == 'disclosure') { 
							if(trim(z[j].nodeValue).length > 0) {
								if(trim(z[j].nodeValue).toLowerCase() == 'yes')
									allProp[allPropIndex].disclosure = 'yes';
							}
							continue;
						}
						if(zName == 'slideShow') {
							allProp[allPropIndex].slideShow = trim(z[j].nodeValue);
							pAttributes = listNodes[i].attributes;
							if(trim(allProp[allPropIndex].slideShow).length > 0) {
								pA = trim(pAttributes.getNamedItem("zoomIn").nodeValue);
								if(pA.length > 0) {
									if(pA.toLowerCase() !== 'yes') pA = 'no';
									allProp[allPropIndex].slideShowZoom = pA;
								}
								pA = trim(pAttributes.getNamedItem("pan").nodeValue);
								if(pA.length > 0) {
									if(pA.toLowerCase() != 'lateral' && pA != 'circular') 
										pA = 'none';
									allProp[allPropIndex].slideShowPan = pA;
								}
								pA = trim(pAttributes.getNamedItem("picWidth").nodeValue);
								if(pA.length > 0)
									allProp[allPropIndex].slideShowWidth = parseInt(pA);
								pA = trim(pAttributes.getNamedItem("numPhotos").nodeValue);
								if(pA.length > 0)
									allProp[allPropIndex].numPhotos = parseInt(pA);
							}
							continue;
						}
						if(zName == 'listingType') {
							if(trim(z[j].nodeValue).length > 0)
								allProp[allPropIndex].listType = trim(z[j].nodeValue);
							pAttributes = listNodes[i].attributes;
							pA = trim(pAttributes.getNamedItem("leasePurchase").nodeValue);
							if(pA.length > 0) {
								pA = pA.toLowerCase();
								if(pA == 'yes')
									allProp[allPropIndex].leasePurchase = pA;
							}
							pAttributes = listNodes[i].attributes;
							pA = trim(pAttributes.getNamedItem("ownerFinance").nodeValue);
							if(pA.length > 0) {
								pA = pA.toLowerCase();
								if(pA == 'yes')
									allProp[allPropIndex].ownerFinance = pA;
							}
							pA = trim(pAttributes.getNamedItem("forRentShort").nodeValue);
							if(pA.length > 0) {
								pA = pA.toLowerCase();
								if(pA == 'yes')
									allProp[allPropIndex].forRentShort = pA;
							}
							pA = trim(pAttributes.getNamedItem("forRentLong").nodeValue);
							if(pA.length > 0) {
								pA = pA.toLowerCase();
								if(pA == 'yes')
									allProp[allPropIndex].forRentLong = pA;
							}
							pA = trim(pAttributes.getNamedItem("forSale").nodeValue);
							if(pA.length > 0) {
								pA = pA.toLowerCase();
								if(pA == 'yes')
									allProp[allPropIndex].forSale = pA;
							}
							continue;
						}
						if(zName == 'features') {
							if(trim(z[j].nodeValue).length > 0)
								allProp[allPropIndex].features = trim(z[j].nodeValue);
							pAttributes = listNodes[i].attributes;
							pA = trim(pAttributes.getNamedItem("views").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].views = pA;
							}
							pA = trim(pAttributes.getNamedItem("lakeView").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].lakeView = pA;
							}
							pA = trim(pAttributes.getNamedItem("lakeFront").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].lakeFront = pA;
							}
							pA = trim(pAttributes.getNamedItem("boat").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].boat = pA;
							}
							pA = trim(pAttributes.getNamedItem("dock").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].dock = pA;
							}
							pA = trim(pAttributes.getNamedItem("usfs").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].usfs = pA;
							}
							pA = trim(pAttributes.getNamedItem("water").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].water = pA;
							}
							pA = trim(pAttributes.getNamedItem("woods").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].woods = pA;
							}
						}
						if(zName == 'leaseAmount') {
							if(trim(z[j].nodeValue).length > 0)
								allProp[allPropIndex].leaseAmount = trim(z[j].nodeValue);
							pAttributes = listNodes[i].attributes;
							pA = trim(pAttributes.getNamedItem("downPayment").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].leasePurchase = pA;
							}
							pA = trim(pAttributes.getNamedItem("securityDeposit").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].securityDeposit = pA;
							}
							pA = trim(pAttributes.getNamedItem("petDeposit").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].petDeposit = pA;
							}
							pA = trim(pAttributes.getNamedItem("smokingDeposit").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].smokingDeposit = pA;
							}
							pA = trim(pAttributes.getNamedItem("cleaningFee").nodeValue);
							if(pA.length > 0) {
									allProp[allPropIndex].cleaningFee = pA;
							}
							pA = trim(pAttributes.getNamedItem("lastMonthRent").nodeValue);
							if(pA.length > 0) {
								pA = pA.toLowerCase();
								if(pA == 'yes')
									allProp[allPropIndex].lastMonthRent = pA;
							}
							continue;
						} 
						if(zName == 'mlsGArent') {
							allProp[allPropIndex].gaMLSrent = trim(z[j].nodeValue);
// if(allProp[allPropIndex].name == '374Nichols') alert(nodeValue);
							continue;
						}
					}
				  }
			  	}
			}
		} 
		allPropIndex++;
	}
//	myTestXML();  // test the xml retrieval functions
}
// -----------------------------------------------------------------
function nextProperty(anAddress) {
	property = new Object();
// ------------------------------- enter either null or 'filename' -------------
		property.name = anAddress;
	var myIndex = getPropertyIndex(property.name);
	property.listingAddress = getListingAddress(myIndex);
		property.owner = getOwner(myIndex);
		property.openListing = getOpenListing(myIndex);
		property.status = getStatus(myIndex);
	property.listingAgent = getListingAgent(myIndex);
	property.directory = property.listingAgent + 'Listings/' + property.name + '/';
	property.category = getPropertyCategory(myIndex);
		property.secondType = getSecondType(myIndex);
		property.acres = getAcres(myIndex);
		property.bd = getBd(myIndex);
		property.ba = getBa(myIndex);
		property.sloft = getSloft(myIndex);
		property.sleeps = getSleeps(myIndex);
	property.price = getPrice(myIndex);
	property.description = getDescription(myIndex);
	property.thumb = getThumb(myIndex);
	property.listingNumberGAMLS = getMlsGA(myIndex);
	property.cbId = getCbId(myIndex);
	property.mlsGAfile = getGAmlsFile(myIndex);
	property.expiresDate = getExpiresDate(myIndex);
	property.newListingDate = getNewListingDate(myIndex);
	property.priceChangeDate = getPriceChangeDate(myIndex);
	property.map = getFileNameMap(myIndex);
		property.numMaps = getNumMaps(myIndex);
		property.mapType = getFileTypeMap(myIndex);
		property.latitude = getLatitude(myIndex);
		property.latDeg = getLatitudeDegrees(myIndex);
		property.latMin = getLatitudeMinutes(myIndex);
		property.longitude = getLongitude(myIndex);
		property.lonDeg = getLongitudeDegrees(myIndex);
		property.lonMin = getLongitudeMinutes(myIndex);
		property.alt = getAltitude(myIndex);
	property.topo = getTopo(myIndex);
	property.virtualTour = getVirtualTour(myIndex); 
		property.youTube = getYouTubeFlag(myIndex);
		property.local = getVirtualLocalFlag(myIndex);
		property.scene1 = getScene1(myIndex);
		property.scene2 = getScene2(myIndex);
		property.scene3 = getScene3(myIndex);
		property.scene4 = getScene4(myIndex);
		property.scene5 = getScene5(myIndex);
		property.scene6 = getScene6(myIndex);
	property.aerial = getFileNameAerial(myIndex);
		property.numAerial = getNumAerial(myIndex);
		property.aerialType = getFileTypeAerial(myIndex);
	property.flyer = getFlyer(myIndex);
	property.emailPlat = getPlat(myIndex);
	property.emailDisclosure = getDisclosure(myIndex);
	property.slideShow = getSlideShow(myIndex);
		property.slideShowZoom = getSlideShowZoom(myIndex);
		property.slideShowPan = getSlideShowPan(myIndex);
		property.slideShowWidth = getSlideShowWidth(myIndex);
		property.numPhotos = getNumPhotos(myIndex);
	property.listType = getListType(myIndex);
		property.leasePurchase = getLeasePurchase(myIndex);
		property.ownerFinance = getOwnerFinance(myIndex);
		property.forSale = getForSale(myIndex);
		property.forRentShort = getForRentShort(myIndex);
		property.forRentLong = getForRentLong(myIndex);
	property.features = getFeatures(myIndex);
		property.views = getViews(myIndex);
		property.lakeView = getLakeView(myIndex);
		property.lakeFront = getLakeFront(myIndex);
		property.boat = getBoat(myIndex);
		property.dock = getDock(myIndex);
		property.usfs = getUsfs(myIndex);
		property.water = getWater(myIndex);
		property.woods = getWoods(myIndex);
	property.leaseAmount = getLeaseAmount(myIndex);
		property.downPayment = getDownPayment(myIndex);
		property.securityDeposit = getSecurityDeposit(myIndex);
		property.petFriendly = getPetFriendly(myIndex);
		property.petDeposit = getPetDeposit(myIndex);
		property.smokingDeposit = getSmokingDeposit(myIndex);
		property.lastMonthRent = getLastMonthRent(myIndex);
		property.cleaningFee = getCleaningFee(myIndex);
	property.gaMLSrent = getGAMLSrent(myIndex);
	property.URL = 'ourListings.htm?theProperty=' + property.name;
	return property;
}
// ----------------------------------------------------------------

function myTestXML() {
	var ss = '616ColonyPark';
//	alert(getNumListings());
	var i = getPropertyIndex(ss);
//	alert(getPropertyIndex(ss));
//	alert(getListingAddress(i) + ' length= ' + getListingAddress(i).length);
//	alert(getOwner(i));
//	alert(getOpenListing(i));
//	alert(getStatus(i));
//	alert(getListingAgent(i));
//	alert(getPropertyCategory(i));
//	alert(getSecondType(i));
//	alert(getAcres(i));
//	alert(getBd(i));
//	alert(getBa(i));
//	alert(getSloft(i));
//	alert(getSleeps(i));
//	alert(getPrice(i));
//	alert(getDescription(i));
//  alert(getThumb(i));
//	alert(getMlsGA(i));
//	alert(getCbId(i));
//	alert(getGAmleFile(i));
//	alert(getExpiresDate(i));
//	alert(getNewListingDate(i));
//	alert(getPriceChangeDate(i));
//	alert(getFileNameMap(i));
//	alert(getNumMaps(i));
//	alert(getFileTypeMap(i));
//	alert(getLatitude(i));
//	alert(getLatitudeDegrees(i));
//	alert(getLatitudeMinutes(i));
//	alert(getLongitude(i));
//	alert(getLongitudeDegrees(i));
//	alert(getLongitudeMinutes(i));
//	alert(getAltitude(i));
//	alert(getTopo(i));
//	alert(getVirtualTour(i));
//	alert(getYouTubeFlag(i));
//	alert(getVirtualLocalFlag(i));
//	alert(getScene1(i));
//	alert(getScene2(i));
//	alert(getScene3(i));
//	alert(getScene4(i));
//	alert(getScene5(i));
//	alert(getScene6(i));
//	alert(getFileNameAerial(i));
//	alert(getNumAerial(i));
//	alert(getFileTypeAerial(i));
//	alert(getFlyer(i));
//	alert(getPlat(i));
//	alert(getDisclosure(i));
//	alert(getSlideShow(i));
//	alert(getSlideShowZoom(i));
//	alert(getSlideShowPan(i));
//	alert(getSlideShowWidth(i));
//	alert(getNumPhotos(i));
//	alert(getListType(i));
//	alert(getLeasePurchase(i));
//	alert(getOwnerFinance(i));
//	alert(getForSale(i));
//	alert(getForRentShort(i));
//	alert(getForRentLong(i));
//	alert(getFeatures(i));
//	alert(getViews(i));
//	alert(getLakeView(i));
//	alert(getLakeFront(i));
//	alert(getBoat(i));
//	alert(getDock(i));
//	alert(getUsfsi));
//	alert(getWater(i));
//	alert(getWoods(i));
//	alert(getLeaseAmount(i));
//	alert(getDownPayment(i));
//	alert(getSecurityDeposit(i));
//	alert(getPetFriendly(i));
//	alert(getPetDeposit(i));
//	alert(getSmokingDeposit(i));
//	alert(getCleaningFee(i));
//	alert(getLastMonthRent(i));
//	alert(getGAMLSrent(i));
}
// --------------------------------------------------------------
function setupDummy() {
		pObj = new Object();
		allPropIndex = 0;
		allProp[allPropIndex] = pObj;
		allProp[allPropIndex].listingAddress = '';
		allProp[allPropIndex].name = '';
			allProp[allPropIndex].owner = '';
			allProp[allPropIndex].openListing = 'no';
			allProp[allPropIndex].status = 'expired';
		allProp[allPropIndex].agent = 'lee';
		allProp[allPropIndex].category = 'home';
			allProp[allPropIndex].secondType = '';
			allProp[allPropIndex].acres = '';
			allProp[allPropIndex].bd = '';
			allProp[allPropIndex].ba = '';
			allProp[allPropIndex].sloft = '';
			allProp[allPropIndex].sleeps = '';
		allProp[allPropIndex].price = '';
		allProp[allPropIndex].description = '';
        allProp[allPropIndex].thumb = '';
		allProp[allPropIndex].mlsGA = 'na';
		allProp[allPropIndex].cbId = '';
		allProp[allPropIndex].expiresDate = '';
		allProp[allPropIndex].newListingDate = '';
		allProp[allPropIndex].priceChangeDate = '';
		allProp[allPropIndex].map = '';
			allProp[allPropIndex].mapNum= 0;
			allProp[allPropIndex].mapType = 'jpg';
			allProp[allPropIndex].latitude = '';
			allProp[allPropIndex].latDeg = 0;
			allProp[allPropIndex].latMin = 0;
			allProp[allPropIndex].longitude = '';
			allProp[allPropIndex].lonDeg = 0;
			allProp[allPropIndex].lonMin = 0;
			allProp[allPropIndex].alt = 0;
		allProp[allPropIndex].virtualTour = 'none';
		allProp[allPropIndex].youTube = '';
		allProp[allPropIndex].local = '';
		allProp[allPropIndex].scene1 = '';
		allProp[allPropIndex].scene2 = '';
		allProp[allPropIndex].scene3 = '';
		allProp[allPropIndex].scene4 = '';
		allProp[allPropIndex].scene5 = '';
		allProp[allPropIndex].scene6 = '';
		allProp[allPropIndex].aerial = '';
			allProp[allPropIndex].numAerial = 0;
			allProp[allPropIndex].aerialType = 'jpg';
		allProp[allPropIndex].flyer = '';
		allProp[allPropIndex].plat = 'no';
		allProp[allPropIndex].disclosure = 'no';
		allProp[allPropIndex].slideShow = '';
			allProp[allPropIndex].slideShowZoom = 'no';
			allProp[allPropIndex].slideShowPan = 'none';
			allProp[allPropIndex].slideShowWidth = '360';
			allProp[allPropIndex].numPhotos = '';
		allProp[allPropIndex].listType = 'na';
			allProp[allPropIndex].leasePurchase = 'no';
			allProp[allPropIndex].ownerFinance = 'no';
			allProp[allPropIndex].forSale = 'no';
			allProp[allPropIndex].forRentShort = 'no';
			allProp[allPropIndex].forRentLong = 'no';
		allProp[allPropIndex].features = '';
			allProp[allPropIndex].views = '';
			allProp[allPropIndex].lakeView = '';
			allProp[allPropIndex].lakeFront = '';
			allProp[allPropIndex].boat = 'no';
			allProp[allPropIndex].dock = 'no';
			allProp[allPropIndex].usfs = '';
			allProp[allPropIndex].water = '';
			allProp[allPropIndex].woods = '';
		allProp[allPropIndex].leaseAmount = 'na';
			allProp[allPropIndex].downPayment = '';
			allProp[allPropIndex].securityDeposit = '';
			allProp[allPropIndex].petFriendly = '';
			allProp[allPropIndex].petDeposit = '';
			allProp[allPropIndex].smokingDeposit = '';
			allProp[allPropIndex].cleaningFee = '';
			allProp[allPropIndex].lastMonthRent = 'yes';
		allProp[allPropIndex].gaMLSrent = 'na';
}

// ---------------------------------------------------------------------
function getNumListings() {
	return allProp.length;	
}

function getPropertyIndex(propName) {
	if(propName == 'invalid') return 0;
	if(allProp.length > 0) {
		for (sIndex = 0; sIndex < allProp.length; sIndex++) {
			if (allProp[sIndex].name.toLowerCase() == propName.toLowerCase()) {
				propertyValid = true;
				return sIndex;
			}
		}
	}
	propertyValid = false;
	return 0;
}
function getThePropertyAddress(pIndex) {
	return allProp[pIndex].name;
}

function getListingAddress(pIndex) {
	return allProp[pIndex].listingAddress;	
}

function getOwner(pIndex) {
	return allProp[pIndex].owner;	
}

function getOpenListing(pIndex) {
	return allProp[pIndex].openListing;	
}

function getStatus(pIndex) {
	return allProp[pIndex].status;	
}

function getListingAgent(pIndex) {
	return allProp[pIndex].agent.toLowerCase();	
}

function getPropertyCategory(pIndex) {
	return allProp[pIndex].category.toLowerCase();	
}

function getSecondType(pIndex) {
	return allProp[pIndex].secondType.toLowerCase();	
}

function getAcres(pIndex) {
	return allProp[pIndex].acres;	
}

function getBd(pIndex) {
	return allProp[pIndex].bd;	
}

function getBa(pIndex) {
	return allProp[pIndex].ba;	
}

function getSloft(pIndex) {
	return allProp[pIndex].sloft;	
}

function getSleeps(pIndex) {
	return allProp[pIndex].sleeps;	
}

function getPrice(pIndex) {
	return allProp[pIndex].price;	
}

function getDescription(pIndex) {
	return allProp[pIndex].description;	
}

function getThumb(pIndex) {
    return allProp[pIndex].thumb;
}

function getMlsGA(pIndex) {
	if(propertyValid) {
		return allProp[pIndex].mlsGA;
	} else {
		return 'invalid.htm';
	}
}

function getCbId(pIndex) {
	return allProp[pIndex].cbId;	
}

function getGAmlsFile(pIndex,flg) {
var mls = allProp[pIndex].mlsGA;
	if(flg == false) mls = allProp[pindex].gaMLSrent;
	if(propertyValid) {
var s = 'http://www.georgiamls.com/agentsite/search/propertyDetail.cfm?SiteID=';
	s += agentID(pIndex) + '&LN=' + mls;
		return s;
	} else {
		return 'invalid.htm';
	}
}

function agentID(pIndex) {
var a = allProp[pIndex].agent.toLowerCase();
	switch (a) {
		case 'lee': 	return 'SILVERMANLEE';
		 				break;
		case 'howard':	return 'SILVERMANHOW';
		 				break;
		case 'liz':		return 'CHURCHLIZ';
		 				break;
	}
	return 'SILVERMANLEE';
}

function getGAmlsFileName(pIndex) {
	return allProp[pIndex].mlsGAfile;	
}

function getExpiresDate(pIndex) {
	return allProp[pIndex].expiresDate;
}

function getNewListingDate(pIndex) {
	return allProp[pIndex].newListingDate;	
}

function getPriceChangeDate(pIndex) {
	return allProp[pIndex].priceChangeDate;	
}

function getFileNameMap(pIndex) {
	return allProp[pIndex].map;	
}

function getFileTypeMap(pIndex) {
	return allProp[pIndex].mapType;	
}

function getNumMaps(pIndex) {
	return allProp[pIndex].mapNum;	
}

function getLatitude(pIndex) {
	return allProp[pIndex].latitude;	
}

function getLatitudeMinutes(pIndex) {
	return allProp[pIndex].latMin;	
}

function getLatitudeDegrees(pIndex) {
	return allProp[pIndex].latDeg;	
}

function getLongitude(pIndex) {
	return allProp[pIndex].longitude;	
}

function getLongitudeDegrees(pIndex) {
	return allProp[pIndex].lonDeg;	
}

function getLongitudeMinutes(pIndex) {
	return allProp[pIndex].lonMin;	
}

function getAltitude(pIndex) {
	return allProp[pIndex].alt;	
}

function getTopo(pIndex) {
	return allProp[pIndex].topo;	
}

function getVirtualTour(pIndex) {
	return allProp[pIndex].virtualTour;	
}

function getYouTubeFlag(pIndex) {
	return allProp[pIndex].youTube;	
}

function getVirtualLocalFlag(pIndex) {
	return allProp[pIndex].local;	
}

function getScene1(pIndex) {
	return allProp[pIndex].scene1;	
}

function getScene2(pIndex) {
	return allProp[pIndex].scene2;	
}

function getScene3(pIndex) {
	return allProp[pIndex].scene3;	
}

function getScene4(pIndex) {
	return allProp[pIndex].scene4;	
}

function getScene5(pIndex) {
	return allProp[pIndex].scene5;	
}

function getScene6(pIndex) {
	return allProp[pIndex].scene6;	
}

function getFileNameAerial(pIndex) {
	return allProp[pIndex].aerial;	
}

function getNumAerial(pIndex) {
	return allProp[pIndex].numAerial;	
}

function getFileTypeAerial(pIndex) {
	return allProp[pIndex].aerialType;	
}

function getFlyer(pIndex) {
	return allProp[pIndex].flyer;	
}

function getPlat(pIndex) {
	return allProp[pIndex].plat;	
}

function getDisclosure(pIndex) {
	return allProp[pIndex].disclosure;	
}

function getSlideShow(pIndex) {
	return allProp[pIndex].slideShow;	
}

function getSlideShowZoom(pIndex) {
	return allProp[pIndex].slideShowZoom;
}

function getSlideShowPan(pIndex) {
	return allProp[pIndex].slideShowPan;
}

function getSlideShowWidth(pIndex) {
	return allProp[pIndex].slideShowWidth;
}

function getNumPhotos(pIndex) {
	return allProp[pIndex].numPhotos;	
}

function getListType(pIndex) {
	return allProp[pIndex].listType;	
}

function getLeasePurchase(pIndex) {
	return allProp[pIndex].leasePurchase;	
}

function getOwnerFinance(pIndex) {
	return allProp[pIndex].ownerFinance;	
}

function getForSale(pIndex) {
	return allProp[pIndex].forSale;	
}

function getForRentShort(pIndex) {
	return allProp[pIndex].forRentShort;	
}

function getForRentLong(pIndex) {
	return allProp[pIndex].forRentLong;	
}

function getCommercialLease(pIndex) {
	var flg = 'no';
	if(getPropertyCategory(pIndex) == 'commercial') {
		if(getForRentLong(pIndex) == 'yes') flg = 'yes'
	}
	return flg;
}

function getFeatures(pIndex) {
	return allProp[pIndex].features;	
}

function getViews(pIndex) {
	return allProp[pIndex].views;	
}

function getLakeView(pIndex) {
	return allProp[pIndex].lakeView;	
}

function getLakeFront(pIndex) {
	return allProp[pIndex].lakeFront;	
}

function getBoat(pIndex) {
	return allProp[pIndex].boat;	
}

function getDock(pIndex) {
	return allProp[pIndex].dock;	
}

function getUsfs(pIndex) {
	return allProp[pIndex].usfs;	
}

function getWater(pIndex) {
	return allProp[pIndex].water;	
}

function getWoods(pIndex) {
	return allProp[pIndex].woods;	
}

function getLeaseAmount(pIndex) {
	return allProp[pIndex].leaseAmount;
}

function getDownPayment(pIndex) {
	return allProp[pIndex].downPayment;
}

function getSecurityDeposit(pIndex) {
	return allProp[pIndex].securityDeposit;	
}

function getPetFriendly(pIndex) {
var v = 'yes';
var p = allProp[pIndex].petDeposit;
	if(p == '') v = 'no';	
	return v;	
}

function getPetDeposit(pIndex) {
	return allProp[pIndex].petDeposit;	
}

function getSmokingDeposit(pIndex) {
	return allProp[pIndex].smokingDeposit;	
}

function getCleaningFee(pIndex) {
	return allProp[pIndex].cleaningFee;	
}

function getLastMonthRent(pIndex) {
	return allProp[pIndex].lastMonthRent;	
}

function getGAMLSrent(pIndex) {
	return allProp[pIndex].gaMLSrent;	
}

function convert(realAddr) {
// remove blanks
	var s = realAddr;
	var z = '';
	var y = '';
	for( var i = 0; i < s.length; i++) {
		if(s.charAt(i) != ' ') y += s.charAt(i);				
	}
// replace # with a hyphen then save as .name
	for ( var i = 0; i < y.length; i++) {
		if(y.charAt(i) == '#') {
			z += '-';	
		} else {
			z += y.charAt(i);	
		}
	}
 	return z;	
}

// ------------------------------------------------------------------------------
function setVTaddress(pIndex) {      // adjust the URL for the local virtual tour
	allProp[pIndex].virtualTour = "viewer.htm?theProperty=" + allProp[pIndex].name 
			+ "&agent=" + allProp[pIndex].agent.toLowerCase() + 
			"&scene1=" + allProp[pIndex].scene1 + "&scene2=" + allProp[pIndex].scene2 +	
			"&scene1=" + allProp[pIndex].scene3 + "&scene2=" + allProp[pIndex].scene4 +	
			"&scene1=" + allProp[pIndex].scene5 + "&scene2=" + allProp[pIndex].scene6;
	return;		
}
// -------------------- code for property.htm ---------------------------

function placeIframe(prop) { // used by property.htm
	var j = getPropertyIndex(prop);
	var theOffer = getPropertyOffer();
	var ourFlg = false;
	if (j >= 0) {
		var s = '';
		document.writeln(s);
		s = '<iframe';	
		if((getMlsGA(j).length == 7)) { // for sale, long term rental, or lease purchase
			if(theOffer == 'sale') {
				if(getOpenListing(j) != 'yes') {
					s = s + ' src=\"' + getGAmlsFile(j,true) + '\"';
				} else {
					var parameters = '?agent=' + getListingAgent(j) + '&theProperty=' +  getPropertyAddress(j) + '&offer=' + theOffer;
					var fileAddress = '/info.htm' + parameters;
					s = s + ' src=\"./' + fileAddress + '\"';	
					ourFlg = true; 	
				}
			} else {
				if(getGAMLSrent(j).length == 7) {
					s = s + ' src=\"' + getGAmlsFile(j,false) + '\"';
				} else {
					var parameters = '?agent=' + getListingAgent(j) + '&theProperty=' +  getPropertyAddress(j) + '&offer=' + theOffer;
					var fileAddress = '/info.htm' + parameters;
					s = s + ' src=\"./' + fileAddress + '\"';	
					ourFlg = true;					
				}
			}
		} else {  // FSBO or short term rental
		var parameters = '?agent=' + getListingAgent(j) + '&theProperty=' +  getPropertyAddress(j)+ '&offer=' + theOffer;
		var fileAddress = '/info.htm' + parameters;
				s = s + ' src=\"./' + fileAddress + '\"';	
				ourFlg = true;
		}
		s = s + ' name=\"Text\"';
		s = s + ' id=\"Text\"';
		s = s + ' width=\"675\"';
		var myHeight = 800;
		if(!ourFlg) {
			myHeight = 2500;
			var listingType = getPropertyCategory(getPropertyIndex(getPropertyAddress()));
			if(listingType.toLowerCase() == 'home') {
				myHeight = 1700;   // IE6 & IE7
				if(browserFlag == 'Netscape') myHeight = 1800;
				if(browserFlag == 'Opera') myHeight = 1850;
				if(browserFlag == 'Safari') myHeight = 1800;
			}
			if(listingType.toLowerCase() == 'land') {
				myHeight = 1660;   // IE6 & IE7
				if(browserFlag == 'Netscape') myHeight = 1850;
				if(browserFlag == 'Opera') myHeight = 1850;
				if(browserFlag == 'Safari') myHeight = 1850;
			}
		}
		s = s + ' height=' + '\"' + myHeight + '\"';
		s = s + ' scrolling=\"no\"';
		s = s + ' frameborder=\"0\"';
		s = s + ' allowtransparency=\"no\" >';
		s = s + '</iframe>';
		document.writeln(s);
		mlsOfset = 1600;
		itemObj = document.getElementById('shiftIt');
		if(!ourFlg) {
			var mlsDelta = 0;
			var mlsOfset = 1896;  // OK for IE6, IE7
			mlsDelta = 0;
			if(browserFlag == 'Netscape') mlsDelta = 6;
			mlsOfset = mlsOfset + mlsDelta;
		}
		itemObj.style.top = '-' + mlsOfset + 'px';
	}
	return;	
}
// ----------------------------------- check for expired listing --------------------------
function expired(aDate, someDays) {
	var cDate = convertDate(aDate);
	if( cDate >= 0) {
		var today = new Date().getTime();
		var delta = someDays * 24 * 60 * 60 *1000;
		var endDate = cDate + delta;
// alert(someDays+ ' ' + endDate + '  Today -> ' + today);
		if( endDate >= today) {
			return false;   // not expired or past end date	
		} else {
			return true;
		}
		return false;
	}
}
// ---------------------------------------------------------------------------------
function convertDate(aDate) {
	var len = aDate.length;	
	if (len == 10) {
		var mon = aDate.substring(0,2);
		var day = aDate.substring(3,5);
		var yr = aDate.substring(6);
		var myDate = new Date();
		return myDate.setFullYear(yr,mon-1,day);
	} else {
		return -1;
	}
}
// --------------------------------------------------------------------------------
function trim(stringToTrim) {   // trim leading and trailing blanks, tabs, and linefeeds
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) { // trim only leading
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) { // trim only trailing
	return stringToTrim.replace(/\s+$/,"");
}
//  -----------------------------------------------------------------------------------
function getNum(what) {
	var numList = getNumListings();
	var count = 0;
	for ( var i = 0; i < numList; i++) {
		switch (what) {
			case "ownerFinance":
				if (getOwnerFinance(i) == 'yes') count++;
				break;
			case "leasePurchase":
				if (getLeasePurchase(i) == 'yes') count++;
				break;
			case "shortRentals":
				if (getForRentShort(i) == 'yes') count++;
				break;
			case "longRentals":
				if (getForRentLong(i) == 'yes') count++;
				break;
			case "commercialLease":
				if (getCommercialLease(i) == 'yes') count++;
				break;
		}
	}
	return count;
}
// ------------------------------------------------------------------------------------
function resetIframe() {   // make the height of iframe large enough to handle the listings
	var frameHeight;
	var listingHeight = 140;
	numListings = getNumListings();
	numOwnerFinance = getNum('ownerFinance');
	numLeasePurchase = getNum('leasePurchase');
	numShortRentals = getNum('shortRentals');
	numLongRentals = getNum('longRentals');
	numCommercialLease = getNum('commercialLease');
	frameHeight = (numListings + numOwnerFinance + numLeasePurchase 
				   + numShortRentals + numLongRentals + numCommercialLease) * listingHeight;
	var objIframe = document.getElementById("Text");
	objIframe.height = "" + frameHeight;
}
//  ---------------------------------------------------------------------------------
function getTheListingAgent() {
	return property.listingAgent;	
}
