
		function addLoadEvent(f){var ono=window.onload;if(typeof window.onload!='function'){window.onload=f}else{window.onload=function(){ono();f()}}}

		/* Featured property object */
		function FeaturedPropertyModel(details_url, image_url, address, price, description) 
		{
			this.details_url = details_url;
			this.image_url = image_url;
			this.address = address;
			this.price = price.replace("£", String.fromCharCode(163));
			this.description = description;
		};

    function FeaturedProperty(sp,db,err) {
        this.speed = sp;
        this.dbtype = db;
        this.featuredProperties = new Array();
        this.currentIndex = 0;
        this.featureDiv = null;
        this.error = err;
        if (document.getElementById("featureprops")) {
       this.featureDiv = document.getElementById("featureprops");
    } else if  (document.getElementById("featureprops" + this.dbtype)) {
       this.featureDiv = document.getElementById("featureprops"+ this.dbtype);
    }

    }
    
    FeaturedProperty.prototype.ShowNextSlide = ShowNextSlide;
    FeaturedProperty.prototype.AppendFeature = AppendFeature;
    FeaturedProperty.prototype.AddFeature = AddFeature;
    FeaturedProperty.prototype.CreateTextDiv = CreateTextDiv;
    FeaturedProperty.prototype.FeatureLoad = FeatureLoad;      
    FeaturedProperty.prototype.AddFeatureProperty = AddFeatureProperty;  
         

		function ShowNextSlide(me) {
		    if ( me.featuredProperties.length ==0 ) return;
		    if (me.currentIndex >= me.featuredProperties.length) {
			    me.currentIndex = 0;
			}
		    if (me.currentIndex == 0 && me.featuredProperties.length == 1) {
		        me.AddFeature(0);
		    } else if (me.speed == 0 ) {
		        var ul = document.createElement("ul");
		        me.featureDiv.appendChild(ul);
		        for(var i=0; i<me.featuredProperties.length; i++)
		        {
		            var li = document.createElement("li");
		            me.AppendFeature(li, me.featuredProperties[i]);
		            ul.appendChild(li);
		        }
		    } else {
		        var timeout = function () {
		            ShowNextSlide(me);
		        };
	
		        me.AddFeature(me.currentIndex++);
		        window.setTimeout(timeout, me.speed);
		    }

		};
		
		function AppendFeature(targetDiv, fpModel) {
		    var imageDiv = document.createElement("div");
		    imageDiv.className ="fpImage";
		    var imageLink = document.createElement("a");
		    imageLink.setAttribute("href", fpModel.details_url);
		    imageLink.setAttribute("title", "View property details for property in " + fpModel.address + ", " + fpModel.price);
		    var imageTag = document.createElement("img");
		    imageTag.setAttribute("src", fpModel.image_url);
		    imageTag.setAttribute("alt", "Image for property in " + fpModel.address);
		    imageLink.appendChild(imageTag);
		    imageDiv.appendChild(imageLink);
		    var addressDiv = CreateTextDiv("fpAddress", fpModel.address);
		    var priceDiv = CreateTextDiv("fpPrice", fpModel.price);
		    targetDiv.appendChild(imageDiv);
		    targetDiv.appendChild(addressDiv);
		    targetDiv.appendChild(priceDiv);
		};

		function AddFeature(index) {
		    var fpModel = this.featuredProperties[index];
		    var l = this.featureDiv.childNodes.length;
		    for (var i=0; i < l; i++) {
		        var ch = this.featureDiv.firstChild;
		        this.featureDiv.removeChild(ch);
		    }
		    AppendFeature(this.featureDiv, fpModel);
		};
		
	   function AddFeatureProperty(fpModel) {
		    this.featuredProperties[this.featuredProperties.length] = fpModel;
		};

		function CreateTextDiv(id, text) {
		    var textDiv = document.createElement("div");
		    textDiv.className= id;
		    var paraElement = document.createElement("p");
		    textDiv.appendChild(paraElement);
		    var textElement = document.createTextNode(text);
		    paraElement.appendChild(textElement);
		    textDiv.appendChild(paraElement);
		    return textDiv;
		};

		function FeatureLoad() { 
          if (this.error == null && this.featureDiv != null)
          {
            var propCount = this.featuredProperties.length;
            var randomPropIndex = Math.floor(Math.random() * propCount);
            this.currentIndex = randomPropIndex;
            this.ShowNextSlide(this);
	        } 
          else if (this.error != null && this.featureDiv != null)
          {
	          var p = document.createElement("p");
	          p.appendChild(document.createTextNode(error));
	          this.featureDiv.appendChild(p);
	        }
    };
        
		
		
		
		

      // this variable name needs to be unique
      var featuredObj1;
      function initFeaturedProp() {
        featuredObj1 = new FeaturedProperty(0,1, null);
        
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23021514",
      "http://images.vebra.com/images/1150/084/type1/arden.jpg",
      "Plot 8, Arden House, Lyndon Road, Olton, West Midlands, B92 7RF",
      "£167,500",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23020464",
      "http://images.vebra.com/images/1150/009/type1/19trunfv.jpg",
      "19, Trundalls Lane, Dickens Heath, Solihull, B90 1SS",
      "£235,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23019306",
      "http://images.vebra.com/images/1150/006/type1/t1nnlgn1.jpg",
      "Tennal, Rowney Green Lane, Rowney Green, Birmingham, B48 7RB",
      "£950,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23015479",
      "http://images.vebra.com/images/1150/008/type1/12kgfv.jpg",
      "Apt 12 Kineton Grange, Kineton Green Road, Solihull, West Midlands, B92 7EB",
      "£179,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23013866",
      "http://images.vebra.com/images/1150/007/type1/fbfront.jpg",
      "Barn Farm, Lower Eastern Green Lane, Eastern Green, Coventry, CV5 7DT",
      "£325,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23012998",
      "http://images.vebra.com/images/1150/003/type1/79anmain.jpg",
      "79, St. Andrews Crescent, Stratford Upon Avon, Warwickshire, CV37 9RP",
      "£339,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23010319",
      "http://images.vebra.com/images/1150/008/type1/5brfv.jpg",
      "5, Bransford Rise, Catherine De Barnes, West Midlands, B91 2TP",
      "£269,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23010320",
      "http://images.vebra.com/images/1150/008/type1/50dlfv.jpg",
      "50, Danford Lane, Solihull, West Midlands, B91 1QG",
      "£389,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23010321",
      "http://images.vebra.com/images/1150/008/type1/289wr.jpg",
      "The Gables,289, Whitefields Road, Solihull, West Midlands, B91 3PA",
      "£695,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23005261",
      "http://images.vebra.com/images/1150/005/type1/c1cosyfv.jpg",
      "Cosy Corner,36, Browns Lane, Knowle, West Midlands, B93 9BE",
      "£429,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23005193",
      "http://images.vebra.com/images/1150/007/type1/114nelfr.jpg",
      "114, Needlers End Lane, Balsall Common, Solihull, CV7 7AB",
      "£439,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23003759",
      "http://images.vebra.com/images/1150/009/type1/18pthlfv.jpg",
      "18, Pathlow Crescent, Shirley, Solihull, B90 2PS",
      "£289,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23001650",
      "http://images.vebra.com/images/1150/006/type1/bruefv.jpg",
      "Land Adjacent To, Brueton Park, Solihull, West Midlands, B91 3HG",
      "£40,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23000598",
      "http://images.vebra.com/images/1150/003/type1/wdhymain.jpg",
      "Woodhayes, Church Road, Snitterfield, Stratford Upon Avon, CV37 0LF",
      "£439,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/23000015",
      "http://images.vebra.com/images/1150/006/type1/199e30~1.jpg",
      "The Mount,198, High Street, Henley In Arden, West Midlands, B95 5HT",
      "£895,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/22995901",
      "http://images.vebra.com/images/1150/005/type1/252hlfv.jpg",
      "252, Henwood Lane, Catherine De Barnes, West Midlands, B91 2SY",
      "£399,995",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/22995902",
      "http://images.vebra.com/images/1150/006/type1/windme~1.jpg",
      "Windmere, Mill Lane, Rowington, Warwickshire, CV35 7AE",
      "£350,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/22995905",
      "http://images.vebra.com/images/1150/009/type1/14beefv.jpg",
      "14, Beechwood Close, Cheswick Green, West Midlands, B90 4HU",
      "£179,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/22994240",
      "http://images.vebra.com/images/1150/008/type1/40ur.jpg",
      "40, Ulleries Road, Solihull, West Midlands, B92 8EF",
      "£239,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/22993196",
      "http://images.vebra.com/images/1150/006/type1/lynfv.jpg",
      "Lynton Croft, Rising Lane, Solihull, West Midlands, B93 0DB",
      "£750,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/22992056",
      "http://images.vebra.com/images/1150/003/type1/77th4.jpg",
      "Plot 77, The Hathaways, Bishopton Lane, Stratford Upon Avon, Warwickshire, CV37 0RJ",
      "£345,995",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/22990430",
      "http://images.vebra.com/images/1150/006/type1/25crim~1.jpg",
      "25, Crimscote Square, Hatton Park, Warwick, CV35 7TS",
      "£325,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/22990302",
      "http://images.vebra.com/images/1150/007/type1/9wbcfr1.jpg",
      "9, Whitebeam Close, Tile Hill, Coventry, CV4 9UL",
      "£155,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://www.vebra.com/jsresidential/property/22988751",
      "http://images.vebra.com/images/1150/009/type1/616beefv.jpg",
      "Brigsteer,6, Beech Road, Wythall, Birmingham, B47 5QS",
      "£525,000",
      ""));
    
      featuredObj1.FeatureLoad();
      
      }
      addLoadEvent(initFeaturedProp);

    
