var N = 3;


var rn = NaN;

// get a random number and make it a string
while( isNaN( rn ) )
	rn = ( parseInt( Math.random() * N ) + 1 ) + "";
	
// if rn is "2", make it "02"
if( rn.length < 2 )
	rn = "0" + rn;

// write to screen
document.write( '<img src="images/first/' + rn + '.gif" width="531" height="186" alt=""><br>' );