var ai=null;
var to=null;

function changepic(sv) {
  if (document.getElementById(ai)) {
    var matches=document.getElementById(ai).src.match(/(.*)(\d)(\.[a-z]{3,4})$/);
    if (matches[2]>=4) {
      matches[2]=0;
    } else {
      matches[2]++;
    }
    if (typeof sv == undefined || sv == null) {
      document.getElementById(ai).src=matches[1]+matches[2]+matches[3];
      to=setTimeout("changepic()",750);
    } else {
      document.getElementById(ai).src=matches[1]+sv+matches[3];
    }
  }
}
function startm(id) {
  ai=id.id;
  changepic();
}
function endm(id,inum) {
  clearTimeout(to);
  changepic(inum);
  ai=null;
}

