
		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) {
	        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://search.thinkproperty.com/johnshepherd/property/20024047",
      "http://images.vebra.com/images/1150/006/type1/fxbk9fv2.jpg",
      "Foxbrook Cottage, Old Warwick Road, Warwick, CV35 7AA",
      "£650,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/20023380",
      "http://images.vebra.com/images/1150/008/type1/22hafv.jpg",
      "22, Heathcote Avenue, Solihull, West Midlands, B91 1QL",
      "£325,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/20014052",
      "http://images.vebra.com/images/1150/084/type1/plot2f~1.jpg",
      "Plot 2 The Fairways,199, St. Bernard's Road, Solihull, West Midlands, B92 7DL",
      "£799,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/20007987",
      "http://images.vebra.com/images/1150/008/type1/5tibbfv.jpg",
      "5, Tibberton Close, Solihull, West Midlands, B91 3UD",
      "£375,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19998455",
      "http://images.vebra.com/images/1150/008/type1/73dhlfv.jpg",
      "73, Dovehouse Lane, Solihull, West Midlands, B91 2EF",
      "£565,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19997598",
      "http://images.vebra.com/images/1150/008/type1/12ashfv.jpg",
      "12, Ashleigh Heights, Solihull, West Midlands, B91 1AG",
      "£282,500",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19997599",
      "http://images.vebra.com/images/1150/008/type1/79linfv.jpg",
      "79, Links Drive, B91 2DJ",
      "£399,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19991514",
      "http://images.vebra.com/images/1150/008/type1/35wroxfv.jpg",
      "35, Wroxall Road, Solihull, West Midlands, B91 1DR",
      "£315,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19990852",
      "http://images.vebra.com/images/1150/005/type1/11wcfv.jpg",
      "11, Whiteslade Close, Knowle, West Midlands, B93 9PD",
      "£345,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19979173",
      "http://images.vebra.com/images/1150/008/type1/423strfr.jpg",
      "Treloyhan,423, Streetsbrook Road, Solihull, West Midlands, B91 1RE",
      "£795,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19974814",
      "http://images.vebra.com/images/1150/007/type1/31ga.jpg",
      "31, Greenfield Avenue, CV7 7UG",
      "£449,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19974815",
      "http://images.vebra.com/images/1150/008/type1/52kimfv.jpg",
      "52, Kimberley Road, Solihull, West Midlands, B92 8PU",
      "£255,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19970448",
      "http://images.vebra.com/images/1150/008/type1/13marfv.jpg",
      "13, Marsh Lane, Solihull, West Midlands, B91 2PG",
      "£525,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19970449",
      "http://images.vebra.com/images/1150/008/type1/11pinfv.jpg",
      "11, Pinfold Road, Solihull, West Midlands, B91 2PB",
      "£350,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19965179",
      "http://images.vebra.com/images/1150/003/type1/keble1.jpg",
      "Keble House,2, The Old School, Stratford Upon Avon, Warwickshire, CV37 8SG",
      "£299,950",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19952788",
      "http://images.vebra.com/images/1150/003/type1/30esfrt.jpg",
      "30, Evesham Street, Alcester, Warwickshire, B49 5DW",
      "£345,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19952789",
      "http://images.vebra.com/images/1150/003/type1/oakfrn~1.jpg",
      "Oaklands Farm, Fulready, Stratford Upon Avon, Warwickshire, CV37 7PE",
      "£445,000",
      ""));
    
      featuredObj1.AddFeatureProperty(  new FeaturedPropertyModel(
      "http://search.thinkproperty.com/johnshepherd/property/19952061",
      "http://images.vebra.com/images/1150/006/type1/44flint.jpg",
      "44, Flint Green Road, Birmingham, B27 6QA",
      "£150,000",
      ""));
    

      featuredObj1.FeatureLoad();
      }
      addLoadEvent(initFeaturedProp);

    