/*Unframe*/
if (top.location.href != 'http://www.alabamagoldstarfamilies.org/') top.location.href = 'http://www.alabamagoldstarfamilies.org/'


/*Define Variables*/
var bCSS = 0
var bDyn = 0
var sApp = navigator.appName
var sVer = navigator.appVersion

var menuwidth = '125px'
var menubgcolor = 'white'
var disappeardelay = 125
var hidemenu_onclick = "yes"

var ie4 = document.all
var ns6 = document.getElementById && !document.all

var navTab00 = new Array()
navTab00[0] = '<a href="mailto:listserv@alabamagoldstarfamilies.org?subject=Add me to the mailing list&body=Add me to the mailing list">Join our Mailing List</a>'
navTab00[1] = '<a href="AGSF_Financial_Disclosure.htm">Financial Disclosure</a>'
navTab00[2] = '<a href="AGSF_Privacy_Notice.htm">Privacy Notice</a>'
navTab00[3] = '<a href="AGSF_Site_Credits.htm">Site Credits</a>'
navTab00[4] = '<a href="AGSF_Donations.htm">Donate</a>'
navTab00[5] = '<a href="AGSF_Contact.htm">Help</a>'

var info00 = new Array()
info00[0] = '<a href="mailto:listserv@alabamagoldstarfamilies.org?subject=Add me to the mailing list&body=Add me to the mailing list">Join our Mailing List</a>'
info00[1] = '<a href="/rss/rss.xml" target="_blank">Subscribe to RSS Feed</a>'
info00[2] = '<a href="AGSF_Financial_Disclosure.htm">Financial Disclosure</a>'
info00[3] = '<a href="AGSF_Privacy_Notice.htm">Privacy Notice</a>'
info00[4] = '<a href="AGSF_Site_Credits.htm">Site Credits</a>'
info00[5] = '<a href="AGSF_Donations.htm">Donate</a>'
info00[6] = '<a href="AGSF_Contact.htm">Help</a>'

if (ie4 || ns6) document.write('<div id="menu" style="visibility: hidden; width: ' + menuwidth + '; background-color: '+ menubgcolor + '" onmouseover="clearhidemenu()" onmouseout="dynamichide(event)"></div>')

if (sApp == "Microsoft Internet Explorer" && (sVer.indexOf("MSIE 6") != -1 || sVer.indexOf("MSIE 7") != -1)) bCSS = 1
else if (sApp == "Netscape" && sVer.charAt(0) >= 5) bCSS = 1


/*Mouseover Images*/
if (document.images) {

bDyn = 1

var star_mini0 = new Image()
star_mini0.src = "/agsf/_star_mini_14x8.gif"
var star_mini1 = new Image()
star_mini1.src = "/agsf/!star_mini_14x8.gif"

var about_us0 = new Image()
about_us0.src = "/agsf/_hm_about_us.png"
var about_us1 = new Image()
about_us1.src = "/agsf/!hm_about_us.png"

var news0 = new Image()
news0.src = "/agsf/_hm_news.png"
var news1 = new Image()
news1.src = "/agsf/!hm_news.png"

var events0 = new Image()
events0.src = "/agsf/_hm_events.png"
var events1 = new Image()
events1.src = "/agsf/!hm_events.png"

var donations0 = new Image()
donations0.src = "/agsf/_hm_donations.png"
var donations1 = new Image()
donations1.src = "/agsf/!hm_donations.png"

var license_plates0 = new Image()
license_plates0.src = "/agsf/_hm_license_plates.png"
var license_plates1 = new Image()
license_plates1.src = "/agsf/!hm_license_plates.png"

var family_resources0 = new Image()
family_resources0.src = "/agsf/_hm_family_resources.png"
var family_resources1 = new Image()
family_resources1.src = "/agsf/!hm_family_resources.png"

var alabama_casualties0 = new Image()
alabama_casualties0.src = "/agsf/_hm_alabama_casualties.png"
var alabama_casualties1 = new Image()
alabama_casualties1.src = "/agsf/!hm_alabama_casualties.png"

var contact0 = new Image()
contact0.src = "/agsf/_hm_contact.png"
var contact1 = new Image()
contact1.src = "/agsf/!hm_contact.png"

var text0 = new Image()
text0.src = "/agsf/_hm_text.png"
var text1 = new Image()
text1.src = "/agsf/!hm_text.png"

}

function hover(A) {
    if (bDyn) eval("document.images." + A + ".src = " + A + "1.src")
}

function idle(A) {
    if (bDyn) eval("document.images." + A + ".src = " + A + "0.src")
}


/*Dropdown Menu*/
function getposOffset(what, offsettype) {
    var totaloffset = (offsettype == "left")? what.offsetLeft : what.offsetTop;
    var parentEl = what.offsetParent;
    while (parentEl != null) {
        totaloffset = (offsettype == "left")? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop;
        parentEl = parentEl.offsetParent;
    }
    return totaloffset;
}

function showhide(obj, e, visible, hidden, menuwidth) {
    if (ie4 || ns6) dropmenuobj.style.left = dropmenuobj.style.top = "-500px"

    if (menuwidth != "") {
        dropmenuobj.widthobj = dropmenuobj.style
        dropmenuobj.widthobj.width = menuwidth
    }

    if (e.type == "click" && obj.visibility == hidden || e.type == "mouseover") obj.visibility = visible
    else if (e.type == "click") obj.visibility = hidden
}

function iecompattest() {
    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge) {
    var edgeoffset = 0

    if (whichedge == "rightedge") {
        var windowedge = ie4 && !window.opera ? iecompattest().scrollLeft + iecompattest().clientWidth - 15 : window.pageXOffset + window.innerWidth - 15
        dropmenuobj.contentmeasure = dropmenuobj.offsetWidth
        if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure) edgeoffset = dropmenuobj.contentmeasure - obj.offsetWidth
    }
    else {
        var topedge = ie4 && !window.opera ? iecompattest().scrollTop : window.pageYOffset
        var windowedge = ie4 && !window.opera ? iecompattest().scrollTop + iecompattest().clientHeight - 15 : window.pageYOffset + window.innerHeight - 18
        dropmenuobj.contentmeasure = dropmenuobj.offsetHeight

        if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure) {
            edgeoffset = dropmenuobj.contentmeasure + obj.offsetHeight
            if ((dropmenuobj.y - topedge) < dropmenuobj.contentmeasure) edgeoffset = dropmenuobj.y + obj.offsetHeight - topedge
        }
    }

    return edgeoffset

}

function populatemenu(what) {
    if (ie4 || ns6) dropmenuobj.innerHTML = what.join("")
}

function showmenu(obj, e, menucontents, menuwidth) {
    if (window.event) event.cancelBubble = true
    else if (e.stopPropagation) e.stopPropagation()

    clearhidemenu()
    dropmenuobj = document.getElementById ? document.getElementById("menu") : menu
    populatemenu(menucontents)

    if (ie4 || ns6) {
        showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
        dropmenuobj.x = getposOffset(obj, "left")
        dropmenuobj.y = getposOffset(obj, "top")
        dropmenuobj.style.left = dropmenuobj.x - clearbrowseredge(obj, "rightedge") + "px"
        dropmenuobj.style.top = dropmenuobj.y - clearbrowseredge(obj, "bottomedge") + obj.offsetHeight + "px"
    }

    return clickreturnvalue()
}

function clickreturnvalue() {
    if (ie4 || ns6) return false
    else return true
}

function contains_ns6(a, b) {
    while (b.parentNode) {
        if ((b = b.parentNode) == a) return true;
        return false;
    }
}

function dynamichide(e) {
    if (ie4 && !dropmenuobj.contains(e.toElement)) hidemenu()
    else if (ns6 && e.currentTarget != e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget)) hidemenu()
}

function xmenu(e) {
    if (typeof dropmenuobj != "undefined") {
        if (ie4 || ns6) dropmenuobj.style.visibility = "hidden"
    }
}

function hidemenu() {
    if (ie4 || ns6) delayhide = setTimeout("xmenu()", disappeardelay)
}

function clearhidemenu() {
    if (typeof delayhide != "undefined") clearTimeout(delayhide)
}

if (hidemenu_onclick == "yes") document.onclick = xmenu


/*Scrolling Division*/
function startScroll() {
//    moveObject(document.all.scrollableObject, 9866)
    moveObject(document.getElementById("scrollableObject"), 9366)
}

//62 pixels per entry: 62 * 143 = 8866

function moveObject(o, w) {
    obj = o

    if (obj.style.top == "") {
        obj.style.top = 0
    }
    else if (parseInt(obj.style.top) < (0 - (w/2) + 6)) {
        obj.style.top = 0
    }
    else {
        obj.style.top = parseInt(obj.style.top) - 1
    }

    timer = setTimeout("moveObject(obj, "+w+");", 50)
}

//window.onload = setTimeout("startScroll()", 2000)
window.onload = startScroll
