﻿//************************************************************************************* 
// File     :   aram_functions.js
// Requires :   mf_domLibrary_0.1.js, prototype.js
// Author   :   Kyle Weems (ksw)
// Origin   :   mindfly.com
// Created  :   September 18, 2008
// Modified :   September 18, 2008
// Purpose  :   Functions specific to AramcoExPats.com
//*************************************************************************************

addLoadEvent(activationSequence);

function activationSequence() {

    homeEventsClickableDivs();

} // end of function activationSequence()


function homeEventsClickableDivs() {
    var homeEventList = $$('.liHomeEvents');
    if (homeEventList.length) {
        var i;
        for (i = 0; i < homeEventList.length; i++) {
            homeEventList[i].observe('click', homeEventsNavigate);
        }
    }
} // end of function homeEventsClickableDivs()


function homeEventsNavigate(event) {
    var elem = event.element();
    if (!elem.hasClassName('liHomeEvents')) {
        var ancestor = elem.ancestors();
        if (ancestor.length) {
            var i;
            for (i = 0; i < ancestor.length; i++) {
                if (ancestor[i].hasClassName('liHomeEvents')) {
                    elem = ancestor[i];
                }
            }
        }
    }
    var anchorKid = elem.select('a');
    location.href = anchorKid[0].href;
} // end of homeEventsNavigate()