﻿/**
* Allows display of link box.
* Copyright 2010 Softfornet Ltd.
*/

var NauBox_BaseUrl = 'http://community.adlandpro.com/';
var NauBox_ForumStub = 'NewsArchive/';
var NauBox_ImageBg = 'images/community/naubox_back.png';
var NauBox_Color = '#fff';

function NauBox_GetRefer(url) {
    if (typeof NauBox_Refer != 'undefined' && url.indexOf('refer=') == -1) {
        if (url.indexOf('?') == -1) {
            return url + "?refer=" + NauBox_Refer;
        }
        else {
            return url + "&refer=" + NauBox_Refer;
        }
    }
    else {
        return url;
    }
}

function NauBox_Link(url, name, style) {
    if (typeof style == 'undefined') {
        style = '';
    }
    var css = style + 'color:' + NauBox_Color + ';text-decoration:none;';
    var html = '<a style="' + css + '" href="' + NauBox_GetRefer(url) + '" target="_blank">&raquo; <span style="text-decoration:underline;">' + name + '</span></a>';
    return html;
}

function NauBox_ForumLink(id, name) {
    var css = 'width:33%;float:left;color:' + NauBox_Color + ';text-decoration:none;';
    var html = '<a style="' + css + '" href="' + NauBox_GetRefer(NauBox_BaseUrl + NauBox_ForumStub + id + '.aspx') + '" target="_blank">&raquo; <span style="text-decoration:underline;">' + name + '</span></a>';
    return html;
}

function NauBox_LoadLinks() {
    var html = '';
    html += NauBox_Link('http://www.adlandpro.com', 'classifieds', 'width:33%;float:left;');
    html += NauBox_Link('http://www.adlandpro.com/Advertisers/Advertising.aspx?TB=ad', 'advertisers', 'width:33%;float:left;');
    html += NauBox_Link('http://www.adlandpro.com/Affiliate/Affiliate.aspx', 'affiliates', 'width:33%;float:left;');
    html += NauBox_Link('http://community.adlandpro.com', 'business community', 'width:33%;float:left;');
    html += NauBox_Link('http://www.adlandpro.com/Tutorial/Info.aspx?TB=tu&s=', 'business tutorials', 'width:33%;float:left;');
    html += NauBox_Link(NauBox_BaseUrl + "brandmanagement.aspx", 'your OWN business!', 'width:33%;float:left;');
    return html;
}

function NauBox(parentId) {
    var parent = document.getElementById(parentId);
    if (parent) {
        var css = 'width:350px;';
        css += 'height:100px;';
        css += 'background-image:url(\'' + NauBox_BaseUrl + NauBox_ImageBg + '\');';

        var html = '<div style="' + css + '">';
        html += '<a href="' + NauBox_GetRefer(NauBox_BaseUrl) + '" style="width:350px;height:45px;display:block;" target="_blank"></a>';
        html += '<div style="padding:2px 10px 5px 10px;">';
        if (typeof NauBox_Url != 'undefined' && typeof NauBox_Name != 'undefined') {
            html += NauBox_Link(NauBox_Url, NauBox_Name);
        }
        else {
            html += NauBox_LoadLinks();
        }
        html += '</div>';
        html += '</div>';

        parent.innerHTML = html;
    }
}
function StartNauBox() {
    var nauBox = NauBox('NauBox');
}
var x = window.onload;
if (typeof (x) != 'function') { window.onload = StartNauBox; }
else { window.onload = function() { if (x) { x(); } StartNauBox(); }; }
document.write('<div id="NauBox" style="font-family:Arial,Helvetica,sans-serif;font-size:11px;"></div>');
