 

function featProperty (xdetailsurl,ximageurl,xaddress,xprice, xbedrooms,xproptype ) {
	this.detailsurl = xdetailsurl;
	this.imageurl = ximageurl;
	this.address = xaddress;
	this.price = xprice;
	this.bedrooms = xbedrooms;
	this.proptype = xproptype;
}

var currentIndex = 0;
var allFeatures = new Array();
var timeOut = 8000;
allFeatures[0] = new featProperty("http://www.vebra.com/home/search/vdetails.asp?src=agent&cl=15399&pid=20626040&amp;dbt=1","http://images.vebra.com/images/1967/001/type1/seafield.jpg","Stepaside, Amroth","£695,000","7","Detached Bungalow");


addLoadEvent(featuredProps);


function featuredProps() {
	if (!document.getElementsByTagName || !document.getElementById) {
		return false;
	} else if(document.getElementById('featureprops')) {
			slideshow();
	}
}

function slideshow() { 
	if (currentIndex >= allFeatures.length) {
		currentIndex = 0;
	}
	if ( currentIndex == 0 && allFeatures.length == 1 ) {
		makeFeature(0);
	} else {
		makeFeature(currentIndex++);
		window.setTimeout("slideshow()",timeOut); 
	}		
}	

function makeFeature(index) {
	var target = document.getElementById('featureprops');
	featprop = allFeatures[index];
	//target.innerHTML = "";
	var l = target.childNodes.length;
	for (var i=0; i < l; i++){
		var ch = target.firstChild;
		target.removeChild(ch);
	}
	var flink = document.createElement('a');
	var fimg = document.createElement('img');
	
	fimg.setAttribute('src',featprop.imageurl);
	flink.appendChild(fimg);
	flink.setAttribute('href',featprop.detailsurl);
	
	var fhead = document.createElement('h4');
	var fheadtext = document.createTextNode('Property of the week');
	fhead.appendChild(fheadtext);
	
	var fpara = document.createElement('p');
	var fbreak = document.createElement('br');
	var fbreak1 = document.createElement('br');
	
	var flocation = document.createElement('strong');
	var flocationtext = document.createTextNode(featprop.address);
	flocation.appendChild(flocationtext);

	var fprice = document.createElement('em');
	var fpricetext = document.createTextNode(featprop.price);
	fprice.appendChild(fpricetext);
	var fproptype = document.createTextNode(featprop.bedrooms + ' Bed ' + featprop.proptype);

	fpara.appendChild(flocation);
	fpara.appendChild(fbreak);
	fpara.appendChild(fprice);
	fpara.appendChild(fbreak1);
	fpara.appendChild(fproptype);
	target.appendChild(flink);
	target.appendChild(fhead);
	target.appendChild(fpara);
}