
// This function checks for links with a certain class name, then disables them.
// This is so that Iphone / Ipad users can use the popup menu as well.
function gwslinks()
{	
	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
		
		//alert('Ipad / Iphone / ipod touch detected');

		var lnks = document.links;
		for(i=0;i<document.links.length;i++) {		   
		   // Check for class, if exists disable link
		   if(hasClass(lnks[i], "level0"))
		   {
			   lnks[i].disabled = true;
			   lnks[i].onclick = function(){return false;}
		   }
		}
	}
}

// This only works if everything is loaded!
window.onload = gwslinks;


function hasClass (obj, className) {
    if (typeof obj == 'undefined' || obj==null || !RegExp) { return false; }
    var re = new RegExp("(^|\\s)" + className + "(\\s|$)");
    if (typeof(obj)=="string") {
      return re.test(obj);
    }
    else if (typeof(obj)=="object" && obj.className) {
      return re.test(obj.className);
    }
    return false;
}



