document.write("<a href=\'"+ ads[adNumber].href +"\'\n");
Notice also the double quotes and single quotes have been reversed and the single quotes have been 'escaped' [that means that a \ has been put in front of each single quote so that the parser ignores it]. While some browsers/parsers can handle messy scripts others choke on it if everything isn't correct.
Also terminate the end of each line with a semicolon as in the example. Do this throughout your script and it should work fine. That is unless you have other errors.