﻿// left side navigation
function toggle(id,targetNum){
    targetUL = "ul_" + id + targetNum;
    targetImg = "img_" + id + targetNum;
    ulElement = document.getElementById(targetUL);
    imgElement = document.getElementById(targetImg);
    
    if (ulElement)
    {
          var i=0;
          myULElement=null;
          do
          {    
              i++;
              myUL = "ul_" + id + i;
              myImg = "img_" + id + i;
              try{myULElement = document.getElementById(myUL);
              myImgElement = document.getElementById(myImg);
                }catch(err){alert(error);}
              if(i==targetNum) {continue}
          
              if (myULElement && myULElement.className == 'open')
              {
                  myULElement.className = "closed";
                  myImgElement.src = "/starmark/images/arrow_closed.gif";
              }          
          } while(myULElement) 
    }
    
    if (ulElement)
    {            
           if (ulElement.className == 'closed')
           {
               ulElement.className = "open";
               imgElement.src = "/starmark/images/arrow_open.gif";
           }
           else
           {
               ulElement.className = "closed";
               imgElement.src = "/starmark/images/arrow_closed.gif";
           }
    }    
}

function toggleLeft(id,targetNum){
    targetUL = "ul_" + id + targetNum;
    targetImg = "img_" + id + targetNum;
    ulElement = document.getElementById(targetUL);
    imgElement = document.getElementById(targetImg);
    
    if (ulElement)
    {
          var i=0;
          myULElement=null;
          do
          {    
              i++;
              myUL = "ulLeft_" + id + i;
              myImg = "imgLeft_" + id + i;
              try{myULElement = document.getElementById(myUL);
              myImgElement = document.getElementById(myImg);
                }catch(err){alert(error);}
              if(i==targetNum) {continue}
          
              if (myULElement && myULElement.className == 'open')
              {
                  myULElement.className = "closed";
                  myImgElement.src = "/starmark/images/arrow_closed.gif";
              }          
          } while(myULElement) 
    }
    
    if (ulElement)
    {            
           if (ulElement.className == 'closed')
           {
               ulElement.className = "open";
               imgElement.src = "/starmark/images/arrow_open.gif";
           }
           else
           {
               ulElement.className = "closed";
               imgElement.src = "/starmark/images/arrow_closed.gif";
           }
    }    
}

function toggleRight(id,targetNum){
    targetUL = "ulRight_" + id + targetNum;
    targetImg = "imgRight_" + id + targetNum;
    ulElement = document.getElementById(targetUL);
    imgElement = document.getElementById(targetImg);
    
    if (ulElement)
    {
          var i=0;
          myULElement=null;
          do
          {    
              i++;
              myUL = "ul_" + id + i;
              myImg = "img_" + id + i;
              try{myULElement = document.getElementById(myUL);
              myImgElement = document.getElementById(myImg);
                }catch(err){alert(error);}
              if(i==targetNum) {continue}
          
              if (myULElement && myULElement.className == 'open')
              {
                  myULElement.className = "closed";
                  myImgElement.src = "/starmark/images/arrow_closed.gif";
              }          
          } while(myULElement) 
    }
    
    if (ulElement)
    {            
           if (ulElement.className == 'closed')
           {
               ulElement.className = "open";
               imgElement.src = "/starmark/images/arrow_open.gif";
           }
           else
           {
               ulElement.className = "closed";
               imgElement.src = "/starmark/images/arrow_closed.gif";
           }
    }    
}

function toggleSubNav(id,targetNum,itemNums){
    targetUL = "ul_" + id + targetNum;
    targetImg = "img_" + id + targetNum;
    ulElement = document.getElementById(targetUL);
    imgElement = document.getElementById(targetImg);
    if (ulElement){            
        for (var i=1; i<=itemNums; i++) {
            if (i==targetNum){continue}
            myUL = "ul_" + id + i;
             myImg = "img_" + id + i;
            myULElement = document.getElementById(myUL);
            myImgElement = document.getElementById(myImg);
        
            if (myULElement.className == 'open'){
                myULElement.className = "closed";
                myImgElement.src = "/starmark/images/arrowNav_closed.gif";
            }
        }
    }
    
    if (ulElement){            
           if (ulElement.className == 'closed'){
            ulElement.className = "open";
            imgElement.src = "/starmark/images/arrowNav_open.gif";
            }else{
            ulElement.className = "closed";
            imgElement.src = "/starmark/images/arrowNav_closed.gif";
        }
    }    
}

function toggleDataList(id,targetNum,itemNums){
    targetUL = "ul_" + id + targetNum;
    targetImg = "img_" + id + targetNum;
    ulElement = document.getElementById(targetUL);
    imgElement = document.getElementById(targetImg);
    
    //alert("toggleDataList " + id + ":" + targetNum)
    //alert("toggleDataList targetUL " + targetUL)
    //alert("toggleDataList targetImg " + targetImg)
    //alert("toggleDataList ulElement " + ulElement)
    //alert("toggleDataList imgElement " + imgElement)

    if (ulElement)
    {
          var i=0;
          myULElement=null;
          do
          {    
              i++;
              myUL = "ul_" + id + i;
              myImg = "img_" + id + i;
              try{myULElement = document.getElementById(myUL);
              myImgElement = document.getElementById(myImg);
                }catch(err){alert(error);}
              if(i==targetNum) {continue}
          
              if (myULElement && myULElement.className == 'open')
              {
                  myULElement.className = "closed";
                  myImgElement.src = "/starmark/images/data_arrow_closed.gif";
              }          
          } while(myULElement) 
    }
    
    if (ulElement)
    {            
           if (ulElement.className == 'closed')
           {
               ulElement.className = "open";
               imgElement.src = "/starmark/images/data_arrow_open.gif";
           }
           else
           {
               ulElement.className = "closed";
               imgElement.src = "/starmark/images/data_arrow_closed.gif";
           }
    }      
}

function toggleDataListR(id,targetNum,itemNums){
    targetUL = "ul_" + id + targetNum;
    targetImg = "img_" + id + targetNum;
    ulElement = document.getElementById(targetUL);
    imgElement = document.getElementById(targetImg);
    
    //alert("toggleDataListR " + id + ":" + targetNum)
    //alert("toggleDataListR targetUL " + targetUL)
    //alert("toggleDataListR targetImg " + targetImg)
    //alert("toggleDataListR ulElement " + ulElement)
    //alert("toggleDataListR imgElement " + imgElement)

    if (ulElement)
    {
          var i=0;
          myULElement=null;
          do
          {    
              i++;
              myUL = "ul_" + id + i;
              myImg = "img_" + id + i;
              try{myULElement = document.getElementById(myUL);
              myImgElement = document.getElementById(myImg);
                }catch(err){alert(error);}
              if(i==targetNum) {continue}
          
              if (myULElement && myULElement.className == 'open')
              {
                  myULElement.className = "closed";
                  myImgElement.src = "/starmark/images/data_arrow_closed.gif";
              }          
          } while(myULElement) 
    }
    
    if (ulElement)
    {            
           if (ulElement.className == 'closed')
           {
               ulElement.className = "open";
               imgElement.src = "/starmark/images/data_arrow_open.gif";
           }
           else
           {
               ulElement.className = "closed";
               imgElement.src = "/starmark/images/data_arrow_closed.gif";
           }
    }      
}

function toggleDataListL(id,targetNum,itemNums){
    targetUL = "ul_" + id + targetNum;
    targetImg = "img_" + id + targetNum;
    ulElement = document.getElementById(targetUL);
    imgElement = document.getElementById(targetImg);

    //alert("toggleDataListL " + id + ":" + targetNum)
    //alert("toggleDataListL targetUL " + targetUL)
    //alert("toggleDataListL targetImg " + targetImg)
    //alert("toggleDataListL ulElement " + ulElement)
    //alert("toggleDataListL imgElement " + imgElement)
    
    if (ulElement)
    {
          var i=0;
          myULElement=null;
          do
          {    
              i++;
              myUL = "ul_" + id + i;
              myImg = "img_" + id + i;
              try{myULElement = document.getElementById(myUL);
              myImgElement = document.getElementById(myImg);
                }catch(err){alert(error);}
              if(i==targetNum) {continue}
          
              if (myULElement && myULElement.className == 'open')
              {
                  myULElement.className = "closed";
                  myImgElement.src = "/starmark/images/data_arrow_closed.gif";
              }          
          } while(myULElement) 
    }
    
    if (ulElement)
    {            
           if (ulElement.className == 'closed')
           {
               ulElement.className = "open";
               imgElement.src = "/starmark/images/data_arrow_open.gif";
           }
           else
           {
               ulElement.className = "closed";
               imgElement.src = "/starmark/images/data_arrow_closed.gif";
           }
    }      
}
