﻿function S(pA, pT) {
    if (dm_set_topic == '') {
        for (i = 0; i < pA.length; i++) {
            if (Strings.indexOf(pA[i]) > 0) {
                dm_set_topic = pT;
                return;
            }
        }
    }
}
function C(pI) {
    if (pI == undefined)
        return ('');
    else
        return (pI);
}

var Q = '';
var W = 120;
var H = 300;
var W = window;

if (C(W.dm_size) == '')
    dm_size = '300x250';
if (C(W.dm_affiliate) == '')
    dm_affiliate = '';
if (C(W.dm_color_border) == '')
    dm_color_border = '';
if (C(W.dm_color_title) == '')
    dm_color_title = '';
if (C(W.dm_color_links) == '')
    dm_color_links = '';
if (C(W.dm_color_background) == '')
    dm_color_background = '';
if (C(W.dm_set_categorylist) == '')
    dm_set_categorylist = '';
if (C(W.dm_set_categoryexcludelist) == '')
    dm_set_categoryexcludelist = '';
if (C(W.dm_set_autoregion) == '')
    dm_set_autoregion = '';
if (C(W.dm_set_regionlist) == '')
    dm_set_regionlist = '';
if (C(W.dm_set_regionexcludelist) == '')
    dm_set_regionexcludelist = '';
if (C(W.dm_set_topic) == '')
    dm_set_topic = '';
if (C(W.dm_set_autotopic) == '')
    dm_set_autotopic = '';
if (C(W.dm_open_in_new_window) == '')
    dm_open_in_new_window = '';
if (C(W.dm_link_url) == '')
    dm_link_url = '';

H = dm_size.substring(dm_size.indexOf("x") + 1);
W = dm_size.substring(0, dm_size.indexOf("x"));

if (dm_set_autotopic == "yes") {
    var Tags;
    var Strings = '';
    var i;

    Strings = document.title;

    if (document.getElementsByTagName) {
        Tags = document.getElementsByTagName('meta');
        for (i = 0; i < Tags.length; i++) {
            if (Tags[i].name.toLowerCase() == 'keywords' || Tags[i].name.toLowerCase() == 'description')
                Strings += " " + Tags[i].content;
        }

        Tags = document.getElementsByTagName('h1');
        if (Tags != null && Tags.length > 0)
                Strings += " " + Tags[0].innerHTML;
    }
        
    Strings = Strings.toLowerCase();
    
    Technology = new Array("technology", "software", "computer", "apple", "microsoft", "internet", "ipod", "multimedia", "network", "hdtv");
    Finance = new Array("finance", "stocks", "bonds", "insurance", "investment", "investing", "accounting", "banking", "nasdaq", "nyse", "financial", "money", "banker");
    Business = new Array("marketing", "staffing", "hiring", "insurance", "legal", "lawyer", "business", "advertising");
    Consumer = new Array("golf", "painting", "spas", "jewelery");
    Travel = new Array("travel", "airfares", "delta", "airlines", "planes", "air charter");
    Automotive = new Array("cars", "car", "car parts", "ford", "mazda", "nissan", "bmw");
    Construction = new Array("building", "air conditioning", "gutting", "contractor");
    Education = new Array("education", "college", "degree");
    Health = new Array("travel", "airfares", "delta", "airlines", "planes", "air charter");
    Legal = new Array("lawyers", "congress", "courts");
    RealEstate = new Array("real estate", "mortgage", "renting", "housing");
    Weddings = new Array("wedding", "weddings", "marriage", "ceremony");

      
    S(Technology, "technology");
    S(Finance, "finance");
    S(Business, "business");
    S(Consumer, "consumer");
    S(Travel, "travel");
    S(Automotive, "automotive");
    S(Construction, "construction");
    S(Education, "education");
    S(Health, "health");
    S(Legal, "legal");
    S(RealEstate, "real estate");
    S(Weddings, "weddings");
}

if (dm_affiliate == '202')
    dm_set_autoregion = 'yes';

Q += "dm_affiliate=" + dm_affiliate;
Q += "&dm_size=" + dm_size;
Q += "&dm_color_border=" + dm_color_border;
Q += "&dm_color_title=" + dm_color_title;
Q += "&dm_color_links=" + dm_color_links;
Q += "&dm_color_background=" + dm_color_background;
Q += "&dm_set_categorylist=" + dm_set_categorylist;
Q += "&dm_set_categoryexcludelist=" + dm_set_categoryexcludelist;
Q += "&dm_set_autoregion=" + dm_set_autoregion;
Q += "&dm_set_regionlist=" + dm_set_regionlist;
Q += "&dm_set_regionexcludelist=" + dm_set_regionexcludelist;
Q += "&dm_set_topic=" + dm_set_topic;
Q += "&dm_open_in_new_window=" + dm_open_in_new_window;
Q += "&dm_link_url=" + dm_link_url;

document.write("<iframe src=\"http://aserve.directorym.com/ModuleG.aspx?" + Q + "\" width=\"" + W + "\" height=\"" + H + "\"" +
    " frameborder=\"no\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\"></iframe>");