Changing Rollover state via javascript
<p>I am trying to change the image src and Rollover of a button based on a condition. I have the following code which works fine for changing the image src, how do I change the rollover state when the condition is met?</p>

<pre><code>&lt;div id="btn_1" style="position:absolute; left: 310px; top: 284px; z-index:8"&gt;
&lt;a href="javascript:self.location.href='menu.htm'" onMouseOver="MM_swapImage('btn_1','','../images/btn_over_01.jpg',1)" onMouseOut="MM_swapImgRestore()"&gt;&lt;img src="../images/btn_01.jpg"  name="btn_1" border="0"&gt;&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>//Javascript<BR></p>

<pre><code>if (btn1Visited == true){
    parent.Content.document.images['btn_1'].src = "../images/btn_visited_01.jpg";
        parent.Content.document.images['btn_1'].onMouseOver = "../images/btn_check_over_01.jpg";
    parent.Content.document.images['btn_1'].onMouseOut = "../images/btn_visited_01.jpg";
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&amp;&amp;i&lt;a.length&amp;&amp;(x=a[i])&amp;&amp;x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))&gt;0&amp;&amp;parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&amp;&amp;d.all) x=d.all[n]; for (i=0;!x&amp;&amp;i&lt;d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&amp;&amp;d.layers&amp;&amp;i&lt;d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x &amp;&amp; d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i&lt;(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</code></pre>
