

// adlength: is the number of files (total) in the directory. starts with 0.htm ... lenght.htm
// pause is the amount of time the ad should wait.
// Expects length and pause variables to be defined by a PHP script at the source.
// get the iframe named: adframe then add. If this is greater than or equal to lenght
// then iframe named adframe is reset to 0.htm as its source.

function showads() {
 srcobj = document.getElementById("adframe").src;
// alert(srcobj);
 var srcarray = srcobj.split("/");
 srclength = srcarray.length;
 srclength = srclength - 1; 
 srcobj = srcarray [ srclength ];
// alert(srcobj);
 htmn = parseInt(srcobj);
// alert("htmn " + htmn);
// alert("adlength " + adlength);
 htmn = 1;
 if (htmn < adlength) {
    htmn = htmn + ".htm";
    document.getElementById("adframe").src = "ad/" + htmn;
 } else {
    htmn = "0.htm";
    document.getElementById("adframe").src = "ad/" + htmn;
    
 }
 setTimeout("showads()", adpause);

}
