images = new Array(); textx = new Array(); images[0] = "kitchen.jpg"; images[1] = "paintbucket.jpg"; var imgcount = 1; if (document.images) {pic_0= new Image(259,172);pic_0.src="images/carousel/kitchen.jpg";pic_1= new Image(259,172);pic_1.src="images/carousel/paintbucket.jpg";} textx[0] = "Fall is almost here! Find an interior designer with ideas to keep your home feelin’ young. Check out Interior listings."; textx[1] = "Beautiful kitchens can change everything! Start planning your remodeling project now! Check out Interior listings."; var currentimg = 0; var timer = setInterval("nextphoto()",10000); function nextphoto() { if (currentimg == imgcount){ currentimg = 0; clearTimeout(timer); timer = setInterval("nextphoto()",10000); $("#ctext").fadeOut("slow"); $("#carousel_photo").fadeOut("slow",function() { document.getElementById("carousel_photo").src = "images/carousel/" + images[currentimg]; document.getElementById("ctext").innerHTML = textx[currentimg]; $("#carousel_photo").fadeIn("slow") $("#ctext").fadeIn("slow") }); } else { currentimg++; clearTimeout(timer); timer = setInterval("nextphoto()",10000); $("#ctext").fadeOut("slow"); $("#carousel_photo").fadeOut("slow",function() { document.getElementById("carousel_photo").src = "images/carousel/" + images[currentimg]; document.getElementById("ctext").innerHTML = textx[currentimg]; $("#carousel_photo").fadeIn("slow") $("#ctext").fadeIn("slow") }); } } function previousphoto() { if (currentimg == 0){ currentimg = imgcount; clearTimeout(timer); timer = setInterval("nextphoto()",10000); $("#ctext").fadeOut("slow"); $("#carousel_photo").fadeOut("slow",function() { document.getElementById("carousel_photo").src = "images/carousel/" + images[currentimg]; document.getElementById("ctext").innerHTML = textx[currentimg]; $("#carousel_photo").fadeIn("slow") $("#ctext").fadeIn("slow") }); } else { currentimg--; clearTimeout(timer); timer = setInterval("nextphoto()",10000); $("#ctext").fadeOut("slow"); $("#carousel_photo").fadeOut("slow",function() { document.getElementById("carousel_photo").src = "images/carousel/" + images[currentimg]; document.getElementById("ctext").innerHTML = textx[currentimg]; $("#carousel_photo").fadeIn("slow") $("#ctext").fadeIn("slow") }); } }