//initialize at top of page
if (typeof adPTile == "undefined") var adPTile = 1;
if (typeof adDcopt == "undefined") var adDcopt = "ist"; //interstitial
if (typeof adSiteValue == "undefined") var adSiteValue = new String();
if (typeof adZoneValue == "undefined") var adZoneValue = new String();
if (typeof wlpArray == "undefined") var wlpArray = new Array();
if (typeof adKW == "undefined") var adKW = "";
if (typeof adSZ == "undefined") var adSZ = new String();
if (typeof adRandom == "undefined") var adRandom = Math.round(Math.random() * 10000000); //cache buster
wlpArray = window.location.pathname.toLowerCase().split("/");
if (typeof wlpArray[1] == "undefined") wlpArray[1] = "";
if (typeof wlpArray[2] == "undefined") wlpArray[2] = "";
adZoneValue = (wlpArray[1] == "" || wlpArray[1] == "/tss" || wlpArray[1] == "/index.tss") ? "home" : wlpArray[1];
if (wlpArray[2] != "" && wlpArray[2].indexOf(".tss") == -1) adZoneValue += "_" + wlpArray[2];
adSiteValue = ( window.location.href.toLowerCase().indexOf("theserverside.net") == -1 ) ? "atssc" : "atssn"  ;

function renderDartAd(/* ad count   */  _textAdNumber, 
                      /* ad width   */  _adWidth, 
                      /* ad height  */  _adHeight, 
                      /* iHeight    */  _iHeight,
                      /* bgcolor    */  _adBgColor,
                      /* showSpacer */  _showSpacer ,
                      /* count start*/  _countStart ){

        // defaults 
        if ( _countStart == "" || _countStart  == undefined ) _countStart = 1;                      
        if ( _showSpacer == undefined ) _showSpacer = true;
        if ( _adBgColor == "" || _adBgColor == undefined ) _adBgColor = "FFFFFF";

        for ( i = _countStart ; i < _textAdNumber+_countStart; i++) {
          baseAdURLStr =  adSiteValue + "/" + adZoneValue + ";bkg=" + _adBgColor + ";kw=" + adKW + ";dcopt=" + adDcopt + ";pos=" + (i) + ";sz=" + _adWidth + "x" + _adHeight + ";ptile=" + i + ";ord=" + adRandom + "?'";
          adString = "<iframe src='http://ad.doubleclick.net/adi/" + baseAdURLStr +"' width='" + _adWidth + "' height='" + _iHeight + "' border='0' frameborder='0' marginheight='0' marginwidth='0' scrolling='no'>\n";
          adString += "<a href='http://ad.doubleclick.net/jump/" + baseAdURLStr+ "'>\n";
          adString += "<img src='http://ad.doubleclick.net/ad/" + baseAdURLStr +"' width='" + _adWidth + "' height='" + _iHeight + "' border='0'></a>\n";
          adString += "</iframe>";
          if ( _showSpacer )
            adString += "<br><img src='/tt/images/spacer.gif' height='5' width='1' border='0'><br>";
          document.write(adString);

          //info debugging
          if (window.location.search.indexOf("adIframe=on") != -1) window.alert(adString);
          if (window.location.search.indexOf("adString=on") != -1) 
              window.alert("site=" + adSiteValue + " zone=" + adZoneValue + "\n " + " bkg=" +
                            _adBgColor + " kw=" + adKW + " dcopt=" + adDcopt + " pos=" + (i-1) +
                            " sz=" + _adWidth + "x" + _adHeight + " ptile=" + i + " ord=" + adRandom + "?");
          //continue
          adDcopt = "";
        }
}