 var j=parseInt(Math.random()*6);
  j=(isNaN(j))?0:j;

function writeHomeImage(){
  document.write('<img src="images/headphoto'+(j+1)+'.jpg" width="195" height="138" />');
}

var k=parseInt(Math.random()*1);
  k=(isNaN(k))?0:k;

function writeSubImage(){
  document.write('<img src="images/subphoto'+(k+1)+'.jpg" border="0">');
}