// The result set is in the form of an array data structure, named zSr. 

function showOvertureListings(headerText, whatsThisText, whatsThisLink, whatsThisLinkType) {
    
    var ht   = (headerText != undefined && headerText.length > 0) ? headerText : "Ads by Overture";
    var wtt  = (whatsThisText != undefined && whatsThisText.length > 0) ? whatsThisText : "What's This?";
    var wtl  = (whatsThisLink != undefined && whatsThisLink.length > 0) ? whatsThisLink : "/tools/overtureAdHelp";
    var wtlt = (whatsThisLinkType != undefined && whatsThisLinkType.length > 0) ? whatsThisLinkType : "dialog";

    if (typeof (zSr) == 'undefined' || zSr.length <= 6)
        return;
    
    if (wtlt == "dialog") {
        document.write("<div id=\"overtureAd\" class=\"textAd\"><div class=\"textAdHeader\"><h3>" + ht + "</h3><div class=\"headerLink\"><a href=\"javascript:commonPopup('" + wtl + "', '340', '350')\">" + wtt + "</a></div></div><div class=\"textAdBody\">");
    } else {
        document.write("<div id=\"overtureAd\" class=\"textAd\"><div class=\"textAdHeader\"><h3>" + ht + "</h3><div class=\"headerLink\"><a href=\"" + wtl + "\" target=\"_blank\">" + wtt + "</a></div></div><div class=\"textAdBody\">");
    }
    
    var i=6;    // the array starting at position six
    
    while (i < zSr.length) {

        // the array contains ad elements in six pieces
        var descr    = zSr[i++];   // listing description
        var unused1  = zSr[i++];   // (ignore)
        var clickURL = zSr[i++];   // listing link
        var title    = zSr[i++];   // listing title
        var sitehost = zSr[i++];   // advertiser's domain name
        var unused2  = zSr[i++];   // (ignore)

        // render the ads
        document.write('<P>');
        document.write('<A class="title" TARGET="_new" HREF="' + clickURL + '">');
        document.write(title);
        document.write('</A><BR>');
        document.write('<A class="textAdDesc" TARGET="_new" HREF="' + clickURL + '">');
        document.write(descr);
        document.write('</A><BR>');
        document.write('<A TARGET="_new" HREF="' + clickURL + '">');
        document.write('(' + sitehost + ')');
        document.write('</A>');
        document.write('</P>');
    }
	document.write("</div></div>");
}
