// JavaScript Document
//Build developments array for "Where we're selling homes" page

// Array Explanation! //
// Each element in the developments array holds details of a development (shocking!)
// Within each element is another array with 5 elements of its own. These are as follows:
//   [0] = Development number (as string)
//   [1] = Development name
//   [2] = Development location
//   [3] = Property types available in this development. This is another array (of strings) indicating all of the property types available.
//   [4] = which image should be displayed on bottom right corner of site (this is used as: 'split' + developments[4] + '.jpg')

// To add a new development just add a new element at the end of the array. Be sure to update the ASP page as well so as to add the relevant marker on the map!
// To remove a development just delete the element from the array. You *should* also re-number the remaining developments so you don't have a number missing in the middle
//    dont forget to also remove the marker from the ASP page


var developments = [];

developments[1] = ['1', 'High Gate Mews', 'Liverpool Road, Whitchurch', ['3 Bed Houses', '2 Bed Apartments'], 'Whitchurch'];
developments[2] = ['2', 'Charlotte Place', 'Brownlow Road, Ellesmere', ['3 Bed Houses'], 'Ellesmere'];
developments[3] = ['3', 'Church Farm', 'Church Farm, Tilstock', ['2 Bed Houses'], 'Whitchurch'];
developments[4] = ['4', 'Castleford', 'Longslow Road, Market Drayton', ['2 Bed Apartments'], 'Market Drayton'];
developments[5] = ['5', 'Saxon Fields', 'Aston Street, Wem', ['2 Bed Houses', '3 Bed Houses', '2 Bed Apartments'], 'Wem'];
developments[6] = ['6', 'The Meadows', 'Shrewsbury Road, Cockshutt', ['3 Bed Houses'], 'Cockshutt'];
developments[7] = ['7', 'Hinstock','Hinstock', ['3 Bed Semi'], 'Hinstock'];
developments[8] = ['8', 'Manor Farm', 'Childs Ercall', ['3 Bed Houses'], 'Childs Ercall'];
developments[9] = ['9', 'Bowmere Heath', 'Shrewsbury', ['Apartments'], ''];
developments[10] = ['10', 'Mayfields', 'Battlefield Road, Shrewsbury', ['2 Bed Apartment'], 'Shrewsbury'];
developments[11] = ['11', 'Ellesmere Grange', 'Shrewsbury', ['2 Bed Apartment'], 'Shrewsbury'];
developments[12] = ['12', 'Radbrook', 'Shrewsbury', ['2 Bed Apartment'], 'Shrewsbury'];
developments[13] = ['13', 'Sutton Lane', 'Shrewsbury', ['2 Bed Apartment'], 'Shrewsbury'];
developments[14] = ['14', 'Tilling Drive', 'Stone', ['3 Bed Houses'], 'Stone'];
developments[15] = ['15', 'The Crossings', 'Stafford', ['3 Bed Houses'], 'Stafford'];
developments[16] = ['16', 'Wenlock Road', 'Bridgnorth', ['2 Bed Houses', '3 Bed Houses', '2 Bed Apartments'], 'Bridgnorth'];
developments[17] = ['17', 'Falcons Court', 'Much Wenlock', ['Houses'], 'Much Wenlock'];
developments[18] = ['18', 'King Street', 'Dawley', ['2 Bed Apartments'], 'Dawley'];




function updateSellingDetail(ref)
{
	var devNum = document.getElementById('houseIcon');
	var devName = document.getElementById('devName');
	var devLoc = document.getElementById('devLocation');
	var devDetails = document.getElementById('devDetails');

	if (ref <= 0 || ref > developments.length)
		return false;

	thisDev = developments[ref];

	devNum.innerHTML = thisDev[0];		//Update development number
	devName.innerHTML = thisDev[1];		//Update development name
	devLoc.innerHTML = thisDev[2];		//Update development location

	//Update property types available
	propTypes = thisDev[3];

	newDetails = '<ul>';

	for (x = 0; x < propTypes.length; x++)
		newDetails += '<li>' + propTypes[x] + '</li>';

	newDetails += '</ul>';

	devDetails.innerHTML = newDetails;

	return true;
}

