I was going through a script from Videoegg which the user puts onto their own site(s) to display video ads. Here is the script:

var ve_publisher = "testPublisher";
var ve_site = "testSite";
var ve_area = "testArea";
var ve_width = 728;
var ve_height = 90;
document.write("<script src='http://core.videoegg.com/eap/html/js/init.js?" + Math.random() + "'><\/script>");
I'm wondering what exactly is going on in the script (I'm extremely new to JavaScript). From what I understand, the first 5 lines of code are setting up variables. Right? The document.write part is confusing me a bit. Is it calling an external javaScript file which uses the variables determined in the first 5 lines of the script?

Any help would be great, since I need to understand how to create a similar kind of script to allow my users to place the embed code (seperate from videegg) on their sites.

Thank you very much.