function doExternalLink(){
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++) {
        var anchor = anchors[i];
        if (anchor.getAttribute("href") &&
            anchor.getAttribute("rel") == "external")
            anchor.target = "_blank";
    }
}
window.onload = doExternalLink;

function doStateProfiles(theState){
    
    // alert(theState);
    
    if (!document.getElementsByTagName) return;        
        var profileDivs = document.getElementsByTagName("div");     
        for (var i = 0; i < profileDivs.length; i++) {
            var anchor = profileDivs[i];
            if (anchor.getAttribute("class")== "profiles-state-group")
                profileDivs[i].style.display = "none";
            }

    // alert(theState + "-profiles");
    
    document.getElementById(theState + "-profiles").style.display = "block";
}

function doProfile(theProfile){
    top.location.href=theProfile + "#profile";   
}

function doPopUpWindow(url) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=500,left = 505,top = 234');");
}

function doPicturePopUpWindow(url) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=550');");
}
