/*
$(document).ready(function() {
   $(document).on("touchstart","li.outline",function(e) {

   var link = $(this); //preselect the link
    if (link.hasClass('hover')) {
        return true;
    } else {
        link.addClass('hover');
        $('li.outline').not(this).removeClass('hover');
		e.preventDefault();	
        return false; //extra, and to make sure the function has consistent return points
    }
		
    });
});
*/

// Updated by marijn to not require thousands of lines of jquery.js includes
// note: this function gets explicitly called by pageInit (from document.onload)
function menu_touch_init()
{
	var items = document.getElementsByClassName("outline")
	for (var i=0; i<items.length;i++){
		var item = items[i];
		items[i].ontouchstart = menu_touch_cb;
	}
}
function menu_touch_cb(e)
{
    // note "this", confusingly is element we are bubbling through (vs target(e) which is actual dom element hit!)
    var link = this;	
	if(class_contains(link,'hover')) return true;
	class_add(link,'hover');
	var items = document.getElementsByClassName("outline")
	for (var i=0; i<items.length;i++){
		var item = items[i];
		if(item==link) continue;
		class_remove(item,'hover');
	}
	e.preventDefault();	
	return false;
}

