 var j=parseInt(Math.random()*2);
  j=(isNaN(j))?0:j;

function writeHomeImage(){
  document.write('<img src="images/homephoto'+(j+1)+'.jpg" width="909" height="258" border="0" />');
}

var k=parseInt(Math.random()*6);
  k=(isNaN(k))?0:k;

function writeSubImage(){
  document.write('<img src="images/subphoto'+(k+1)+'.jpg" border="0" align="right" style="padding-left: 10px;">');
}