/**
* This checks for apple mobile devices, and enables clicking, since hovering isn't really optimal and is non-funcitonal for
* the menu
*/
$(document).ready(function() {
    //enable clicking for menus on mobile devices. Hover behavior is non-funcitonal for iOS
    if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))  || (navigator.userAgent.match(/iPad/i))) {
        //get all menu items, start at the li level, then add click handler to the first anchor, and see if their is a hover ul
        $('#horiz ul li').each(function(index){
            var hoverMenu = $('ul', this); //select menu from the context of this li only (otherwise all will be gotten)
            //if a submenu exists
            if(hoverMenu.length > 0){
                var link = $('a', this); //select the anchor from the context of this li only (otherwise all will be gotten)
                link.click(function(){
                    //toggle visibility
                    hoverMenu.toggle(); 
                });
            }
        });
    }
});
