sfHover = function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i = 0; i < sfEls.length; i++) {
        sfEls[i].onmouseover = function() {
            this.className += " sfhover";
        }
        sfEls[i].onmouseout = function() {
            this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//set up pages while still in dev
//template: [pagename] [pageimg] [headerimg] [activemenuitem]
//hierarchy
//home
//overview:invgrp,lwm,iicr
//dwllings:con,hom,eh
//purchasingoptions:finance resources
//news:currevents,devmilestones
//contact us:contact info
var page_config = [
    ["h","home.jpg","","l10","Home"],
    ["ig","investment_group.jpg","hd_investment_group.jpg","l11","Investment Group"],
    ["lwm","location.jpg","hd_location.jpg","l11","Location With Map"],
    ["iicr","investment_group.jpg","hd_Investing_in_Costa_Rica.jpg","l11","Investing in Costa Rica"],
    ["c","investment_group.jpg","hd_condominiums.jpg","l12","Condominiums"],
    ["hs","homes.jpg","hd_homes.jpg","l12","Homes"],
    ["eh","investment_group.jpg","hd_Eco-Hotel.jpg","l12","Eco-Hotel"],
    ["fr","investment_group.jpg","hd_Finance_Resources.jpg","l13","Finance Resources"],
    ["ce","investment_group.jpg","hd_Current_Events.jpg","l14","Current Events"],
    ["dm","investment_group.jpg","hd_Development_milestones.jpg","l14","Development Milestones"],
    ["ci","investment_group.jpg","hd_Contact_Information.jpg","l15","Contact Info"]
];

//js has to:
//change page img src, headerimg src, active menu item

function initPage(pgname) {
    
    // add header
    var myheader = document.createElement("div");
    myheader.setAttribute("id", "header");
    document.getElementById("page").appendChild(myheader);
    // search arrays and match options to pagename
    for (var i = 0; i < page_config.length; i++) {
        if (pgname == page_config[i][0]) {
            //                        alert("found!!");
            // fill in options
            setBg("vp_header.jpg");
            setHeader(page_config[i][2]);
            setTitle(page_config[i][4]);
        }
    }
}
;

function setBg(img) {
    document.getElementById("page").style.backgroundImage = "url(img/" + img + ")";
    //    alert(img);
    //    document.getElementById("page").style.backgroundImage="img/"+img;
}

function setHeader(img) {
    document.getElementById("header").style.backgroundImage = "url(img/" + img + ")";
}
function setTitle(t) {
    document.title = "ViaPacifica: " + t;
}
function setMenuItem(itemid) {

}
