///grab the URL and store it as a varible //splice out the page info //switch that will figure out which page it's on //if page == x then #midImgX == foo; $(function() { midImg2over = new Image(); midImg3over = new Image(); midImg4over = new Image(); midImg5over = new Image(); midImg3over.src = "/images/midImg-3-over.jpg"; midImg4over.src = "/images/midImg-4-over.jpg"; midImg5over.src = "/images/midImg-5-over.jpg"; //isolates the name of the .html page the browser is looking at... var page = window.location.pathname.split("/",2)[1]; $("#midImg2").hover(onOverMidImg2, onOutMidImg2); $("#midImg3").hover(onOverMidImg3, onOutMidImg3); $("#midImg4").hover(onOverMidImg4, onOutMidImg4); $("#midImg5").hover(onOverMidImg5, onOutMidImg5); defaultButtonState(page); }); //sets the defaults up position, if any, for the roller function defaultButtonState(page) { switch (page) { case "find-an-apartment-stl.html": $("#midImg2").attr("src","/images/midImg-2-over.jpg"); $("#midImg2").unbind(); break; case "invest.html": $("#midImg3").attr("src","/images/midImg-3-over.jpg"); $("#midImg3").unbind(); break; case "property-manager.html": $("#midImg4").attr("src","/images/midImg-4-over.jpg"); $("#midImg4").unbind(); break; case "storage-stl.html": $("#midImg5").attr("src","/images/midImg-5-over.jpg"); $("#midImg5").unbind(); break; default: break; }//end switch }//end defaultButtonState(page) function onOverMidImg2() {$("#midImg2").attr("src","/images/midImg-2-over.jpg");} function onOutMidImg2() {$("#midImg2").attr("src","/images/midImg-2.jpg");} function onOverMidImg3() {$("#midImg3").attr("src","/images/midImg-3-over.jpg");} function onOutMidImg3() {$("#midImg3").attr("src","/images/midImg-3.jpg");} function onOverMidImg4() {$("#midImg4").attr("src","/images/midImg-4-over.jpg");} function onOutMidImg4() {$("#midImg4").attr("src","/images/midImg-4.jpg");} function onOverMidImg5() {$("#midImg5").attr("src","/images/midImg-5-over.jpg");} function onOutMidImg5() {$("#midImg5").attr("src","/images/midImg-5.jpg");}