var i=0;
var j=0;
var numPics=4;
var picture = new Array(numPics);
var picture_link = new Array(numPics);
var address = new Array(numPics);
var agent = new Array(numPics);
var agentlink = new Array(numPics);
var agentphone = new Array(numPics);

picture[0] = "images/listing1/pic1.jpg";
picture[1] = "images/listing2/pic1.jpg";
picture[2] = "images/listing3/pic1.jpg";
picture[3] = "images/listing4/pic1.jpg";

picture_link[0] = "http://www.obeo.com/Public/Viewer/Default.aspx?ID=471979";
picture_link[1] = "http://www.destinationevergreen.com";
picture_link[2] = "http://www.destinationevergreen.com";
picture_link[3] = "http://www.destinationevergreen.com";

address[0] = "2987 Sun Creek Ridge,<br>Evergreen, CO (Bergen Glen/Hiwan)<br>$525,000";
address[1] = "14752 Kit Carson Peak Trl.,<br>Pine, CO (5.09 ACRE LAND)<br>$225,000";
address[2] = "Highway 73,<br>Evergreen, CO (Valley Hi - 5 ACRE LAND)<br>$250,000";
address[3] = "30735 Bryant Dr.,<br>Evergreen, CO (Commercial Office Condo)<br>$250,000";

agent[0] = "Lauri Gorder"
agent[1] = "Christine Castner"
agent[2] = "Christine Castner"
agent[3] = "Christine Castner"

agentlink[0] = "about-lauri.html"
agentlink[1] = "about-chris.html"
agentlink[2] = "about-chris.html"
agentlink[3] = "about-chris.html"

agentphone[0] = "303.884.1375"
agentphone[1] = "303.726.8231"
agentphone[2] = "303.726.8231"
agentphone[3] = "303.726.8231"

RotatePic(i,j,picture,picture_link,address,numPics);

function RotatePic(i,j,picture,picture_link,address,numPics) {

        if(j==0)
        {
          i = Math.round(Math.random()*(numPics-1));
          j = j+1;
        }
        else
        {
          i = i+1;
          if(i==numPics) { i=0; }
        }


	p = document.getElementById('pic');
        pl = document.getElementById('pic_link');
        al = document.getElementById('addresslink');
        a = document.getElementById('address');
        ag = document.getElementById('agent');
        agl = document.getElementById('agentlink');
        ap=document.getElementById('agentphone');


        if (p != null)
          p.src=picture[i];
        if (pl != null)
          pl.href=picture_link[i];
        if (al != null)
          al.href=picture_link[i];
        if (a != null)
          a.innerHTML=address[i];
        if (ag != null)
          ag.innerHTML=agent[i];
        if (agl != null)
          agl.href=agentlink[i];
        if (ap != null)
          ap.innerHTML=agentphone[i];

	setTimeout("RotatePic(i,j,picture,picture_link,address,numPics)",7000);
}




