SiteItem = function(name, title, url, icon, links, navIcon) {
    this.icon = icon;
    this.navIcon = navIcon;
    this.links = links;
    this.name = name;
    this.title = title;
    this.url = url;
}
LinkItem = function(text, title, url) {
    this.text = text;
    this.title = title;
    this.url = url;
}
Icon = function(url, altText) {
    this.url = url;
    this.altText = altText;
}
sensisBarWriter = {
//    baseUrl: "http://nav.sensis.com.au/",
     baseUrl: "/affiliates/gostay/img/",
//    baseUrl: "http://bestlahome.aot.com.au/~danw/gostay/htdocs/images",
    version: "snn-02d",
    aboutUsList: null,
    bigpondLinkId: "snb-bpl",
    bigpondSitesId: "snb-bps",
    bigpondSitesLinkId: "snb-bpsl",
    bigpondLinkList: null,
    bigpondList: null,
    navTarget: null,
    navBarId: "snb",
    hackFrameId: "snb-hf",
    hostSite: null,
    hostReferrer: null,
    hostPartnerId: null,
    isIE50: (navigator.appVersion.indexOf("MSIE 5.0") != -1),
    isIE: (navigator.appVersion.indexOf("MSIE") != -1),
    mediasmartFlashId: "flashad",
    navList: null,
    navLinksId: "snb-siteLinks",
    ourSitesId: "snb-os",
    ourSitesLinkId: "snb-osl",
    ourSitesList: null,
    siteLinkClass: "snb-slc",
    displaySearchForm: true,
    bigpondLink: function() {
        return document.getElementById(sensisBarWriter.bigpondLinkId);
    },
    bigpondLinkHoverOn: function(e) {
        //get the link
        if (e) {
            link = sensisBarWriter.getTargetElement(e, "A");
        } else {
            link = sensisBarWriter.bigpondLink();
        }
        if (link) {
            navImage = link.getElementsByTagName("IMG")[0];
            navImage.src = sensisBarWriter.baseUrl + "n_bp_02.gif";
        }
    },
    bigpondLinkHoverOff: function(e) {
        //get the link
        if (e) {
            link = sensisBarWriter.getTargetElement(e, "A");
        } else {
            link = sensisBarWriter.bigpondLink();
        }
        if (link) {
            navImage = link.getElementsByTagName("IMG")[0];
            navImage.src = sensisBarWriter.baseUrl + "n_bp.gif";
        }
    },
    bigpondSites: function() {
        return document.getElementById(sensisBarWriter.bigpondSitesId);
    },
    bigpondSitesLink: function() {
        return document.getElementById(sensisBarWriter.bigpondSitesLinkId);
    },
    bigpondSitesHide: function(element, mirror) {
        element.style.display = "none";
        mirror.style.display = "none";
        navImage = sensisBarWriter.bigpondSitesLink().getElementsByTagName("IMG")[0];
        navImage.src = sensisBarWriter.baseUrl + "n_bpa.gif";
    },
    bigpondSitesHoverOn: function(e) {
        if (sensisBarWriter.bigpondSites().style.display == "none") {
            link = sensisBarWriter.getTargetElement(e, "A");
            if (link) {
                navImage = link.getElementsByTagName("IMG")[0];
                navImage.src = sensisBarWriter.baseUrl + "n_bpa_02.gif";
                sensisBarWriter.bigpondLinkHoverOn();
            }
        }
    },
    bigpondSitesHoverOff: function(e) {
        if (sensisBarWriter.bigpondSites().style.display == "none") {
            //get the link
            if (e) {
                link = sensisBarWriter.getTargetElement(e, "A");
            } else {
                link = sensisBarWriter.bigpondSitesLink();
            }
            if (link) {
                navImage = link.getElementsByTagName("IMG")[0];
                navImage.src = sensisBarWriter.baseUrl + "n_bpa.gif";
                sensisBarWriter.bigpondLinkHoverOff();
            }
        }
    },
    bigpondSitesClick: function(e) {
        //get the link
        if (e) {
            link = sensisBarWriter.getTargetElement(e, "A");
        } else {
            link = sensisBarWriter.bigpondSitesLink();
        }
        //show or hide the window
        var hideSelectFrame = document.getElementById(sensisBarWriter.hackFrameId);
        //turn off any remaining our sites Effects
        sensisBarWriter.ourSitesHide(sensisBarWriter.ourSites(), hideSelectFrame);
        bigpondSites = sensisBarWriter.bigpondSites()
        if (bigpondSites.style.display == "none") {
            //position on the x-axis is the X pos - the amount of pixels back to the left portion of the window
            var xOffSet = sensisBarWriter.findPosX(link) - 421;
            bigpondSites.style.top = "24px";
            bigpondSites.style.left = xOffSet + "px";
            bigpondSites.style.display = "block";
            hideSelectFrame.style.top = "30px";
            hideSelectFrame.style.left = (xOffSet + 1) + "px";
            hideSelectFrame.style.display = "block";
            hideSelectFrame.style.width = "573px";
            hideSelectFrame.style.height = "269px";
            //stop hover effects
            navImage = link.getElementsByTagName("IMG")[0];
            navImage.src = sensisBarWriter.baseUrl + "n_bpa_03.gif";
            sensisBarWriter.bigpondLinkHoverOff();
            sensisBarWriter.ourSitesHoverOff();
            //toggle flash presentation
            sensisBarWriter.toggleElement(document.getElementById(sensisBarWriter.mediasmartFlashId), false);
        } else {
            sensisBarWriter.bigpondSitesHide(sensisBarWriter.bigpondSites(), hideSelectFrame);
            //toggle flash presentation
            sensisBarWriter.toggleElement(document.getElementById(sensisBarWriter.mediasmartFlashId), true);
        }
    },
    toggleElement: function(element, makeVisible) {
        if (!element) {
            return
        }
        if (makeVisible) {
            element.style.visibility = "visible";
        } else {
            element.style.visibility = "hidden";
        }
    },
    generateBigpond: function() {
        var html = "<div id=\"" + this.bigpondSitesId + "\" style=\"position:absolute;display:none;top:1px;left:1px;z-index:99;\"><div style=\"width:574px;position:relative;padding:11px 0 0 0;\">";
        //write out border placeholders
        html += "<div style=\"background:url('" + this.baseUrl + "b_top.gif') top no-repeat;position:absolute;top:0;height:11px;width:100%\"></div>";
        html += "<div style=\"background:url('" + this.baseUrl + "b_bor_l.gif') bottom repeat-x;position:absolute;bottom:0;height:257px;width:10px;\"></div>";
        html += "<div style=\"background:url('" + this.baseUrl + "b_bor_r.gif') bottom repeat-x;position:absolute;bottom:0;right:0;height:257px;width:10px;\"></div>";
        html += "<div style=\"background:url('" + this.baseUrl + "b_bor_t.gif') #FFF repeat-y;\">";
        html += "<a href=\"#\" style=\"float:right;margin:0 10px 0 0\" onclick=\"sensisBarWriter.bigpondSitesClick();return false;\"><img style=\"border:0px;\" src=\"" + this.baseUrl + "m_close.gif\" alt=\"close\"/></a>";
        html += "<h1 style=\"font-weight:normal;color:#9F9E9C;margin:0 50px 0 0;padding:0 0 0 10px;\"><img style=\"border:0px;\" src=\"" + this.baseUrl + "b_bp.gif\" alt=\"Bigpond logo\" /></h1>";

        //write out the our bigpond list
        html += "<ul style=\"list-style:none;margin:22px 0 0 0;padding:0 10px;background:#FFF;\">";

        //set up styles for the elements in the li
        linkTextColor = "color:#9F9E9C;";
        //write out the list of links
        for(i = 0; i < this.bigpondList.length; i++) {
            site = this.bigpondList[i];
            if (i % 2 == 1) {
                textWidth = "width:255px;";
                liStyle = "width:288px;float:right;";
            } else {
                textWidth = "width:226px;";
                liStyle = "width:259px;clear:left;float:left;";
            }
            html += this.generateSiteItemLi(site, liStyle, textWidth, linkTextColor);
        }
        html += "</ul>";
        html += this.generateClearer() + "</div>";

        html += "<div style=\"background:#FFF url('" + this.baseUrl + "m_tile.gif') bottom repeat-x;height:80px;margin:0 10px;\">";
        //write out the secondary links
        html += "<ul style=\"list-style:none;margin:0;padding:0;height:80px;\">";
        for (i = 0; i < this.bigpondLinkList.length; i++) {
            link = this.bigpondLinkList[i];
            html += "<li style=\"float:left;width:180px;font-size:10px;margin:0;padding:20px 0 0 0;\"><a style=\"color:#027AAF;\" href=\"" + this.addReferrer(link.url) + "\" title=\"" + link.title + "\">" + link.text + "</a></li>";
        }
        html += "</ul>" + this.generateClearer() + "</div></div></div>";
        return html;

    },
    generateClearer: function() {
        return "<div style=\"clear:both;height:1%;line-height:0px;\"></div>"
    },
    generateNav: function() {
        var html = "<div style=\"min-height:24px;background:url('" + this.baseUrl + "n_tile.gif') repeat;\">";
        html += "<div style=\"margin:0 0 0 2px;padding:0;height:100%;\">"
        html += "<div id=\"" + this.navLinksId +"\">";
        //set default padding for the first link as all others must have left margin
        linkStyle = "margin:0;";
        sitesWritten = 0;
        //loop through the sites list and write out the sites
        for (i = 0; i < this.navList.length; i++) {
            site = this.navList[i];
            //only add the extra 9px of margin for items after the first
            if (sitesWritten > 0) {
                linkStyle = "margin:0 0 0 3px;";
            }
            //check that it isn't the host site
            if (site != this.hostSite) {
                html += "<a href=\"" + this.addReferrer(site.url, 1) + "\" style=\"background:inherit;font-size:10px;color:#344667;text-decoration:none;float:left;padding:0 5px;" + linkStyle + "\" title=\"" + site.title + "\">";
                html += "<img src=\"" + site.navIcon.url + "\" style=\"border:0;vertical-align:middle;margin:0 5px 0 0;\" alt=\"\" title=\"" + site.title + "\"><span style=\"line-height:24px;vertical-align:middle;\">" + site.name + "</span></a>"
                //increment the count written
                sitesWritten++;
            }
            //exit if 4 links have been written
            if (sitesWritten == 4) {
                break;
            }
        }
        html += "</div>";
        html += "<a href=\"#\" id=\"" + this.ourSitesLinkId +"\" style=\"font-size:10px;color:#344667;text-decoration:none;margin:0 3px 0 3px;padding:0;display:block;float:left;background:url('" + this.baseUrl + "n_ms.gif');height:24px;width:93px;\" onclick=\"return false;\" title=\"Show all Sensis's sites\">";
        html += "<img src=\"" + this.baseUrl + "n_tile.gif\" style=\"border:0;vertical-align:middle;margin:0 8px 0 0;\" alt=\"\" /><span style=\"line-height:24px;vertical-align:middle;\">more sites</span>";
        html += "</a>";
        html += "<a href=\"" + this.addReferrer("http://www.bigpond.com.au") + "\" id=\"" + this.bigpondLinkId + "\" style=\"display:block;float:left;width:63px;\" title=\"Go to Bigpond\">";
        html += "<img src=\"" + this.baseUrl + "n_bp.gif\" style=\"border:0;\" alt=\"\" title=\"Go to Bigpond\" />";
        html += "</a>";
        html += "<a href=\"#\" id=\"" + this.bigpondSitesLinkId +"\" style=\"display:block;float:left;width:30px;\" onclick=\"return false;\" title=\"Show Bigpond channels and links\">";
        html += "<img src=\"" + this.baseUrl + "n_bpa.gif\" style=\"border:0;\" alt=\"\" title=\"Show Bigpond channels and links\" />";
        html += "</a>";
        html += "</div>";

        if (this.displaySearchForm) {
            html += "<form style=\"position:absolute;left:670px;top:0;margin:0;padding:0;font-size:10px;width:176px;\" action=\"http://www.sensis.com.au/search.do\">";
            html += "<fieldset style=\"border:0;margin:0;padding:0;\"><legend style=\"display:none;\">Perform a search on sensis.com.au</legend>";
            html += "<input type=\"hidden\" name=\"partnerid\" value=\"" + this.hostPartnerId + "\" />";
            html += "<input type=\"hidden\" name=\"searchIndex\" value=\"australia\" />";
            html += "<label for=\"sensisSearchInput\" style=\"color:#329800\">web search</label>";
            html += "<input id=\"sensisSearchInput\" style=\"margin:0 3px;vertical-align:middle;width:80px;\" maxlength=\"100\" type=\"text\" onfocus=\"this.select();\" name=\"find\" />";
            html += "<input type=\"image\" src=\"" + this.baseUrl + "n_go.gif\" style=\"vertical-align:middle;margin:0 0 0 0;\" value=\"Go\" title=\"Search the web using Sensis.com.au\" />";
            html += "</form>";
        }
        html += "</div>";

        return html;
    },
    generateOurSites: function() {
        var html = "<div id=\"" + this.ourSitesId + "\" style=\"position:absolute;display:none;top:1px;left:1px;z-index:99;\"><div style=\"width:626px;position:relative;padding:11px 0 0 0;\">";
        //write out border placeholders
        html += "<div style=\"background:url('" + this.baseUrl + "m_top.gif') top no-repeat;position:absolute;top:0;height:11px;width:100%\"></div>";
        html += "<div style=\"background:url('" + this.baseUrl + "m_bor_l.gif') bottom repeat-x;position:absolute;bottom:0;height:374px;width:10px;\"></div>";
        html += "<div style=\"background:url('" + this.baseUrl + "m_bor_r.gif') bottom repeat-x;position:absolute;bottom:0;right:0;height:374px;width:10px;\"></div>";
        html += "<div style=\"background:url('" + this.baseUrl + "m_bor_t.gif') #FFF repeat-y;\">";
        html += "<a href=\"#\" style=\"position:absolute;right:10px;top:11px;\" onclick=\"sensisBarWriter.ourSitesClick();return false;\"><img style=\"border:0px;\" src=\"" + this.baseUrl + "m_close.gif\" alt=\"close\"></a>";
        html += "<h1 style=\"position:relative;font-size:24px;font-weight:normal;color:#9F9E9C;margin:0 50px 0 0;padding:0 0 0 10px;\">Our Sites</h1>";
        //write out the our sites list
        html += "<ul style=\"list-style:none;margin:18px 0 0 0;padding:0 10px\">";

        //set up styles for the elements in the li
        textWidth = "width:268px;";
        linkTextColor = "color:#9F9E9C;";
        //write out the list of links
        for(i = 0; i < this.ourSitesList.length; i++) {
            site = this.ourSitesList[i];
            if (i % 2 == 1) {
                liStyle = "width:300px;float:right;";
            } else {
                liStyle = "width:300px;clear:left;float:left;";
            }
            html += this.generateSiteItemLi(site, liStyle, textWidth, linkTextColor);
        }
        html += "</ul>";
        html += this.generateClearer() + "</div>";
        html += "<div style=\"background:#FFF url('" + this.baseUrl + "m_tile.gif') bottom repeat-x;height:80px;margin:0 10px;\">";
        //write out the About us links
        html += "<ul style=\"list-style:none;margin:0;padding:0;\">";

        //set up styles for the elements in the li
        textWidth = "width:268px;";
        linkTextColor = "color:#81807E;";
        //write out the list of links
        for(i = 0; i < this.aboutUsList.length; i++) {
            site = this.aboutUsList[i];
            if (i % 2 == 1) {
                liStyle = "width:300px;margin:23px 0 0 0;float:right;";
            } else {
                liStyle = "width:300px;margin:23px 0 0 0;clear:left;float:left;";
            }
            html += this.generateSiteItemLi(site, liStyle, textWidth, linkTextColor);
        }
        html += "</ul>" + this.generateClearer() + "</div></div></div>";
        return html;
    },
    generateSiteItemLi: function(site, liStyleAdds, textWidth, linkTextColor) {
        var html = "<li style=\"margin:0;padding:0 0 17px 0;overflow:auto;" + liStyleAdds + "\">";
        //icon link
        html += "<a href=\"" + this.addReferrer(site.url, 1) + "\" title=\"" + site.title + "\">";
        html += "<img style=\"float:left;margin:0 6px 0 0;padding:0;border:0;\" src=\"" + site.icon.url + "\" alt=\"" + site.icon.altText + "\" title=\"" + site.title + "\"/></a>";
        //heading
        html += "<a href=\"" + this.addReferrer(site.url, 1) + "\" class=\"" + this.siteLinkClass + "\" style=\"font-size:11px;color:#344667;text-decoration:none;padding:0;margin:0;float:left;" + textWidth + "\" title=\"" + site.title + "\">" + site.name + "</a>";
        html += "<p style=\"font-size:9px;padding:0;margin:0;clear:none;float:left;" + textWidth + linkTextColor + "\">";
        //write out links
        for (j = 0; j < site.links.length; j++) {
            link = site.links[j];
            html += "<a style=\"text-decoration:underline;" + linkTextColor + "\" href=\"" + this.addReferrer(link.url, j + 2) + "\" title=\"" + link.title + "\">" + link.text + "</a>";
            if (j != site.links.length - 1) {
                html += ", ";
            }
        }
        html += "</p></li>";
        return html;
    },
    navLinkHoverOn: function(e) {
        link = sensisBarWriter.getTargetElement(e, "A");
        if (link) {
            link.style.background = "url('" + sensisBarWriter.baseUrl + "n_tile_02.gif')";
            link.style.height = "24px";
        }
    },
    navLinkHoverOff: function(e) {
        link = sensisBarWriter.getTargetElement(e, "A");
        if (link) {
            link.style.background = "transparent";
        }
    },
    siteLinkHoverOn: function(e) {
        link = sensisBarWriter.getTargetElement(e, "A");
        if (link) {
            link.style.textDecoration = "underline";
        }
    },
    siteLinkHoverOff: function(e) {
        link = sensisBarWriter.getTargetElement(e, "A");
        if (link) {
            link.style.textDecoration = "none";
        }
    },
    ourSites: function() {
        return document.getElementById(sensisBarWriter.ourSitesId);
    },
    ourSitesLink: function() {
        return document.getElementById(sensisBarWriter.ourSitesLinkId);
    },
    getTargetElement: function(e, nodeName) {
        var link;
        if (window.event && window.event.srcElement) {
            link = window.event.srcElement;
        }
        if (e && e.target) {
            // defeats Safari bug
            if (e.target.nodeType == 3) {
                link = e.target.parentNode;
            } else {
                link = e.target;
            }
        }
        while (link.nodeName != nodeName) {
            link = link.parentNode;
        }
        return link;
    },
    ourSitesHide: function(element, mirror) {
        element.style.display = "none";
        mirror.style.display = "none";
        sensisBarWriter.ourSitesLink().style.background = "url('" + sensisBarWriter.baseUrl + "n_ms.gif')";
    },
    ourSitesHoverOn: function(e) {
        if (sensisBarWriter.ourSites().style.display == "none") {
            link = sensisBarWriter.getTargetElement(e, "A");
            if (link) {
                link.style.background = "url('" + sensisBarWriter.baseUrl + "n_ms_02.gif')";
            }
        }
    },
    ourSitesHoverOff: function(e) {
        if (sensisBarWriter.ourSites().style.display == "none") {
            //get the link
            if (e) {
                link = sensisBarWriter.getTargetElement(e, "A");
            } else {
                link = sensisBarWriter.ourSitesLink();
            }
            if (link) {
                link.style.background = "url('" + sensisBarWriter.baseUrl + "n_ms.gif')";
            }
        }
    },
    ourSitesClick: function(e) {
        //get the link
        if (e) {
            link = sensisBarWriter.getTargetElement(e, "A");
        } else {
            link = sensisBarWriter.ourSitesLink();
        }
        //show or hide the window
        ourSites = sensisBarWriter.ourSites();
        var hideSelectFrame = document.getElementById(sensisBarWriter.hackFrameId);
        //turn off any remaining bigpond site Effects
        sensisBarWriter.bigpondSitesHide(sensisBarWriter.bigpondSites(), hideSelectFrame);

        if (ourSites.style.display == "none") {
            //position on the x-axis is the X pos - the amount of pixels back to the left portion of the window
            var xOffSet = sensisBarWriter.findPosX(link) - 309;
            ourSites.style.top = "23px";
            ourSites.style.left = xOffSet + "px";
            ourSites.style.display = "block";
            hideSelectFrame.style.top = "29px";
            hideSelectFrame.style.left = (xOffSet + 1) + "px";
            hideSelectFrame.style.display = "block";
            hideSelectFrame.style.width = "625px";
            hideSelectFrame.style.height = "386px";
            link.style.background = "url('" + sensisBarWriter.baseUrl + "m_ms_03.gif')";
            //toggle flash presentation
            sensisBarWriter.toggleElement(document.getElementById(sensisBarWriter.mediasmartFlashId), false);
        } else {
            sensisBarWriter.ourSitesHide(sensisBarWriter.ourSites(), hideSelectFrame);
            //toggle flash presentation
            sensisBarWriter.toggleElement(document.getElementById(sensisBarWriter.mediasmartFlashId), true);
        }
    },
    addReferrer: function(url, counter) {
        processedURL = url;
        if (url.indexOf('?') == -1) {
            url += "?"
        } else {
            url += "&amp;"
        }
        url += "ref=" + this.hostReferrer + "navex";
        if (counter) {
            url += counter;
        }
        return url;
    },
    addEvent: function(obj, evType, fn, useCapture) {
        if (useCapture == null)
            useCapture = true;

        if (obj.addEventListener) {
            obj.addEventListener(evType, fn, useCapture);
            return true;
        } else if (obj.attachEvent) {
            return obj.attachEvent("on" + evType, fn);
        } else {
            obj['on' + eventType] = fn;
        }
    },
    findPosX: function (obj) {
        var curleft = 0;
        if (obj.offsetParent) {
            while (obj.offsetParent && obj.id != this.navBarId) {
                curleft += obj.offsetLeft
                obj = obj.offsetParent;
            }
        }
        else if (obj.x) {
            curleft += obj.x;
        }
        return curleft;
    },
    writeNav: function() {
        //exit if IE 5.0 not enough time to implement
        if(this.isIE50) {
            return;
        }
        //create the wrapping container
        var output = "<div id=\"" + sensisBarWriter.navBarId + "\" style=\"font-family:Verdana;position:relative;z-index:99;height:24px;text-align:left;\">";
        output += sensisBarWriter.generateNav();
        output += "<iframe id=\"" + sensisBarWriter.hackFrameId + "\" style=\"border:0;position:absolute;display:none;width:0;height:0;top:0;left:2px;z-index:99;\" src=\"javascript:false\"></iframe>";
        //write out the containers for Our Sites and Bigpond popouts
        output += sensisBarWriter.generateOurSites() + sensisBarWriter.generateBigpond();
        output += "</div>";
        if (sensisBarWriter.navTarget) {
            var destination = document.getElementById(sensisBarWriter.navTarget);
            if (destination == null)
            {
                alert("Could not locate navTarget for bar insertion");
                return;
            }
            destination.innerHTML = output;
        } else {
            document.write(output);
        }

        //add events to the links etc
        sensisBarWriter.initBehaviour();
    },
    init: function(hostSiteString, navTarget) {
        // set the navTarget if it is passed in
        if (navTarget) {
            this.navTarget = navTarget;
        }
        //init CitySearch items
        csIcon = new Icon(this.baseUrl + "m_cs.gif", "");
        csNavIcon = new Icon(this.baseUrl + "n_cs.gif", "");
        csLinks = [new LinkItem("Sydney", "View Sydney city information", "http://sydney.citysearch.com.au/"),
                new LinkItem("Melbourne", "View Melbourne city information", "http://melbourne.citysearch.com.au/"),
                new LinkItem("Perth", "View Perth city information", "http://www.perth.citysearch.com.au/"),
                new LinkItem("Brisbane", "View Brisbane city information", "http://brisbane.citysearch.com.au/")];
        csSite = new SiteItem("CitySearch", "Go to CitySearch home", "http://www.citysearch.com.au/", csIcon, csLinks, csNavIcon);
        //init GoStay items
        gsIcon = new Icon(this.baseUrl + "m_gs.gif", "");
        gsNavIcon = new Icon(this.baseUrl + "n_gs.gif", "");
        gsLinks = [new LinkItem("Find accommodation", "Find accommodation", "http://www.gostay.com.au/"),
                new LinkItem("Sign up for newsletter", "Sign up to GoStay newsletter", "http://www.gostay.com.au/subscribe.php")];
        gsSite = new SiteItem("GoStay", "Go to GoStay", "http://www.gostay.com.au/", gsIcon, gsLinks, gsNavIcon);
        //init Invizage items
        inIcon = new Icon(this.baseUrl + "m_in.gif", "");
        inLinks = [new LinkItem("Home", "View homepage", "http://www.invizage.com.au/"),
                new LinkItem("Buy IT", "Buy IT products", "http://www.invizage.com.au/buyit/products/buyit.asp"),
                new LinkItem("Services", "View our services", "http://www.invizage.com.au/services/services.asp")];
        inSite = new SiteItem("Invizage", "Go to Invizage", "http://www.invizage.com.au/", inIcon, inLinks);
        //init Just Listed items
        jlIcon = new Icon(this.baseUrl + "m_jl.gif", "");
        jlNavIcon = new Icon(this.baseUrl + "n_jl.gif", "");
        jlLinks = [new LinkItem("Buy, Rent or Commercial", "Search properties to buy, rent or for commercial use", "http://www.justlisted.com.au/")];
        jlSite = new SiteItem("Just Listed", "Go to Just Listed", "http://www.justlisted.com.au/", jlIcon, jlLinks, jlNavIcon);
        //init LinkMe items
        lmIcon = new Icon(this.baseUrl + "m_lm.gif", "");
        lmNavIcon = new Icon(this.baseUrl + "n_lm.gif", "");
        lmLinks = [new LinkItem("Find a job", "Search for a job", "https://www.linkme.com.au/"),
                new LinkItem("Find staff", "Search for staff", "https://www.linkme.com.au/")];
        lmSite = new SiteItem("LinkMe", "Go to LinkMe", "https://www.linkme.com.au/", lmIcon, lmLinks, lmNavIcon);
        //init Sensis corp items
        scIcon = new Icon(this.baseUrl + "m_s.gif", "");
        scLinks = [new LinkItem("Inside Sensis", "Find out more about what we do", "http://www.about.sensis.com.au/inside/"),
                new LinkItem("Products &amp; solutions", "View Sensis product and solutions", "http://www.about.sensis.com.au/products/"),
                new LinkItem("Customer centre", "View Sensis customer centre", "http://www.about.sensis.com.au/customer/")];
        scSite = new SiteItem("Sensis Corporate", "Go to corporate Sensis site", "http://www.about.sensis.com.au/", scIcon, scLinks);
        //init Sensis.com.au items
        ssIcon = new Icon(this.baseUrl + "m_se.gif", "");
        ssLinks = [new LinkItem("Search all sources", "Search all sources", "http://www.sensis.com.au/siteEntry.do"),
                new LinkItem("Advanced search", "Do an advanced search", "http://www.sensis.com.au/search_advanced.do?")];
        ssSite = new SiteItem("Sensis.com.au", "Go to Sensis.com.au", "http://www.sensis.com.au/siteEntry.do", ssIcon, ssLinks);
        //init Telstra items
        teIcon = new Icon(this.baseUrl + "m_t.gif", "");
        teLinks = [new LinkItem("Home &amp; family", "View home and family information", "http://www.telstra.com.au/services/homefamily.htm?tR=1"),
                new LinkItem("Business", "View business information", "http://www.telstrabusiness.com/TelstraTBG?tR=4"),
                new LinkItem("Shop online", "Go to online shop", "http://shop.telstra.com/webapp/wcs/stores/servlet/TopCategoriesDisplay?storeId=10001&catalogId=11651"),
                new LinkItem("My Account", "View your account details", "https://telstra.com/myaccount/index.jsp?tR=1")];
        teSite = new SiteItem("Telstra", "Go to Telstra", "http://www.telstra.com.au", teIcon, teLinks);
        //init Trading post items
        tpIcon = new Icon(this.baseUrl + "m_tp.gif", "");
        tpNavIcon = new Icon(this.baseUrl + "n_tp.gif", "");
        tpLinks = [new LinkItem("Cars", "Go to the automotive section", "http://www.autotrader.com.au/search.asp?TPGSite=1&State=nat"),
                new LinkItem("Home &amp; family", "Go to the household and family section", "http://www.tradingpost.com.au/search.asp?SectionID=%232"),
                new LinkItem("Entertainment &amp; electronics", "Go to the entertainment and electronics section", "http://www.tradingpost.com.au/search.asp?SectionID=%234"),
                new LinkItem("more...", "Go to other sections on Trading Post", "http://www.tradingpost.com.au/default.asp")];
        tpSite = new SiteItem("Trading Post", "Go to Trading Post", "http://www.tradingpost.com.au", tpIcon, tpLinks, tpNavIcon);
        //init Universal Publishers items
        upIcon = new Icon(this.baseUrl + "m_up.gif", "");
        upLinks = [new LinkItem("UBD", "Go to UBD site", "http://www.ubd-online.com/"),
                new LinkItem("Gregory’s", "Go to Gregory's site", "http://www.gregorys-online.com/"),
                new LinkItem("more...", "Go to other Universal Publishers sites", "http://www.universalpublishers.com.au/")];
        upSite = new SiteItem("Universal Publishers", "Go to Universal Publishers", "http://www.universalpublishers.com.au/", upIcon, upLinks);
        //init Whereis items
        wiIcon = new Icon(this.baseUrl + "m_wi.gif", "");
        wiNavIcon = new Icon(this.baseUrl + "n_wi.gif", "");
        wiLinks = [new LinkItem("Get a map", "Get a map", "http://www.whereis.com/whereis/map.do"),
                new LinkItem("Get directions", "Get directions", "http://www.whereis.com/whereis/directions.do")];
        wiSite = new SiteItem("Whereis", "Go to Whereis", "http://www.whereis.com/whereis/home.do", wiIcon, wiLinks, wiNavIcon);
        //init WPOL items
        wpIcon = new Icon(this.baseUrl + "m_wp.gif", "");
        wpNavIcon = new Icon(this.baseUrl + "n_wp.gif", "");
        wpLinks = [new LinkItem("Business/Government", "Do a business or government search", "http://www.whitepages.com.au/wp/busSearch.jhtml"),
                new LinkItem("Residential", "Do a residential search", "http://www.whitepages.com.au/wp/resSearch.jhtml")];
        wpSite = new SiteItem("White Pages", "Go to White Pages", "http://www.whitepages.com.au/", wpIcon, wpLinks, wpNavIcon);
        //init YPOL items
        ypIcon = new Icon(this.baseUrl + "m_yp.gif", "");
        ypNavIcon = new Icon(this.baseUrl + "n_yp.gif", "");
        ypLinks = [new LinkItem("Business type &amp; name", "Do a business type and name search", "http://www.yellowpages.com.au/siteEntry.do"),
                new LinkItem("Map based search", "Do a map based search", "http://www.yellowpages.com.au/map/mapEntry.do")];
        ypSite = new SiteItem("Yellow Pages", "Go to Yellow Pages", "http://www.yellowpages.com.au/siteEntry.do", ypIcon, ypLinks, ypNavIcon);


        //init Bigpond Sport items
        bSpIcon = new Icon(this.baseUrl + "b_spo.gif", "");
        bSpLinks = [new LinkItem("AFL", "Go to AFL", "http://afl.com.au/"),
                new LinkItem("V8 Supercars", "Go to V8 Supercars", "http://www.v8supercar.com.au/"),
                new LinkItem("NRL", "Go to NRL", "http://www.nrl.com/"),
                new LinkItem("Horseracing", "Go to Horseracing", "http://www.horseracing.bigpond.com/")];
        bSpSite = new SiteItem("Sports", "Go to Sports", "http://bigpondsport.com/", bSpIcon, bSpLinks);
        //init Bigpond Games items
        bGmIcon = new Icon(this.baseUrl + "b_gam.gif", "");
        bGmLinks = [new LinkItem("About Bigpond games", "About Bigpond games", "http://bigpondgames.com/"),
                new LinkItem("GameArena", "Go to GameArena", "http://www.gamearena.com.au/"),
                new LinkItem("GameNow", "Go to GameNow", "http://www.gamenow.com.au/")];
        bGmSite = new SiteItem("Games", "Go to Games", "http://bigpondgames.com/", bGmIcon, bGmLinks);
        //init Bigpond Movies items
        bMoIcon = new Icon(this.baseUrl + "b_mov.gif", "");
        bMoLinks = [new LinkItem("About Bigpond movies", "About Bigpond movies", "http://bigpondmovies.com"),
                new LinkItem("DVD's", "Go to DVD's", "http://www.bigpondmovies.com/default.htm"),
                new LinkItem("Downloads", "Go to downloads", "http://downloads.bigpondmovies.com/")];
        bMoSite = new SiteItem("Movies", "Go to Movies", "http://www.bigpondmovies.com/", bMoIcon, bMoLinks);
        //init Bigpond Kids items
        bKiIcon = new Icon(this.baseUrl + "b_kid.gif", "");
        bKiLinks = [new LinkItem("Favourites", "Kids favourites", "http://bigpond.com/kids"),
                new LinkItem("Kids sports", "Kids sports", "http://bigpond.com/kids"),
                new LinkItem("Top 10 movies", "Kids top 10 movies", "http://bigpond.com/kids"),
                new LinkItem("Music &amp; Games", "Kids music and games", "http://bigpond.com/kids")];
        bKiSite = new SiteItem("Kids", "Go to Kids", "http://bigpond.com/kids", bKiIcon, bKiLinks);
        //init Bigpond Music items
        bMuIcon = new Icon(this.baseUrl + "b_mus.gif", "");
        bMuLinks = [new LinkItem("Latest Albums", "Latest albums", "http://bigpondmusic.com"),
                new LinkItem("99c Top10", "99c Top10", "http://bigpondmusic.com"),
                new LinkItem("Exclusive tracks", "Exclusive tracks", "http://bigpondmusic.com")];
        bMuSite = new SiteItem("Music", "Go to Music", "http://bigpondmusic.com", bMuIcon, bMuLinks);
        //init Bigpond News items
        bNeIcon = new Icon(this.baseUrl + "b_new.gif", "");
        bNeLinks = [new LinkItem("Local &amp; international", "Local and international news", "http://bigpond.com/news"),
                new LinkItem("Top stories", "Top stories", "http://bigpond.com/news"),
                new LinkItem("Latest news", "Latest news", "http://bigpond.com/news")];
        bNeSite = new SiteItem("News", "News", "http://bigpond.com/news", bNeIcon, bNeLinks);

        //init below border list
        this.bigpondLinkList = [new LinkItem("Internet plans - join now", "Get an internet plan", "http://bigpond.com/internet-plans/"),
        new LinkItem("Wireless Broadband - join now", "Get a wireless broadband plan", "http://my.bigpond.com/internetplans/broadband/wireless/about/default.jsp"),
        new LinkItem("Security Services - buy now", "Buy a security service", "http://www.bigpond.com/internet-plans/additional/security/"),
        new LinkItem("Email - log in", "Log into your email", "http://www.bigpond.com/default.asp"),
        new LinkItem("Storage &amp; photos - buy now", "Go to storage and photos - buy now", "http://www.bigpond.com/additional/storageandphotos/"),
        new LinkItem("BigBlogs - visit now", "Go to BigBlogs", "http://www.bigblog.com.au/index.do")];

        this.ourSitesList = [ypSite, lmSite, wpSite, gsSite, ssSite, inSite, wiSite, jlSite, csSite, upSite, tpSite];
        this.aboutUsList = [scSite, teSite];
        this.bigpondList = [bSpSite, bGmSite, bMoSite, bKiSite, bMuSite, bNeSite];
        this.navList = [ypSite, wpSite, csSite, tpSite, wiSite, gsSite, jlSite, lmSite];

        //set the host site
        if (hostSiteString) {
            switch(hostSiteString) {
                case "citysearch":
                    {
                        this.hostSite = csSite;
                        this.hostReferrer = "cs";
                        this.hostPartnerId = "ssn103";
                        break;
                    }
                case "corporate":
                    {
                        this.hostSite = scSite;
                        this.hostReferrer = "sc";
                        this.hostPartnerId = "ssn106";
                        break;
                    }
                case "gostay":
                    {
                        this.hostSite = gsSite;
                        this.hostReferrer = "sc";
                        this.hostPartnerId = "ssn107";
                        break;
                    }
                case "invizage":
                    {
                        this.hostSite = inSite;
                        this.hostReferrer = "in";
                        break;
                    }
                case "justListed":
                    {
                        this.hostSite = jlSite;
                        this.hostReferrer = "jl";
                        this.hostPartnerId = "ssn108";
                        break;
                    }
                case "linkme":
                    {
                        this.hostSite = lmSite;
                        this.hostReferrer = "lm";
                        this.hostPartnerId = "ssn105";
                        break;
                    }
                case "sensis":
                    {
                        this.hostSite = ssSite;
                        this.hostReferrer = "ss";
                        this.displaySearchForm = false;
                        break;
                    }
                case "telstra":
                    {
                        this.hostSite = teSite;
                        this.hostReferrer = "te";
                        break;
                    }
                case "tradingpost":
                    {
                        this.hostSite = tpSite;
                        this.hostReferrer = "tp";
                        this.hostPartnerId = "ssn102";
                        break;
                    }
                case "universalPublishers":
                    {
                        this.hostSite = upSite;
                        this.hostReferrer = "up";
                        break;
                    }
                case "whereis":
                    {
                        this.hostSite = wiSite;
                        this.hostReferrer = "wi";
                        this.hostPartnerId = "ssn104";
                        break;
                    }
                case "white":
                    {
                        this.hostSite = wpSite;
                        this.hostReferrer = "wp";
                        this.hostPartnerId = "ssn101";
                        this.displaySearchForm = true;
                        break;
                    }
                case "yellow":
                    {
                        this.hostSite = ypSite;
                        this.hostReferrer = "yp";
                        this.hostPartnerId = "ssn100";
                        break;
                    }
            }
        }
    },
    initBehaviour: function() {
        //get the element containing the navigation links for the sites.
        navLinks = (document.getElementById(this.navLinksId)).getElementsByTagName("A");
        //loop through the links in the container
        for (i = 0; i < navLinks.length; i++) {
            link = navLinks[i];
            this.addEvent(link, "mouseover", sensisBarWriter.navLinkHoverOn, false);
            this.addEvent(link, "mouseout", sensisBarWriter.navLinkHoverOff, false);
        }
        //our sites tab-link mouseaction
        ourSiteslink = this.ourSitesLink();
        this.addEvent(ourSiteslink, "mouseover", sensisBarWriter.ourSitesHoverOn, false);
        this.addEvent(ourSiteslink, "mouseout", sensisBarWriter.ourSitesHoverOff, false);
        this.addEvent(ourSiteslink, "click", sensisBarWriter.ourSitesClick, false);
        //our sites popout mouseaction
        ourSites = this.ourSites();
        linkList = ourSites.getElementsByTagName("A");
        for (i = 0; i < linkList.length; i++) {
            siteLink = linkList[i];
            if (siteLink.className == this.siteLinkClass) {
                this.addEvent(siteLink, "mouseover", sensisBarWriter.siteLinkHoverOn, false);
                this.addEvent(siteLink, "mouseout", sensisBarWriter.siteLinkHoverOff, false);
            }
        }
        //bigpond mouseaction
        bigpondLink = this.bigpondLink();
        this.addEvent(bigpondLink, "mouseover", sensisBarWriter.bigpondLinkHoverOn, false);
        this.addEvent(bigpondLink, "mouseout", sensisBarWriter.bigpondLinkHoverOff, false);
        bigpondSites = this.bigpondSites();
        linkList = bigpondSites.getElementsByTagName("A");
        for (i = 0; i < linkList.length; i++) {
            siteLink = linkList[i];
            if (siteLink.className == this.siteLinkClass) {
                this.addEvent(siteLink, "mouseover", sensisBarWriter.siteLinkHoverOn, false);
                this.addEvent(siteLink, "mouseout", sensisBarWriter.siteLinkHoverOff, false);
            }
        }
        //bigpond sites mouseaction
        bigPondSitesLink = this.bigpondSitesLink();
        this.addEvent(bigPondSitesLink, "mouseover", sensisBarWriter.bigpondSitesHoverOn, false);
        this.addEvent(bigPondSitesLink, "mouseout", sensisBarWriter.bigpondSitesHoverOff, false);
        this.addEvent(bigPondSitesLink, "click", sensisBarWriter.bigpondSitesClick, false);
    }
}
