jQuery(document).ready(function() {
    var redir = getParameterByName("url");
    redir = redir.replace("https://istweb.apple.com","");
    console.log(redir);
    if(redir!="") {
        console.log(jQuery("#navigationView ul li a[onclick*=\'"+redir+"\']'").html());
            jQuery("#navigationView ul li a[onclick*=\'"+redir+"\']'").trigger('click');
            var selElem = jQuery("#navigationView li.selected");
            var parentElem = selElem.parent();
            var parentId = parentElem.attr("id");
            while(parentId!="navigationView") {
                parentElem.prev().trigger("click");
                parentElem = parentElem.parent();
                parentId = parentElem.attr("id");
            }
    }
});
  
function getParameterByName(name) {
  name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
  var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
      results = regex.exec(location.search);
  return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

