var nav;

      function clearLastStatus(){
          document.getElementById('L0_laststatus').value = '';
          document.getElementById('laststatus').value = '';
      }

      function showdetail(id){
            if(document.getElementById('H'+id).value==''){
              document.getElementById(id).style.display='';
              document.getElementById('H'+id).value='X'
            } else {
              document.getElementById(id).style.display='none';
              document.getElementById('H'+id).value=''
            }
        }

        function switchL0(id, imj){
          var L0_laststatus;
          L0_laststatus = document.getElementById("L0_laststatus").value;
          if(document.getElementById('IMGL0' + id).name == 'arrow_right' || document.getElementById('IMGL0' + id).name == ''){
            document.getElementById('L0' + id).style.display='';
            document.getElementById('IMGL0' + id).src=imj + 'arrow_down.gif';
            document.getElementById('IMGL0' + id).name = 'arrow_down';
            try{
              if(L0_laststatus != 'L0' + id){
                document.getElementById(L0_laststatus).style.display='none';
                document.getElementById('IMG' + L0_laststatus).src=imj + 'arrow_right.gif';
              }
            } catch(e){ }
          document.getElementById("L0_laststatus").value = 'L0' + id;
          switchL3(document.getElementById("laststatus").value.substring(2,document.getElementById("laststatus").value.length), imj)
          } else {
            document.getElementById('L0' + id).style.display='none';
            document.getElementById('IMGL0' + id).src=imj + 'arrow_right.gif';
            document.getElementById('IMGL0' + id).name = 'arrow_right';
            document.getElementById("L0_laststatus").value = 'L0' + id;
            switchL3(document.getElementById("laststatus").value.substring(2,document.getElementById("laststatus").value.length), imj)
          }
        }

        function switchL3(id, imj){
        var laststatus;
          laststatus = document.getElementById("laststatus").value;
          if(id != '' && (document.getElementById('IMGL3' + id).name == 'arrow_right' || document.getElementById('IMGL3' + id).name == '')){
            document.getElementById('L3' + id).style.display='';
            document.getElementById('IMGL3' + id).src=imj + 'arrow_down.gif';
            document.getElementById('IMGL3' + id).name = 'arrow_down';
            try{
              if(laststatus != 'L3' + id){
                document.getElementById(laststatus).style.display='none';
                document.getElementById('IMG' + laststatus).src=imj + 'arrow_right.gif';
              }
            } catch(e){}

              if(navigator.appName.indexOf('Microsoft') == -1){
                showEventTypes_ns(id);
              } else {
                showEventTypes_ie(id);
              }
            document.getElementById("laststatus").value = 'L3' + id;
          } else if(id != ''){
            document.getElementById('L3' + id).style.display='none';
            document.getElementById('IMGL3' + id).src=imj + 'arrow_right.gif';
            document.getElementById('IMGL3' + id).name = 'arrow_right';
            if(laststatus == 'L3' + id){
              if(navigator.appName.indexOf('Microsoft') == -1){
                showEventTypes_ns("");
              } else {
                showEventTypes_ie("");
              }
            } else {
              if(nav == "ns"){
                showEventTypes_ns(id);
              } else {
                showEventTypes_ie(id);
              }
            }
            document.getElementById("laststatus").value = '';
          }
        }

          function showEventTypes_ns(id){
          var daterowch = 0;
          var isNoDateRow = false;
          daterowar = new Array();
           for(i=0; i < document.getElementsByTagName("tr").length; i++){
             if(document.getElementsByTagName("tr")[i].getAttribute("rowname") == "daterow"){
               daterowar[daterowch] = document.getElementsByTagName("tr")[i];
               daterowch = daterowch + 1;
             }
           }

             // Re-display all rows
             for(j=0; j < daterowar.length; j++){
                    daterowar[j].style.display = "";
                    daterowar[j].nextSibling.nextSibling.style.display = "";
                    for(k=0; k < daterowar[j].childNodes[3].childNodes[1].childNodes[1].childNodes.length; k++){
                      try{
                        if(daterowar[j].childNodes[3].childNodes[1].childNodes[1].childNodes[k].getAttribute("rowname") == "itemrow"){
                          daterowar[j].childNodes[3].childNodes[1].childNodes[1].childNodes[k].style.display = "";
                        } else {
                          daterowar[j].childNodes[3].childNodes[1].childNodes[1].childNodes[k].style.display = "none";
                        }
                      } catch(e){}
                    }
                 }

            if(id != ""){ // To hide the rows
             for(j=0; j < daterowar.length; j++){
                 daterowch = 0;
                 for(k=0; k < daterowar[j].childNodes[3].childNodes[1].childNodes[1].childNodes.length; k++){
                   try{
                    if(daterowar[j].childNodes[3].childNodes[1].childNodes[1].childNodes[k].getAttribute("name") == id){
                      daterowar[j].childNodes[3].childNodes[1].childNodes[1].childNodes[k].style.display = "";
                      daterowch = daterowch + 1;
                    } else {
                      daterowar[j].childNodes[3].childNodes[1].childNodes[1].childNodes[k].style.display = "none";
                    }
                   } catch(e){}
                 }
                  if(daterowch == 0){
                     daterowar[j].style.display = "none";
                     daterowar[j].nextSibling.nextSibling.style.display = "none";
                  }
                 }
              }
            }

        function showEventTypes_ie(id){
          var daterowch = 0;
          daterowar = new Array();
           for(i=0; i < document.getElementsByTagName("tr").length; i++){
             if(document.getElementsByTagName("tr")[i].getAttribute("rowname") == "daterow"){
               daterowar[daterowch] = document.getElementsByTagName("tr")[i];
               daterowch = daterowch + 1;
             }
           }
           // Re-display all rows
           for(j=0; j < daterowar.length; j++){
              daterowar[j].style.display = "";
              daterowar[j].nextSibling.style.display = "";
              for(k=0; k < daterowar[j].childNodes[1].childNodes[0].childNodes[0].childNodes.length; k++){
                try{
                  if(daterowar[j].childNodes[1].childNodes[0].childNodes[0].childNodes[k].getAttribute("rowname") == "itemrow"){
                    daterowar[j].childNodes[1].childNodes[0].childNodes[0].childNodes[k].style.display = "";
                  } else {
                    daterowar[j].childNodes[1].childNodes[0].childNodes[0].childNodes[k].style.display = "none";
                  }
                } catch(e){}
              }
           }
           if(id != ""){// To hide the rows
             for(j=0; j < daterowar.length; j++){
                 daterowch = 0;
                 for(k=0; k < daterowar[j].childNodes[1].childNodes[0].childNodes[0].childNodes.length; k++){

                   try{
                    if(daterowar[j].childNodes[1].childNodes[0].childNodes[0].childNodes[k].getAttribute("name") == id){
                      daterowar[j].childNodes[1].childNodes[0].childNodes[0].childNodes[k].style.display = "";
                      daterowch = daterowch + 1;
                    } else {
                      daterowar[j].childNodes[1].childNodes[0].childNodes[0].childNodes[k].style.display = "none";
                    }
                   } catch(e){}
                 }
                  if(daterowch == 0){
                     daterowar[j].style.display = "none";
                     daterowar[j].nextSibling.style.display = "none";
                  }
                 }
              }
            }

      function showDiv(element) {
          var MainLink = document.getElementById("menutable").getElementsByTagName('td');
	  for(i=0; i < MainLink.length; i++) {
          if(MainLink[i].id == 'mainnav'+element) {
            MainLink[i].className = 'activetab';
          }
          else {
            if (MainLink[i].className == 'activetab') {
              MainLink[i].className = 'passivetab';
            }
          }
        }
        var NavEntries = document.getElementById("subnav").getElementsByTagName('div');
        for(i=0; i < NavEntries.length; i++) {
          if(NavEntries[i].id == 'subnav'+element) {
            NavEntries[i].className = 'subnavvisible';
          }
          else {
            NavEntries[i].className = 'subnavhidden';
          }
        }
        if(document.getElementById('currentlink').value.length > 5){
	    HighlightLink(document.getElementById('currentlink').value);
	}
      }
      function LowlightLink() {
        for (var j=0; j < document.links.length; j++) {
          if (document.links[j].className == 'youarehere') {
            document.links[j].className = '';
          }
        }
      }

      function HighlightLink(ElementID) {
        LowlightLink();
        document.getElementById(ElementID).className = 'youarehere';
      }

      function newWin(url){
        fixtures = window.open(url,"fixtures","width=750,height=550,left=50,top=50");
      }

      function setLyr(e, obj, movelink){
        if(navigator.appName.indexOf("Microsoft") != -1){
          document.getElementById("divlink").style.top = e.clientY + document.body.scrollTop - 130;
        } else {
          document.getElementById("divlink").style.top = e.clientY + window.pageYOffset - 130;
        }
      }

        function showDetailPopup(e, obj, id){
                document.getElementById("detailpopup").innerHTML = document.getElementById(id).value;
                if(navigator.appName.indexOf("Microsoft") != -1){
                  document.getElementById("detailpopup").style.top = e.clientY + document.documentElement.scrollTop - 25 + "px";
                } else {
                  document.getElementById("detailpopup").style.top = e.clientY + window.pageYOffset - 25 + "px";
                }
                document.getElementById("detailpopup").style.left = e.clientX + 10 + "px";
                document.getElementById("detailpopup").style.visibility = 'visible';
        }

        function hideDetailPopup(){
          document.getElementById("detailpopup").style.visibility = 'hidden';
        }


            function toggleAlert(xHow) {
                var coverDiv = document.getElementById("coverDiv");
                var loadingDiv = document.getElementById("loadingDiv");
                if(xHow){
                    coverDiv.style.display  = "block";
                    loadingDiv.style.display  = "block";
                } else {
                    coverDiv.style.display  = "none";
                    loadingDiv.style.display  = "none";
                }                                
            }
                        


