var width = window.innerWidth; if(width ==undefined) { var D= document.documentElement; if(D) width= D.clientWidth; } var bannerId = Math.ceil(Math.random() * 2); switch(bannerId) { case 1: document.write(""); break; case 2: document.write(""); break; case 3: break; }